code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static boolean is_email(String email, boolean checkDNS)
throws DNSLookupException {
return (is_email_verbose(email, checkDNS).getState() == GeneralState.OK);
} | class class_name[name] begin[{]
method[is_email, return_type[type[boolean]], modifier[public static], parameter[email, checkDNS]] begin[{]
return[binary_operation[call[.is_email_verbose, parameter[member[.email], member[.checkDNS]]], ==, member[GeneralState.OK]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[is_email] operator[SEP] identifier[String] identifier[email] , Keyword[boolean] identifier[checkDNS] operator[SEP] Keyword[throws] identifier[DNSLookupException] {
Keyword[return] operator[SEP] identifier[is_email_verbose] operator[SEP] identifier[email] , identifier[checkDNS] operator[SEP] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[==] identifier[GeneralState] operator[SEP] identifier[OK] operator[SEP] operator[SEP]
}
|
protected void update(List<TableInfo> tableInfos)
{
try
{
if (admin.isTableAvailable(databaseName))
{
HTableDescriptor hTableDescriptor = admin.getTableDescriptor(databaseName.getBytes());
addColumnFamilies(tableInfos, hTableDescriptor, true);
}
else
{
createTable(tableInfos);
}
}
catch (IOException ioe)
{
logger.error("Either check for network connection or table isn't in enabled state, Caused by:", ioe);
throw new SchemaGenerationException(ioe, "Hbase");
}
} | class class_name[name] begin[{]
method[update, return_type[void], modifier[protected], parameter[tableInfos]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=databaseName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isTableAvailable, postfix_operators=[], prefix_operators=[], qualifier=admin, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tableInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=databaseName, selectors=[], type_arguments=None)], member=getTableDescriptor, postfix_operators=[], prefix_operators=[], qualifier=admin, selectors=[], type_arguments=None), name=hTableDescriptor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HTableDescriptor, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tableInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hTableDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=addColumnFamilies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Either check for network connection or table isn't in enabled state, Caused by:"), MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Hbase")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SchemaGenerationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[update] operator[SEP] identifier[List] operator[<] identifier[TableInfo] operator[>] identifier[tableInfos] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[admin] operator[SEP] identifier[isTableAvailable] operator[SEP] identifier[databaseName] operator[SEP] operator[SEP] {
identifier[HTableDescriptor] identifier[hTableDescriptor] operator[=] identifier[admin] operator[SEP] identifier[getTableDescriptor] operator[SEP] identifier[databaseName] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addColumnFamilies] operator[SEP] identifier[tableInfos] , identifier[hTableDescriptor] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[createTable] operator[SEP] identifier[tableInfos] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ioe] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SchemaGenerationException] operator[SEP] identifier[ioe] , literal[String] operator[SEP] operator[SEP]
}
}
|
public static void notEmpty(String string, String message) {
if (LettuceStrings.isEmpty(string)) {
throw new IllegalArgumentException(message);
}
} | class class_name[name] begin[{]
method[notEmpty, return_type[void], modifier[public static], parameter[string, message]] begin[{]
if[call[LettuceStrings.isEmpty, parameter[member[.string]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[notEmpty] operator[SEP] identifier[String] identifier[string] , identifier[String] identifier[message] operator[SEP] {
Keyword[if] operator[SEP] identifier[LettuceStrings] operator[SEP] identifier[isEmpty] operator[SEP] identifier[string] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
|
public synchronized void addRule(final RuleImpl rule) throws InvalidPatternException {
final List<TerminalNode> terminals = this.ruleBuilder.addRule( rule,
this.kBase );
BaseNode[] nodes = terminals.toArray( new BaseNode[terminals.size()] );
this.rules.put( rule.getFullyQualifiedName(), nodes );
if (rule.isQuery()) {
this.queries.put( rule.getName(), nodes );
}
} | class class_name[name] begin[{]
method[addRule, return_type[void], modifier[synchronized public], parameter[rule]] begin[{]
local_variable[type[List], terminals]
local_variable[type[BaseNode], nodes]
THIS[member[None.rules]call[None.put, parameter[call[rule.getFullyQualifiedName, parameter[]], member[.nodes]]]]
if[call[rule.isQuery, parameter[]]] begin[{]
THIS[member[None.queries]call[None.put, parameter[call[rule.getName, parameter[]], member[.nodes]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[addRule] operator[SEP] Keyword[final] identifier[RuleImpl] identifier[rule] operator[SEP] Keyword[throws] identifier[InvalidPatternException] {
Keyword[final] identifier[List] operator[<] identifier[TerminalNode] operator[>] identifier[terminals] operator[=] Keyword[this] operator[SEP] identifier[ruleBuilder] operator[SEP] identifier[addRule] operator[SEP] identifier[rule] , Keyword[this] operator[SEP] identifier[kBase] operator[SEP] operator[SEP] identifier[BaseNode] operator[SEP] operator[SEP] identifier[nodes] operator[=] identifier[terminals] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[BaseNode] operator[SEP] identifier[terminals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[rules] operator[SEP] identifier[put] operator[SEP] identifier[rule] operator[SEP] identifier[getFullyQualifiedName] operator[SEP] operator[SEP] , identifier[nodes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rule] operator[SEP] identifier[isQuery] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[queries] operator[SEP] identifier[put] operator[SEP] identifier[rule] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[nodes] operator[SEP] operator[SEP]
}
}
|
public void setCellspacing(java.lang.String cellspacing) {
getStateHelper().put(PropertyKeys.cellspacing, cellspacing);
handleAttribute("cellspacing", cellspacing);
} | class class_name[name] begin[{]
method[setCellspacing, return_type[void], modifier[public], parameter[cellspacing]] begin[{]
call[.getStateHelper, parameter[]]
call[.handleAttribute, parameter[literal["cellspacing"], member[.cellspacing]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCellspacing] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[cellspacing] operator[SEP] {
identifier[getStateHelper] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[PropertyKeys] operator[SEP] identifier[cellspacing] , identifier[cellspacing] operator[SEP] operator[SEP] identifier[handleAttribute] operator[SEP] literal[String] , identifier[cellspacing] operator[SEP] operator[SEP]
}
|
public void start(StartContext context) {
final SuspendController suspendController = suspendControllerInjectedValue.getValue();
suspendController.registerActivity(this);
final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue();
localTransactionContext.registerCreationListener(this);
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[context]] begin[{]
local_variable[type[SuspendController], suspendController]
call[suspendController.registerActivity, parameter[THIS[]]]
local_variable[type[LocalTransactionContext], localTransactionContext]
call[localTransactionContext.registerCreationListener, parameter[THIS[]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] identifier[StartContext] identifier[context] operator[SEP] {
Keyword[final] identifier[SuspendController] identifier[suspendController] operator[=] identifier[suspendControllerInjectedValue] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[suspendController] operator[SEP] identifier[registerActivity] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[final] identifier[LocalTransactionContext] identifier[localTransactionContext] operator[=] identifier[localTransactionContextInjectedValue] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[localTransactionContext] operator[SEP] identifier[registerCreationListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
private boolean optimizeForInclusion(QuerySpec querySpec) {
ResourceField idField = getIdField();
return querySpec.getIncludedRelations().size() == 1 &&
querySpec.getIncludedFields().size() == 1
&& idField.getUnderlyingName().equals(querySpec.getIncludedFields().get(0).getPath().toString());
} | class class_name[name] begin[{]
method[optimizeForInclusion, return_type[type[boolean]], modifier[private], parameter[querySpec]] begin[{]
local_variable[type[ResourceField], idField]
return[binary_operation[binary_operation[binary_operation[call[querySpec.getIncludedRelations, parameter[]], ==, literal[1]], &&, binary_operation[call[querySpec.getIncludedFields, parameter[]], ==, literal[1]]], &&, call[idField.getUnderlyingName, parameter[]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[optimizeForInclusion] operator[SEP] identifier[QuerySpec] identifier[querySpec] operator[SEP] {
identifier[ResourceField] identifier[idField] operator[=] identifier[getIdField] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[querySpec] operator[SEP] identifier[getIncludedRelations] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[querySpec] operator[SEP] identifier[getIncludedFields] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[idField] operator[SEP] identifier[getUnderlyingName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[querySpec] operator[SEP] identifier[getIncludedFields] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
void initInputsByIdMap() {
inputsById.clear();
for (CompilerInput input : externs) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_EXTERN_INPUT, input.getName()));
}
}
for (CompilerInput input : moduleGraph.getAllInputs()) {
InputId id = input.getInputId();
CompilerInput previous = putCompilerInput(id, input);
if (previous != null) {
report(JSError.make(DUPLICATE_INPUT, input.getName()));
}
}
} | class class_name[name] begin[{]
method[initInputsByIdMap, return_type[void], modifier[default], parameter[]] begin[{]
call[inputsById.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInputId, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputId, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putCompilerInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=previous)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CompilerInput, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=previous, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=DUPLICATE_EXTERN_INPUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=make, postfix_operators=[], prefix_operators=[], qualifier=JSError, selectors=[], type_arguments=None)], member=report, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=externs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=input)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CompilerInput, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInputId, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputId, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putCompilerInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=previous)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CompilerInput, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=previous, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=DUPLICATE_INPUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=make, postfix_operators=[], prefix_operators=[], qualifier=JSError, selectors=[], type_arguments=None)], member=report, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAllInputs, postfix_operators=[], prefix_operators=[], qualifier=moduleGraph, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=input)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CompilerInput, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[initInputsByIdMap] operator[SEP] operator[SEP] {
identifier[inputsById] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CompilerInput] identifier[input] operator[:] identifier[externs] operator[SEP] {
identifier[InputId] identifier[id] operator[=] identifier[input] operator[SEP] identifier[getInputId] operator[SEP] operator[SEP] operator[SEP] identifier[CompilerInput] identifier[previous] operator[=] identifier[putCompilerInput] operator[SEP] identifier[id] , identifier[input] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[previous] operator[!=] Other[null] operator[SEP] {
identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[DUPLICATE_EXTERN_INPUT] , identifier[input] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[CompilerInput] identifier[input] operator[:] identifier[moduleGraph] operator[SEP] identifier[getAllInputs] operator[SEP] operator[SEP] operator[SEP] {
identifier[InputId] identifier[id] operator[=] identifier[input] operator[SEP] identifier[getInputId] operator[SEP] operator[SEP] operator[SEP] identifier[CompilerInput] identifier[previous] operator[=] identifier[putCompilerInput] operator[SEP] identifier[id] , identifier[input] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[previous] operator[!=] Other[null] operator[SEP] {
identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[DUPLICATE_INPUT] , identifier[input] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private boolean isTransportSecure(HttpServletRequest req) {
String url = req.getRequestURL().toString();
if (req.getScheme().equals("https")) {
return true;
}
String value = req.getHeader("X-Forwarded-Proto");
if (value != null && value.toLowerCase().equals("https")) {
return true;
}
return false;
} | class class_name[name] begin[{]
method[isTransportSecure, return_type[type[boolean]], modifier[private], parameter[req]] begin[{]
local_variable[type[String], url]
if[call[req.getScheme, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], value]
if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, call[value.toLowerCase, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isTransportSecure] operator[SEP] identifier[HttpServletRequest] identifier[req] operator[SEP] {
identifier[String] identifier[url] operator[=] identifier[req] operator[SEP] identifier[getRequestURL] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[req] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[value] operator[=] identifier[req] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[value] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void encode(OutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
if (extensionValue == null) {
extensionId = PKIXExtensions.CertificateIssuer_Id;
critical = true;
encodeThis();
}
super.encode(tmp);
out.write(tmp.toByteArray());
} | class class_name[name] begin[{]
method[encode, return_type[void], modifier[public], parameter[out]] begin[{]
local_variable[type[DerOutputStream], tmp]
if[binary_operation[member[.extensionValue], ==, literal[null]]] begin[{]
assign[member[.extensionId], member[PKIXExtensions.CertificateIssuer_Id]]
assign[member[.critical], literal[true]]
call[.encodeThis, parameter[]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[out.write, parameter[call[tmp.toByteArray, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[encode] operator[SEP] identifier[OutputStream] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[DerOutputStream] identifier[tmp] operator[=] Keyword[new] identifier[DerOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extensionValue] operator[==] Other[null] operator[SEP] {
identifier[extensionId] operator[=] identifier[PKIXExtensions] operator[SEP] identifier[CertificateIssuer_Id] operator[SEP] identifier[critical] operator[=] literal[boolean] operator[SEP] identifier[encodeThis] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[encode] operator[SEP] identifier[tmp] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[tmp] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EClass getIfcTypeResource() {
if (ifcTypeResourceEClass == null) {
ifcTypeResourceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(740);
}
return ifcTypeResourceEClass;
} | class class_name[name] begin[{]
method[getIfcTypeResource, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcTypeResourceEClass], ==, literal[null]]] begin[{]
assign[member[.ifcTypeResourceEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=740)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcTypeResourceEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcTypeResource] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcTypeResourceEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcTypeResourceEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[740] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcTypeResourceEClass] operator[SEP]
}
|
public void setPseudoFixedToolbars(boolean value) {
boolean oldVal = this.pseudoFixedToolbars;
this.pseudoFixedToolbars = value;
if (oldVal != this.pseudoFixedToolbars && content != null && content.isAttached()) {
if (this.pseudoFixedToolbars) {
centerContent();
initWindowResize();
} else {
centerContent();
}
}
} | class class_name[name] begin[{]
method[setPseudoFixedToolbars, return_type[void], modifier[public], parameter[value]] begin[{]
local_variable[type[boolean], oldVal]
assign[THIS[member[None.pseudoFixedToolbars]], member[.value]]
if[binary_operation[binary_operation[binary_operation[member[.oldVal], !=, THIS[member[None.pseudoFixedToolbars]]], &&, binary_operation[member[.content], !=, literal[null]]], &&, call[content.isAttached, parameter[]]]] begin[{]
if[THIS[member[None.pseudoFixedToolbars]]] begin[{]
call[.centerContent, parameter[]]
call[.initWindowResize, parameter[]]
else begin[{]
call[.centerContent, parameter[]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPseudoFixedToolbars] operator[SEP] Keyword[boolean] identifier[value] operator[SEP] {
Keyword[boolean] identifier[oldVal] operator[=] Keyword[this] operator[SEP] identifier[pseudoFixedToolbars] operator[SEP] Keyword[this] operator[SEP] identifier[pseudoFixedToolbars] operator[=] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[oldVal] operator[!=] Keyword[this] operator[SEP] identifier[pseudoFixedToolbars] operator[&&] identifier[content] operator[!=] Other[null] operator[&&] identifier[content] operator[SEP] identifier[isAttached] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[pseudoFixedToolbars] operator[SEP] {
identifier[centerContent] operator[SEP] operator[SEP] operator[SEP] identifier[initWindowResize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[centerContent] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public int getRecordCount(FieldTable table)
{
int iKeyOrder = table.getRecord().getDefaultOrder();
if (iKeyOrder == -1)
iKeyOrder = Constants.MAIN_KEY_AREA;
return this.getPKeyArea(iKeyOrder).getRecordCount();
} | class class_name[name] begin[{]
method[getRecordCount, return_type[type[int]], modifier[public], parameter[table]] begin[{]
local_variable[type[int], iKeyOrder]
if[binary_operation[member[.iKeyOrder], ==, literal[1]]] begin[{]
assign[member[.iKeyOrder], member[Constants.MAIN_KEY_AREA]]
else begin[{]
None
end[}]
return[THIS[call[None.getPKeyArea, parameter[member[.iKeyOrder]]]call[None.getRecordCount, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getRecordCount] operator[SEP] identifier[FieldTable] identifier[table] operator[SEP] {
Keyword[int] identifier[iKeyOrder] operator[=] identifier[table] operator[SEP] identifier[getRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultOrder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iKeyOrder] operator[==] operator[-] Other[1] operator[SEP] identifier[iKeyOrder] operator[=] identifier[Constants] operator[SEP] identifier[MAIN_KEY_AREA] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[getPKeyArea] operator[SEP] identifier[iKeyOrder] operator[SEP] operator[SEP] identifier[getRecordCount] operator[SEP] operator[SEP] operator[SEP]
}
|
public void loadPolicy() {
model.clearPolicy();
adapter.loadPolicy(model);
model.printPolicy();
if (autoBuildRoleLinks) {
buildRoleLinks();
}
} | class class_name[name] begin[{]
method[loadPolicy, return_type[void], modifier[public], parameter[]] begin[{]
call[model.clearPolicy, parameter[]]
call[adapter.loadPolicy, parameter[member[.model]]]
call[model.printPolicy, parameter[]]
if[member[.autoBuildRoleLinks]] begin[{]
call[.buildRoleLinks, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[loadPolicy] operator[SEP] operator[SEP] {
identifier[model] operator[SEP] identifier[clearPolicy] operator[SEP] operator[SEP] operator[SEP] identifier[adapter] operator[SEP] identifier[loadPolicy] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[printPolicy] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[autoBuildRoleLinks] operator[SEP] {
identifier[buildRoleLinks] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public double addPoint( double x, double y ) {
pts.add(new Coordinate(x, y));
return selection = pts.size() - 1;
} | class class_name[name] begin[{]
method[addPoint, return_type[type[double]], modifier[public], parameter[x, y]] begin[{]
call[pts.add, parameter[ClassCreator(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, 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))]]
return[assign[member[.selection], binary_operation[call[pts.size, parameter[]], -, literal[1]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[addPoint] operator[SEP] Keyword[double] identifier[x] , Keyword[double] identifier[y] operator[SEP] {
identifier[pts] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[selection] operator[=] identifier[pts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP]
}
|
@Nullable
public static LocationEngineResult extractResult(Intent intent) {
LocationEngineResult result = null;
if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) {
result = extractGooglePlayResult(intent);
}
return result == null ? extractAndroidResult(intent) : result;
} | class class_name[name] begin[{]
method[extractResult, return_type[type[LocationEngineResult]], modifier[public static], parameter[intent]] begin[{]
local_variable[type[LocationEngineResult], result]
if[call[.isOnClasspath, parameter[member[.GOOGLE_PLAY_LOCATION_RESULT]]]] begin[{]
assign[member[.result], call[.extractGooglePlayResult, parameter[member[.intent]]]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=intent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractAndroidResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[LocationEngineResult] identifier[extractResult] operator[SEP] identifier[Intent] identifier[intent] operator[SEP] {
identifier[LocationEngineResult] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isOnClasspath] operator[SEP] identifier[GOOGLE_PLAY_LOCATION_RESULT] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[extractGooglePlayResult] operator[SEP] identifier[intent] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[==] Other[null] operator[?] identifier[extractAndroidResult] operator[SEP] identifier[intent] operator[SEP] operator[:] identifier[result] operator[SEP]
}
|
public void createStyleRelationship(String featureTable) {
createStyleRelationship(
getMappingTableName(TABLE_MAPPING_STYLE, featureTable),
featureTable, featureTable, StyleTable.TABLE_NAME);
} | class class_name[name] begin[{]
method[createStyleRelationship, return_type[void], modifier[public], parameter[featureTable]] begin[{]
call[.createStyleRelationship, parameter[call[.getMappingTableName, parameter[member[.TABLE_MAPPING_STYLE], member[.featureTable]]], member[.featureTable], member[.featureTable], member[StyleTable.TABLE_NAME]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[createStyleRelationship] operator[SEP] identifier[String] identifier[featureTable] operator[SEP] {
identifier[createStyleRelationship] operator[SEP] identifier[getMappingTableName] operator[SEP] identifier[TABLE_MAPPING_STYLE] , identifier[featureTable] operator[SEP] , identifier[featureTable] , identifier[featureTable] , identifier[StyleTable] operator[SEP] identifier[TABLE_NAME] operator[SEP] operator[SEP]
}
|
public static StringBuilder quotedString(String s) {
final EscapeStringResult escapeString = escapeString(s, '\"');
final StringBuilder result = escapeString.buffer;
result.insert(0, '\"');
result.append('\"');
return result;
} | class class_name[name] begin[{]
method[quotedString, return_type[type[StringBuilder]], modifier[public static], parameter[s]] begin[{]
local_variable[type[EscapeStringResult], escapeString]
local_variable[type[StringBuilder], result]
call[result.insert, parameter[literal[0], literal['\"']]]
call[result.append, parameter[literal['\"']]]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StringBuilder] identifier[quotedString] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[final] identifier[EscapeStringResult] identifier[escapeString] operator[=] identifier[escapeString] operator[SEP] identifier[s] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[result] operator[=] identifier[escapeString] operator[SEP] identifier[buffer] operator[SEP] identifier[result] operator[SEP] identifier[insert] operator[SEP] Other[0] , literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void resetReportedLeaks() {
try {
Field reportedLeaks = ResourceLeakDetector.class.getDeclaredField("reportedLeaks");
reportedLeaks.setAccessible(true);
Object f = reportedLeaks.get(this);
if (f instanceof Map) {
((Map) f).clear();
}
}
catch (Throwable t) {
// do nothing
}
} | class class_name[name] begin[{]
method[resetReportedLeaks, return_type[void], modifier[private], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="reportedLeaks")], member=getDeclaredField, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ResourceLeakDetector, sub_type=None)), name=reportedLeaks)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=reportedLeaks, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=reportedLeaks, selectors=[], type_arguments=None), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=None)), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[resetReportedLeaks] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[Field] identifier[reportedLeaks] operator[=] identifier[ResourceLeakDetector] operator[SEP] Keyword[class] operator[SEP] identifier[getDeclaredField] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[reportedLeaks] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Object] identifier[f] operator[=] identifier[reportedLeaks] operator[SEP] identifier[get] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] Keyword[instanceof] identifier[Map] operator[SEP] {
operator[SEP] operator[SEP] identifier[Map] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
}
}
|
public static <A extends Number & Comparable<?>> NumberExpression<Double> power(Expression<A> num, int exponent) {
return Expressions.numberOperation(Double.class, Ops.MathOps.POWER, num, ConstantImpl.create(exponent));
} | class class_name[name] begin[{]
method[power, return_type[type[NumberExpression]], modifier[public static], parameter[num, exponent]] begin[{]
return[call[Expressions.numberOperation, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Double, sub_type=None)), member[Ops.MathOps.POWER], member[.num], call[ConstantImpl.create, parameter[member[.exponent]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[A] Keyword[extends] identifier[Number] operator[&] identifier[Comparable] operator[<] operator[?] operator[>] operator[>] identifier[NumberExpression] operator[<] identifier[Double] operator[>] identifier[power] operator[SEP] identifier[Expression] operator[<] identifier[A] operator[>] identifier[num] , Keyword[int] identifier[exponent] operator[SEP] {
Keyword[return] identifier[Expressions] operator[SEP] identifier[numberOperation] operator[SEP] identifier[Double] operator[SEP] Keyword[class] , identifier[Ops] operator[SEP] identifier[MathOps] operator[SEP] identifier[POWER] , identifier[num] , identifier[ConstantImpl] operator[SEP] identifier[create] operator[SEP] identifier[exponent] operator[SEP] operator[SEP] operator[SEP]
}
|
public Selection restrictArgumentType(int arg, Class type) {
List<Function> lst;
int i;
Class tmp;
Class[] paras;
lst = new ArrayList<Function>();
for (i = 0; i < functions.length; i++) {
paras = functions[i].getParameterTypes();
if (arg < paras.length) {
tmp = paras[arg];
tmp = ClassRef.wrappedType(tmp);
if (tmp.isAssignableFrom(type)) {
lst.add(functions[i]);
}
}
}
return new Selection(lst);
} | class class_name[name] begin[{]
method[restrictArgumentType, return_type[type[Selection]], modifier[public], parameter[arg, type]] begin[{]
local_variable[type[List], lst]
local_variable[type[int], i]
local_variable[type[Class], tmp]
local_variable[type[Class], paras]
assign[member[.lst], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Function, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=paras, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=functions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=paras, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=paras, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrappedType, postfix_operators=[], prefix_operators=[], qualifier=ClassRef, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=[], prefix_operators=[], qualifier=tmp, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=functions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=add, postfix_operators=[], prefix_operators=[], qualifier=lst, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=functions, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=lst, 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=Selection, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Selection] identifier[restrictArgumentType] operator[SEP] Keyword[int] identifier[arg] , identifier[Class] identifier[type] operator[SEP] {
identifier[List] operator[<] identifier[Function] operator[>] identifier[lst] operator[SEP] Keyword[int] identifier[i] operator[SEP] identifier[Class] identifier[tmp] operator[SEP] identifier[Class] operator[SEP] operator[SEP] identifier[paras] operator[SEP] identifier[lst] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Function] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[functions] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[paras] operator[=] identifier[functions] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[arg] operator[<] identifier[paras] operator[SEP] identifier[length] operator[SEP] {
identifier[tmp] operator[=] identifier[paras] operator[SEP] identifier[arg] operator[SEP] operator[SEP] identifier[tmp] operator[=] identifier[ClassRef] operator[SEP] identifier[wrappedType] operator[SEP] identifier[tmp] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[lst] operator[SEP] identifier[add] operator[SEP] identifier[functions] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[Selection] operator[SEP] identifier[lst] operator[SEP] operator[SEP]
}
|
@VisibleForTesting
HamtPMap<K, V> assertCorrectStructure() {
if (isEmpty()) {
return this;
}
int hash = hash(key);
for (int i = 0; i < children.length; i++) {
int childHash = hash(children[i].key);
if (compareUnsigned(childHash, hash) < 0) {
throw new AssertionError("Invalid map has decreasing hash " + children[i].key + "("
+ Integer.toHexString(childHash) + ") beneath " + key + "("
+ Integer.toHexString(hash) + ": " + this);
}
children[i].assertCorrectStructure();
}
return this;
} | class class_name[name] begin[{]
method[assertCorrectStructure, return_type[type[HamtPMap]], modifier[default], parameter[]] begin[{]
if[call[.isEmpty, parameter[]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[int], hash]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=childHash)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=childHash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareUnsigned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid map has decreasing hash "), operandr=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="("), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=childHash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") beneath "), operator=+), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="("), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssertionError, sub_type=None)), label=None)])), StatementExpression(expression=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=assertCorrectStructure, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[VisibleForTesting] identifier[HamtPMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[assertCorrectStructure] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[int] identifier[hash] operator[=] identifier[hash] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[children] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[childHash] operator[=] identifier[hash] operator[SEP] identifier[children] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[compareUnsigned] operator[SEP] identifier[childHash] , identifier[hash] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AssertionError] operator[SEP] literal[String] operator[+] identifier[children] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[key] operator[+] literal[String] operator[+] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[childHash] operator[SEP] operator[+] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[hash] operator[SEP] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP]
}
identifier[children] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[assertCorrectStructure] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public ServerSocketBar create(InetAddress host, int port)
throws IOException, GeneralSecurityException
{
SSLServerSocketFactory ssFactory = null;
if (_keyStore != null) {
SSLContext sslContext = SSLContext.getInstance(_sslContext);
KeyManagerFactory kmf
= KeyManagerFactory.getInstance(keyManagerFactory());
kmf.init(_keyStore, keyStorePassword().toCharArray());
sslContext.init(kmf.getKeyManagers(), null, null);
/*
if (_cipherSuites != null)
sslContext.createSSLEngine().setEnabledCipherSuites(_cipherSuites);
if (_protocols != null)
sslContext.createSSLEngine().setEnabledProtocols(_protocols);
*/
SSLEngine engine = sslContext.createSSLEngine();
engine.setEnabledProtocols(enabledProtocols(engine.getSupportedProtocols()));
ssFactory = sslContext.getServerSocketFactory();
}
else {
ssFactory = createAnonymousServerFactory(host, port);
}
ServerSocket serverSocket;
int listen = 100;
if (host == null)
serverSocket = ssFactory.createServerSocket(port, listen);
else
serverSocket = ssFactory.createServerSocket(port, listen, host);
SSLServerSocket sslServerSocket = (SSLServerSocket) serverSocket;
if (_cipherSuites != null) {
sslServerSocket.setEnabledCipherSuites(_cipherSuites);
}
if (_cipherSuitesForbidden != null) {
String []cipherSuites = sslServerSocket.getEnabledCipherSuites();
if (cipherSuites == null)
cipherSuites = sslServerSocket.getSupportedCipherSuites();
ArrayList<String> cipherList = new ArrayList<String>();
for (String cipher : cipherSuites) {
if (! isCipherForbidden(cipher, _cipherSuitesForbidden)) {
cipherList.add(cipher);
}
}
cipherSuites = new String[cipherList.size()];
cipherList.toArray(cipherSuites);
sslServerSocket.setEnabledCipherSuites(cipherSuites);
}
sslServerSocket.setEnabledProtocols(enabledProtocols(sslServerSocket.getSupportedProtocols()));
if ("required".equals(_verifyClient))
sslServerSocket.setNeedClientAuth(true);
else if ("optional".equals(_verifyClient))
sslServerSocket.setWantClientAuth(true);
return new ServerSocketWrapper(serverSocket);
} | class class_name[name] begin[{]
method[create, return_type[type[ServerSocketBar]], modifier[public], parameter[host, port]] begin[{]
local_variable[type[SSLServerSocketFactory], ssFactory]
if[binary_operation[member[._keyStore], !=, literal[null]]] begin[{]
local_variable[type[SSLContext], sslContext]
local_variable[type[KeyManagerFactory], kmf]
call[kmf.init, parameter[member[._keyStore], call[.keyStorePassword, parameter[]]]]
call[sslContext.init, parameter[call[kmf.getKeyManagers, parameter[]], literal[null], literal[null]]]
local_variable[type[SSLEngine], engine]
call[engine.setEnabledProtocols, parameter[call[.enabledProtocols, parameter[call[engine.getSupportedProtocols, parameter[]]]]]]
assign[member[.ssFactory], call[sslContext.getServerSocketFactory, parameter[]]]
else begin[{]
assign[member[.ssFactory], call[.createAnonymousServerFactory, parameter[member[.host], member[.port]]]]
end[}]
local_variable[type[ServerSocket], serverSocket]
local_variable[type[int], listen]
if[binary_operation[member[.host], ==, literal[null]]] begin[{]
assign[member[.serverSocket], call[ssFactory.createServerSocket, parameter[member[.port], member[.listen]]]]
else begin[{]
assign[member[.serverSocket], call[ssFactory.createServerSocket, parameter[member[.port], member[.listen], member[.host]]]]
end[}]
local_variable[type[SSLServerSocket], sslServerSocket]
if[binary_operation[member[._cipherSuites], !=, literal[null]]] begin[{]
call[sslServerSocket.setEnabledCipherSuites, parameter[member[._cipherSuites]]]
else begin[{]
None
end[}]
if[binary_operation[member[._cipherSuitesForbidden], !=, literal[null]]] begin[{]
local_variable[type[String], cipherSuites]
if[binary_operation[member[.cipherSuites], ==, literal[null]]] begin[{]
assign[member[.cipherSuites], call[sslServerSocket.getSupportedCipherSuites, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[ArrayList], cipherList]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=cipher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_cipherSuitesForbidden, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isCipherForbidden, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cipher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=cipherList, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=cipherSuites, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cipher)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
assign[member[.cipherSuites], ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=cipherList, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
call[cipherList.toArray, parameter[member[.cipherSuites]]]
call[sslServerSocket.setEnabledCipherSuites, parameter[member[.cipherSuites]]]
else begin[{]
None
end[}]
call[sslServerSocket.setEnabledProtocols, parameter[call[.enabledProtocols, parameter[call[sslServerSocket.getSupportedProtocols, parameter[]]]]]]
if[literal["required"]] begin[{]
call[sslServerSocket.setNeedClientAuth, parameter[literal[true]]]
else begin[{]
if[literal["optional"]] begin[{]
call[sslServerSocket.setWantClientAuth, parameter[literal[true]]]
else begin[{]
None
end[}]
end[}]
return[ClassCreator(arguments=[MemberReference(member=serverSocket, 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=ServerSocketWrapper, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ServerSocketBar] identifier[create] operator[SEP] identifier[InetAddress] identifier[host] , Keyword[int] identifier[port] operator[SEP] Keyword[throws] identifier[IOException] , identifier[GeneralSecurityException] {
identifier[SSLServerSocketFactory] identifier[ssFactory] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[_keyStore] operator[!=] Other[null] operator[SEP] {
identifier[SSLContext] identifier[sslContext] operator[=] identifier[SSLContext] operator[SEP] identifier[getInstance] operator[SEP] identifier[_sslContext] operator[SEP] operator[SEP] identifier[KeyManagerFactory] identifier[kmf] operator[=] identifier[KeyManagerFactory] operator[SEP] identifier[getInstance] operator[SEP] identifier[keyManagerFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[kmf] operator[SEP] identifier[init] operator[SEP] identifier[_keyStore] , identifier[keyStorePassword] operator[SEP] operator[SEP] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sslContext] operator[SEP] identifier[init] operator[SEP] identifier[kmf] operator[SEP] identifier[getKeyManagers] operator[SEP] operator[SEP] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[SSLEngine] identifier[engine] operator[=] identifier[sslContext] operator[SEP] identifier[createSSLEngine] operator[SEP] operator[SEP] operator[SEP] identifier[engine] operator[SEP] identifier[setEnabledProtocols] operator[SEP] identifier[enabledProtocols] operator[SEP] identifier[engine] operator[SEP] identifier[getSupportedProtocols] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ssFactory] operator[=] identifier[sslContext] operator[SEP] identifier[getServerSocketFactory] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ssFactory] operator[=] identifier[createAnonymousServerFactory] operator[SEP] identifier[host] , identifier[port] operator[SEP] operator[SEP]
}
identifier[ServerSocket] identifier[serverSocket] operator[SEP] Keyword[int] identifier[listen] operator[=] Other[100] operator[SEP] Keyword[if] operator[SEP] identifier[host] operator[==] Other[null] operator[SEP] identifier[serverSocket] operator[=] identifier[ssFactory] operator[SEP] identifier[createServerSocket] operator[SEP] identifier[port] , identifier[listen] operator[SEP] operator[SEP] Keyword[else] identifier[serverSocket] operator[=] identifier[ssFactory] operator[SEP] identifier[createServerSocket] operator[SEP] identifier[port] , identifier[listen] , identifier[host] operator[SEP] operator[SEP] identifier[SSLServerSocket] identifier[sslServerSocket] operator[=] operator[SEP] identifier[SSLServerSocket] operator[SEP] identifier[serverSocket] operator[SEP] Keyword[if] operator[SEP] identifier[_cipherSuites] operator[!=] Other[null] operator[SEP] {
identifier[sslServerSocket] operator[SEP] identifier[setEnabledCipherSuites] operator[SEP] identifier[_cipherSuites] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_cipherSuitesForbidden] operator[!=] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[cipherSuites] operator[=] identifier[sslServerSocket] operator[SEP] identifier[getEnabledCipherSuites] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cipherSuites] operator[==] Other[null] operator[SEP] identifier[cipherSuites] operator[=] identifier[sslServerSocket] operator[SEP] identifier[getSupportedCipherSuites] operator[SEP] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[cipherList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[cipher] operator[:] identifier[cipherSuites] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isCipherForbidden] operator[SEP] identifier[cipher] , identifier[_cipherSuitesForbidden] operator[SEP] operator[SEP] {
identifier[cipherList] operator[SEP] identifier[add] operator[SEP] identifier[cipher] operator[SEP] operator[SEP]
}
}
identifier[cipherSuites] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[cipherList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cipherList] operator[SEP] identifier[toArray] operator[SEP] identifier[cipherSuites] operator[SEP] operator[SEP] identifier[sslServerSocket] operator[SEP] identifier[setEnabledCipherSuites] operator[SEP] identifier[cipherSuites] operator[SEP] operator[SEP]
}
identifier[sslServerSocket] operator[SEP] identifier[setEnabledProtocols] operator[SEP] identifier[enabledProtocols] operator[SEP] identifier[sslServerSocket] operator[SEP] identifier[getSupportedProtocols] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[_verifyClient] operator[SEP] operator[SEP] identifier[sslServerSocket] operator[SEP] identifier[setNeedClientAuth] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[_verifyClient] operator[SEP] operator[SEP] identifier[sslServerSocket] operator[SEP] identifier[setWantClientAuth] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ServerSocketWrapper] operator[SEP] identifier[serverSocket] operator[SEP] operator[SEP]
}
|
private String reorg(String tableName) {
List<String> statement = new ArrayList<>();
statement.add("CALL sysproc.admin_cmd('REORG TABLE");
statement.add(quotize(tableName));
statement.add("')");
return join(statement, " ");
} | class class_name[name] begin[{]
method[reorg, return_type[type[String]], modifier[private], parameter[tableName]] begin[{]
local_variable[type[List], statement]
call[statement.add, parameter[literal["CALL sysproc.admin_cmd('REORG TABLE"]]]
call[statement.add, parameter[call[.quotize, parameter[member[.tableName]]]]]
call[statement.add, parameter[literal["')"]]]
return[call[.join, parameter[member[.statement], literal[" "]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[reorg] operator[SEP] identifier[String] identifier[tableName] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[statement] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[statement] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[statement] operator[SEP] identifier[add] operator[SEP] identifier[quotize] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] operator[SEP] identifier[statement] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[join] operator[SEP] identifier[statement] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public String unit( CssFormatter formatter ) {
switch( operator ) {
case '*':
case '/':
ArrayList<Unit> list = unit( formatter, null );
if( list != null ) {
Unit unit = list.get( 0 );
int useCount = unit.useCount();
for( int i=1; i<list.size(); i++ ){
if( list.get( i ).useCount() > useCount ) {
unit = list.get( i );
}
}
return unit.unit;
}
return "";
}
for( int i = 0; i < operands.size(); i++ ) {
String unit = operands.get( i ).unit( formatter );
if( !unit.isEmpty() ) {
return unit;
}
}
return "";
} | class class_name[name] begin[{]
method[unit, return_type[type[String]], modifier[public], parameter[formatter]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/')], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=list)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Unit, sub_type=None))], dimensions=[], name=ArrayList, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), name=unit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Unit, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=useCount, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[], type_arguments=None), name=useCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[MethodInvocation(arguments=[], member=useCount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=useCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=list, 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=list, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), ReturnStatement(expression=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[]), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), label=None)])], expression=MemberReference(member=operator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
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=operands, selectors=[MethodInvocation(arguments=[MemberReference(member=formatter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=unit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=unit, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=unit, 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=operands, 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[literal[""]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[unit] operator[SEP] identifier[CssFormatter] identifier[formatter] operator[SEP] {
Keyword[switch] operator[SEP] identifier[operator] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[ArrayList] operator[<] identifier[Unit] operator[>] identifier[list] operator[=] identifier[unit] operator[SEP] identifier[formatter] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[!=] Other[null] operator[SEP] {
identifier[Unit] identifier[unit] operator[=] identifier[list] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[useCount] operator[=] identifier[unit] operator[SEP] identifier[useCount] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[list] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[useCount] operator[SEP] operator[SEP] operator[>] identifier[useCount] operator[SEP] {
identifier[unit] operator[=] identifier[list] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[unit] operator[SEP] identifier[unit] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[operands] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[unit] operator[=] identifier[operands] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[unit] operator[SEP] identifier[formatter] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[unit] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[unit] operator[SEP]
}
}
Keyword[return] literal[String] operator[SEP]
}
|
public static long getDurationInNanos(final String propertyName, final long defaultValue)
{
final String propertyValue = getProperty(propertyName);
if (propertyValue != null)
{
final long value = parseDuration(propertyName, propertyValue);
if (value < 0)
{
throw new NumberFormatException(propertyName + " must be positive: " + value);
}
return value;
}
return defaultValue;
} | class class_name[name] begin[{]
method[getDurationInNanos, return_type[type[long]], modifier[public static], parameter[propertyName, defaultValue]] begin[{]
local_variable[type[String], propertyValue]
if[binary_operation[member[.propertyValue], !=, literal[null]]] begin[{]
local_variable[type[long], value]
if[binary_operation[member[.value], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must be positive: "), operator=+), operandr=MemberReference(member=value, 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=NumberFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.value]]
else begin[{]
None
end[}]
return[member[.defaultValue]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[getDurationInNanos] operator[SEP] Keyword[final] identifier[String] identifier[propertyName] , Keyword[final] Keyword[long] identifier[defaultValue] operator[SEP] {
Keyword[final] identifier[String] identifier[propertyValue] operator[=] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyValue] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[long] identifier[value] operator[=] identifier[parseDuration] operator[SEP] identifier[propertyName] , identifier[propertyValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NumberFormatException] operator[SEP] identifier[propertyName] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
Keyword[return] identifier[defaultValue] operator[SEP]
}
|
public SoapClient setHeader(QName name, String actorURI, String roleUri, Boolean mustUnderstand, Boolean relay) {
SOAPHeader header;
SOAPHeaderElement ele;
try {
header = this.message.getSOAPHeader();
ele = header.addHeaderElement(name);
if (StrUtil.isNotBlank(roleUri)) {
ele.setRole(roleUri);
}
if (null != relay) {
ele.setRelay(relay);
}
} catch (SOAPException e) {
throw new SoapRuntimeException(e);
}
if (StrUtil.isNotBlank(actorURI)) {
ele.setActor(actorURI);
}
if (null != mustUnderstand) {
ele.setMustUnderstand(mustUnderstand);
}
return this;
} | class class_name[name] begin[{]
method[setHeader, return_type[type[SoapClient]], modifier[public], parameter[name, actorURI, roleUri, mustUnderstand, relay]] begin[{]
local_variable[type[SOAPHeader], header]
local_variable[type[SOAPHeaderElement], ele]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=header, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=message, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getSOAPHeader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addHeaderElement, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=roleUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StrUtil, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=roleUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRole, postfix_operators=[], prefix_operators=[], qualifier=ele, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=relay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=relay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRelay, postfix_operators=[], prefix_operators=[], qualifier=ele, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SoapRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SOAPException']))], finally_block=None, label=None, resources=None)
if[call[StrUtil.isNotBlank, parameter[member[.actorURI]]]] begin[{]
call[ele.setActor, parameter[member[.actorURI]]]
else begin[{]
None
end[}]
if[binary_operation[literal[null], !=, member[.mustUnderstand]]] begin[{]
call[ele.setMustUnderstand, parameter[member[.mustUnderstand]]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[SoapClient] identifier[setHeader] operator[SEP] identifier[QName] identifier[name] , identifier[String] identifier[actorURI] , identifier[String] identifier[roleUri] , identifier[Boolean] identifier[mustUnderstand] , identifier[Boolean] identifier[relay] operator[SEP] {
identifier[SOAPHeader] identifier[header] operator[SEP] identifier[SOAPHeaderElement] identifier[ele] operator[SEP] Keyword[try] {
identifier[header] operator[=] Keyword[this] operator[SEP] identifier[message] operator[SEP] identifier[getSOAPHeader] operator[SEP] operator[SEP] operator[SEP] identifier[ele] operator[=] identifier[header] operator[SEP] identifier[addHeaderElement] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StrUtil] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[roleUri] operator[SEP] operator[SEP] {
identifier[ele] operator[SEP] identifier[setRole] operator[SEP] identifier[roleUri] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[relay] operator[SEP] {
identifier[ele] operator[SEP] identifier[setRelay] operator[SEP] identifier[relay] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SOAPException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SoapRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StrUtil] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[actorURI] operator[SEP] operator[SEP] {
identifier[ele] operator[SEP] identifier[setActor] operator[SEP] identifier[actorURI] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[mustUnderstand] operator[SEP] {
identifier[ele] operator[SEP] identifier[setMustUnderstand] operator[SEP] identifier[mustUnderstand] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public com.liferay.commerce.model.CommerceCountry updateCommerceCountry(
com.liferay.commerce.model.CommerceCountry commerceCountry) {
return _commerceCountryLocalService.updateCommerceCountry(commerceCountry);
} | class class_name[name] begin[{]
method[updateCommerceCountry, return_type[type[com]], modifier[public], parameter[commerceCountry]] begin[{]
return[call[_commerceCountryLocalService.updateCommerceCountry, parameter[member[.commerceCountry]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CommerceCountry] identifier[updateCommerceCountry] operator[SEP] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CommerceCountry] identifier[commerceCountry] operator[SEP] {
Keyword[return] identifier[_commerceCountryLocalService] operator[SEP] identifier[updateCommerceCountry] operator[SEP] identifier[commerceCountry] operator[SEP] operator[SEP]
}
|
public void putBuildRow(BinaryRow row) throws IOException {
long key = getBuildLongKey(row);
final int hashCode = hashLong(key, 0);
insertIntoTable(key, hashCode, row);
} | class class_name[name] begin[{]
method[putBuildRow, return_type[void], modifier[public], parameter[row]] begin[{]
local_variable[type[long], key]
local_variable[type[int], hashCode]
call[.insertIntoTable, parameter[member[.key], member[.hashCode], member[.row]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[putBuildRow] operator[SEP] identifier[BinaryRow] identifier[row] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[long] identifier[key] operator[=] identifier[getBuildLongKey] operator[SEP] identifier[row] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[hashCode] operator[=] identifier[hashLong] operator[SEP] identifier[key] , Other[0] operator[SEP] operator[SEP] identifier[insertIntoTable] operator[SEP] identifier[key] , identifier[hashCode] , identifier[row] operator[SEP] operator[SEP]
}
|
public void process( GrayU8 binary ) {
found.reset();
labeled.reshape(binary.width, binary.height);
contourFinder.process(binary, labeled);
List<ContourPacked> blobs = contourFinder.getContours();
for (int i = 0; i < blobs.size(); i++) {
ContourPacked c = blobs.get(i);
contourFinder.loadContour(c.externalIndex,contourTmp);
proccessContour(contourTmp.toList());
if(internalContour) {
for( int j = 0; j < c.internalIndexes.size(); j++ ) {
contourFinder.loadContour(c.internalIndexes.get(j),contourTmp);
proccessContour(contourTmp.toList());
}
}
}
} | class class_name[name] begin[{]
method[process, return_type[void], modifier[public], parameter[binary]] begin[{]
call[found.reset, parameter[]]
call[labeled.reshape, parameter[member[binary.width], member[binary.height]]]
call[contourFinder.process, parameter[member[.binary], member[.labeled]]]
local_variable[type[List], blobs]
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=blobs, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContourPacked, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=externalIndex, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[]), MemberReference(member=contourTmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadContour, postfix_operators=[], prefix_operators=[], qualifier=contourFinder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toList, postfix_operators=[], prefix_operators=[], qualifier=contourTmp, selectors=[], type_arguments=None)], member=proccessContour, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=internalContour, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=c.internalIndexes, selectors=[], type_arguments=None), MemberReference(member=contourTmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadContour, postfix_operators=[], prefix_operators=[], qualifier=contourFinder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toList, postfix_operators=[], prefix_operators=[], qualifier=contourTmp, selectors=[], type_arguments=None)], member=proccessContour, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=c.internalIndexes, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=blobs, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[process] operator[SEP] identifier[GrayU8] identifier[binary] operator[SEP] {
identifier[found] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[labeled] operator[SEP] identifier[reshape] operator[SEP] identifier[binary] operator[SEP] identifier[width] , identifier[binary] operator[SEP] identifier[height] operator[SEP] operator[SEP] identifier[contourFinder] operator[SEP] identifier[process] operator[SEP] identifier[binary] , identifier[labeled] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ContourPacked] operator[>] identifier[blobs] operator[=] identifier[contourFinder] operator[SEP] identifier[getContours] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[blobs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ContourPacked] identifier[c] operator[=] identifier[blobs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[contourFinder] operator[SEP] identifier[loadContour] operator[SEP] identifier[c] operator[SEP] identifier[externalIndex] , identifier[contourTmp] operator[SEP] operator[SEP] identifier[proccessContour] operator[SEP] identifier[contourTmp] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[internalContour] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[c] operator[SEP] identifier[internalIndexes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[contourFinder] operator[SEP] identifier[loadContour] operator[SEP] identifier[c] operator[SEP] identifier[internalIndexes] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] , identifier[contourTmp] operator[SEP] operator[SEP] identifier[proccessContour] operator[SEP] identifier[contourTmp] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
@Nonnull
public final Launcher decorateByPrefix(final String... prefix) {
final Launcher outer = this;
return new Launcher(outer) {
@Override
public boolean isUnix() {
return outer.isUnix();
}
@Override
public Proc launch(ProcStarter starter) throws IOException {
starter.commands.addAll(0,Arrays.asList(prefix));
boolean[] masks = starter.masks;
if (masks != null) {
starter.masks = prefix(masks);
}
return outer.launch(starter);
}
@Override
public Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) throws IOException, InterruptedException {
return outer.launchChannel(prefix(cmd),out,workDir,envVars);
}
@Override
public void kill(Map<String, String> modelEnvVars) throws IOException, InterruptedException {
outer.kill(modelEnvVars);
}
private String[] prefix(@Nonnull String[] args) {
String[] newArgs = new String[args.length+prefix.length];
System.arraycopy(prefix,0,newArgs,0,prefix.length);
System.arraycopy(args,0,newArgs,prefix.length,args.length);
return newArgs;
}
private boolean[] prefix(@Nonnull boolean[] args) {
boolean[] newArgs = new boolean[args.length+prefix.length];
System.arraycopy(args,0,newArgs,prefix.length,args.length);
return newArgs;
}
};
} | class class_name[name] begin[{]
method[decorateByPrefix, return_type[type[Launcher]], modifier[final public], parameter[prefix]] begin[{]
local_variable[type[Launcher], outer]
return[ClassCreator(arguments=[MemberReference(member=outer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=isUnix, postfix_operators=[], prefix_operators=[], qualifier=outer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=isUnix, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=starter.commands, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=masks, postfix_operators=[], prefix_operators=[], qualifier=starter, selectors=[]), name=masks)], modifiers=set(), type=BasicType(dimensions=[None], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=masks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=masks, postfix_operators=[], prefix_operators=[], qualifier=starter, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=masks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=starter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=launch, postfix_operators=[], prefix_operators=[], qualifier=outer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=launch, parameters=[FormalParameter(annotations=[], modifiers=set(), name=starter, type=ReferenceType(arguments=None, dimensions=[], name=ProcStarter, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Proc, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=workDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=envVars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=launchChannel, postfix_operators=[], prefix_operators=[], qualifier=outer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=launchChannel, parameters=[FormalParameter(annotations=[], modifiers=set(), name=cmd, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=out, type=ReferenceType(arguments=None, dimensions=[], name=OutputStream, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=workDir, type=ReferenceType(arguments=None, dimensions=[], name=FilePath, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=envVars, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None), throws=['IOException', 'InterruptedException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=modelEnvVars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=kill, postfix_operators=[], prefix_operators=[], qualifier=outer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=kill, parameters=[FormalParameter(annotations=[], modifiers=set(), name=modelEnvVars, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None), varargs=False)], return_type=None, throws=['IOException', 'InterruptedException'], type_parameters=None), MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=prefix, selectors=[]), operator=+)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=newArgs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=newArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=prefix, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=newArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=prefix, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=newArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'private'}, name=prefix, parameters=[FormalParameter(annotations=[Annotation(element=None, name=Nonnull)], modifiers=set(), name=args, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=prefix, selectors=[]), operator=+)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), name=newArgs)], modifiers=set(), type=BasicType(dimensions=[None], name=boolean)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=newArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=prefix, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=newArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'private'}, name=prefix, parameters=[FormalParameter(annotations=[Annotation(element=None, name=Nonnull)], modifiers=set(), name=args, type=BasicType(dimensions=[None], name=boolean), varargs=False)], return_type=BasicType(dimensions=[None], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Launcher, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[final] identifier[Launcher] identifier[decorateByPrefix] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[prefix] operator[SEP] {
Keyword[final] identifier[Launcher] identifier[outer] operator[=] Keyword[this] operator[SEP] Keyword[return] Keyword[new] identifier[Launcher] operator[SEP] identifier[outer] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isUnix] operator[SEP] operator[SEP] {
Keyword[return] identifier[outer] operator[SEP] identifier[isUnix] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Proc] identifier[launch] operator[SEP] identifier[ProcStarter] identifier[starter] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[starter] operator[SEP] identifier[commands] operator[SEP] identifier[addAll] operator[SEP] Other[0] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[masks] operator[=] identifier[starter] operator[SEP] identifier[masks] operator[SEP] Keyword[if] operator[SEP] identifier[masks] operator[!=] Other[null] operator[SEP] {
identifier[starter] operator[SEP] identifier[masks] operator[=] identifier[prefix] operator[SEP] identifier[masks] operator[SEP] operator[SEP]
}
Keyword[return] identifier[outer] operator[SEP] identifier[launch] operator[SEP] identifier[starter] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Channel] identifier[launchChannel] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[cmd] , identifier[OutputStream] identifier[out] , identifier[FilePath] identifier[workDir] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[envVars] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
Keyword[return] identifier[outer] operator[SEP] identifier[launchChannel] operator[SEP] identifier[prefix] operator[SEP] identifier[cmd] operator[SEP] , identifier[out] , identifier[workDir] , identifier[envVars] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[kill] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[modelEnvVars] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[outer] operator[SEP] identifier[kill] operator[SEP] identifier[modelEnvVars] operator[SEP] operator[SEP]
}
Keyword[private] identifier[String] operator[SEP] operator[SEP] identifier[prefix] operator[SEP] annotation[@] identifier[Nonnull] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[newArgs] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[+] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[prefix] , Other[0] , identifier[newArgs] , Other[0] , identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[args] , Other[0] , identifier[newArgs] , identifier[prefix] operator[SEP] identifier[length] , identifier[args] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[newArgs] operator[SEP]
}
Keyword[private] Keyword[boolean] operator[SEP] operator[SEP] identifier[prefix] operator[SEP] annotation[@] identifier[Nonnull] Keyword[boolean] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[boolean] operator[SEP] operator[SEP] identifier[newArgs] operator[=] Keyword[new] Keyword[boolean] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[+] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[args] , Other[0] , identifier[newArgs] , identifier[prefix] operator[SEP] identifier[length] , identifier[args] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[newArgs] operator[SEP]
}
} operator[SEP]
}
|
@Override
public <ActualSolutionType extends SolutionType> WeightedIndexEvaluation evaluate(Move<? super ActualSolutionType> move,
ActualSolutionType curSolution,
Evaluation curEvaluation,
DataType data) {
// cast current evaluation object
WeightedIndexEvaluation curEval = (WeightedIndexEvaluation) curEvaluation;
// initialize new evaluation object
WeightedIndexEvaluation newEval = new WeightedIndexEvaluation();
// compute delta evaluation for each contained objective
weights.keySet().forEach(obj -> {
// extract current evaluation
Evaluation objCurEval = curEval.getEvaluation(obj);
// delta evaluation of contained objective
Evaluation objNewEval = obj.evaluate(move, curSolution, objCurEval, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in new weighted index evaluation
newEval.addEvaluation(obj, objNewEval, w);
});
// return new evaluation
return newEval;
} | class class_name[name] begin[{]
method[evaluate, return_type[type[WeightedIndexEvaluation]], modifier[public], parameter[move, curSolution, curEvaluation, data]] begin[{]
local_variable[type[WeightedIndexEvaluation], curEval]
local_variable[type[WeightedIndexEvaluation], newEval]
call[weights.keySet, parameter[]]
return[member[.newEval]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[ActualSolutionType] Keyword[extends] identifier[SolutionType] operator[>] identifier[WeightedIndexEvaluation] identifier[evaluate] operator[SEP] identifier[Move] operator[<] operator[?] Keyword[super] identifier[ActualSolutionType] operator[>] identifier[move] , identifier[ActualSolutionType] identifier[curSolution] , identifier[Evaluation] identifier[curEvaluation] , identifier[DataType] identifier[data] operator[SEP] {
identifier[WeightedIndexEvaluation] identifier[curEval] operator[=] operator[SEP] identifier[WeightedIndexEvaluation] operator[SEP] identifier[curEvaluation] operator[SEP] identifier[WeightedIndexEvaluation] identifier[newEval] operator[=] Keyword[new] identifier[WeightedIndexEvaluation] operator[SEP] operator[SEP] operator[SEP] identifier[weights] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[obj] operator[->] {
identifier[Evaluation] identifier[objCurEval] operator[=] identifier[curEval] operator[SEP] identifier[getEvaluation] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[Evaluation] identifier[objNewEval] operator[=] identifier[obj] operator[SEP] identifier[evaluate] operator[SEP] identifier[move] , identifier[curSolution] , identifier[objCurEval] , identifier[data] operator[SEP] operator[SEP] Keyword[double] identifier[w] operator[=] identifier[weights] operator[SEP] identifier[get] operator[SEP] identifier[obj] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[SEP] identifier[isMinimizing] operator[SEP] operator[SEP] operator[SEP] {
identifier[w] operator[=] operator[-] identifier[w] operator[SEP]
}
identifier[newEval] operator[SEP] identifier[addEvaluation] operator[SEP] identifier[obj] , identifier[objNewEval] , identifier[w] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[return] identifier[newEval] operator[SEP]
}
|
public SIPDialog getDialog(String dialogId) throws SipCacheException {
try {
Node dialogNode = ((Node) dialogRootNode.getChild(Fqn.fromString(dialogId)));
if(dialogNode != null) {
return (SIPDialog) dialogNode.get(dialogId);
} else {
return null;
}
} catch (CacheException e) {
throw new SipCacheException("A problem occured while retrieving the following dialog " + dialogId + " from JBoss Cache", e);
}
} | class class_name[name] begin[{]
method[getDialog, return_type[type[SIPDialog]], modifier[public], parameter[dialogId]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=dialogId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromString, postfix_operators=[], prefix_operators=[], qualifier=Fqn, selectors=[], type_arguments=None)], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=dialogRootNode, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), name=dialogNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dialogNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=dialogId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=dialogNode, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SIPDialog, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A problem occured while retrieving the following dialog "), operandr=MemberReference(member=dialogId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" from JBoss Cache"), 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=SipCacheException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CacheException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[SIPDialog] identifier[getDialog] operator[SEP] identifier[String] identifier[dialogId] operator[SEP] Keyword[throws] identifier[SipCacheException] {
Keyword[try] {
identifier[Node] identifier[dialogNode] operator[=] operator[SEP] operator[SEP] identifier[Node] operator[SEP] identifier[dialogRootNode] operator[SEP] identifier[getChild] operator[SEP] identifier[Fqn] operator[SEP] identifier[fromString] operator[SEP] identifier[dialogId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dialogNode] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP] identifier[SIPDialog] operator[SEP] identifier[dialogNode] operator[SEP] identifier[get] operator[SEP] identifier[dialogId] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[CacheException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SipCacheException] operator[SEP] literal[String] operator[+] identifier[dialogId] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static ByteBuf createDnsQueryPayload(DnsTransaction transaction) {
ByteBuf byteBuf = ByteBufPool.allocate(MAX_SIZE);
byteBuf.writeShort(transaction.getId());
// standard query flags, 1 question and 0 of other stuff
byteBuf.write(STANDARD_QUERY_HEADER);
// query domain name
byte componentSize = 0;
DnsQuery query = transaction.getQuery();
byte[] domainBytes = query.getDomainName().getBytes(US_ASCII);
int pos = -1;
while (++pos < domainBytes.length) {
if (domainBytes[pos] != '.') {
componentSize++;
continue;
}
byteBuf.writeByte(componentSize);
byteBuf.write(domainBytes, pos - componentSize, componentSize);
componentSize = 0;
}
byteBuf.writeByte(componentSize);
byteBuf.write(domainBytes, pos - componentSize, componentSize);
byteBuf.writeByte((byte) 0x0); // terminator byte
// query record type
byteBuf.writeShort(query.getRecordType().getCode());
// query class: IN
byteBuf.writeShort(QueryClass.INTERNET.getCode());
return byteBuf;
} | class class_name[name] begin[{]
method[createDnsQueryPayload, return_type[type[ByteBuf]], modifier[public static], parameter[transaction]] begin[{]
local_variable[type[ByteBuf], byteBuf]
call[byteBuf.writeShort, parameter[call[transaction.getId, parameter[]]]]
call[byteBuf.write, parameter[member[.STANDARD_QUERY_HEADER]]]
local_variable[type[byte], componentSize]
local_variable[type[DnsQuery], query]
local_variable[type[byte], domainBytes]
local_variable[type[int], pos]
while[binary_operation[member[.pos], <, member[domainBytes.length]]] begin[{]
if[binary_operation[member[.domainBytes], !=, literal['.']]] begin[{]
member[.componentSize]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[byteBuf.writeByte, parameter[member[.componentSize]]]
call[byteBuf.write, parameter[member[.domainBytes], binary_operation[member[.pos], -, member[.componentSize]], member[.componentSize]]]
assign[member[.componentSize], literal[0]]
end[}]
call[byteBuf.writeByte, parameter[member[.componentSize]]]
call[byteBuf.write, parameter[member[.domainBytes], binary_operation[member[.pos], -, member[.componentSize]], member[.componentSize]]]
call[byteBuf.writeByte, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0), type=BasicType(dimensions=[], name=byte))]]
call[byteBuf.writeShort, parameter[call[query.getRecordType, parameter[]]]]
call[byteBuf.writeShort, parameter[call[QueryClass.INTERNET.getCode, parameter[]]]]
return[member[.byteBuf]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ByteBuf] identifier[createDnsQueryPayload] operator[SEP] identifier[DnsTransaction] identifier[transaction] operator[SEP] {
identifier[ByteBuf] identifier[byteBuf] operator[=] identifier[ByteBufPool] operator[SEP] identifier[allocate] operator[SEP] identifier[MAX_SIZE] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[writeShort] operator[SEP] identifier[transaction] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[write] operator[SEP] identifier[STANDARD_QUERY_HEADER] operator[SEP] operator[SEP] Keyword[byte] identifier[componentSize] operator[=] Other[0] operator[SEP] identifier[DnsQuery] identifier[query] operator[=] identifier[transaction] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[domainBytes] operator[=] identifier[query] operator[SEP] identifier[getDomainName] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[US_ASCII] operator[SEP] operator[SEP] Keyword[int] identifier[pos] operator[=] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] operator[++] identifier[pos] operator[<] identifier[domainBytes] operator[SEP] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] identifier[domainBytes] operator[SEP] identifier[pos] operator[SEP] operator[!=] literal[String] operator[SEP] {
identifier[componentSize] operator[++] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[byteBuf] operator[SEP] identifier[writeByte] operator[SEP] identifier[componentSize] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[write] operator[SEP] identifier[domainBytes] , identifier[pos] operator[-] identifier[componentSize] , identifier[componentSize] operator[SEP] operator[SEP] identifier[componentSize] operator[=] Other[0] operator[SEP]
}
identifier[byteBuf] operator[SEP] identifier[writeByte] operator[SEP] identifier[componentSize] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[write] operator[SEP] identifier[domainBytes] , identifier[pos] operator[-] identifier[componentSize] , identifier[componentSize] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[writeByte] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] literal[Integer] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[writeShort] operator[SEP] identifier[query] operator[SEP] identifier[getRecordType] operator[SEP] operator[SEP] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[byteBuf] operator[SEP] identifier[writeShort] operator[SEP] identifier[QueryClass] operator[SEP] identifier[INTERNET] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[byteBuf] operator[SEP]
}
|
public static String format(final long time, final String format) {
return format(time, DateTimeFormat.forPattern(format));
} | class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[public static], parameter[time, format]] begin[{]
return[call[.format, parameter[member[.time], call[DateTimeFormat.forPattern, parameter[member[.format]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[format] operator[SEP] Keyword[final] Keyword[long] identifier[time] , Keyword[final] identifier[String] identifier[format] operator[SEP] {
Keyword[return] identifier[format] operator[SEP] identifier[time] , identifier[DateTimeFormat] operator[SEP] identifier[forPattern] operator[SEP] identifier[format] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.PGPRG__RG_LENGTH:
return RG_LENGTH_EDEFAULT == null ? rgLength != null : !RG_LENGTH_EDEFAULT.equals(rgLength);
case AfplibPackage.PGPRG__XM_OSET:
return XM_OSET_EDEFAULT == null ? xmOset != null : !XM_OSET_EDEFAULT.equals(xmOset);
case AfplibPackage.PGPRG__YM_OSET:
return YM_OSET_EDEFAULT == null ? ymOset != null : !YM_OSET_EDEFAULT.equals(ymOset);
case AfplibPackage.PGPRG__PGORIENT:
return PGORIENT_EDEFAULT == null ? pGorient != null : !PGORIENT_EDEFAULT.equals(pGorient);
case AfplibPackage.PGPRG__SHSIDE:
return SHSIDE_EDEFAULT == null ? sHside != null : !SHSIDE_EDEFAULT.equals(sHside);
case AfplibPackage.PGPRG__PG_FLGS:
return PG_FLGS_EDEFAULT == null ? pgFlgs != null : !PG_FLGS_EDEFAULT.equals(pgFlgs);
case AfplibPackage.PGPRG__PM_CID:
return PM_CID_EDEFAULT == null ? pmCid != null : !PM_CID_EDEFAULT.equals(pmCid);
}
return super.eIsSet(featureID);
} | class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=PGPRG__RG_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=RG_LENGTH_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=rgLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=RG_LENGTH_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=rgLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__XM_OSET, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=XM_OSET_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=xmOset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=XM_OSET_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=xmOset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__YM_OSET, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=YM_OSET_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=ymOset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=YM_OSET_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=ymOset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__PGORIENT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=PGORIENT_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=pGorient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=PGORIENT_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=pGorient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__SHSIDE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=SHSIDE_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=sHside, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=SHSIDE_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=sHside, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__PG_FLGS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=PG_FLGS_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=pgFlgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=PG_FLGS_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=pgFlgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=PGPRG__PM_CID, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=PM_CID_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=pmCid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=PM_CID_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=pmCid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__RG_LENGTH] operator[:] Keyword[return] identifier[RG_LENGTH_EDEFAULT] operator[==] Other[null] operator[?] identifier[rgLength] operator[!=] Other[null] operator[:] operator[!] identifier[RG_LENGTH_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[rgLength] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__XM_OSET] operator[:] Keyword[return] identifier[XM_OSET_EDEFAULT] operator[==] Other[null] operator[?] identifier[xmOset] operator[!=] Other[null] operator[:] operator[!] identifier[XM_OSET_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[xmOset] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__YM_OSET] operator[:] Keyword[return] identifier[YM_OSET_EDEFAULT] operator[==] Other[null] operator[?] identifier[ymOset] operator[!=] Other[null] operator[:] operator[!] identifier[YM_OSET_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[ymOset] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__PGORIENT] operator[:] Keyword[return] identifier[PGORIENT_EDEFAULT] operator[==] Other[null] operator[?] identifier[pGorient] operator[!=] Other[null] operator[:] operator[!] identifier[PGORIENT_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[pGorient] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__SHSIDE] operator[:] Keyword[return] identifier[SHSIDE_EDEFAULT] operator[==] Other[null] operator[?] identifier[sHside] operator[!=] Other[null] operator[:] operator[!] identifier[SHSIDE_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[sHside] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__PG_FLGS] operator[:] Keyword[return] identifier[PG_FLGS_EDEFAULT] operator[==] Other[null] operator[?] identifier[pgFlgs] operator[!=] Other[null] operator[:] operator[!] identifier[PG_FLGS_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[pgFlgs] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PGPRG__PM_CID] operator[:] Keyword[return] identifier[PM_CID_EDEFAULT] operator[==] Other[null] operator[?] identifier[pmCid] operator[!=] Other[null] operator[:] operator[!] identifier[PM_CID_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[pmCid] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public AnnotationHeader processAnnotationHeader(String resourceLocation,
File rawannotation, File annotationHomeFile)
throws IndexingFailure {
AnnotationHeaderParser ahParser = new AnnotationHeaderParser();
AnnotationHeader annotationHeader;
try {
annotationHeader = ahParser.parseAnnotation(resourceLocation,
rawannotation);
characterStopOffset = ahParser.getNextCharacterOffset();
} catch (IOException e) {
throw new IndexingFailure(resourceLocation, e);
} catch (BELDataMissingPropertyException e) {
throw new IndexingFailure(resourceLocation, e);
} catch (BELDataConversionException e) {
throw new IndexingFailure(resourceLocation, e);
} catch (BELDataInvalidPropertyException e) {
throw new IndexingFailure(resourceLocation, e);
}
String output = asPath(annotationHomeFile.getAbsolutePath(),
"annotation.header");
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(
new FileOutputStream(output));
oos.writeObject(annotationHeader);
} catch (IOException e) {
final String msg = "Error writing annotation header.";
throw new IndexingFailure(resourceLocation, msg, e);
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException e) {}
}
}
return annotationHeader;
} | class class_name[name] begin[{]
method[processAnnotationHeader, return_type[type[AnnotationHeader]], modifier[public], parameter[resourceLocation, rawannotation, annotationHomeFile]] begin[{]
local_variable[type[AnnotationHeaderParser], ahParser]
local_variable[type[AnnotationHeader], annotationHeader]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=annotationHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawannotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseAnnotation, postfix_operators=[], prefix_operators=[], qualifier=ahParser, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=characterStopOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNextCharacterOffset, postfix_operators=[], prefix_operators=[], qualifier=ahParser, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingFailure, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingFailure, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BELDataMissingPropertyException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingFailure, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BELDataConversionException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingFailure, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['BELDataInvalidPropertyException']))], finally_block=None, label=None, resources=None)
local_variable[type[String], output]
local_variable[type[ObjectOutputStream], oos]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=oos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=output, 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=FileOutputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectOutputStream, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=annotationHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=oos, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error writing annotation header."), name=msg)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=resourceLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexingFailure, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=oos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=oos, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]))], label=None, resources=None)
return[member[.annotationHeader]]
end[}]
END[}] | Keyword[public] identifier[AnnotationHeader] identifier[processAnnotationHeader] operator[SEP] identifier[String] identifier[resourceLocation] , identifier[File] identifier[rawannotation] , identifier[File] identifier[annotationHomeFile] operator[SEP] Keyword[throws] identifier[IndexingFailure] {
identifier[AnnotationHeaderParser] identifier[ahParser] operator[=] Keyword[new] identifier[AnnotationHeaderParser] operator[SEP] operator[SEP] operator[SEP] identifier[AnnotationHeader] identifier[annotationHeader] operator[SEP] Keyword[try] {
identifier[annotationHeader] operator[=] identifier[ahParser] operator[SEP] identifier[parseAnnotation] operator[SEP] identifier[resourceLocation] , identifier[rawannotation] operator[SEP] operator[SEP] identifier[characterStopOffset] operator[=] identifier[ahParser] operator[SEP] identifier[getNextCharacterOffset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexingFailure] operator[SEP] identifier[resourceLocation] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BELDataMissingPropertyException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexingFailure] operator[SEP] identifier[resourceLocation] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BELDataConversionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexingFailure] operator[SEP] identifier[resourceLocation] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BELDataInvalidPropertyException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexingFailure] operator[SEP] identifier[resourceLocation] , identifier[e] operator[SEP] operator[SEP]
}
identifier[String] identifier[output] operator[=] identifier[asPath] operator[SEP] identifier[annotationHomeFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[oos] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[oos] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[output] operator[SEP] operator[SEP] operator[SEP] identifier[oos] operator[SEP] identifier[writeObject] operator[SEP] identifier[annotationHeader] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[final] identifier[String] identifier[msg] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexingFailure] operator[SEP] identifier[resourceLocation] , identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[oos] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[oos] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
}
}
Keyword[return] identifier[annotationHeader] operator[SEP]
}
|
public static boolean isInstance(Object obj, String interfaceClazzName) {
for (Class<?> clazz = obj.getClass(); clazz != null
&& !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
Class<?>[] interfaces = clazz.getInterfaces();
for (Class<?> itf : interfaces) {
if (itf.getName().equals(interfaceClazzName)) {
return true;
}
}
}
return false;
} | class class_name[name] begin[{]
method[isInstance, return_type[type[boolean]], modifier[public static], parameter[obj, interfaceClazzName]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), name=interfaces)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[None], name=Class, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=itf, selectors=[MethodInvocation(arguments=[MemberReference(member=interfaceClazzName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=interfaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=itf)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=clazz, selectors=[], type_arguments=None), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None), name=clazz)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None))]), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isInstance] operator[SEP] identifier[Object] identifier[obj] , identifier[String] identifier[interfaceClazzName] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[=] identifier[obj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[clazz] operator[!=] Other[null] operator[&&] operator[!] identifier[clazz] operator[SEP] identifier[equals] operator[SEP] identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[clazz] operator[=] identifier[clazz] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[interfaces] operator[=] identifier[clazz] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[itf] operator[:] identifier[interfaces] operator[SEP] {
Keyword[if] operator[SEP] identifier[itf] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[interfaceClazzName] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static List<String[]> extractLines(File dockerFile, String keyword, FixedStringSearchInterpolator interpolator) throws IOException {
List<String[]> ret = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(dockerFile))) {
String line;
while ((line = reader.readLine()) != null) {
String lineInterpolated = interpolator.interpolate(line);
String[] lineParts = lineInterpolated.split("\\s+");
if (lineParts.length > 0 && lineParts[0].equalsIgnoreCase(keyword)) {
ret.add(lineParts);
}
}
}
return ret;
} | class class_name[name] begin[{]
method[extractLines, return_type[type[List]], modifier[public static], parameter[dockerFile, keyword, interpolator]] begin[{]
local_variable[type[List], ret]
TryStatement(block=[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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=interpolate, postfix_operators=[], prefix_operators=[], qualifier=interpolator, selectors=[], type_arguments=None), name=lineInterpolated)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\s+")], member=split, postfix_operators=[], prefix_operators=[], qualifier=lineInterpolated, selectors=[], type_arguments=None), name=lineParts)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lineParts, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MemberReference(member=lineParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[MemberReference(member=keyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=lineParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, 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=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=dockerFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[SEP] operator[SEP] operator[>] identifier[extractLines] operator[SEP] identifier[File] identifier[dockerFile] , identifier[String] identifier[keyword] , identifier[FixedStringSearchInterpolator] identifier[interpolator] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[List] operator[<] identifier[String] operator[SEP] operator[SEP] operator[>] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[FileReader] operator[SEP] identifier[dockerFile] 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[String] identifier[lineInterpolated] operator[=] identifier[interpolator] operator[SEP] identifier[interpolate] operator[SEP] identifier[line] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[lineParts] operator[=] identifier[lineInterpolated] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lineParts] operator[SEP] identifier[length] operator[>] Other[0] operator[&&] identifier[lineParts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[keyword] operator[SEP] operator[SEP] {
identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[lineParts] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
@Override
@DoesServiceRequest
public int read(final byte[] b, final int off, final int len) throws IOException {
if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
}
return this.readInternal(b, off, len);
} | class class_name[name] begin[{]
method[read, return_type[type[int]], modifier[public], parameter[b, off, len]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.off], <, literal[0]], ||, binary_operation[member[.len], <, literal[0]]], ||, binary_operation[member[.len], >, binary_operation[member[b.length], -, member[.off]]]]] 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=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[THIS[call[None.readInternal, parameter[member[.b], member[.off], member[.len]]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[DoesServiceRequest] Keyword[public] Keyword[int] identifier[read] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[b] , Keyword[final] Keyword[int] identifier[off] , Keyword[final] Keyword[int] identifier[len] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[off] operator[<] Other[0] operator[||] identifier[len] operator[<] Other[0] operator[||] identifier[len] operator[>] identifier[b] operator[SEP] identifier[length] operator[-] identifier[off] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[readInternal] operator[SEP] identifier[b] , identifier[off] , identifier[len] operator[SEP] operator[SEP]
}
|
@Sensitive
public Map<String, Object> getAccessToken(HttpServletRequest request, HttpServletResponse response, SocialLoginConfig config) {
TwitterEndpointServices twitter = getTwitterEndpointServices();
twitter.setConsumerKey(config.getClientId());
twitter.setConsumerSecret(config.getClientSecret());
Map<String, String[]> params = request.getParameterMap();
if (isMissingParameter(params, TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN)) {
return null;
}
// oauth_token provided in request MUST match the request token obtained earlier
String token = request.getParameter(TwitterConstants.PARAM_OAUTH_TOKEN);
String cachedRequestToken = webUtils.getAndClearCookie(request, response, TwitterConstants.COOKIE_NAME_REQUEST_TOKEN);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Obtained token from request: [" + token + "], matching against: [" + cachedRequestToken + "]");
}
if (!token.equals(cachedRequestToken)) {
Tr.error(tc, "TWITTER_TOKEN_DOES_NOT_MATCH");
return null;
}
String oauthVerifier = request.getParameter(TwitterConstants.PARAM_OAUTH_VERIFIER);
Map<String, Object> result = twitter.obtainAccessToken(config, cachedRequestToken, oauthVerifier);
if (result == null || result.isEmpty()) {
Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN });
return null;
}
if (!isSuccessfulResult(result, TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN)) {
return null;
}
// If result was successful, the result has already been verified to contain a non-empty access_token and access_token_secret
return result;
} | class class_name[name] begin[{]
method[getAccessToken, return_type[type[Map]], modifier[public], parameter[request, response, config]] begin[{]
local_variable[type[TwitterEndpointServices], twitter]
call[twitter.setConsumerKey, parameter[call[config.getClientId, parameter[]]]]
call[twitter.setConsumerSecret, parameter[call[config.getClientSecret, parameter[]]]]
local_variable[type[Map], params]
if[call[.isMissingParameter, parameter[member[.params], member[TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], token]
local_variable[type[String], cachedRequestToken]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[literal["Obtained token from request: ["], +, member[.token]], +, literal["], matching against: ["]], +, member[.cachedRequestToken]], +, literal["]"]]]]
else begin[{]
None
end[}]
if[call[token.equals, parameter[member[.cachedRequestToken]]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["TWITTER_TOKEN_DOES_NOT_MATCH"]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], oauthVerifier]
local_variable[type[Map], result]
if[binary_operation[binary_operation[member[.result], ==, literal[null]], ||, call[result.isEmpty, parameter[]]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=TWITTER_ENDPOINT_ACCESS_TOKEN, postfix_operators=[], prefix_operators=[], qualifier=TwitterConstants, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
return[literal[null]]
else begin[{]
None
end[}]
if[call[.isSuccessfulResult, parameter[member[.result], member[TwitterConstants.TWITTER_ENDPOINT_ACCESS_TOKEN]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Sensitive] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getAccessToken] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] , identifier[SocialLoginConfig] identifier[config] operator[SEP] {
identifier[TwitterEndpointServices] identifier[twitter] operator[=] identifier[getTwitterEndpointServices] operator[SEP] operator[SEP] operator[SEP] identifier[twitter] operator[SEP] identifier[setConsumerKey] operator[SEP] identifier[config] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[twitter] operator[SEP] identifier[setConsumerSecret] operator[SEP] identifier[config] operator[SEP] identifier[getClientSecret] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[params] operator[=] identifier[request] operator[SEP] identifier[getParameterMap] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isMissingParameter] operator[SEP] identifier[params] , identifier[TwitterConstants] operator[SEP] identifier[TWITTER_ENDPOINT_ACCESS_TOKEN] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[token] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[PARAM_OAUTH_TOKEN] operator[SEP] operator[SEP] identifier[String] identifier[cachedRequestToken] operator[=] identifier[webUtils] operator[SEP] identifier[getAndClearCookie] operator[SEP] identifier[request] , identifier[response] , identifier[TwitterConstants] operator[SEP] identifier[COOKIE_NAME_REQUEST_TOKEN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[token] operator[+] literal[String] operator[+] identifier[cachedRequestToken] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[token] operator[SEP] identifier[equals] operator[SEP] identifier[cachedRequestToken] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[oauthVerifier] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[PARAM_OAUTH_VERIFIER] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[result] operator[=] identifier[twitter] operator[SEP] identifier[obtainAccessToken] operator[SEP] identifier[config] , identifier[cachedRequestToken] , identifier[oauthVerifier] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[||] identifier[result] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[TwitterConstants] operator[SEP] identifier[TWITTER_ENDPOINT_ACCESS_TOKEN]
} operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[isSuccessfulResult] operator[SEP] identifier[result] , identifier[TwitterConstants] operator[SEP] identifier[TWITTER_ENDPOINT_ACCESS_TOKEN] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {
Collection<Import> imports = instance.getImports().get( componentOrFacetName );
if(imports == null) {
imports = new LinkedHashSet<Import> ();
instance.getImports().put( componentOrFacetName, imports );
}
if( ! imports.contains( imp ))
imports.add( imp );
} | class class_name[name] begin[{]
method[addImport, return_type[void], modifier[public static], parameter[instance, componentOrFacetName, imp]] begin[{]
local_variable[type[Collection], imports]
if[binary_operation[member[.imports], ==, literal[null]]] begin[{]
assign[member[.imports], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Import, sub_type=None))], dimensions=None, name=LinkedHashSet, sub_type=None))]
call[instance.getImports, parameter[]]
else begin[{]
None
end[}]
if[call[imports.contains, parameter[member[.imp]]]] begin[{]
call[imports.add, parameter[member[.imp]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addImport] operator[SEP] identifier[Instance] identifier[instance] , identifier[String] identifier[componentOrFacetName] , identifier[Import] identifier[imp] operator[SEP] {
identifier[Collection] operator[<] identifier[Import] operator[>] identifier[imports] operator[=] identifier[instance] operator[SEP] identifier[getImports] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[componentOrFacetName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[imports] operator[==] Other[null] operator[SEP] {
identifier[imports] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[Import] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[instance] operator[SEP] identifier[getImports] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[componentOrFacetName] , identifier[imports] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[imports] operator[SEP] identifier[contains] operator[SEP] identifier[imp] operator[SEP] operator[SEP] identifier[imports] operator[SEP] identifier[add] operator[SEP] identifier[imp] operator[SEP] operator[SEP]
}
|
public static void sendPong(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(pooledData, WebSocketFrameType.PONG, wsChannel, callback, null, -1);
} | class class_name[name] begin[{]
method[sendPong, return_type[void], modifier[public static], parameter[pooledData, wsChannel, callback]] begin[{]
call[.sendInternal, parameter[member[.pooledData], member[WebSocketFrameType.PONG], member[.wsChannel], member[.callback], literal[null], literal[1]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[sendPong] operator[SEP] Keyword[final] identifier[PooledByteBuffer] identifier[pooledData] , Keyword[final] identifier[WebSocketChannel] identifier[wsChannel] , Keyword[final] identifier[WebSocketCallback] operator[<] identifier[Void] operator[>] identifier[callback] operator[SEP] {
identifier[sendInternal] operator[SEP] identifier[pooledData] , identifier[WebSocketFrameType] operator[SEP] identifier[PONG] , identifier[wsChannel] , identifier[callback] , Other[null] , operator[-] Other[1] operator[SEP] operator[SEP]
}
|
@Override
public void close() {
if (!isClosed()) {
closed = true;
// With the current code we don't expect readableBytes > 0 to be possible here, added
// defensively to prevent buffer leak issues if the framer code changes later.
if (buffer != null && buffer.readableBytes() == 0) {
releaseBuffer();
}
commitToSink(true, true);
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isClosed, parameter[]]] begin[{]
assign[member[.closed], literal[true]]
if[binary_operation[binary_operation[member[.buffer], !=, literal[null]], &&, binary_operation[call[buffer.readableBytes, parameter[]], ==, literal[0]]]] begin[{]
call[.releaseBuffer, parameter[]]
else begin[{]
None
end[}]
call[.commitToSink, parameter[literal[true], literal[true]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[closed] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[buffer] operator[!=] Other[null] operator[&&] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[releaseBuffer] operator[SEP] operator[SEP] operator[SEP]
}
identifier[commitToSink] operator[SEP] literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
boolean setToken(char token[], byte tokenstring[])
{
if (token != null && tokenstring != null && token.length > 0 &&
tokenstring.length > 0) {
m_tokentable_ = token;
m_tokenstring_ = tokenstring;
return true;
}
return false;
} | class class_name[name] begin[{]
method[setToken, return_type[type[boolean]], modifier[default], parameter[token, tokenstring]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.token], !=, literal[null]], &&, binary_operation[member[.tokenstring], !=, literal[null]]], &&, binary_operation[member[token.length], >, literal[0]]], &&, binary_operation[member[tokenstring.length], >, literal[0]]]] begin[{]
assign[member[.m_tokentable_], member[.token]]
assign[member[.m_tokenstring_], member[.tokenstring]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[boolean] identifier[setToken] operator[SEP] Keyword[char] identifier[token] operator[SEP] operator[SEP] , Keyword[byte] identifier[tokenstring] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[token] operator[!=] Other[null] operator[&&] identifier[tokenstring] operator[!=] Other[null] operator[&&] identifier[token] operator[SEP] identifier[length] operator[>] Other[0] operator[&&] identifier[tokenstring] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[m_tokentable_] operator[=] identifier[token] operator[SEP] identifier[m_tokenstring_] operator[=] identifier[tokenstring] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, String reportFile)
throws ReportDownloadResponseException, ReportException, IOException {
// Create selector.
Selector selector = new Selector();
selector.getFields().addAll(Arrays.asList("CampaignId",
"AdGroupId",
"Id",
"CriteriaType",
"Criteria",
"FinalUrls",
"Impressions",
"Clicks",
"Cost"));
// Create report definition.
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("Criteria performance report #" + System.currentTimeMillis());
reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.YESTERDAY);
reportDefinition.setReportType(ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT);
reportDefinition.setDownloadFormat(DownloadFormat.CSV);
// Optional: Set the reporting configuration of the session to suppress header, column name, or
// summary rows in the report output. You can also configure this via your ads.properties
// configuration file. See AdWordsSession.Builder.from(Configuration) for details.
// In addition, you can set whether you want to explicitly include or exclude zero impression
// rows.
ReportingConfiguration reportingConfiguration =
new ReportingConfiguration.Builder()
.skipReportHeader(false)
.skipColumnHeader(false)
.skipReportSummary(false)
// Enable to allow rows with zero impressions to show.
.includeZeroImpressions(false)
.build();
session.setReportingConfiguration(reportingConfiguration);
reportDefinition.setSelector(selector);
ReportDownloaderInterface reportDownloader =
adWordsServices.getUtility(session, ReportDownloaderInterface.class);
// Set the property api.adwords.reportDownloadTimeout or call
// ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
// for CONNECT and READ in report downloads.
ReportDownloadResponse response = reportDownloader.downloadReport(reportDefinition);
response.saveToFile(reportFile);
System.out.printf("Report successfully downloaded to: %s%n", reportFile);
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adWordsServices, session, reportFile]] begin[{]
local_variable[type[Selector], selector]
call[selector.getFields, parameter[]]
local_variable[type[ReportDefinition], reportDefinition]
call[reportDefinition.setReportName, parameter[binary_operation[literal["Criteria performance report #"], +, call[System.currentTimeMillis, parameter[]]]]]
call[reportDefinition.setDateRangeType, parameter[member[ReportDefinitionDateRangeType.YESTERDAY]]]
call[reportDefinition.setReportType, parameter[member[ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT]]]
call[reportDefinition.setDownloadFormat, parameter[member[DownloadFormat.CSV]]]
local_variable[type[ReportingConfiguration], reportingConfiguration]
call[session.setReportingConfiguration, parameter[member[.reportingConfiguration]]]
call[reportDefinition.setSelector, parameter[member[.selector]]]
local_variable[type[ReportDownloaderInterface], reportDownloader]
local_variable[type[ReportDownloadResponse], response]
call[response.saveToFile, parameter[member[.reportFile]]]
call[System.out.printf, parameter[literal["Report successfully downloaded to: %s%n"], member[.reportFile]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] , identifier[String] identifier[reportFile] operator[SEP] Keyword[throws] identifier[ReportDownloadResponseException] , identifier[ReportException] , identifier[IOException] {
identifier[Selector] identifier[selector] operator[=] Keyword[new] identifier[Selector] operator[SEP] operator[SEP] operator[SEP] identifier[selector] operator[SEP] identifier[getFields] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[ReportDefinition] identifier[reportDefinition] operator[=] Keyword[new] identifier[ReportDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[reportDefinition] operator[SEP] identifier[setReportName] operator[SEP] literal[String] operator[+] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[reportDefinition] operator[SEP] identifier[setDateRangeType] operator[SEP] identifier[ReportDefinitionDateRangeType] operator[SEP] identifier[YESTERDAY] operator[SEP] operator[SEP] identifier[reportDefinition] operator[SEP] identifier[setReportType] operator[SEP] identifier[ReportDefinitionReportType] operator[SEP] identifier[CRITERIA_PERFORMANCE_REPORT] operator[SEP] operator[SEP] identifier[reportDefinition] operator[SEP] identifier[setDownloadFormat] operator[SEP] identifier[DownloadFormat] operator[SEP] identifier[CSV] operator[SEP] operator[SEP] identifier[ReportingConfiguration] identifier[reportingConfiguration] operator[=] Keyword[new] identifier[ReportingConfiguration] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[skipReportHeader] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[skipColumnHeader] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[skipReportSummary] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[includeZeroImpressions] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[setReportingConfiguration] operator[SEP] identifier[reportingConfiguration] operator[SEP] operator[SEP] identifier[reportDefinition] operator[SEP] identifier[setSelector] operator[SEP] identifier[selector] operator[SEP] operator[SEP] identifier[ReportDownloaderInterface] identifier[reportDownloader] operator[=] identifier[adWordsServices] operator[SEP] identifier[getUtility] operator[SEP] identifier[session] , identifier[ReportDownloaderInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[ReportDownloadResponse] identifier[response] operator[=] identifier[reportDownloader] operator[SEP] identifier[downloadReport] operator[SEP] identifier[reportDefinition] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[saveToFile] operator[SEP] identifier[reportFile] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[reportFile] operator[SEP] operator[SEP]
}
|
public int[] findBestUsingSampling(SequenceModel model, int numSamples, int sampleInterval, int[] initialSequence) {
List samples = collectSamples(model, numSamples, sampleInterval, initialSequence);
int[] best = null;
double bestScore = Double.NEGATIVE_INFINITY;
for (int i = 0; i < samples.size(); i++) {
int[] sequence = (int[]) samples.get(i);
double score = model.scoreOf(sequence);
if (score>bestScore) {
best = sequence;
bestScore = score;
System.err.println("found new best ("+bestScore+")");
System.err.println(ArrayMath.toString(best));
}
}
return best;
} | class class_name[name] begin[{]
method[findBestUsingSampling, return_type[type[int]], modifier[public], parameter[model, numSamples, sampleInterval, initialSequence]] begin[{]
local_variable[type[List], samples]
local_variable[type[int], best]
local_variable[type[double], bestScore]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=samples, selectors=[], type_arguments=None), type=BasicType(dimensions=[None], name=int)), name=sequence)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=sequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scoreOf, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), name=score)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=score, 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=best, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=sequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=score, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="found new best ("), operandr=MemberReference(member=bestScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=best, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=ArrayMath, selectors=[], type_arguments=None)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, 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=samples, 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[}] | Keyword[public] Keyword[int] operator[SEP] operator[SEP] identifier[findBestUsingSampling] operator[SEP] identifier[SequenceModel] identifier[model] , Keyword[int] identifier[numSamples] , Keyword[int] identifier[sampleInterval] , Keyword[int] operator[SEP] operator[SEP] identifier[initialSequence] operator[SEP] {
identifier[List] identifier[samples] operator[=] identifier[collectSamples] operator[SEP] identifier[model] , identifier[numSamples] , identifier[sampleInterval] , identifier[initialSequence] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[best] operator[=] Other[null] operator[SEP] Keyword[double] identifier[bestScore] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[samples] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[sequence] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[samples] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[double] identifier[score] operator[=] identifier[model] operator[SEP] identifier[scoreOf] operator[SEP] identifier[sequence] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[score] operator[>] identifier[bestScore] operator[SEP] {
identifier[best] operator[=] identifier[sequence] operator[SEP] identifier[bestScore] operator[=] identifier[score] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[bestScore] operator[+] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[ArrayMath] operator[SEP] identifier[toString] operator[SEP] identifier[best] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[best] operator[SEP]
}
|
public V put(K key, V value) {
reverseMap.put(value, key);
return originalMap.put(key, value);
} | class class_name[name] begin[{]
method[put, return_type[type[V]], modifier[public], parameter[key, value]] begin[{]
call[reverseMap.put, parameter[member[.value], member[.key]]]
return[call[originalMap.put, parameter[member[.key], member[.value]]]]
end[}]
END[}] | Keyword[public] identifier[V] identifier[put] operator[SEP] identifier[K] identifier[key] , identifier[V] identifier[value] operator[SEP] {
identifier[reverseMap] operator[SEP] identifier[put] operator[SEP] identifier[value] , identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[originalMap] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
@Nonnull
private EMarkToken _getToken (final String sIn, final int nPos)
{
final char c0 = nPos > 0 ? _whitespaceToSpace (sIn.charAt (nPos - 1)) : ' ';
final char c = _whitespaceToSpace (sIn.charAt (nPos));
final char c1 = nPos + 1 < sIn.length () ? _whitespaceToSpace (sIn.charAt (nPos + 1)) : ' ';
final char c2 = nPos + 2 < sIn.length () ? _whitespaceToSpace (sIn.charAt (nPos + 2)) : ' ';
final char c3 = nPos + 3 < sIn.length () ? _whitespaceToSpace (sIn.charAt (nPos + 3)) : ' ';
switch (c)
{
case '*':
if (c1 == '*')
{
return c0 != ' ' || c2 != ' ' ? EMarkToken.STRONG_STAR : EMarkToken.EM_STAR;
}
return c0 != ' ' || c1 != ' ' ? EMarkToken.EM_STAR : EMarkToken.NONE;
case '_':
if (c1 == '_')
{
return c0 != ' ' || c2 != ' ' ? EMarkToken.STRONG_UNDERSCORE : EMarkToken.EM_UNDERSCORE;
}
if (m_bUseExtensions)
{
return Character.isLetterOrDigit (c0) &&
c0 != '_' &&
Character.isLetterOrDigit (c1) ? EMarkToken.NONE : EMarkToken.EM_UNDERSCORE;
}
return c0 != ' ' || c1 != ' ' ? EMarkToken.EM_UNDERSCORE : EMarkToken.NONE;
case '~':
if (m_bUseExtensions && c1 == '~')
{
return EMarkToken.STRIKE;
}
return EMarkToken.NONE;
case '!':
if (c1 == '[')
return EMarkToken.IMAGE;
return EMarkToken.NONE;
case '[':
if (m_bUseExtensions && c1 == '[')
return EMarkToken.X_LINK_OPEN;
return EMarkToken.LINK;
case ']':
if (m_bUseExtensions && c1 == ']')
return EMarkToken.X_LINK_CLOSE;
return EMarkToken.NONE;
case '`':
return c1 == '`' ? EMarkToken.CODE_DOUBLE : EMarkToken.CODE_SINGLE;
case '\\':
if (MarkdownHelper.isEscapeChar (c1))
return EMarkToken.ESCAPE;
return EMarkToken.NONE;
case '<':
if (m_bUseExtensions && c1 == '<')
return EMarkToken.X_LAQUO;
return EMarkToken.HTML;
case '&':
return EMarkToken.ENTITY;
default:
if (m_bUseExtensions)
{
switch (c)
{
case '-':
if (c1 == '-')
return c2 == '-' ? EMarkToken.X_MDASH : EMarkToken.X_NDASH;
break;
case '^':
return c0 == '^' || c1 == '^' ? EMarkToken.NONE : EMarkToken.SUPER;
case '>':
if (c1 == '>')
return EMarkToken.X_RAQUO;
break;
case '.':
if (c1 == '.' && c2 == '.')
return EMarkToken.X_HELLIP;
break;
case '(':
if (c1 == 'C' && c2 == ')')
return EMarkToken.X_COPY;
if (c1 == 'R' && c2 == ')')
return EMarkToken.X_REG;
if (c1 == 'T' & c2 == 'M' & c3 == ')')
return EMarkToken.X_TRADE;
break;
case '"':
if (!Character.isLetterOrDigit (c0) && c1 != ' ')
return EMarkToken.X_LDQUO;
if (c0 != ' ' && !Character.isLetterOrDigit (c1))
return EMarkToken.X_RDQUO;
break;
}
}
return EMarkToken.NONE;
}
} | class class_name[name] begin[{]
method[_getToken, return_type[type[EMarkToken]], modifier[private], parameter[sIn, nPos]] begin[{]
local_variable[type[char], c0]
local_variable[type[char], c]
local_variable[type[char], c1]
local_variable[type[char], c2]
local_variable[type[char], c3]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c1, 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=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=c2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=||), if_false=MemberReference(member=EM_STAR, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=STRONG_STAR, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)])), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=||), if_false=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=EM_STAR, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='_')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c1, 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=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=c2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=||), if_false=MemberReference(member=EM_UNDERSCORE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=STRONG_UNDERSCORE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)])), IfStatement(condition=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='_'), operator=!=), operator=&&), operandr=MethodInvocation(arguments=[MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operator=&&), if_false=MemberReference(member=EM_UNDERSCORE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)])), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=||), if_false=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=EM_UNDERSCORE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='~')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=c1, 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=[ReturnStatement(expression=MemberReference(member=STRIKE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)])), ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='!')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='['), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=IMAGE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='[')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=c1, 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=ReturnStatement(expression=MemberReference(member=X_LINK_OPEN, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), ReturnStatement(expression=MemberReference(member=LINK, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=c1, 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=ReturnStatement(expression=MemberReference(member=X_LINK_CLOSE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='`')], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='`'), operator===), if_false=MemberReference(member=CODE_SINGLE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=CODE_DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEscapeChar, postfix_operators=[], prefix_operators=[], qualifier=MarkdownHelper, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=ESCAPE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=c1, 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=ReturnStatement(expression=MemberReference(member=X_LAQUO, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), ReturnStatement(expression=MemberReference(member=HTML, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='&')], statements=[ReturnStatement(expression=MemberReference(member=ENTITY, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=MemberReference(member=m_bUseExtensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=c2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), if_false=MemberReference(member=X_NDASH, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=X_MDASH, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='^')], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='^'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='^'), operator===), operator=||), if_false=MemberReference(member=SUPER, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), if_true=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[])), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>'), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=X_RAQUO, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c2, 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=ReturnStatement(expression=MemberReference(member=X_HELLIP, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='(')], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='C'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c2, 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=ReturnStatement(expression=MemberReference(member=X_COPY, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='R'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c2, 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=ReturnStatement(expression=MemberReference(member=X_REG, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='T'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='M'), operator===), operator=&), operandr=BinaryOperation(operandl=MemberReference(member=c3, 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=ReturnStatement(expression=MemberReference(member=X_TRADE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=['!'], qualifier=Character, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=c1, 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=ReturnStatement(expression=MemberReference(member=X_LDQUO, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=c1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=['!'], qualifier=Character, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=X_RDQUO, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=EMarkToken, selectors=[]), label=None)])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[private] identifier[EMarkToken] identifier[_getToken] operator[SEP] Keyword[final] identifier[String] identifier[sIn] , Keyword[final] Keyword[int] identifier[nPos] operator[SEP] {
Keyword[final] Keyword[char] identifier[c0] operator[=] identifier[nPos] operator[>] Other[0] operator[?] identifier[_whitespaceToSpace] operator[SEP] identifier[sIn] operator[SEP] identifier[charAt] operator[SEP] identifier[nPos] operator[-] Other[1] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[final] Keyword[char] identifier[c] operator[=] identifier[_whitespaceToSpace] operator[SEP] identifier[sIn] operator[SEP] identifier[charAt] operator[SEP] identifier[nPos] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[char] identifier[c1] operator[=] identifier[nPos] operator[+] Other[1] operator[<] identifier[sIn] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[?] identifier[_whitespaceToSpace] operator[SEP] identifier[sIn] operator[SEP] identifier[charAt] operator[SEP] identifier[nPos] operator[+] Other[1] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[final] Keyword[char] identifier[c2] operator[=] identifier[nPos] operator[+] Other[2] operator[<] identifier[sIn] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[?] identifier[_whitespaceToSpace] operator[SEP] identifier[sIn] operator[SEP] identifier[charAt] operator[SEP] identifier[nPos] operator[+] Other[2] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[final] Keyword[char] identifier[c3] operator[=] identifier[nPos] operator[+] Other[3] operator[<] identifier[sIn] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[?] identifier[_whitespaceToSpace] operator[SEP] identifier[sIn] operator[SEP] identifier[charAt] operator[SEP] identifier[nPos] operator[+] Other[3] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[SEP] {
Keyword[return] identifier[c0] operator[!=] literal[String] operator[||] identifier[c2] operator[!=] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[STRONG_STAR] operator[:] identifier[EMarkToken] operator[SEP] identifier[EM_STAR] operator[SEP]
}
Keyword[return] identifier[c0] operator[!=] literal[String] operator[||] identifier[c1] operator[!=] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[EM_STAR] operator[:] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[SEP] {
Keyword[return] identifier[c0] operator[!=] literal[String] operator[||] identifier[c2] operator[!=] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[STRONG_UNDERSCORE] operator[:] identifier[EMarkToken] operator[SEP] identifier[EM_UNDERSCORE] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[SEP] {
Keyword[return] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[c0] operator[SEP] operator[&&] identifier[c0] operator[!=] literal[String] operator[&&] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[c1] operator[SEP] operator[?] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[:] identifier[EMarkToken] operator[SEP] identifier[EM_UNDERSCORE] operator[SEP]
}
Keyword[return] identifier[c0] operator[!=] literal[String] operator[||] identifier[c1] operator[!=] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[EM_UNDERSCORE] operator[:] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[&&] identifier[c1] operator[==] literal[String] operator[SEP] {
Keyword[return] identifier[EMarkToken] operator[SEP] identifier[STRIKE] operator[SEP]
}
Keyword[return] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[IMAGE] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[&&] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_LINK_OPEN] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[LINK] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[&&] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_LINK_CLOSE] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[c1] operator[==] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[CODE_DOUBLE] operator[:] identifier[EMarkToken] operator[SEP] identifier[CODE_SINGLE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[MarkdownHelper] operator[SEP] identifier[isEscapeChar] operator[SEP] identifier[c1] operator[SEP] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[ESCAPE] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[&&] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_LAQUO] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[HTML] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[ENTITY] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[m_bUseExtensions] operator[SEP] {
Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[c2] operator[==] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[X_MDASH] operator[:] identifier[EMarkToken] operator[SEP] identifier[X_NDASH] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[return] identifier[c0] operator[==] literal[String] operator[||] identifier[c1] operator[==] literal[String] operator[?] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[:] identifier[EMarkToken] operator[SEP] identifier[SUPER] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_RAQUO] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[&&] identifier[c2] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_HELLIP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[&&] identifier[c2] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_COPY] operator[SEP] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[&&] identifier[c2] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_REG] operator[SEP] Keyword[if] operator[SEP] identifier[c1] operator[==] literal[String] operator[&] identifier[c2] operator[==] literal[String] operator[&] identifier[c3] operator[==] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_TRADE] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[c0] operator[SEP] operator[&&] identifier[c1] operator[!=] literal[String] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_LDQUO] operator[SEP] Keyword[if] operator[SEP] identifier[c0] operator[!=] literal[String] operator[&&] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[c1] operator[SEP] operator[SEP] Keyword[return] identifier[EMarkToken] operator[SEP] identifier[X_RDQUO] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP]
}
}
|
public boolean editInlineCaption(String inlineMessageId, String caption, InlineReplyMarkup inlineReplyMarkup) {
if(caption != null && inlineReplyMarkup != null) {
JSONObject jsonResponse = this.editMessageCaption(null, null, inlineMessageId, caption, inlineReplyMarkup);
if(jsonResponse != null) {
if(jsonResponse.getBoolean("result")) return true;
}
}
return false;
} | class class_name[name] begin[{]
method[editInlineCaption, return_type[type[boolean]], modifier[public], parameter[inlineMessageId, caption, inlineReplyMarkup]] begin[{]
if[binary_operation[binary_operation[member[.caption], !=, literal[null]], &&, binary_operation[member[.inlineReplyMarkup], !=, literal[null]]]] begin[{]
local_variable[type[JSONObject], jsonResponse]
if[binary_operation[member[.jsonResponse], !=, literal[null]]] begin[{]
if[call[jsonResponse.getBoolean, parameter[literal["result"]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[editInlineCaption] operator[SEP] identifier[String] identifier[inlineMessageId] , identifier[String] identifier[caption] , identifier[InlineReplyMarkup] identifier[inlineReplyMarkup] operator[SEP] {
Keyword[if] operator[SEP] identifier[caption] operator[!=] Other[null] operator[&&] identifier[inlineReplyMarkup] operator[!=] Other[null] operator[SEP] {
identifier[JSONObject] identifier[jsonResponse] operator[=] Keyword[this] operator[SEP] identifier[editMessageCaption] operator[SEP] Other[null] , Other[null] , identifier[inlineMessageId] , identifier[caption] , identifier[inlineReplyMarkup] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonResponse] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[getBoolean] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static void decryptAsync(String encrypted, String password, RNCryptorNativeCallback RNCryptorNativeCallback) {
String decrypted;
try {
decrypted = new RNCryptorNative().decrypt(encrypted, password);
RNCryptorNativeCallback.done(decrypted, null);
} catch (Exception e) {
RNCryptorNativeCallback.done(null, e);
}
} | class class_name[name] begin[{]
method[decryptAsync, return_type[void], modifier[public static], parameter[encrypted, password, RNCryptorNativeCallback]] begin[{]
local_variable[type[String], decrypted]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=decrypted, 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=[MemberReference(member=encrypted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decrypt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=RNCryptorNative, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=decrypted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=done, postfix_operators=[], prefix_operators=[], qualifier=RNCryptorNativeCallback, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=done, postfix_operators=[], prefix_operators=[], qualifier=RNCryptorNativeCallback, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[decryptAsync] operator[SEP] identifier[String] identifier[encrypted] , identifier[String] identifier[password] , identifier[RNCryptorNativeCallback] identifier[RNCryptorNativeCallback] operator[SEP] {
identifier[String] identifier[decrypted] operator[SEP] Keyword[try] {
identifier[decrypted] operator[=] Keyword[new] identifier[RNCryptorNative] operator[SEP] operator[SEP] operator[SEP] identifier[decrypt] operator[SEP] identifier[encrypted] , identifier[password] operator[SEP] operator[SEP] identifier[RNCryptorNativeCallback] operator[SEP] identifier[done] operator[SEP] identifier[decrypted] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[RNCryptorNativeCallback] operator[SEP] identifier[done] operator[SEP] Other[null] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String toHexString(byte[] b) {
StringBuilder sb = new StringBuilder(b.length * 2);
for (byte aByte : b) {
// look up high nibble char
sb.append(hexChar[(aByte & 0xf0) >>> 4]);
// look up low nibble char
sb.append(hexChar[aByte & 0x0f]);
}
return sb.toString();
} | class class_name[name] begin[{]
method[toHexString, return_type[type[String]], modifier[public static], parameter[b]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hexChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=aByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xf0), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=>>>))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hexChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=aByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0f), operator=&))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=aByte)], modifiers=set(), type=BasicType(dimensions=[], name=byte))), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toHexString] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[b] operator[SEP] identifier[length] operator[*] Other[2] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[byte] identifier[aByte] operator[:] identifier[b] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[hexChar] operator[SEP] operator[SEP] identifier[aByte] operator[&] literal[Integer] operator[SEP] operator[>] operator[>] operator[>] Other[4] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[hexChar] operator[SEP] identifier[aByte] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void post(String path, boolean crumbFlag) throws IOException {
post(path, null, null,null, crumbFlag);
} | class class_name[name] begin[{]
method[post, return_type[void], modifier[public], parameter[path, crumbFlag]] begin[{]
call[.post, parameter[member[.path], literal[null], literal[null], literal[null], member[.crumbFlag]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[post] operator[SEP] identifier[String] identifier[path] , Keyword[boolean] identifier[crumbFlag] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[post] operator[SEP] identifier[path] , Other[null] , Other[null] , Other[null] , identifier[crumbFlag] operator[SEP] operator[SEP]
}
|
private static <K, V> SortedMap<K, V> filterFiltered(
FilteredEntrySortedMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) {
Predicate<Entry<K, V>> predicate = Predicates.<Entry<K, V>>and(map.predicate, entryPredicate);
return new FilteredEntrySortedMap<K, V>(map.sortedMap(), predicate);
} | class class_name[name] begin[{]
method[filterFiltered, return_type[type[SortedMap]], modifier[private static], parameter[map, entryPredicate]] begin[{]
local_variable[type[Predicate], predicate]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=sortedMap, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), MemberReference(member=predicate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=FilteredEntrySortedMap, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[SortedMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[filterFiltered] operator[SEP] identifier[FilteredEntrySortedMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[map] , identifier[Predicate] operator[<] operator[?] Keyword[super] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[entryPredicate] operator[SEP] {
identifier[Predicate] operator[<] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[predicate] operator[=] identifier[Predicates] operator[SEP] operator[<] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[and] operator[SEP] identifier[map] operator[SEP] identifier[predicate] , identifier[entryPredicate] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[FilteredEntrySortedMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[map] operator[SEP] identifier[sortedMap] operator[SEP] operator[SEP] , identifier[predicate] operator[SEP] operator[SEP]
}
|
public static String join(Collection<?> collection, String separator)
{
return StringUtils.join(collection, separator);
} | class class_name[name] begin[{]
method[join, return_type[type[String]], modifier[public static], parameter[collection, separator]] begin[{]
return[call[StringUtils.join, parameter[member[.collection], member[.separator]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[join] operator[SEP] identifier[Collection] operator[<] operator[?] operator[>] identifier[collection] , identifier[String] identifier[separator] operator[SEP] {
Keyword[return] identifier[StringUtils] operator[SEP] identifier[join] operator[SEP] identifier[collection] , identifier[separator] operator[SEP] operator[SEP]
}
|
public static Object getObjectFromBytes(byte[] objBytes) throws Exception {
if (objBytes == null || objBytes.length == 0) {
return null;
}
ByteArrayInputStream bi = new ByteArrayInputStream(objBytes);
ObjectInputStream oi = new ObjectInputStream(bi);
return oi.readObject();
} | class class_name[name] begin[{]
method[getObjectFromBytes, return_type[type[Object]], modifier[public static], parameter[objBytes]] begin[{]
if[binary_operation[binary_operation[member[.objBytes], ==, literal[null]], ||, binary_operation[member[objBytes.length], ==, literal[0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ByteArrayInputStream], bi]
local_variable[type[ObjectInputStream], oi]
return[call[oi.readObject, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[getObjectFromBytes] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[objBytes] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[objBytes] operator[==] Other[null] operator[||] identifier[objBytes] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[ByteArrayInputStream] identifier[bi] operator[=] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[objBytes] operator[SEP] operator[SEP] identifier[ObjectInputStream] identifier[oi] operator[=] Keyword[new] identifier[ObjectInputStream] operator[SEP] identifier[bi] operator[SEP] operator[SEP] Keyword[return] identifier[oi] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP]
}
|
public com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadataOrBuilder
getTextEntityExtractionDetailsOrBuilder() {
if (detailsCase_ == 13) {
return (com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata)
details_;
}
return com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata
.getDefaultInstance();
} | class class_name[name] begin[{]
method[getTextEntityExtractionDetailsOrBuilder, return_type[type[com]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.detailsCase_], ==, literal[13]]] begin[{]
return[Cast(expression=MemberReference(member=details_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=google, sub_type=ReferenceType(arguments=None, dimensions=None, name=cloud, sub_type=ReferenceType(arguments=None, dimensions=None, name=datalabeling, sub_type=ReferenceType(arguments=None, dimensions=None, name=v1beta1, sub_type=ReferenceType(arguments=None, dimensions=None, name=LabelTextEntityExtractionOperationMetadata, sub_type=None)))))))]
else begin[{]
None
end[}]
return[call[com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata.getDefaultInstance, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[cloud] operator[SEP] identifier[datalabeling] operator[SEP] identifier[v1beta1] operator[SEP] identifier[LabelTextEntityExtractionOperationMetadataOrBuilder] identifier[getTextEntityExtractionDetailsOrBuilder] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[detailsCase_] operator[==] Other[13] operator[SEP] {
Keyword[return] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[cloud] operator[SEP] identifier[datalabeling] operator[SEP] identifier[v1beta1] operator[SEP] identifier[LabelTextEntityExtractionOperationMetadata] operator[SEP] identifier[details_] operator[SEP]
}
Keyword[return] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[cloud] operator[SEP] identifier[datalabeling] operator[SEP] identifier[v1beta1] operator[SEP] identifier[LabelTextEntityExtractionOperationMetadata] operator[SEP] identifier[getDefaultInstance] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public String get(Object key) {
return this.groupedMap.get(DEFAULT_GROUP, Convert.toStr(key));
} | class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[key]] begin[{]
return[THIS[member[None.groupedMap]call[None.get, parameter[member[.DEFAULT_GROUP], call[Convert.toStr, parameter[member[.key]]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[get] operator[SEP] identifier[Object] identifier[key] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[groupedMap] operator[SEP] identifier[get] operator[SEP] identifier[DEFAULT_GROUP] , identifier[Convert] operator[SEP] identifier[toStr] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) {
BenchmarkSettings settings = BenchmarkSettings.from(args).build();
new BenchmarkServiceState(settings, new BenchmarkServiceImpl())
.runForAsync(
state -> {
BenchmarkService benchmarkService = state.api(BenchmarkService.class);
BenchmarkTimer timer = state.timer("timer");
BenchmarkMeter meter = state.meter("meter");
ServiceMessage message = ServiceMessage.builder().qualifier(QUALIFIER).build();
return i -> {
Context timeContext = timer.time();
return benchmarkService
.requestVoid(message)
.doOnTerminate(timeContext::stop)
.doOnTerminate(meter::mark);
};
});
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[BenchmarkSettings], settings]
ClassCreator(arguments=[MemberReference(member=settings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BenchmarkServiceImpl, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BenchmarkService, sub_type=None))], member=api, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[], type_arguments=None), name=benchmarkService)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BenchmarkService, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="timer")], member=timer, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[], type_arguments=None), name=timer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BenchmarkTimer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="meter")], member=meter, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[], type_arguments=None), name=meter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BenchmarkMeter, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=builder, postfix_operators=[], prefix_operators=[], qualifier=ServiceMessage, selectors=[MethodInvocation(arguments=[MemberReference(member=QUALIFIER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=qualifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ServiceMessage, sub_type=None)), ReturnStatement(expression=LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=time, postfix_operators=[], prefix_operators=[], qualifier=timer, selectors=[], type_arguments=None), name=timeContext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Context, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requestVoid, postfix_operators=[], prefix_operators=[], qualifier=benchmarkService, selectors=[MethodInvocation(arguments=[MethodReference(expression=MemberReference(member=timeContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=stop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=doOnTerminate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodReference(expression=MemberReference(member=meter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=doOnTerminate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), label=None)], parameters=[MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=runForAsync, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BenchmarkServiceState, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
identifier[BenchmarkSettings] identifier[settings] operator[=] identifier[BenchmarkSettings] operator[SEP] identifier[from] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[BenchmarkServiceState] operator[SEP] identifier[settings] , Keyword[new] identifier[BenchmarkServiceImpl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[runForAsync] operator[SEP] identifier[state] operator[->] {
identifier[BenchmarkService] identifier[benchmarkService] operator[=] identifier[state] operator[SEP] identifier[api] operator[SEP] identifier[BenchmarkService] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[BenchmarkTimer] identifier[timer] operator[=] identifier[state] operator[SEP] identifier[timer] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[BenchmarkMeter] identifier[meter] operator[=] identifier[state] operator[SEP] identifier[meter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ServiceMessage] identifier[message] operator[=] identifier[ServiceMessage] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[qualifier] operator[SEP] identifier[QUALIFIER] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[i] operator[->] {
identifier[Context] identifier[timeContext] operator[=] identifier[timer] operator[SEP] identifier[time] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[benchmarkService] operator[SEP] identifier[requestVoid] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[doOnTerminate] operator[SEP] identifier[timeContext] operator[::] identifier[stop] operator[SEP] operator[SEP] identifier[doOnTerminate] operator[SEP] identifier[meter] operator[::] identifier[mark] operator[SEP] operator[SEP]
} operator[SEP]
} operator[SEP] operator[SEP]
}
|
private ItemStack handleNormalClick(MalisisSlot slot, boolean fullStack)
{
if (!getPickedItemStack().isEmpty() && !slot.isItemValid(pickedItemStack))
return getPickedItemStack();
// already picked up an itemStack, insert/swap itemStack
if (!getPickedItemStack().isEmpty())
{
if (slot.isState(PLAYER_INSERT | PLAYER_EXTRACT))
setPickedItemStack(slot.insert(pickedItemStack, fullStack ? ItemUtils.FULL_STACK : 1, true));
}
// pick itemStack in slot
else if (slot.isState(PLAYER_EXTRACT))
setPickedItemStack(slot.extract(fullStack ? ItemUtils.FULL_STACK : ItemUtils.HALF_STACK));
return getPickedItemStack();
} | class class_name[name] begin[{]
method[handleNormalClick, return_type[type[ItemStack]], modifier[private], parameter[slot, fullStack]] begin[{]
if[binary_operation[call[.getPickedItemStack, parameter[]], &&, call[slot.isItemValid, parameter[member[.pickedItemStack]]]]] begin[{]
return[call[.getPickedItemStack, parameter[]]]
else begin[{]
None
end[}]
if[call[.getPickedItemStack, parameter[]]] begin[{]
if[call[slot.isState, parameter[binary_operation[member[.PLAYER_INSERT], |, member[.PLAYER_EXTRACT]]]]] begin[{]
call[.setPickedItemStack, parameter[call[slot.insert, parameter[member[.pickedItemStack], TernaryExpression(condition=MemberReference(member=fullStack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=MemberReference(member=FULL_STACK, postfix_operators=[], prefix_operators=[], qualifier=ItemUtils, selectors=[])), literal[true]]]]]
else begin[{]
None
end[}]
else begin[{]
if[call[slot.isState, parameter[member[.PLAYER_EXTRACT]]]] begin[{]
call[.setPickedItemStack, parameter[call[slot.extract, parameter[TernaryExpression(condition=MemberReference(member=fullStack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=HALF_STACK, postfix_operators=[], prefix_operators=[], qualifier=ItemUtils, selectors=[]), if_true=MemberReference(member=FULL_STACK, postfix_operators=[], prefix_operators=[], qualifier=ItemUtils, selectors=[]))]]]]
else begin[{]
None
end[}]
end[}]
return[call[.getPickedItemStack, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[ItemStack] identifier[handleNormalClick] operator[SEP] identifier[MalisisSlot] identifier[slot] , Keyword[boolean] identifier[fullStack] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[getPickedItemStack] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[slot] operator[SEP] identifier[isItemValid] operator[SEP] identifier[pickedItemStack] operator[SEP] operator[SEP] Keyword[return] identifier[getPickedItemStack] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[getPickedItemStack] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[slot] operator[SEP] identifier[isState] operator[SEP] identifier[PLAYER_INSERT] operator[|] identifier[PLAYER_EXTRACT] operator[SEP] operator[SEP] identifier[setPickedItemStack] operator[SEP] identifier[slot] operator[SEP] identifier[insert] operator[SEP] identifier[pickedItemStack] , identifier[fullStack] operator[?] identifier[ItemUtils] operator[SEP] identifier[FULL_STACK] operator[:] Other[1] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[slot] operator[SEP] identifier[isState] operator[SEP] identifier[PLAYER_EXTRACT] operator[SEP] operator[SEP] identifier[setPickedItemStack] operator[SEP] identifier[slot] operator[SEP] identifier[extract] operator[SEP] identifier[fullStack] operator[?] identifier[ItemUtils] operator[SEP] identifier[FULL_STACK] operator[:] identifier[ItemUtils] operator[SEP] identifier[HALF_STACK] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getPickedItemStack] operator[SEP] operator[SEP] operator[SEP]
}
|
String _serialize(Object o) {
String body = null;
try {
body = new String(serialize(o));
} catch (IOException e) {
throw new ServiceException(ErrorCode.HTTP_CLIENT_ERROR,
ErrorCode.HTTP_CLIENT_ERROR.getMessageTemplate(),
"serialize failed.");
}
return body;
} | class class_name[name] begin[{]
method[_serialize, return_type[type[String]], modifier[default], parameter[o]] begin[{]
local_variable[type[String], body]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, 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=String, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_CLIENT_ERROR, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[]), MethodInvocation(arguments=[], member=getMessageTemplate, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode.HTTP_CLIENT_ERROR, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="serialize failed.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.body]]
end[}]
END[}] | identifier[String] identifier[_serialize] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
identifier[String] identifier[body] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[body] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[serialize] operator[SEP] identifier[o] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[HTTP_CLIENT_ERROR] , identifier[ErrorCode] operator[SEP] identifier[HTTP_CLIENT_ERROR] operator[SEP] identifier[getMessageTemplate] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[body] operator[SEP]
}
|
public short extract_DevUShort(Any in) throws DevFailed
{
short data = 0;
try
{
data = in.extract_ushort();
}
catch (BAD_OPERATION ex)
{
throw_bad_type("DevUShort");
}
return data;
} | class class_name[name] begin[{]
method[extract_DevUShort, return_type[type[short]], modifier[public], parameter[in]] begin[{]
local_variable[type[short], data]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=extract_ushort, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DevUShort")], member=throw_bad_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['BAD_OPERATION']))], finally_block=None, label=None, resources=None)
return[member[.data]]
end[}]
END[}] | Keyword[public] Keyword[short] identifier[extract_DevUShort] operator[SEP] identifier[Any] identifier[in] operator[SEP] Keyword[throws] identifier[DevFailed] {
Keyword[short] identifier[data] operator[=] Other[0] operator[SEP] Keyword[try] {
identifier[data] operator[=] identifier[in] operator[SEP] identifier[extract_ushort] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[BAD_OPERATION] identifier[ex] operator[SEP] {
identifier[throw_bad_type] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[data] operator[SEP]
}
|
private void createHtmlDoc() throws PrompterException {
HtmlDocConfiguration configuration = new HtmlDocConfiguration();
String heading = prompter.prompt("Enter overview title:", configuration.getHeading());
String columns = prompter.prompt("Enter number of columns in overview:", configuration.getColumns());
String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());
String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());
String logo = prompter.prompt("Enter file path to logo:", configuration.getLogo());
String confirm = prompter.prompt("Confirm HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'\n",
Arrays.asList("y", "n"), "y");
if (confirm.equalsIgnoreCase("n")) {
return;
}
HtmlTestDocsGenerator generator = getHtmlTestDocsGenerator();
generator.withOutputFile(outputFile + (outputFile.endsWith(".html") ? "" : ".html"))
.withPageTitle(pageTitle)
.withOverviewTitle(heading)
.withColumns(columns)
.useSrcDirectory(getTestSrcDirectory())
.withLogo(logo);
generator.generateDoc();
getLog().info("Successfully created HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'");
} | class class_name[name] begin[{]
method[createHtmlDoc, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[HtmlDocConfiguration], configuration]
local_variable[type[String], heading]
local_variable[type[String], columns]
local_variable[type[String], pageTitle]
local_variable[type[String], outputFile]
local_variable[type[String], logo]
local_variable[type[String], confirm]
if[call[confirm.equalsIgnoreCase, parameter[literal["n"]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[HtmlTestDocsGenerator], generator]
call[generator.withOutputFile, parameter[binary_operation[member[.outputFile], +, TernaryExpression(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".html")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=outputFile, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".html"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]]]
call[generator.generateDoc, parameter[]]
call[.getLog, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[createHtmlDoc] operator[SEP] operator[SEP] Keyword[throws] identifier[PrompterException] {
identifier[HtmlDocConfiguration] identifier[configuration] operator[=] Keyword[new] identifier[HtmlDocConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[heading] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] , identifier[configuration] operator[SEP] identifier[getHeading] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[columns] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] , identifier[configuration] operator[SEP] identifier[getColumns] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[pageTitle] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] , identifier[configuration] operator[SEP] identifier[getPageTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[outputFile] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] , identifier[configuration] operator[SEP] identifier[getOutputFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[logo] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] , identifier[configuration] operator[SEP] identifier[getLogo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[confirm] operator[=] identifier[prompter] operator[SEP] identifier[prompt] operator[SEP] literal[String] operator[+] identifier[outputFile] operator[+] operator[SEP] identifier[outputFile] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[+] literal[String] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] literal[String] , literal[String] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[confirm] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[HtmlTestDocsGenerator] identifier[generator] operator[=] identifier[getHtmlTestDocsGenerator] operator[SEP] operator[SEP] operator[SEP] identifier[generator] operator[SEP] identifier[withOutputFile] operator[SEP] identifier[outputFile] operator[+] operator[SEP] identifier[outputFile] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[withPageTitle] operator[SEP] identifier[pageTitle] operator[SEP] operator[SEP] identifier[withOverviewTitle] operator[SEP] identifier[heading] operator[SEP] operator[SEP] identifier[withColumns] operator[SEP] identifier[columns] operator[SEP] operator[SEP] identifier[useSrcDirectory] operator[SEP] identifier[getTestSrcDirectory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withLogo] operator[SEP] identifier[logo] operator[SEP] operator[SEP] identifier[generator] operator[SEP] identifier[generateDoc] operator[SEP] operator[SEP] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[outputFile] operator[+] operator[SEP] identifier[outputFile] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
private void linearGradient(Attributes attributes) throws SVGParseException
{
debug("<linearGradient>");
if (currentElement == null)
throw new SVGParseException("Invalid document. Root element must be <svg>");
SVG.SvgLinearGradient obj = new SVG.SvgLinearGradient();
obj.document = svgDocument;
obj.parent = currentElement;
parseAttributesCore(obj, attributes);
parseAttributesStyle(obj, attributes);
parseAttributesGradient(obj, attributes);
parseAttributesLinearGradient(obj, attributes);
currentElement.addChild(obj);
currentElement = obj;
} | class class_name[name] begin[{]
method[linearGradient, return_type[void], modifier[private], parameter[attributes]] begin[{]
call[.debug, parameter[literal["<linearGradient>"]]]
if[binary_operation[member[.currentElement], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid document. Root element must be <svg>")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SVGParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[SVG], obj]
assign[member[obj.document], member[.svgDocument]]
assign[member[obj.parent], member[.currentElement]]
call[.parseAttributesCore, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesStyle, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesGradient, parameter[member[.obj], member[.attributes]]]
call[.parseAttributesLinearGradient, parameter[member[.obj], member[.attributes]]]
call[currentElement.addChild, parameter[member[.obj]]]
assign[member[.currentElement], member[.obj]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[linearGradient] operator[SEP] identifier[Attributes] identifier[attributes] operator[SEP] Keyword[throws] identifier[SVGParseException] {
identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentElement] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[SVGParseException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SVG] operator[SEP] identifier[SvgLinearGradient] identifier[obj] operator[=] Keyword[new] identifier[SVG] operator[SEP] identifier[SvgLinearGradient] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[document] operator[=] identifier[svgDocument] operator[SEP] identifier[obj] operator[SEP] identifier[parent] operator[=] identifier[currentElement] operator[SEP] identifier[parseAttributesCore] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesStyle] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesGradient] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[parseAttributesLinearGradient] operator[SEP] identifier[obj] , identifier[attributes] operator[SEP] operator[SEP] identifier[currentElement] operator[SEP] identifier[addChild] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[currentElement] operator[=] identifier[obj] operator[SEP]
}
|
public String resolveScope(final Class type, final String methodName) {
if (scopePattern == null) {
return null;
}
String ctx = scopePattern;
ctx = StringUtil.replace(ctx, JTXCTX_PATTERN_CLASS, type.getName());
ctx = StringUtil.replace(ctx, JTXCTX_PATTERN_METHOD, methodName);
return ctx;
} | class class_name[name] begin[{]
method[resolveScope, return_type[type[String]], modifier[public], parameter[type, methodName]] begin[{]
if[binary_operation[member[.scopePattern], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], ctx]
assign[member[.ctx], call[StringUtil.replace, parameter[member[.ctx], member[.JTXCTX_PATTERN_CLASS], call[type.getName, parameter[]]]]]
assign[member[.ctx], call[StringUtil.replace, parameter[member[.ctx], member[.JTXCTX_PATTERN_METHOD], member[.methodName]]]]
return[member[.ctx]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[resolveScope] operator[SEP] Keyword[final] identifier[Class] identifier[type] , Keyword[final] identifier[String] identifier[methodName] operator[SEP] {
Keyword[if] operator[SEP] identifier[scopePattern] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[ctx] operator[=] identifier[scopePattern] operator[SEP] identifier[ctx] operator[=] identifier[StringUtil] operator[SEP] identifier[replace] operator[SEP] identifier[ctx] , identifier[JTXCTX_PATTERN_CLASS] , identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ctx] operator[=] identifier[StringUtil] operator[SEP] identifier[replace] operator[SEP] identifier[ctx] , identifier[JTXCTX_PATTERN_METHOD] , identifier[methodName] operator[SEP] operator[SEP] Keyword[return] identifier[ctx] operator[SEP]
}
|
public FullColumnDescription getQuantumDescription()
{
if (quantumField == null)
{
for (FullColumnDescription fd: getPartitionKeyColumnDescriptions())
{
if (fd.hasQuantum())
{
if (quantumField != null)
{
throw new IllegalStateException("Table definition has more than one quantum.");
}
else
{
quantumField = fd;
}
}
}
}
return quantumField;
} | class class_name[name] begin[{]
method[getQuantumDescription, return_type[type[FullColumnDescription]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.quantumField], ==, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasQuantum, postfix_operators=[], prefix_operators=[], qualifier=fd, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=quantumField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=quantumField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=fd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table definition has more than one quantum.")], 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)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPartitionKeyColumnDescriptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FullColumnDescription, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.quantumField]]
end[}]
END[}] | Keyword[public] identifier[FullColumnDescription] identifier[getQuantumDescription] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[quantumField] operator[==] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[FullColumnDescription] identifier[fd] operator[:] identifier[getPartitionKeyColumnDescriptions] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fd] operator[SEP] identifier[hasQuantum] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[quantumField] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[quantumField] operator[=] identifier[fd] operator[SEP]
}
}
}
}
Keyword[return] identifier[quantumField] operator[SEP]
}
|
public void setSAMLProviderList(java.util.Collection<SAMLProviderListEntry> sAMLProviderList) {
if (sAMLProviderList == null) {
this.sAMLProviderList = null;
return;
}
this.sAMLProviderList = new com.amazonaws.internal.SdkInternalList<SAMLProviderListEntry>(sAMLProviderList);
} | class class_name[name] begin[{]
method[setSAMLProviderList, return_type[void], modifier[public], parameter[sAMLProviderList]] begin[{]
if[binary_operation[member[.sAMLProviderList], ==, literal[null]]] begin[{]
assign[THIS[member[None.sAMLProviderList]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.sAMLProviderList]], ClassCreator(arguments=[MemberReference(member=sAMLProviderList, 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=SAMLProviderListEntry, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setSAMLProviderList] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[SAMLProviderListEntry] operator[>] identifier[sAMLProviderList] operator[SEP] {
Keyword[if] operator[SEP] identifier[sAMLProviderList] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[sAMLProviderList] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[sAMLProviderList] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[SAMLProviderListEntry] operator[>] operator[SEP] identifier[sAMLProviderList] operator[SEP] operator[SEP]
}
|
public static Element extractElement(Document document, Element element) throws MalformedElementException {
Assert.isNotNull(document);
Assert.isTrue(document.getDocumentElement() == null);
Assert.isNotNull(element);
return (Element) extractNode(document, element);
} | class class_name[name] begin[{]
method[extractElement, return_type[type[Element]], modifier[public static], parameter[document, element]] begin[{]
call[Assert.isNotNull, parameter[member[.document]]]
call[Assert.isTrue, parameter[binary_operation[call[document.getDocumentElement, parameter[]], ==, literal[null]]]]
call[Assert.isNotNull, parameter[member[.element]]]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Element] identifier[extractElement] operator[SEP] identifier[Document] identifier[document] , identifier[Element] identifier[element] operator[SEP] Keyword[throws] identifier[MalformedElementException] {
identifier[Assert] operator[SEP] identifier[isNotNull] operator[SEP] identifier[document] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[isTrue] operator[SEP] identifier[document] operator[SEP] identifier[getDocumentElement] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[isNotNull] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[Element] operator[SEP] identifier[extractNode] operator[SEP] identifier[document] , identifier[element] operator[SEP] operator[SEP]
}
|
public InputStream openKeyStore(String fileName) throws MalformedURLException, IOException {
InputStream fis = null;
URL urlFile = null;
File kfile = null;
try {
kfile = new File(fileName);
} catch (NullPointerException e) {
throw new IOException();
}
try {
if (kfile.exists()) {
// its a file that is there
if (kfile.length() == 0) {
// the keystore file is empty
// debug
throw new IOException(fileName);
}
// get the url syntax for the fully-qualified filename
urlFile = new URL("file:" + kfile.getCanonicalPath());
} else {
// otherwise, its a url or a file that doesn't exist
try {
urlFile = new URL(fileName);
} catch (MalformedURLException e) {
// not proper url syntax
// -or- a file that doesn't exist, we don't know which.
// error message
throw e;
}
}
} catch (SecurityException e) {
// error message
throw new IOException(fileName);
}
// Attempt to open the keystore file
try {
fis = urlFile.openStream();
} catch (IOException e) {
// error message
throw e;
}
return fis;
} | class class_name[name] begin[{]
method[openKeyStore, return_type[type[InputStream]], modifier[public], parameter[fileName]] begin[{]
local_variable[type[InputStream], fis]
local_variable[type[URL], urlFile]
local_variable[type[File], kfile]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=kfile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NullPointerException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=kfile, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=urlFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=fileName, 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=URL, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=kfile, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=urlFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file:"), operandr=MethodInvocation(arguments=[], member=getCanonicalPath, postfix_operators=[], prefix_operators=[], qualifier=kfile, 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=URL, sub_type=None))), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=fileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=openStream, postfix_operators=[], prefix_operators=[], qualifier=urlFile, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.fis]]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[openKeyStore] operator[SEP] identifier[String] identifier[fileName] operator[SEP] Keyword[throws] identifier[MalformedURLException] , identifier[IOException] {
identifier[InputStream] identifier[fis] operator[=] Other[null] operator[SEP] identifier[URL] identifier[urlFile] operator[=] Other[null] operator[SEP] identifier[File] identifier[kfile] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[kfile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NullPointerException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[kfile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[kfile] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
identifier[urlFile] operator[=] Keyword[new] identifier[URL] operator[SEP] literal[String] operator[+] identifier[kfile] operator[SEP] identifier[getCanonicalPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[urlFile] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[fileName] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[fis] operator[=] identifier[urlFile] operator[SEP] identifier[openStream] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[return] identifier[fis] operator[SEP]
}
|
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AfplibPackage.GBOX__RES:
setRES(RES_EDEFAULT);
return;
case AfplibPackage.GBOX__XPOS0:
setXPOS0(XPOS0_EDEFAULT);
return;
case AfplibPackage.GBOX__YPOS0:
setYPOS0(YPOS0_EDEFAULT);
return;
case AfplibPackage.GBOX__XPOS1:
setXPOS1(XPOS1_EDEFAULT);
return;
case AfplibPackage.GBOX__YPOS1:
setYPOS1(YPOS1_EDEFAULT);
return;
case AfplibPackage.GBOX__HAXIS:
setHAXIS(HAXIS_EDEFAULT);
return;
case AfplibPackage.GBOX__VAXIS:
setVAXIS(VAXIS_EDEFAULT);
return;
}
super.eUnset(featureID);
} | class class_name[name] begin[{]
method[eUnset, return_type[void], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=GBOX__RES, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=RES_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__XPOS0, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XPOS0_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setXPOS0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__YPOS0, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=YPOS0_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setYPOS0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__XPOS1, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XPOS1_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setXPOS1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__YPOS1, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=YPOS1_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setYPOS1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__HAXIS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=HAXIS_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHAXIS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=GBOX__VAXIS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=VAXIS_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setVAXIS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eUnset, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eUnset] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__RES] operator[:] identifier[setRES] operator[SEP] identifier[RES_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__XPOS0] operator[:] identifier[setXPOS0] operator[SEP] identifier[XPOS0_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__YPOS0] operator[:] identifier[setYPOS0] operator[SEP] identifier[YPOS0_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__XPOS1] operator[:] identifier[setXPOS1] operator[SEP] identifier[XPOS1_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__YPOS1] operator[:] identifier[setYPOS1] operator[SEP] identifier[YPOS1_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__HAXIS] operator[:] identifier[setHAXIS] operator[SEP] identifier[HAXIS_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[GBOX__VAXIS] operator[:] identifier[setVAXIS] operator[SEP] identifier[VAXIS_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eUnset] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public Token createToken(final String tokenString, final int offset,
final int length) {
final Token token = new Token();
token.setTokenValue(tokenString);
if (this.addOffsets) {
token.setStartOffset(offset);
token.setTokenLength(length);
}
return token;
} | class class_name[name] begin[{]
method[createToken, return_type[type[Token]], modifier[public], parameter[tokenString, offset, length]] begin[{]
local_variable[type[Token], token]
call[token.setTokenValue, parameter[member[.tokenString]]]
if[THIS[member[None.addOffsets]]] begin[{]
call[token.setStartOffset, parameter[member[.offset]]]
call[token.setTokenLength, parameter[member[.length]]]
else begin[{]
None
end[}]
return[member[.token]]
end[}]
END[}] | Keyword[public] identifier[Token] identifier[createToken] operator[SEP] Keyword[final] identifier[String] identifier[tokenString] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[length] operator[SEP] {
Keyword[final] identifier[Token] identifier[token] operator[=] Keyword[new] identifier[Token] operator[SEP] operator[SEP] operator[SEP] identifier[token] operator[SEP] identifier[setTokenValue] operator[SEP] identifier[tokenString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[addOffsets] operator[SEP] {
identifier[token] operator[SEP] identifier[setStartOffset] operator[SEP] identifier[offset] operator[SEP] operator[SEP] identifier[token] operator[SEP] identifier[setTokenLength] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[return] identifier[token] operator[SEP]
}
|
public static IStatus error(final String message, final Throwable thr) {
return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr);
} | class class_name[name] begin[{]
method[error, return_type[type[IStatus]], modifier[public static], parameter[message, thr]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=IStatus, selectors=[]), MemberReference(member=PLUGIN_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thr, 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=Status, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[IStatus] identifier[error] operator[SEP] Keyword[final] identifier[String] identifier[message] , Keyword[final] identifier[Throwable] identifier[thr] operator[SEP] {
Keyword[return] Keyword[new] identifier[Status] operator[SEP] identifier[IStatus] operator[SEP] identifier[ERROR] , identifier[PLUGIN_ID] , Other[0] , identifier[message] , identifier[thr] operator[SEP] operator[SEP]
}
|
@Deprecated
public static int parsePAT(ByteBuffer data) {
PATSection pat = PATSection.parsePAT(data);
if (pat.getPrograms().size() > 0)
return pat.getPrograms().values()[0];
else
return -1;
} | class class_name[name] begin[{]
method[parsePAT, return_type[type[int]], modifier[public static], parameter[data]] begin[{]
local_variable[type[PATSection], pat]
if[binary_operation[call[pat.getPrograms, parameter[]], >, literal[0]]] begin[{]
return[call[pat.getPrograms, parameter[]]]
else begin[{]
return[literal[1]]
end[}]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] Keyword[int] identifier[parsePAT] operator[SEP] identifier[ByteBuffer] identifier[data] operator[SEP] {
identifier[PATSection] identifier[pat] operator[=] identifier[PATSection] operator[SEP] identifier[parsePAT] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pat] operator[SEP] identifier[getPrograms] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[pat] operator[SEP] identifier[getPrograms] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[else] Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public void log(String FQCN, Priority p, Object msg, Throwable t) {
int levelInt = priorityToLevelInt(p);
differentiatedLog(null, FQCN, levelInt, msg, t);
} | class class_name[name] begin[{]
method[log, return_type[void], modifier[public], parameter[FQCN, p, msg, t]] begin[{]
local_variable[type[int], levelInt]
call[.differentiatedLog, parameter[literal[null], member[.FQCN], member[.levelInt], member[.msg], member[.t]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[log] operator[SEP] identifier[String] identifier[FQCN] , identifier[Priority] identifier[p] , identifier[Object] identifier[msg] , identifier[Throwable] identifier[t] operator[SEP] {
Keyword[int] identifier[levelInt] operator[=] identifier[priorityToLevelInt] operator[SEP] identifier[p] operator[SEP] operator[SEP] identifier[differentiatedLog] operator[SEP] Other[null] , identifier[FQCN] , identifier[levelInt] , identifier[msg] , identifier[t] operator[SEP] operator[SEP]
}
|
public Moment toMoment() {
double secs = this.value * DAY_IN_SECONDS;
TimeScale ts = this.scale;
if (!LeapSeconds.getInstance().isEnabled() && (ts != TimeScale.POSIX)) {
if (ts == TimeScale.TT) {
PlainDate d = PlainDate.of((long) Math.floor(this.getMJD()), EpochDays.MODIFIED_JULIAN_DATE);
secs -= TimeScale.deltaT(d.getYear(), d.getMonth());
}
secs += (DAY_IN_SECONDS * 730);
ts = TimeScale.POSIX;
}
long elapsed = Math.subtractExact((long) secs, jdOffset(ts));
int nano = (int) ((secs - Math.floor(secs)) * MRD);
return Moment.of(elapsed, nano, ts);
} | class class_name[name] begin[{]
method[toMoment, return_type[type[Moment]], modifier[public], parameter[]] begin[{]
local_variable[type[double], secs]
local_variable[type[TimeScale], ts]
if[binary_operation[call[LeapSeconds.getInstance, parameter[]], &&, binary_operation[member[.ts], !=, member[TimeScale.POSIX]]]] begin[{]
if[binary_operation[member[.ts], ==, member[TimeScale.TT]]] begin[{]
local_variable[type[PlainDate], d]
assign[member[.secs], call[TimeScale.deltaT, parameter[call[d.getYear, parameter[]], call[d.getMonth, parameter[]]]]]
else begin[{]
None
end[}]
assign[member[.secs], binary_operation[member[.DAY_IN_SECONDS], *, literal[730]]]
assign[member[.ts], member[TimeScale.POSIX]]
else begin[{]
None
end[}]
local_variable[type[long], elapsed]
local_variable[type[int], nano]
return[call[Moment.of, parameter[member[.elapsed], member[.nano], member[.ts]]]]
end[}]
END[}] | Keyword[public] identifier[Moment] identifier[toMoment] operator[SEP] operator[SEP] {
Keyword[double] identifier[secs] operator[=] Keyword[this] operator[SEP] identifier[value] operator[*] identifier[DAY_IN_SECONDS] operator[SEP] identifier[TimeScale] identifier[ts] operator[=] Keyword[this] operator[SEP] identifier[scale] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[LeapSeconds] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[ts] operator[!=] identifier[TimeScale] operator[SEP] identifier[POSIX] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ts] operator[==] identifier[TimeScale] operator[SEP] identifier[TT] operator[SEP] {
identifier[PlainDate] identifier[d] operator[=] identifier[PlainDate] operator[SEP] identifier[of] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] Keyword[this] operator[SEP] identifier[getMJD] operator[SEP] operator[SEP] operator[SEP] , identifier[EpochDays] operator[SEP] identifier[MODIFIED_JULIAN_DATE] operator[SEP] operator[SEP] identifier[secs] operator[-=] identifier[TimeScale] operator[SEP] identifier[deltaT] operator[SEP] identifier[d] operator[SEP] identifier[getYear] operator[SEP] operator[SEP] , identifier[d] operator[SEP] identifier[getMonth] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[secs] operator[+=] operator[SEP] identifier[DAY_IN_SECONDS] operator[*] Other[730] operator[SEP] operator[SEP] identifier[ts] operator[=] identifier[TimeScale] operator[SEP] identifier[POSIX] operator[SEP]
}
Keyword[long] identifier[elapsed] operator[=] identifier[Math] operator[SEP] identifier[subtractExact] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[secs] , identifier[jdOffset] operator[SEP] identifier[ts] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[nano] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[secs] operator[-] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[secs] operator[SEP] operator[SEP] operator[*] identifier[MRD] operator[SEP] operator[SEP] Keyword[return] identifier[Moment] operator[SEP] identifier[of] operator[SEP] identifier[elapsed] , identifier[nano] , identifier[ts] operator[SEP] operator[SEP]
}
|
public static void main(final String[] args) throws TransformerException {
if (args.length == 2) {
// using default jpdl 3.2 as XSLT stylesheet.
transform(args[0], null, args[1]);
} else if (args.length == 3) {
// using arg[1] as XSLT stylesheet.
transform(args[0], args[1], args[2]);
} else {
System.err.println("Usage:");
System.err.println(" java " + JbpmMigration.class.getName() + " jpdlProcessDefinitionFileName xsltFileName outputFileName");
System.err.println(" or you can use the default jpdl 3.2 transformation:");
System.err.println(" java " + JbpmMigration.class.getName() + " jpdlProcessDefinitionFileName outputFileName");
System.exit(1);
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[member[args.length], ==, literal[2]]] begin[{]
call[.transform, parameter[member[.args], literal[null], member[.args]]]
else begin[{]
if[binary_operation[member[args.length], ==, literal[3]]] begin[{]
call[.transform, parameter[member[.args], member[.args], member[.args]]]
else begin[{]
call[System.err.println, parameter[literal["Usage:"]]]
call[System.err.println, parameter[binary_operation[binary_operation[literal[" java "], +, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JbpmMigration, sub_type=None))], +, literal[" jpdlProcessDefinitionFileName xsltFileName outputFileName"]]]]
call[System.err.println, parameter[literal[" or you can use the default jpdl 3.2 transformation:"]]]
call[System.err.println, parameter[binary_operation[binary_operation[literal[" java "], +, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JbpmMigration, sub_type=None))], +, literal[" jpdlProcessDefinitionFileName outputFileName"]]]]
call[System.exit, parameter[literal[1]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[TransformerException] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
identifier[transform] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] , Other[null] , identifier[args] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[3] operator[SEP] {
identifier[transform] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] , identifier[args] operator[SEP] Other[1] operator[SEP] , identifier[args] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[JbpmMigration] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[JbpmMigration] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
|
public static boolean contains(String list, String keyword) {
int idx;
int colon;
String quality;
idx = list.indexOf(keyword);
if (idx == -1) {
return false;
}
idx += keyword.length();
colon = list.indexOf(",", idx);
if (colon == -1) {
colon = list.length();
}
quality = list.substring(idx, colon);
idx = quality.indexOf('=');
if (idx == -1) {
return true;
}
return !"0".equals(quality.substring(idx + 1).trim());
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public static], parameter[list, keyword]] begin[{]
local_variable[type[int], idx]
local_variable[type[int], colon]
local_variable[type[String], quality]
assign[member[.idx], call[list.indexOf, parameter[member[.keyword]]]]
if[binary_operation[member[.idx], ==, literal[1]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.idx], call[keyword.length, parameter[]]]
assign[member[.colon], call[list.indexOf, parameter[literal[","], member[.idx]]]]
if[binary_operation[member[.colon], ==, literal[1]]] begin[{]
assign[member[.colon], call[list.length, parameter[]]]
else begin[{]
None
end[}]
assign[member[.quality], call[list.substring, parameter[member[.idx], member[.colon]]]]
assign[member[.idx], call[quality.indexOf, parameter[literal['=']]]]
if[binary_operation[member[.idx], ==, literal[1]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal["0"]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[contains] operator[SEP] identifier[String] identifier[list] , identifier[String] identifier[keyword] operator[SEP] {
Keyword[int] identifier[idx] operator[SEP] Keyword[int] identifier[colon] operator[SEP] identifier[String] identifier[quality] operator[SEP] identifier[idx] operator[=] identifier[list] operator[SEP] identifier[indexOf] operator[SEP] identifier[keyword] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[idx] operator[+=] identifier[keyword] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[colon] operator[=] identifier[list] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[idx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[colon] operator[==] operator[-] Other[1] operator[SEP] {
identifier[colon] operator[=] identifier[list] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
identifier[quality] operator[=] identifier[list] operator[SEP] identifier[substring] operator[SEP] identifier[idx] , identifier[colon] operator[SEP] operator[SEP] identifier[idx] operator[=] identifier[quality] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[quality] operator[SEP] identifier[substring] operator[SEP] identifier[idx] operator[+] Other[1] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Messages getInstance(Locale locale, Class<?> cls)
{
Messages instance = null;
locale = (locale == null) ? Locale.getDefault() : locale;
String bundleKey = (cls==null)? BUNDLE_NAME : getBundleName(cls);
String localeKey = locale.getLanguage();
if (messageTable.contains(bundleKey, localeKey)) {
instance = messageTable.get(bundleKey, localeKey);
}
else
{
synchronized (Messages.class)
{
if (instance == null)
{
instance = new Messages(locale, bundleKey);
messageTable.put(bundleKey, localeKey, instance);
}
}
}
return instance;
} | class class_name[name] begin[{]
method[getInstance, return_type[type[Messages]], modifier[public static], parameter[locale, cls]] begin[{]
local_variable[type[Messages], instance]
assign[member[.locale], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=Locale, selectors=[], type_arguments=None))]
local_variable[type[String], bundleKey]
local_variable[type[String], localeKey]
if[call[messageTable.contains, parameter[member[.bundleKey], member[.localeKey]]]] begin[{]
assign[member[.instance], call[messageTable.get, parameter[member[.bundleKey], member[.localeKey]]]]
else begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Messages, sub_type=None))] BEGIN[{]
if[binary_operation[member[.instance], ==, literal[null]]] begin[{]
assign[member[.instance], ClassCreator(arguments=[MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bundleKey, 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=Messages, sub_type=None))]
call[messageTable.put, parameter[member[.bundleKey], member[.localeKey], member[.instance]]]
else begin[{]
None
end[}]
END[}]
end[}]
return[member[.instance]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Messages] identifier[getInstance] operator[SEP] identifier[Locale] identifier[locale] , identifier[Class] operator[<] operator[?] operator[>] identifier[cls] operator[SEP] {
identifier[Messages] identifier[instance] operator[=] Other[null] operator[SEP] identifier[locale] operator[=] operator[SEP] identifier[locale] operator[==] Other[null] operator[SEP] operator[?] identifier[Locale] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[:] identifier[locale] operator[SEP] identifier[String] identifier[bundleKey] operator[=] operator[SEP] identifier[cls] operator[==] Other[null] operator[SEP] operator[?] identifier[BUNDLE_NAME] operator[:] identifier[getBundleName] operator[SEP] identifier[cls] operator[SEP] operator[SEP] identifier[String] identifier[localeKey] operator[=] identifier[locale] operator[SEP] identifier[getLanguage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[messageTable] operator[SEP] identifier[contains] operator[SEP] identifier[bundleKey] , identifier[localeKey] operator[SEP] operator[SEP] {
identifier[instance] operator[=] identifier[messageTable] operator[SEP] identifier[get] operator[SEP] identifier[bundleKey] , identifier[localeKey] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[synchronized] operator[SEP] identifier[Messages] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] identifier[instance] operator[==] Other[null] operator[SEP] {
identifier[instance] operator[=] Keyword[new] identifier[Messages] operator[SEP] identifier[locale] , identifier[bundleKey] operator[SEP] operator[SEP] identifier[messageTable] operator[SEP] identifier[put] operator[SEP] identifier[bundleKey] , identifier[localeKey] , identifier[instance] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[instance] operator[SEP]
}
|
AtomSymbol generatePeriodicSymbol(final int number, final int hydrogens, final int mass, final int charge,
final int unpaired, HydrogenPosition position) {
TextOutline element = number == 0 ? new TextOutline("*", font)
: new TextOutline(Elements.ofNumber(number).symbol(), font);
TextOutline hydrogenAdjunct = defaultHydrogenLabel;
// the hydrogen count, charge, and mass adjuncts are script size
TextOutline hydrogenCount = new TextOutline(Integer.toString(hydrogens), font).resize(scriptSize, scriptSize);
TextOutline chargeAdjunct = new TextOutline(chargeAdjunctText(charge, unpaired), font).resize(scriptSize,
scriptSize);
TextOutline massAdjunct = new TextOutline(Integer.toString(mass), font).resize(scriptSize, scriptSize);
// position each adjunct relative to the element label and each other
hydrogenAdjunct = positionHydrogenLabel(position, element, hydrogenAdjunct);
hydrogenCount = positionSubscript(hydrogenAdjunct, hydrogenCount);
chargeAdjunct = positionChargeLabel(hydrogens, position, chargeAdjunct, element, hydrogenAdjunct);
massAdjunct = positionMassLabel(massAdjunct, element);
// when the hydrogen label is positioned to the left we may need to nudge it
// over to account for the hydrogen count and/or the mass adjunct colliding
// with the element label
if (position == Left) {
final double nudgeX = hydrogenXDodge(hydrogens, mass, element, hydrogenAdjunct, hydrogenCount, massAdjunct);
hydrogenAdjunct = hydrogenAdjunct.translate(nudgeX, 0);
hydrogenCount = hydrogenCount.translate(nudgeX, 0);
}
final List<TextOutline> adjuncts = new ArrayList<TextOutline>(4);
if (hydrogens > 0) adjuncts.add(hydrogenAdjunct);
if (hydrogens > 1) adjuncts.add(hydrogenCount);
if (charge != 0 || unpaired > 0) adjuncts.add(chargeAdjunct);
if (mass > 0) adjuncts.add(massAdjunct);
return new AtomSymbol(element, adjuncts);
} | class class_name[name] begin[{]
method[generatePeriodicSymbol, return_type[type[AtomSymbol]], modifier[default], parameter[number, hydrogens, mass, charge, unpaired, position]] begin[{]
local_variable[type[TextOutline], element]
local_variable[type[TextOutline], hydrogenAdjunct]
local_variable[type[TextOutline], hydrogenCount]
local_variable[type[TextOutline], chargeAdjunct]
local_variable[type[TextOutline], massAdjunct]
assign[member[.hydrogenAdjunct], call[.positionHydrogenLabel, parameter[member[.position], member[.element], member[.hydrogenAdjunct]]]]
assign[member[.hydrogenCount], call[.positionSubscript, parameter[member[.hydrogenAdjunct], member[.hydrogenCount]]]]
assign[member[.chargeAdjunct], call[.positionChargeLabel, parameter[member[.hydrogens], member[.position], member[.chargeAdjunct], member[.element], member[.hydrogenAdjunct]]]]
assign[member[.massAdjunct], call[.positionMassLabel, parameter[member[.massAdjunct], member[.element]]]]
if[binary_operation[member[.position], ==, member[.Left]]] begin[{]
local_variable[type[double], nudgeX]
assign[member[.hydrogenAdjunct], call[hydrogenAdjunct.translate, parameter[member[.nudgeX], literal[0]]]]
assign[member[.hydrogenCount], call[hydrogenCount.translate, parameter[member[.nudgeX], literal[0]]]]
else begin[{]
None
end[}]
local_variable[type[List], adjuncts]
if[binary_operation[member[.hydrogens], >, literal[0]]] begin[{]
call[adjuncts.add, parameter[member[.hydrogenAdjunct]]]
else begin[{]
None
end[}]
if[binary_operation[member[.hydrogens], >, literal[1]]] begin[{]
call[adjuncts.add, parameter[member[.hydrogenCount]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.charge], !=, literal[0]], ||, binary_operation[member[.unpaired], >, literal[0]]]] begin[{]
call[adjuncts.add, parameter[member[.chargeAdjunct]]]
else begin[{]
None
end[}]
if[binary_operation[member[.mass], >, literal[0]]] begin[{]
call[adjuncts.add, parameter[member[.massAdjunct]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=adjuncts, 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=AtomSymbol, sub_type=None))]
end[}]
END[}] | identifier[AtomSymbol] identifier[generatePeriodicSymbol] operator[SEP] Keyword[final] Keyword[int] identifier[number] , Keyword[final] Keyword[int] identifier[hydrogens] , Keyword[final] Keyword[int] identifier[mass] , Keyword[final] Keyword[int] identifier[charge] , Keyword[final] Keyword[int] identifier[unpaired] , identifier[HydrogenPosition] identifier[position] operator[SEP] {
identifier[TextOutline] identifier[element] operator[=] identifier[number] operator[==] Other[0] operator[?] Keyword[new] identifier[TextOutline] operator[SEP] literal[String] , identifier[font] operator[SEP] operator[:] Keyword[new] identifier[TextOutline] operator[SEP] identifier[Elements] operator[SEP] identifier[ofNumber] operator[SEP] identifier[number] operator[SEP] operator[SEP] identifier[symbol] operator[SEP] operator[SEP] , identifier[font] operator[SEP] operator[SEP] identifier[TextOutline] identifier[hydrogenAdjunct] operator[=] identifier[defaultHydrogenLabel] operator[SEP] identifier[TextOutline] identifier[hydrogenCount] operator[=] Keyword[new] identifier[TextOutline] operator[SEP] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[hydrogens] operator[SEP] , identifier[font] operator[SEP] operator[SEP] identifier[resize] operator[SEP] identifier[scriptSize] , identifier[scriptSize] operator[SEP] operator[SEP] identifier[TextOutline] identifier[chargeAdjunct] operator[=] Keyword[new] identifier[TextOutline] operator[SEP] identifier[chargeAdjunctText] operator[SEP] identifier[charge] , identifier[unpaired] operator[SEP] , identifier[font] operator[SEP] operator[SEP] identifier[resize] operator[SEP] identifier[scriptSize] , identifier[scriptSize] operator[SEP] operator[SEP] identifier[TextOutline] identifier[massAdjunct] operator[=] Keyword[new] identifier[TextOutline] operator[SEP] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[mass] operator[SEP] , identifier[font] operator[SEP] operator[SEP] identifier[resize] operator[SEP] identifier[scriptSize] , identifier[scriptSize] operator[SEP] operator[SEP] identifier[hydrogenAdjunct] operator[=] identifier[positionHydrogenLabel] operator[SEP] identifier[position] , identifier[element] , identifier[hydrogenAdjunct] operator[SEP] operator[SEP] identifier[hydrogenCount] operator[=] identifier[positionSubscript] operator[SEP] identifier[hydrogenAdjunct] , identifier[hydrogenCount] operator[SEP] operator[SEP] identifier[chargeAdjunct] operator[=] identifier[positionChargeLabel] operator[SEP] identifier[hydrogens] , identifier[position] , identifier[chargeAdjunct] , identifier[element] , identifier[hydrogenAdjunct] operator[SEP] operator[SEP] identifier[massAdjunct] operator[=] identifier[positionMassLabel] operator[SEP] identifier[massAdjunct] , identifier[element] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[position] operator[==] identifier[Left] operator[SEP] {
Keyword[final] Keyword[double] identifier[nudgeX] operator[=] identifier[hydrogenXDodge] operator[SEP] identifier[hydrogens] , identifier[mass] , identifier[element] , identifier[hydrogenAdjunct] , identifier[hydrogenCount] , identifier[massAdjunct] operator[SEP] operator[SEP] identifier[hydrogenAdjunct] operator[=] identifier[hydrogenAdjunct] operator[SEP] identifier[translate] operator[SEP] identifier[nudgeX] , Other[0] operator[SEP] operator[SEP] identifier[hydrogenCount] operator[=] identifier[hydrogenCount] operator[SEP] identifier[translate] operator[SEP] identifier[nudgeX] , Other[0] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[TextOutline] operator[>] identifier[adjuncts] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TextOutline] operator[>] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hydrogens] operator[>] Other[0] operator[SEP] identifier[adjuncts] operator[SEP] identifier[add] operator[SEP] identifier[hydrogenAdjunct] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hydrogens] operator[>] Other[1] operator[SEP] identifier[adjuncts] operator[SEP] identifier[add] operator[SEP] identifier[hydrogenCount] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[charge] operator[!=] Other[0] operator[||] identifier[unpaired] operator[>] Other[0] operator[SEP] identifier[adjuncts] operator[SEP] identifier[add] operator[SEP] identifier[chargeAdjunct] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mass] operator[>] Other[0] operator[SEP] identifier[adjuncts] operator[SEP] identifier[add] operator[SEP] identifier[massAdjunct] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AtomSymbol] operator[SEP] identifier[element] , identifier[adjuncts] operator[SEP] operator[SEP]
}
|
public void encodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) {
switch (this.pbEncoding) {
case SWC:
this.swc.encode(s, lits, coeffs, rhs);
break;
default:
throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.pbEncoding);
}
} | class class_name[name] begin[{]
method[encodePB, return_type[void], modifier[public], parameter[s, lits, coeffs, rhs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['SWC'], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=swc, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=coeffs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rhs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown pseudo-Boolean encoding: "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pbEncoding, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])], expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pbEncoding, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[encodePB] operator[SEP] Keyword[final] identifier[MiniSatStyleSolver] identifier[s] , Keyword[final] identifier[LNGIntVector] identifier[lits] , Keyword[final] identifier[LNGIntVector] identifier[coeffs] , Keyword[int] identifier[rhs] operator[SEP] {
Keyword[switch] operator[SEP] Keyword[this] operator[SEP] identifier[pbEncoding] operator[SEP] {
Keyword[case] identifier[SWC] operator[:] Keyword[this] operator[SEP] identifier[swc] operator[SEP] identifier[encode] operator[SEP] identifier[s] , identifier[lits] , identifier[coeffs] , identifier[rhs] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[pbEncoding] operator[SEP] operator[SEP]
}
}
|
public <K, V> RedisConnection<K, V> connect(RedisCodec<K, V> codec) {
return new RedisConnection<K, V>(connectAsync(codec));
} | class class_name[name] begin[{]
method[connect, return_type[type[RedisConnection]], modifier[public], parameter[codec]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=codec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=connectAsync, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=RedisConnection, sub_type=None))]
end[}]
END[}] | Keyword[public] operator[<] identifier[K] , identifier[V] operator[>] identifier[RedisConnection] operator[<] identifier[K] , identifier[V] operator[>] identifier[connect] operator[SEP] identifier[RedisCodec] operator[<] identifier[K] , identifier[V] operator[>] identifier[codec] operator[SEP] {
Keyword[return] Keyword[new] identifier[RedisConnection] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[connectAsync] operator[SEP] identifier[codec] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Boolean evaluate() {
switch (getType()) {
case OR: {
if (operands.size() < 2) {
throw new IllegalArgumentException(
"An OR expression must have at least 2 operands");
}
for (BooleanExpression operand : operands) {
if (operand.evaluate()) {
return true;
}
}
return false;
}
case AND: {
if (operands.size() < 2) {
throw new IllegalArgumentException(
"An AND expression must have at least 2 operands");
}
for (BooleanExpression operand : operands) {
if (!operand.evaluate()) {
return false;
}
}
return true;
}
case NOT: {
if (operands.size() != 1) {
throw new IllegalArgumentException("A NOT expression must have 1 operand");
}
return !operands.get(0).evaluate();
}
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
} | class class_name[name] begin[{]
method[evaluate, return_type[type[Boolean]], modifier[public], parameter[]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['OR'], statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=operands, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An OR expression must have at least 2 operands")], 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)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=evaluate, postfix_operators=[], prefix_operators=[], qualifier=operand, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=operands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=operand)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BooleanExpression, sub_type=None))), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])]), SwitchStatementCase(case=['AND'], statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=operands, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An AND expression must have at least 2 operands")], 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)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=evaluate, postfix_operators=[], prefix_operators=['!'], qualifier=operand, 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=operands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=operand)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BooleanExpression, sub_type=None))), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])]), SwitchStatementCase(case=['NOT'], statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=operands, 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=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A NOT expression must have 1 operand")], 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)])), ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=operands, selectors=[MethodInvocation(arguments=[], member=evaluate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown type: "), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Boolean] identifier[evaluate] operator[SEP] operator[SEP] {
Keyword[switch] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[OR] operator[:] {
Keyword[if] operator[SEP] identifier[operands] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[BooleanExpression] identifier[operand] operator[:] identifier[operands] operator[SEP] {
Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[case] identifier[AND] operator[:] {
Keyword[if] operator[SEP] identifier[operands] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[BooleanExpression] identifier[operand] operator[:] identifier[operands] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[operand] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[case] identifier[NOT] operator[:] {
Keyword[if] operator[SEP] identifier[operands] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[!] identifier[operands] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[evaluate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[type] operator[SEP] operator[SEP]
}
}
|
public static String getCurrentStyle(Element element, Style style) {
return getStyleImpl().getCurrentStyle(element, style.toString());
} | class class_name[name] begin[{]
method[getCurrentStyle, return_type[type[String]], modifier[public static], parameter[element, style]] begin[{]
return[call[.getStyleImpl, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getCurrentStyle] operator[SEP] identifier[Element] identifier[element] , identifier[Style] identifier[style] operator[SEP] {
Keyword[return] identifier[getStyleImpl] operator[SEP] operator[SEP] operator[SEP] identifier[getCurrentStyle] operator[SEP] identifier[element] , identifier[style] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Resource create(String hostname, String name, String id, String type) {
Map<String, String> labels = new LinkedHashMap<String, String>();
labels.put(HOSTNAME_KEY, checkNotNull(hostname, "hostname"));
labels.put(NAME_KEY, checkNotNull(name, "name"));
labels.put(ID_KEY, checkNotNull(id, "id"));
labels.put(TYPE_KEY, checkNotNull(type, "type"));
return Resource.create(TYPE, labels);
} | class class_name[name] begin[{]
method[create, return_type[type[Resource]], modifier[public static], parameter[hostname, name, id, type]] begin[{]
local_variable[type[Map], labels]
call[labels.put, parameter[member[.HOSTNAME_KEY], call[.checkNotNull, parameter[member[.hostname], literal["hostname"]]]]]
call[labels.put, parameter[member[.NAME_KEY], call[.checkNotNull, parameter[member[.name], literal["name"]]]]]
call[labels.put, parameter[member[.ID_KEY], call[.checkNotNull, parameter[member[.id], literal["id"]]]]]
call[labels.put, parameter[member[.TYPE_KEY], call[.checkNotNull, parameter[member[.type], literal["type"]]]]]
return[call[Resource.create, parameter[member[.TYPE], member[.labels]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Resource] identifier[create] operator[SEP] identifier[String] identifier[hostname] , identifier[String] identifier[name] , identifier[String] identifier[id] , identifier[String] identifier[type] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[labels] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[put] operator[SEP] identifier[HOSTNAME_KEY] , identifier[checkNotNull] operator[SEP] identifier[hostname] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[put] operator[SEP] identifier[NAME_KEY] , identifier[checkNotNull] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[put] operator[SEP] identifier[ID_KEY] , identifier[checkNotNull] operator[SEP] identifier[id] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[labels] operator[SEP] identifier[put] operator[SEP] identifier[TYPE_KEY] , identifier[checkNotNull] operator[SEP] identifier[type] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Resource] operator[SEP] identifier[create] operator[SEP] identifier[TYPE] , identifier[labels] operator[SEP] operator[SEP]
}
|
public void marshall(ListHandshakesForAccountRequest listHandshakesForAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (listHandshakesForAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listHandshakesForAccountRequest.getFilter(), FILTER_BINDING);
protocolMarshaller.marshall(listHandshakesForAccountRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listHandshakesForAccountRequest.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[listHandshakesForAccountRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.listHandshakesForAccountRequest], ==, 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=getFilter, postfix_operators=[], prefix_operators=[], qualifier=listHandshakesForAccountRequest, selectors=[], type_arguments=None), MemberReference(member=FILTER_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=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=listHandshakesForAccountRequest, 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=listHandshakesForAccountRequest, 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[ListHandshakesForAccountRequest] identifier[listHandshakesForAccountRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[listHandshakesForAccountRequest] 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[listHandshakesForAccountRequest] operator[SEP] identifier[getFilter] operator[SEP] operator[SEP] , identifier[FILTER_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listHandshakesForAccountRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listHandshakesForAccountRequest] 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 void setOperator(com.google.api.ads.admanager.axis.v201811.AudienceSegmentCriteriaComparisonOperator operator) {
this.operator = operator;
} | class class_name[name] begin[{]
method[setOperator, return_type[void], modifier[public], parameter[operator]] begin[{]
assign[THIS[member[None.operator]], member[.operator]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setOperator] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201811] operator[SEP] identifier[AudienceSegmentCriteriaComparisonOperator] identifier[operator] operator[SEP] {
Keyword[this] operator[SEP] identifier[operator] operator[=] identifier[operator] operator[SEP]
}
|
public int getOntologyTermDistance(OntologyTerm ontologyTerm1, OntologyTerm ontologyTerm2) {
String nodePath1 = getOntologyTermNodePath(ontologyTerm1);
String nodePath2 = getOntologyTermNodePath(ontologyTerm2);
if (StringUtils.isEmpty(nodePath1)) {
throw new MolgenisDataAccessException(
"The nodePath cannot be null : " + ontologyTerm1.toString());
}
if (StringUtils.isEmpty(nodePath2)) {
throw new MolgenisDataAccessException(
"The nodePath cannot be null : " + ontologyTerm2.toString());
}
return calculateNodePathDistance(nodePath1, nodePath2);
} | class class_name[name] begin[{]
method[getOntologyTermDistance, return_type[type[int]], modifier[public], parameter[ontologyTerm1, ontologyTerm2]] begin[{]
local_variable[type[String], nodePath1]
local_variable[type[String], nodePath2]
if[call[StringUtils.isEmpty, parameter[member[.nodePath1]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The nodePath cannot be null : "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=ontologyTerm1, 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=MolgenisDataAccessException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[StringUtils.isEmpty, parameter[member[.nodePath2]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The nodePath cannot be null : "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=ontologyTerm2, 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=MolgenisDataAccessException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.calculateNodePathDistance, parameter[member[.nodePath1], member[.nodePath2]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getOntologyTermDistance] operator[SEP] identifier[OntologyTerm] identifier[ontologyTerm1] , identifier[OntologyTerm] identifier[ontologyTerm2] operator[SEP] {
identifier[String] identifier[nodePath1] operator[=] identifier[getOntologyTermNodePath] operator[SEP] identifier[ontologyTerm1] operator[SEP] operator[SEP] identifier[String] identifier[nodePath2] operator[=] identifier[getOntologyTermNodePath] operator[SEP] identifier[ontologyTerm2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[nodePath1] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MolgenisDataAccessException] operator[SEP] literal[String] operator[+] identifier[ontologyTerm1] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[nodePath2] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MolgenisDataAccessException] operator[SEP] literal[String] operator[+] identifier[ontologyTerm2] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[calculateNodePathDistance] operator[SEP] identifier[nodePath1] , identifier[nodePath2] operator[SEP] operator[SEP]
}
|
protected boolean add(Object socketOrChannel, final ItemHolder holder)
{
if (socketOrChannel == null) {
Socket socket = holder.socket();
SelectableChannel ch = holder.item().getRawSocket();
if (ch == null) {
// not a channel
assert (socket != null);
socketOrChannel = socket;
}
else if (socket == null) {
// not a socket
socketOrChannel = ch;
}
}
assert (socketOrChannel != null);
CompositePollItem aggregate = items.get(socketOrChannel);
if (aggregate == null) {
aggregate = new CompositePollItem(socketOrChannel);
items.put(socketOrChannel, aggregate);
}
final boolean rc = aggregate.holders.add(holder);
if (rc) {
all.add(aggregate);
}
return rc;
} | class class_name[name] begin[{]
method[add, return_type[type[boolean]], modifier[protected], parameter[socketOrChannel, holder]] begin[{]
if[binary_operation[member[.socketOrChannel], ==, literal[null]]] begin[{]
local_variable[type[Socket], socket]
local_variable[type[SelectableChannel], ch]
if[binary_operation[member[.ch], ==, literal[null]]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
assign[member[.socketOrChannel], member[.socket]]
else begin[{]
if[binary_operation[member[.socket], ==, literal[null]]] begin[{]
assign[member[.socketOrChannel], member[.ch]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=socketOrChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
local_variable[type[CompositePollItem], aggregate]
if[binary_operation[member[.aggregate], ==, literal[null]]] begin[{]
assign[member[.aggregate], ClassCreator(arguments=[MemberReference(member=socketOrChannel, 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=CompositePollItem, sub_type=None))]
call[items.put, parameter[member[.socketOrChannel], member[.aggregate]]]
else begin[{]
None
end[}]
local_variable[type[boolean], rc]
if[member[.rc]] begin[{]
call[all.add, parameter[member[.aggregate]]]
else begin[{]
None
end[}]
return[member[.rc]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[add] operator[SEP] identifier[Object] identifier[socketOrChannel] , Keyword[final] identifier[ItemHolder] identifier[holder] operator[SEP] {
Keyword[if] operator[SEP] identifier[socketOrChannel] operator[==] Other[null] operator[SEP] {
identifier[Socket] identifier[socket] operator[=] identifier[holder] operator[SEP] identifier[socket] operator[SEP] operator[SEP] operator[SEP] identifier[SelectableChannel] identifier[ch] operator[=] identifier[holder] operator[SEP] identifier[item] operator[SEP] operator[SEP] operator[SEP] identifier[getRawSocket] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ch] operator[==] Other[null] operator[SEP] {
Keyword[assert] operator[SEP] identifier[socket] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[socketOrChannel] operator[=] identifier[socket] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[socket] operator[==] Other[null] operator[SEP] {
identifier[socketOrChannel] operator[=] identifier[ch] operator[SEP]
}
}
Keyword[assert] operator[SEP] identifier[socketOrChannel] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[CompositePollItem] identifier[aggregate] operator[=] identifier[items] operator[SEP] identifier[get] operator[SEP] identifier[socketOrChannel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aggregate] operator[==] Other[null] operator[SEP] {
identifier[aggregate] operator[=] Keyword[new] identifier[CompositePollItem] operator[SEP] identifier[socketOrChannel] operator[SEP] operator[SEP] identifier[items] operator[SEP] identifier[put] operator[SEP] identifier[socketOrChannel] , identifier[aggregate] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[boolean] identifier[rc] operator[=] identifier[aggregate] operator[SEP] identifier[holders] operator[SEP] identifier[add] operator[SEP] identifier[holder] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[SEP] {
identifier[all] operator[SEP] identifier[add] operator[SEP] identifier[aggregate] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rc] operator[SEP]
}
|
public static StringBuilder get(FacesContext facesContext, String stringBuilderKey)
{
Map<Object, Object> attributes = facesContext.getAttributes();
StringBuilder sb = (StringBuilder) attributes.get(stringBuilderKey);
if (sb == null)
{
sb = new StringBuilder();
attributes.put(stringBuilderKey, sb);
}
else
{
// clear out the stringBuilder by setting the length to 0
sb.setLength(0);
}
return sb;
} | class class_name[name] begin[{]
method[get, return_type[type[StringBuilder]], modifier[public static], parameter[facesContext, stringBuilderKey]] begin[{]
local_variable[type[Map], attributes]
local_variable[type[StringBuilder], sb]
if[binary_operation[member[.sb], ==, literal[null]]] begin[{]
assign[member[.sb], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None))]
call[attributes.put, parameter[member[.stringBuilderKey], member[.sb]]]
else begin[{]
call[sb.setLength, parameter[literal[0]]]
end[}]
return[member[.sb]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StringBuilder] identifier[get] operator[SEP] identifier[FacesContext] identifier[facesContext] , identifier[String] identifier[stringBuilderKey] operator[SEP] {
identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[attributes] operator[=] identifier[facesContext] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] operator[SEP] identifier[StringBuilder] operator[SEP] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[stringBuilderKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sb] operator[==] Other[null] operator[SEP] {
identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[attributes] operator[SEP] identifier[put] operator[SEP] identifier[stringBuilderKey] , identifier[sb] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP]
}
|
public static void establishSSLContext(HttpClient client, int port, LibertyServer server) {
establishSSLContext(client, port, server, null, null, null, null, "TLSv1.2");
} | class class_name[name] begin[{]
method[establishSSLContext, return_type[void], modifier[public static], parameter[client, port, server]] begin[{]
call[.establishSSLContext, parameter[member[.client], member[.port], member[.server], literal[null], literal[null], literal[null], literal[null], literal["TLSv1.2"]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[establishSSLContext] operator[SEP] identifier[HttpClient] identifier[client] , Keyword[int] identifier[port] , identifier[LibertyServer] identifier[server] operator[SEP] {
identifier[establishSSLContext] operator[SEP] identifier[client] , identifier[port] , identifier[server] , Other[null] , Other[null] , Other[null] , Other[null] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public Object instantiateItem(ViewGroup container, int position) {
LayoutInflater inflater = (LayoutInflater) container.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.fullscreen_image, null);
ImageView imageView = (ImageView) view.findViewById(R.id.iv);
final LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll);
String image = images.get(position);
Context context = imageView.getContext();
int width = DisplayUtility.getScreenWidth(context);
fullScreenImageLoader.loadFullScreenImage(imageView, image, width, linearLayout);
container.addView(view, 0);
return view;
} | class class_name[name] begin[{]
method[instantiateItem, return_type[type[Object]], modifier[public], parameter[container, position]] begin[{]
local_variable[type[LayoutInflater], inflater]
local_variable[type[View], view]
local_variable[type[ImageView], imageView]
local_variable[type[LinearLayout], linearLayout]
local_variable[type[String], image]
local_variable[type[Context], context]
local_variable[type[int], width]
call[fullScreenImageLoader.loadFullScreenImage, parameter[member[.imageView], member[.image], member[.width], member[.linearLayout]]]
call[container.addView, parameter[member[.view], literal[0]]]
return[member[.view]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[instantiateItem] operator[SEP] identifier[ViewGroup] identifier[container] , Keyword[int] identifier[position] operator[SEP] {
identifier[LayoutInflater] identifier[inflater] operator[=] operator[SEP] identifier[LayoutInflater] operator[SEP] identifier[container] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getSystemService] operator[SEP] identifier[Context] operator[SEP] identifier[LAYOUT_INFLATER_SERVICE] operator[SEP] operator[SEP] identifier[View] identifier[view] operator[=] identifier[inflater] operator[SEP] identifier[inflate] operator[SEP] identifier[R] operator[SEP] identifier[layout] operator[SEP] identifier[fullscreen_image] , Other[null] operator[SEP] operator[SEP] identifier[ImageView] identifier[imageView] operator[=] operator[SEP] identifier[ImageView] operator[SEP] identifier[view] operator[SEP] identifier[findViewById] operator[SEP] identifier[R] operator[SEP] identifier[id] operator[SEP] identifier[iv] operator[SEP] operator[SEP] Keyword[final] identifier[LinearLayout] identifier[linearLayout] operator[=] operator[SEP] identifier[LinearLayout] operator[SEP] identifier[view] operator[SEP] identifier[findViewById] operator[SEP] identifier[R] operator[SEP] identifier[id] operator[SEP] identifier[ll] operator[SEP] operator[SEP] identifier[String] identifier[image] operator[=] identifier[images] operator[SEP] identifier[get] operator[SEP] identifier[position] operator[SEP] operator[SEP] identifier[Context] identifier[context] operator[=] identifier[imageView] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[width] operator[=] identifier[DisplayUtility] operator[SEP] identifier[getScreenWidth] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[fullScreenImageLoader] operator[SEP] identifier[loadFullScreenImage] operator[SEP] identifier[imageView] , identifier[image] , identifier[width] , identifier[linearLayout] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[addView] operator[SEP] identifier[view] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[view] operator[SEP]
}
|
public String getLayer()
{
String str = null;
if ((layer >= 0) && (layer < layerLabels.length))
{
str = layerLabels[layer];
}
return str;
} | class class_name[name] begin[{]
method[getLayer, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], str]
if[binary_operation[binary_operation[member[.layer], >=, literal[0]], &&, binary_operation[member[.layer], <, member[layerLabels.length]]]] begin[{]
assign[member[.str], member[.layerLabels]]
else begin[{]
None
end[}]
return[member[.str]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getLayer] operator[SEP] operator[SEP] {
identifier[String] identifier[str] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[layer] operator[>=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[layer] operator[<] identifier[layerLabels] operator[SEP] identifier[length] operator[SEP] operator[SEP] {
identifier[str] operator[=] identifier[layerLabels] operator[SEP] identifier[layer] operator[SEP] operator[SEP]
}
Keyword[return] identifier[str] operator[SEP]
}
|
public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple0> split5() {
return new Tuple2<>(limit5(), skip5());
} | class class_name[name] begin[{]
method[split5, return_type[type[Tuple2]], modifier[final public], parameter[]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=limit5, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=skip5, 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=Tuple2, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Tuple2] operator[<] identifier[Tuple5] operator[<] identifier[T1] , identifier[T2] , identifier[T3] , identifier[T4] , identifier[T5] operator[>] , identifier[Tuple0] operator[>] identifier[split5] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Tuple2] operator[<] operator[>] operator[SEP] identifier[limit5] operator[SEP] operator[SEP] , identifier[skip5] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private Set<OWLEntity> getChangeSignature() {
Set<OWLEntity> result = new HashSet<OWLEntity>();
final OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException> visitor = new OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException>() {
@Override
public Set<OWLEntity> visit(AddAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(AddOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(SetOntologyIDData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(AddImportData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(RemoveImportData data) throws RuntimeException {
return Collections.emptySet();
}
};
for(OWLOntologyChangeRecord record : changeRecords) {
result.addAll(record.getData().accept(visitor));
}
return result;
} | class class_name[name] begin[{]
method[getChangeSignature, return_type[type[Set]], modifier[private], parameter[]] begin[{]
local_variable[type[Set], result]
local_variable[type[OWLOntologyChangeDataVisitor], visitor]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[MethodInvocation(arguments=[MemberReference(member=visitor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=changeRecords, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=record)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OWLOntologyChangeRecord, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[getChangeSignature] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[result] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[OWLEntity] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[OWLOntologyChangeDataVisitor] operator[<] identifier[Set] operator[<] identifier[OWLEntity] operator[>] , identifier[RuntimeException] operator[>] identifier[visitor] operator[=] Keyword[new] identifier[OWLOntologyChangeDataVisitor] operator[<] identifier[Set] operator[<] identifier[OWLEntity] operator[>] , identifier[RuntimeException] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[AddAxiomData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[data] operator[SEP] identifier[getAxiom] operator[SEP] operator[SEP] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[RemoveAxiomData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[data] operator[SEP] identifier[getAxiom] operator[SEP] operator[SEP] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[AddOntologyAnnotationData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[data] operator[SEP] identifier[getAnnotation] operator[SEP] operator[SEP] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[RemoveOntologyAnnotationData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[data] operator[SEP] identifier[getAnnotation] operator[SEP] operator[SEP] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[SetOntologyIDData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[AddImportData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[OWLEntity] operator[>] identifier[visit] operator[SEP] identifier[RemoveImportData] identifier[data] operator[SEP] Keyword[throws] identifier[RuntimeException] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[for] operator[SEP] identifier[OWLOntologyChangeRecord] identifier[record] operator[:] identifier[changeRecords] operator[SEP] {
identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[record] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[accept] operator[SEP] identifier[visitor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static void writeTo(Object object, String path) throws IOException, NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
OutputStream os = new FileOutputStream(path);
ReflectUtils.invokeMethod(object, "write", new Class<?>[]{OutputStream.class}, new Object[]{os});
os.close();
logger.info("文件已输出:" + path);
} | class class_name[name] begin[{]
method[writeTo, return_type[void], modifier[public static], parameter[object, path]] begin[{]
local_variable[type[OutputStream], os]
call[ReflectUtils.invokeMethod, parameter[member[.object], literal["write"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutputStream, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=None, name=Class, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=os, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
call[os.close, parameter[]]
call[logger.info, parameter[binary_operation[literal["文件已输出:"], +, member[.path]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeTo] operator[SEP] identifier[Object] identifier[object] , identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IOException] , identifier[NoSuchMethodException] , identifier[IllegalAccessException] , identifier[InvocationTargetException] {
identifier[OutputStream] identifier[os] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[ReflectUtils] operator[SEP] identifier[invokeMethod] operator[SEP] identifier[object] , literal[String] , Keyword[new] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] {
identifier[OutputStream] operator[SEP] Keyword[class]
} , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[os]
} operator[SEP] operator[SEP] identifier[os] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[path] operator[SEP] operator[SEP]
}
|
public synchronized SessionLogs getAllLogsForSession(SessionId sessionId) {
SessionLogs sessionLogs = new SessionLogs();
if (perSessionDriverEntries.containsKey(sessionId)) {
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
for (String logType : typeToEntriesMap.keySet()) {
sessionLogs.addLog(logType, typeToEntriesMap.get(logType));
}
perSessionDriverEntries.remove(sessionId);
}
return sessionLogs;
} | class class_name[name] begin[{]
method[getAllLogsForSession, return_type[type[SessionLogs]], modifier[synchronized public], parameter[sessionId]] begin[{]
local_variable[type[SessionLogs], sessionLogs]
if[call[perSessionDriverEntries.containsKey, parameter[member[.sessionId]]]] begin[{]
local_variable[type[Map], typeToEntriesMap]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=logType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=logType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=typeToEntriesMap, selectors=[], type_arguments=None)], member=addLog, postfix_operators=[], prefix_operators=[], qualifier=sessionLogs, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=typeToEntriesMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=logType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[perSessionDriverEntries.remove, parameter[member[.sessionId]]]
else begin[{]
None
end[}]
return[member[.sessionLogs]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[SessionLogs] identifier[getAllLogsForSession] operator[SEP] identifier[SessionId] identifier[sessionId] operator[SEP] {
identifier[SessionLogs] identifier[sessionLogs] operator[=] Keyword[new] identifier[SessionLogs] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[perSessionDriverEntries] operator[SEP] identifier[containsKey] operator[SEP] identifier[sessionId] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[LogEntries] operator[>] identifier[typeToEntriesMap] operator[=] identifier[perSessionDriverEntries] operator[SEP] identifier[get] operator[SEP] identifier[sessionId] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[logType] operator[:] identifier[typeToEntriesMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[sessionLogs] operator[SEP] identifier[addLog] operator[SEP] identifier[logType] , identifier[typeToEntriesMap] operator[SEP] identifier[get] operator[SEP] identifier[logType] operator[SEP] operator[SEP] operator[SEP]
}
identifier[perSessionDriverEntries] operator[SEP] identifier[remove] operator[SEP] identifier[sessionId] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sessionLogs] operator[SEP]
}
|
public <E> E getServiceInterface(Class<E> serviceInterface, SPF spf) {
if (spf == null || serviceInterface == null) {
throw new NullPointerException();
}
return spf
.<SPFServiceExecutor> getComponent(SPF.SERVICE_EXECUTION)
.createStub(this, serviceInterface, getClass().getClassLoader());
} | class class_name[name] begin[{]
method[getServiceInterface, return_type[type[E]], modifier[public], parameter[serviceInterface, spf]] begin[{]
if[binary_operation[binary_operation[member[.spf], ==, literal[null]], ||, binary_operation[member[.serviceInterface], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.spf, parameter[member[SPF.SERVICE_EXECUTION]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[E] operator[>] identifier[E] identifier[getServiceInterface] operator[SEP] identifier[Class] operator[<] identifier[E] operator[>] identifier[serviceInterface] , identifier[SPF] identifier[spf] operator[SEP] {
Keyword[if] operator[SEP] identifier[spf] operator[==] Other[null] operator[||] identifier[serviceInterface] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[spf] operator[SEP] operator[<] identifier[SPFServiceExecutor] operator[>] identifier[getComponent] operator[SEP] identifier[SPF] operator[SEP] identifier[SERVICE_EXECUTION] operator[SEP] operator[SEP] identifier[createStub] operator[SEP] Keyword[this] , identifier[serviceInterface] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean isWebsocketRequest(HttpServletRequest request) {
String upgradeHeader = request.getHeader("Upgrade");
return upgradeHeader != null && upgradeHeader.toLowerCase().contains("websocket");
} | class class_name[name] begin[{]
method[isWebsocketRequest, return_type[type[boolean]], modifier[private], parameter[request]] begin[{]
local_variable[type[String], upgradeHeader]
return[binary_operation[binary_operation[member[.upgradeHeader], !=, literal[null]], &&, call[upgradeHeader.toLowerCase, parameter[]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isWebsocketRequest] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[String] identifier[upgradeHeader] operator[=] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[upgradeHeader] operator[!=] Other[null] operator[&&] identifier[upgradeHeader] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public BatchGetResourceConfigResult batchGetResourceConfig(BatchGetResourceConfigRequest request) {
request = beforeClientExecution(request);
return executeBatchGetResourceConfig(request);
} | class class_name[name] begin[{]
method[batchGetResourceConfig, return_type[type[BatchGetResourceConfigResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeBatchGetResourceConfig, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[BatchGetResourceConfigResult] identifier[batchGetResourceConfig] operator[SEP] identifier[BatchGetResourceConfigRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeBatchGetResourceConfig] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) {
final String projectName = "org.eclipse.xtext.common.types";
new StandaloneSetup() {{
registerProject(new File(".project").getAbsoluteFile());
}};
new DirectoryCleaner() {{
setDirectory("../"+projectName+"/emf-gen");
}}.invoke(null);
new EcoreGenerator() {{
setGenModel("platform:/resource/"+projectName+"/model/JavaVMTypes.genmodel");
addSrcPath("platform:/resource/"+projectName+"/src");
setLineDelimiter("\n");
}}.invoke(null);
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[String], projectName]
ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".project")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getAbsoluteFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=registerProject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StandaloneSetup, sub_type=None))
ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="../"), operandr=MemberReference(member=projectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/emf-gen"), operator=+)], member=setDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DirectoryCleaner, sub_type=None))
ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="platform:/resource/"), operandr=MemberReference(member=projectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/model/JavaVMTypes.genmodel"), operator=+)], member=setGenModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="platform:/resource/"), operandr=MemberReference(member=projectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/src"), operator=+)], member=addSrcPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=setLineDelimiter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=EcoreGenerator, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[final] identifier[String] identifier[projectName] operator[=] literal[String] operator[SEP] Keyword[new] identifier[StandaloneSetup] operator[SEP] operator[SEP] {
{
identifier[registerProject] operator[SEP] Keyword[new] identifier[File] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getAbsoluteFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] Keyword[new] identifier[DirectoryCleaner] operator[SEP] operator[SEP] {
{
identifier[setDirectory] operator[SEP] literal[String] operator[+] identifier[projectName] operator[+] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[invoke] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[new] identifier[EcoreGenerator] operator[SEP] operator[SEP] {
{
identifier[setGenModel] operator[SEP] literal[String] operator[+] identifier[projectName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[addSrcPath] operator[SEP] literal[String] operator[+] identifier[projectName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[setLineDelimiter] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[invoke] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.