code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
static ParameterizedType newParameterizedTypeWithOwner(
Type ownerType, Class<?> rawType, Type... arguments) {
if (ownerType == null) {
return newParameterizedType(rawType, arguments);
}
// ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE
checkNotNull(arguments);
checkArgument(rawType.getEnclosingClass() != null, "Owner type for unenclosed %s", rawType);
return new ParameterizedTypeImpl(ownerType, rawType, arguments);
} | class class_name[name] begin[{]
method[newParameterizedTypeWithOwner, return_type[type[ParameterizedType]], modifier[static], parameter[ownerType, rawType, arguments]] begin[{]
if[binary_operation[member[.ownerType], ==, literal[null]]] begin[{]
return[call[.newParameterizedType, parameter[member[.rawType], member[.arguments]]]]
else begin[{]
None
end[}]
call[.checkNotNull, parameter[member[.arguments]]]
call[.checkArgument, parameter[binary_operation[call[rawType.getEnclosingClass, parameter[]], !=, literal[null]], literal["Owner type for unenclosed %s"], member[.rawType]]]
return[ClassCreator(arguments=[MemberReference(member=ownerType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arguments, 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=ParameterizedTypeImpl, sub_type=None))]
end[}]
END[}] | Keyword[static] identifier[ParameterizedType] identifier[newParameterizedTypeWithOwner] operator[SEP] identifier[Type] identifier[ownerType] , identifier[Class] operator[<] operator[?] operator[>] identifier[rawType] , identifier[Type] operator[...] identifier[arguments] operator[SEP] {
Keyword[if] operator[SEP] identifier[ownerType] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[newParameterizedType] operator[SEP] identifier[rawType] , identifier[arguments] operator[SEP] operator[SEP]
}
identifier[checkNotNull] operator[SEP] identifier[arguments] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[rawType] operator[SEP] identifier[getEnclosingClass] operator[SEP] operator[SEP] operator[!=] Other[null] , literal[String] , identifier[rawType] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ParameterizedTypeImpl] operator[SEP] identifier[ownerType] , identifier[rawType] , identifier[arguments] operator[SEP] operator[SEP]
}
|
@Override
public EClass getIfcClassification() {
if (ifcClassificationEClass == null) {
ifcClassificationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(96);
}
return ifcClassificationEClass;
} | class class_name[name] begin[{]
method[getIfcClassification, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcClassificationEClass], ==, literal[null]]] begin[{]
assign[member[.ifcClassificationEClass], 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=96)], 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[.ifcClassificationEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcClassification] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcClassificationEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcClassificationEClass] 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[96] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcClassificationEClass] operator[SEP]
}
|
protected String getOverwriteValue(String fieldname) {
ActionContext ctx = ServletActionContext.getContext();
ValueStack stack = ctx.getValueStack();
Map<Object ,Object> overrideMap = stack.getExprOverrides();
// If convertion error has not, do nothing.
if ( overrideMap == null || overrideMap.isEmpty()) {
return null;
}
if (! overrideMap.containsKey(fieldname)) {
return null;
}
String convertionValue = (String)overrideMap.get(fieldname);
// Struts2-Conponent is wrapped String quote, which erase for output value.
String altString = StringEscapeUtils.unescapeJava(convertionValue);
altString = altString.substring(1, altString.length() -1);
return altString;
} | class class_name[name] begin[{]
method[getOverwriteValue, return_type[type[String]], modifier[protected], parameter[fieldname]] begin[{]
local_variable[type[ActionContext], ctx]
local_variable[type[ValueStack], stack]
local_variable[type[Map], overrideMap]
if[binary_operation[binary_operation[member[.overrideMap], ==, literal[null]], ||, call[overrideMap.isEmpty, parameter[]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[overrideMap.containsKey, parameter[member[.fieldname]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], convertionValue]
local_variable[type[String], altString]
assign[member[.altString], call[altString.substring, parameter[literal[1], binary_operation[call[altString.length, parameter[]], -, literal[1]]]]]
return[member[.altString]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getOverwriteValue] operator[SEP] identifier[String] identifier[fieldname] operator[SEP] {
identifier[ActionContext] identifier[ctx] operator[=] identifier[ServletActionContext] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[ValueStack] identifier[stack] operator[=] identifier[ctx] operator[SEP] identifier[getValueStack] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[overrideMap] operator[=] identifier[stack] operator[SEP] identifier[getExprOverrides] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[overrideMap] operator[==] Other[null] operator[||] identifier[overrideMap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[overrideMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[fieldname] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[convertionValue] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[overrideMap] operator[SEP] identifier[get] operator[SEP] identifier[fieldname] operator[SEP] operator[SEP] identifier[String] identifier[altString] operator[=] identifier[StringEscapeUtils] operator[SEP] identifier[unescapeJava] operator[SEP] identifier[convertionValue] operator[SEP] operator[SEP] identifier[altString] operator[=] identifier[altString] operator[SEP] identifier[substring] operator[SEP] Other[1] , identifier[altString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[altString] operator[SEP]
}
|
public Variable newVariable() {
if (this.miniSat == null && this.cleaneLing == null)
return this.f.newCCVariable();
else if (this.miniSat != null) {
final int index = this.miniSat.underlyingSolver().newVar(!this.miniSat.initialPhase(), true);
final String name = FormulaFactory.CC_PREFIX + "MINISAT_" + index;
this.miniSat.underlyingSolver().addName(name, index);
return new EncodingAuxiliaryVariable(name, false);
} else
return new EncodingAuxiliaryVariable(this.cleaneLing.createNewVariableOnSolver(FormulaFactory.CC_PREFIX + "CLEANELING"), false);
} | class class_name[name] begin[{]
method[newVariable, return_type[type[Variable]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.miniSat]], ==, literal[null]], &&, binary_operation[THIS[member[None.cleaneLing]], ==, literal[null]]]] begin[{]
return[THIS[member[None.f]call[None.newCCVariable, parameter[]]]]
else begin[{]
if[binary_operation[THIS[member[None.miniSat]], !=, literal[null]]] begin[{]
local_variable[type[int], index]
local_variable[type[String], name]
THIS[member[None.miniSat]call[None.underlyingSolver, parameter[]]call[None.addName, parameter[member[.name], member[.index]]]]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EncodingAuxiliaryVariable, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cleaneLing, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=CC_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=FormulaFactory, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CLEANELING"), operator=+)], member=createNewVariableOnSolver, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EncodingAuxiliaryVariable, sub_type=None))]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[Variable] identifier[newVariable] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[miniSat] operator[==] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[cleaneLing] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[f] operator[SEP] identifier[newCCVariable] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[miniSat] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[int] identifier[index] operator[=] Keyword[this] operator[SEP] identifier[miniSat] operator[SEP] identifier[underlyingSolver] operator[SEP] operator[SEP] operator[SEP] identifier[newVar] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[miniSat] operator[SEP] identifier[initialPhase] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[=] identifier[FormulaFactory] operator[SEP] identifier[CC_PREFIX] operator[+] literal[String] operator[+] identifier[index] operator[SEP] Keyword[this] operator[SEP] identifier[miniSat] operator[SEP] identifier[underlyingSolver] operator[SEP] operator[SEP] operator[SEP] identifier[addName] operator[SEP] identifier[name] , identifier[index] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[EncodingAuxiliaryVariable] operator[SEP] identifier[name] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[return] Keyword[new] identifier[EncodingAuxiliaryVariable] operator[SEP] Keyword[this] operator[SEP] identifier[cleaneLing] operator[SEP] identifier[createNewVariableOnSolver] operator[SEP] identifier[FormulaFactory] operator[SEP] identifier[CC_PREFIX] operator[+] literal[String] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
|
public Participant getParticipant(String sessionId, String participantPrivateId) throws OpenViduException {
Session session = sessions.get(sessionId);
if (session == null) {
throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, "Session '" + sessionId + "' not found");
}
Participant participant = session.getParticipantByPrivateId(participantPrivateId);
if (participant == null) {
throw new OpenViduException(Code.USER_NOT_FOUND_ERROR_CODE,
"Participant '" + participantPrivateId + "' not found in session '" + sessionId + "'");
}
return participant;
} | class class_name[name] begin[{]
method[getParticipant, return_type[type[Participant]], modifier[public], parameter[sessionId, participantPrivateId]] begin[{]
local_variable[type[Session], session]
if[binary_operation[member[.session], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ROOM_NOT_FOUND_ERROR_CODE, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Session '"), operandr=MemberReference(member=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' not found"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OpenViduException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Participant], participant]
if[binary_operation[member[.participant], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=USER_NOT_FOUND_ERROR_CODE, postfix_operators=[], prefix_operators=[], qualifier=Code, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Participant '"), operandr=MemberReference(member=participantPrivateId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' not found in session '"), operator=+), operandr=MemberReference(member=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OpenViduException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.participant]]
end[}]
END[}] | Keyword[public] identifier[Participant] identifier[getParticipant] operator[SEP] identifier[String] identifier[sessionId] , identifier[String] identifier[participantPrivateId] operator[SEP] Keyword[throws] identifier[OpenViduException] {
identifier[Session] identifier[session] operator[=] identifier[sessions] operator[SEP] identifier[get] operator[SEP] identifier[sessionId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[session] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OpenViduException] operator[SEP] identifier[Code] operator[SEP] identifier[ROOM_NOT_FOUND_ERROR_CODE] , literal[String] operator[+] identifier[sessionId] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Participant] identifier[participant] operator[=] identifier[session] operator[SEP] identifier[getParticipantByPrivateId] operator[SEP] identifier[participantPrivateId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[participant] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OpenViduException] operator[SEP] identifier[Code] operator[SEP] identifier[USER_NOT_FOUND_ERROR_CODE] , literal[String] operator[+] identifier[participantPrivateId] operator[+] literal[String] operator[+] identifier[sessionId] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[participant] operator[SEP]
}
|
@SuppressWarnings("PMD.EmptyCatchBlock")
public static ResourceInfo resourceInfo(URL resource) {
try {
Path path = Paths.get(resource.toURI());
return new ResourceInfo(Files.isDirectory(path),
Files.getLastModifiedTime(path).toInstant()
.with(ChronoField.NANO_OF_SECOND, 0));
} catch (FileSystemNotFoundException | IOException
| URISyntaxException e) {
// Fall through
}
if ("jar".equals(resource.getProtocol())) {
try {
JarURLConnection conn
= (JarURLConnection) resource.openConnection();
JarEntry entry = conn.getJarEntry();
return new ResourceInfo(entry.isDirectory(),
entry.getLastModifiedTime().toInstant()
.with(ChronoField.NANO_OF_SECOND, 0));
} catch (IOException e) {
// Fall through
}
}
try {
URLConnection conn = resource.openConnection();
long lastModified = conn.getLastModified();
if (lastModified != 0) {
return new ResourceInfo(null, Instant.ofEpochMilli(
lastModified).with(ChronoField.NANO_OF_SECOND, 0));
}
} catch (IOException e) {
// Fall through
}
return new ResourceInfo(null, null);
} | class class_name[name] begin[{]
method[resourceInfo, return_type[type[ResourceInfo]], modifier[public static], parameter[resource]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=Paths, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLastModifiedTime, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[MethodInvocation(arguments=[], member=toInstant, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=NANO_OF_SECOND, postfix_operators=[], prefix_operators=[], qualifier=ChronoField, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=with, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceInfo, sub_type=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileSystemNotFoundException', 'IOException', 'URISyntaxException']))], finally_block=None, label=None, resources=None)
if[literal["jar"]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None)), name=conn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JarURLConnection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getJarEntry, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JarEntry, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getLastModifiedTime, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toInstant, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=NANO_OF_SECOND, postfix_operators=[], prefix_operators=[], qualifier=ChronoField, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=with, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceInfo, sub_type=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)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), name=conn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URLConnection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLastModified, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), name=lastModified)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[MemberReference(member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ofEpochMilli, postfix_operators=[], prefix_operators=[], qualifier=Instant, selectors=[MethodInvocation(arguments=[MemberReference(member=NANO_OF_SECOND, postfix_operators=[], prefix_operators=[], qualifier=ChronoField, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=with, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceInfo, sub_type=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)
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceInfo, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[ResourceInfo] identifier[resourceInfo] operator[SEP] identifier[URL] identifier[resource] operator[SEP] {
Keyword[try] {
identifier[Path] identifier[path] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[resource] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ResourceInfo] operator[SEP] identifier[Files] operator[SEP] identifier[isDirectory] operator[SEP] identifier[path] operator[SEP] , identifier[Files] operator[SEP] identifier[getLastModifiedTime] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[toInstant] operator[SEP] operator[SEP] operator[SEP] identifier[with] operator[SEP] identifier[ChronoField] operator[SEP] identifier[NANO_OF_SECOND] , Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileSystemNotFoundException] operator[|] identifier[IOException] operator[|] identifier[URISyntaxException] identifier[e] operator[SEP] {
}
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[resource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[JarURLConnection] identifier[conn] operator[=] operator[SEP] identifier[JarURLConnection] operator[SEP] identifier[resource] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] identifier[JarEntry] identifier[entry] operator[=] identifier[conn] operator[SEP] identifier[getJarEntry] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ResourceInfo] operator[SEP] identifier[entry] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getLastModifiedTime] operator[SEP] operator[SEP] operator[SEP] identifier[toInstant] operator[SEP] operator[SEP] operator[SEP] identifier[with] operator[SEP] identifier[ChronoField] operator[SEP] identifier[NANO_OF_SECOND] , Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
}
Keyword[try] {
identifier[URLConnection] identifier[conn] operator[=] identifier[resource] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[lastModified] operator[=] identifier[conn] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastModified] operator[!=] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[ResourceInfo] operator[SEP] Other[null] , identifier[Instant] operator[SEP] identifier[ofEpochMilli] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] identifier[with] operator[SEP] identifier[ChronoField] operator[SEP] identifier[NANO_OF_SECOND] , Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
Keyword[return] Keyword[new] identifier[ResourceInfo] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public void resetFromXml(String xmlResourcePath) throws JoranException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.reset();
configurator.doConfigure(LogbackHelper.class.getResource(xmlResourcePath));
} | class class_name[name] begin[{]
method[resetFromXml, return_type[void], modifier[public], parameter[xmlResourcePath]] begin[{]
local_variable[type[LoggerContext], context]
local_variable[type[JoranConfigurator], configurator]
call[configurator.setContext, parameter[member[.context]]]
call[context.reset, parameter[]]
call[configurator.doConfigure, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=xmlResourcePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=LogbackHelper, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[resetFromXml] operator[SEP] identifier[String] identifier[xmlResourcePath] operator[SEP] Keyword[throws] identifier[JoranException] {
identifier[LoggerContext] identifier[context] operator[=] operator[SEP] identifier[LoggerContext] operator[SEP] identifier[LoggerFactory] operator[SEP] identifier[getILoggerFactory] operator[SEP] operator[SEP] operator[SEP] identifier[JoranConfigurator] identifier[configurator] operator[=] Keyword[new] identifier[JoranConfigurator] operator[SEP] operator[SEP] operator[SEP] identifier[configurator] operator[SEP] identifier[setContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[configurator] operator[SEP] identifier[doConfigure] operator[SEP] identifier[LogbackHelper] operator[SEP] Keyword[class] operator[SEP] identifier[getResource] operator[SEP] identifier[xmlResourcePath] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public <T> T get(String key, Transcoder<T> tc) {
try {
return asyncGet(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for value", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else {
throw new RuntimeException("Exception waiting for value", e);
}
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for value: "
+ buildTimeoutMessage(operationTimeout, TimeUnit.MILLISECONDS), e);
}
} | class class_name[name] begin[{]
method[get, return_type[type[T]], modifier[public], parameter[key, tc]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asyncGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=operationTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Interrupted waiting for value"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException'])), CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=CancellationException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception waiting for value"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=CancellationException, sub_type=None)), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ExecutionException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timeout waiting for value: "), operandr=MethodInvocation(arguments=[MemberReference(member=operationTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=buildTimeoutMessage, postfix_operators=[], prefix_operators=[], qualifier=, 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=OperationTimeoutException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TimeoutException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[get] operator[SEP] identifier[String] identifier[key] , identifier[Transcoder] operator[<] identifier[T] operator[>] identifier[tc] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[asyncGet] operator[SEP] identifier[key] , identifier[tc] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[operationTimeout] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ExecutionException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[CancellationException] operator[SEP] {
Keyword[throw] operator[SEP] identifier[CancellationException] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[TimeoutException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OperationTimeoutException] operator[SEP] literal[String] operator[+] identifier[buildTimeoutMessage] operator[SEP] identifier[operationTimeout] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static AbstractRunner<Long, Long> instantiateRecommender(final Properties properties) {
if (properties.getProperty(RECOMMENDER) == null) {
System.out.println("No recommenderClass specified, exiting.");
return null;
}
if (properties.getProperty(TRAINING_SET) == null) {
System.out.println("No training set specified, exiting.");
return null;
}
if (properties.getProperty(TEST_SET) == null) {
System.out.println("No training set specified, exiting.");
return null;
}
AbstractRunner<Long, Long> rr = null;
if (properties.getProperty(FRAMEWORK).equals(MAHOUT)) {
rr = new MahoutRecommenderRunner(properties);
} else if (properties.getProperty(FRAMEWORK).equals(LENSKIT)) {
rr = new LenskitRecommenderRunner(properties);
} else if (properties.getProperty(FRAMEWORK).equals(RANKSYS)) {
rr = new RanksysRecommenderRunner(properties);
}
return rr;
} | class class_name[name] begin[{]
method[instantiateRecommender, return_type[type[AbstractRunner]], modifier[public static], parameter[properties]] begin[{]
if[binary_operation[call[properties.getProperty, parameter[member[.RECOMMENDER]]], ==, literal[null]]] begin[{]
call[System.out.println, parameter[literal["No recommenderClass specified, exiting."]]]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[properties.getProperty, parameter[member[.TRAINING_SET]]], ==, literal[null]]] begin[{]
call[System.out.println, parameter[literal["No training set specified, exiting."]]]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[properties.getProperty, parameter[member[.TEST_SET]]], ==, literal[null]]] begin[{]
call[System.out.println, parameter[literal["No training set specified, exiting."]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[AbstractRunner], rr]
if[call[properties.getProperty, parameter[member[.FRAMEWORK]]]] begin[{]
assign[member[.rr], ClassCreator(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MahoutRecommenderRunner, sub_type=None))]
else begin[{]
if[call[properties.getProperty, parameter[member[.FRAMEWORK]]]] begin[{]
assign[member[.rr], ClassCreator(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LenskitRecommenderRunner, sub_type=None))]
else begin[{]
if[call[properties.getProperty, parameter[member[.FRAMEWORK]]]] begin[{]
assign[member[.rr], ClassCreator(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RanksysRecommenderRunner, sub_type=None))]
else begin[{]
None
end[}]
end[}]
end[}]
return[member[.rr]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AbstractRunner] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[instantiateRecommender] operator[SEP] Keyword[final] identifier[Properties] identifier[properties] operator[SEP] {
Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[RECOMMENDER] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[TRAINING_SET] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[TEST_SET] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[AbstractRunner] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[rr] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[FRAMEWORK] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[MAHOUT] operator[SEP] operator[SEP] {
identifier[rr] operator[=] Keyword[new] identifier[MahoutRecommenderRunner] operator[SEP] identifier[properties] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[FRAMEWORK] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[LENSKIT] operator[SEP] operator[SEP] {
identifier[rr] operator[=] Keyword[new] identifier[LenskitRecommenderRunner] operator[SEP] identifier[properties] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[FRAMEWORK] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[RANKSYS] operator[SEP] operator[SEP] {
identifier[rr] operator[=] Keyword[new] identifier[RanksysRecommenderRunner] operator[SEP] identifier[properties] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rr] operator[SEP]
}
|
public void save(final SecretKey key) throws IOException {
final File keyFile = getKeyPath(key);
keyFile.getParentFile().mkdirs(); // make directories if they do not exist
try (OutputStream fos = Files.newOutputStream(keyFile.toPath());
ObjectOutputStream oout = new ObjectOutputStream(fos)) {
oout.writeObject(key);
}
} | class class_name[name] begin[{]
method[save, return_type[void], modifier[public], parameter[key]] begin[{]
local_variable[type[File], keyFile]
call[keyFile.getParentFile, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=oout, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=fos, type=ReferenceType(arguments=None, dimensions=[], name=OutputStream, sub_type=None), value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toPath, postfix_operators=[], prefix_operators=[], qualifier=keyFile, selectors=[], type_arguments=None)], member=newOutputStream, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None)), TryResource(annotations=[], modifiers=set(), name=oout, type=ReferenceType(arguments=None, dimensions=[], name=ObjectOutputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=fos, 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=ObjectOutputStream, sub_type=None)))])
end[}]
END[}] | Keyword[public] Keyword[void] identifier[save] operator[SEP] Keyword[final] identifier[SecretKey] identifier[key] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[File] identifier[keyFile] operator[=] identifier[getKeyPath] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[keyFile] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[OutputStream] identifier[fos] operator[=] identifier[Files] operator[SEP] identifier[newOutputStream] operator[SEP] identifier[keyFile] operator[SEP] identifier[toPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[oout] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] identifier[fos] operator[SEP] operator[SEP] {
identifier[oout] operator[SEP] identifier[writeObject] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
|
public static Field findField(Class<?> type, String name) {
while (type != null) {
for (Field field : type.getDeclaredFields()) {
if (field.getName().equals(name)) {
return field;
}
}
type = type.getSuperclass();
}
return null;
} | class class_name[name] begin[{]
method[findField, return_type[type[Field]], modifier[public static], parameter[type, name]] begin[{]
while[binary_operation[member[.type], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[MethodInvocation(arguments=[MemberReference(member=name, 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=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredFields, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
assign[member[.type], call[type.getSuperclass, parameter[]]]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Field] identifier[findField] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , identifier[String] identifier[name] operator[SEP] {
Keyword[while] operator[SEP] identifier[type] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Field] identifier[field] operator[:] identifier[type] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[field] operator[SEP]
}
}
identifier[type] operator[=] identifier[type] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static void writeByte(byte[] buf, int pos, byte v) {
checkBoundary(buf, pos, 1);
buf[pos] = v;
} | class class_name[name] begin[{]
method[writeByte, return_type[void], modifier[public static], parameter[buf, pos, v]] begin[{]
call[.checkBoundary, parameter[member[.buf], member[.pos], literal[1]]]
assign[member[.buf], member[.v]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeByte] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] , Keyword[int] identifier[pos] , Keyword[byte] identifier[v] operator[SEP] {
identifier[checkBoundary] operator[SEP] identifier[buf] , identifier[pos] , Other[1] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[SEP] operator[=] identifier[v] operator[SEP]
}
|
public static void copyFile(@NotNull Path from, @NotNull Path to) throws IOException {
Validate.isTrue(Files.exists(from), "%s is not exist or not a file", from);
Validate.notNull(to);
Validate.isTrue(!FileUtil.isDirExists(to), "%s is exist but it is a dir", to);
Files.copy(from, to);
} | class class_name[name] begin[{]
method[copyFile, return_type[void], modifier[public static], parameter[from, to]] begin[{]
call[Validate.isTrue, parameter[call[Files.exists, parameter[member[.from]]], literal["%s is not exist or not a file"], member[.from]]]
call[Validate.notNull, parameter[member[.to]]]
call[Validate.isTrue, parameter[call[FileUtil.isDirExists, parameter[member[.to]]], literal["%s is exist but it is a dir"], member[.to]]]
call[Files.copy, parameter[member[.from], member[.to]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[copyFile] operator[SEP] annotation[@] identifier[NotNull] identifier[Path] identifier[from] , annotation[@] identifier[NotNull] identifier[Path] identifier[to] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Validate] operator[SEP] identifier[isTrue] operator[SEP] identifier[Files] operator[SEP] identifier[exists] operator[SEP] identifier[from] operator[SEP] , literal[String] , identifier[from] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[isTrue] operator[SEP] operator[!] identifier[FileUtil] operator[SEP] identifier[isDirExists] operator[SEP] identifier[to] operator[SEP] , literal[String] , identifier[to] operator[SEP] operator[SEP] identifier[Files] operator[SEP] identifier[copy] operator[SEP] identifier[from] , identifier[to] operator[SEP] operator[SEP]
}
|
public static Tile getTile(GeoPackageTile geoPackageTile) {
Tile tile = null;
if (geoPackageTile != null) {
tile = new Tile(geoPackageTile.getWidth(), geoPackageTile.getHeight(), geoPackageTile.getData());
}
return tile;
} | class class_name[name] begin[{]
method[getTile, return_type[type[Tile]], modifier[public static], parameter[geoPackageTile]] begin[{]
local_variable[type[Tile], tile]
if[binary_operation[member[.geoPackageTile], !=, literal[null]]] begin[{]
assign[member[.tile], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=geoPackageTile, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=geoPackageTile, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=geoPackageTile, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Tile, sub_type=None))]
else begin[{]
None
end[}]
return[member[.tile]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Tile] identifier[getTile] operator[SEP] identifier[GeoPackageTile] identifier[geoPackageTile] operator[SEP] {
identifier[Tile] identifier[tile] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[geoPackageTile] operator[!=] Other[null] operator[SEP] {
identifier[tile] operator[=] Keyword[new] identifier[Tile] operator[SEP] identifier[geoPackageTile] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[geoPackageTile] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] , identifier[geoPackageTile] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tile] operator[SEP]
}
|
public void getCoefficients(double[] coefs) {
if (coefs.length < 6)
throw new GeometryException(
"Buffer is too small. coefs needs 6 members");
coefs[0] = xx;
coefs[1] = xy;
coefs[2] = xd;
coefs[3] = yx;
coefs[4] = yy;
coefs[5] = yd;
} | class class_name[name] begin[{]
method[getCoefficients, return_type[void], modifier[public], parameter[coefs]] begin[{]
if[binary_operation[member[coefs.length], <, literal[6]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Buffer is too small. coefs needs 6 members")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GeometryException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.coefs], member[.xx]]
assign[member[.coefs], member[.xy]]
assign[member[.coefs], member[.xd]]
assign[member[.coefs], member[.yx]]
assign[member[.coefs], member[.yy]]
assign[member[.coefs], member[.yd]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getCoefficients] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[coefs] operator[SEP] {
Keyword[if] operator[SEP] identifier[coefs] operator[SEP] identifier[length] operator[<] Other[6] operator[SEP] Keyword[throw] Keyword[new] identifier[GeometryException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[coefs] operator[SEP] Other[0] operator[SEP] operator[=] identifier[xx] operator[SEP] identifier[coefs] operator[SEP] Other[1] operator[SEP] operator[=] identifier[xy] operator[SEP] identifier[coefs] operator[SEP] Other[2] operator[SEP] operator[=] identifier[xd] operator[SEP] identifier[coefs] operator[SEP] Other[3] operator[SEP] operator[=] identifier[yx] operator[SEP] identifier[coefs] operator[SEP] Other[4] operator[SEP] operator[=] identifier[yy] operator[SEP] identifier[coefs] operator[SEP] Other[5] operator[SEP] operator[=] identifier[yd] operator[SEP]
}
|
protected String[] getPrimaryKeysList(String schema, String tableName)
throws DatabaseException {
try {
DatabaseMetaData dmd = connection.getMetaData();
ResultSet rs = dmd.getPrimaryKeys(dbName, schema, tableName);
List<String> columnList = new ArrayList<String>();
try {
while (rs.next()) {
columnList.add(rs.getString("COLUMN_NAME"));
}
} finally {
rs.close();
}
String[] primaryKeys = columnList.toArray(new String[columnList
.size()]);
return primaryKeys;
} catch (SQLException e) {
e.printStackTrace();
throw new DatabaseException();
}
} | class class_name[name] begin[{]
method[getPrimaryKeysList, return_type[type[String]], modifier[protected], parameter[schema, tableName]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetaData, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), name=dmd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DatabaseMetaData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dbName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPrimaryKeys, postfix_operators=[], prefix_operators=[], qualifier=dmd, selectors=[], type_arguments=None), name=rs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=columnList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), TryStatement(block=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="COLUMN_NAME")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=columnList, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), label=None)], label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=columnList, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=columnList, selectors=[], type_arguments=None), name=primaryKeys)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ReturnStatement(expression=MemberReference(member=primaryKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatabaseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] identifier[String] operator[SEP] operator[SEP] identifier[getPrimaryKeysList] operator[SEP] identifier[String] identifier[schema] , identifier[String] identifier[tableName] operator[SEP] Keyword[throws] identifier[DatabaseException] {
Keyword[try] {
identifier[DatabaseMetaData] identifier[dmd] operator[=] identifier[connection] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] identifier[ResultSet] identifier[rs] operator[=] identifier[dmd] operator[SEP] identifier[getPrimaryKeys] operator[SEP] identifier[dbName] , identifier[schema] , identifier[tableName] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[columnList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[while] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[columnList] operator[SEP] identifier[add] operator[SEP] identifier[rs] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[rs] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[primaryKeys] operator[=] identifier[columnList] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[columnList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[primaryKeys] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DatabaseException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@RequestMapping(value="", method={RequestMethod.GET, RequestMethod.HEAD})
public Resources<StateDefinitionResource> getStateDefinitions() throws StateDefinitionNotFoundException, ProviderNotFoundException, AttributeDefinitionNotFoundException {
if (LOG.isTraceEnabled()) {
LOG.entry();
}
final Resources<StateDefinitionResource> resources = getStateDefinitions(stateDefinitionService.getStateDefinitions());
if (LOG.isTraceEnabled()) {
LOG.exit(resources);
}
return resources;
} | class class_name[name] begin[{]
method[getStateDefinitions, return_type[type[Resources]], modifier[public], parameter[]] begin[{]
if[call[LOG.isTraceEnabled, parameter[]]] begin[{]
call[LOG.entry, parameter[]]
else begin[{]
None
end[}]
local_variable[type[Resources], resources]
if[call[LOG.isTraceEnabled, parameter[]]] begin[{]
call[LOG.exit, parameter[member[.resources]]]
else begin[{]
None
end[}]
return[member[.resources]]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[method] operator[=] {
identifier[RequestMethod] operator[SEP] identifier[GET] , identifier[RequestMethod] operator[SEP] identifier[HEAD]
} operator[SEP] Keyword[public] identifier[Resources] operator[<] identifier[StateDefinitionResource] operator[>] identifier[getStateDefinitions] operator[SEP] operator[SEP] Keyword[throws] identifier[StateDefinitionNotFoundException] , identifier[ProviderNotFoundException] , identifier[AttributeDefinitionNotFoundException] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[entry] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Resources] operator[<] identifier[StateDefinitionResource] operator[>] identifier[resources] operator[=] identifier[getStateDefinitions] operator[SEP] identifier[stateDefinitionService] operator[SEP] identifier[getStateDefinitions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[exit] operator[SEP] identifier[resources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resources] operator[SEP]
}
|
public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
// Propogate the stop stimulus to the destination handlers...
DestinationTypeFilter destFilter = new DestinationTypeFilter();
destFilter.LOCAL = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
//busses
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
//links
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
// Explicitly start the async deletion thread.
startAsynchDeletion();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["start"]]]
else begin[{]
None
end[}]
local_variable[type[DestinationTypeFilter], destFilter]
assign[member[destFilter.LOCAL], member[Boolean.TRUE]]
local_variable[type[SIMPIterator], itr]
while[call[itr.hasNext, parameter[]]] begin[{]
local_variable[type[DestinationHandler], dh]
call[dh.start, parameter[]]
end[}]
call[itr.finished, parameter[]]
assign[member[.itr], call[foreignBusIndex.iterator, parameter[]]]
while[call[itr.hasNext, parameter[]]] begin[{]
local_variable[type[DestinationHandler], dh]
call[dh.start, parameter[]]
end[}]
call[itr.finished, parameter[]]
local_variable[type[LinkTypeFilter], linkFilter]
assign[member[linkFilter.LOCAL], member[Boolean.TRUE]]
assign[member[.itr], call[linkIndex.iterator, parameter[member[.linkFilter]]]]
while[call[itr.hasNext, parameter[]]] begin[{]
local_variable[type[DestinationHandler], dh]
call[dh.start, parameter[]]
end[}]
call[itr.finished, parameter[]]
call[.startAsynchDeletion, parameter[]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["start"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[DestinationTypeFilter] identifier[destFilter] operator[=] Keyword[new] identifier[DestinationTypeFilter] operator[SEP] operator[SEP] operator[SEP] identifier[destFilter] operator[SEP] identifier[LOCAL] operator[=] identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] identifier[SIMPIterator] identifier[itr] operator[=] identifier[destinationIndex] operator[SEP] identifier[iterator] operator[SEP] identifier[destFilter] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[DestinationHandler] identifier[dh] operator[=] operator[SEP] identifier[DestinationHandler] operator[SEP] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[dh] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
identifier[itr] operator[SEP] identifier[finished] operator[SEP] operator[SEP] operator[SEP] identifier[itr] operator[=] identifier[foreignBusIndex] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[DestinationHandler] identifier[dh] operator[=] operator[SEP] identifier[DestinationHandler] operator[SEP] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[dh] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
identifier[itr] operator[SEP] identifier[finished] operator[SEP] operator[SEP] operator[SEP] identifier[LinkTypeFilter] identifier[linkFilter] operator[=] Keyword[new] identifier[LinkTypeFilter] operator[SEP] operator[SEP] operator[SEP] identifier[linkFilter] operator[SEP] identifier[LOCAL] operator[=] identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] identifier[itr] operator[=] identifier[linkIndex] operator[SEP] identifier[iterator] operator[SEP] identifier[linkFilter] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itr] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[DestinationHandler] identifier[dh] operator[=] operator[SEP] identifier[DestinationHandler] operator[SEP] identifier[itr] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[dh] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
identifier[itr] operator[SEP] identifier[finished] operator[SEP] operator[SEP] operator[SEP] identifier[startAsynchDeletion] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public synchronized void updateTasks(List<TaskInfo> taskInfoList) {
for (TaskInfo taskInfo : taskInfoList) {
mJobInfo.setTaskInfo(taskInfo.getTaskId(), taskInfo);
}
updateStatus();
} | class class_name[name] begin[{]
method[updateTasks, return_type[void], modifier[synchronized public], parameter[taskInfoList]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTaskId, postfix_operators=[], prefix_operators=[], qualifier=taskInfo, selectors=[], type_arguments=None), MemberReference(member=taskInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTaskInfo, postfix_operators=[], prefix_operators=[], qualifier=mJobInfo, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=taskInfoList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=taskInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskInfo, sub_type=None))), label=None)
call[.updateStatus, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[updateTasks] operator[SEP] identifier[List] operator[<] identifier[TaskInfo] operator[>] identifier[taskInfoList] operator[SEP] {
Keyword[for] operator[SEP] identifier[TaskInfo] identifier[taskInfo] operator[:] identifier[taskInfoList] operator[SEP] {
identifier[mJobInfo] operator[SEP] identifier[setTaskInfo] operator[SEP] identifier[taskInfo] operator[SEP] identifier[getTaskId] operator[SEP] operator[SEP] , identifier[taskInfo] operator[SEP] operator[SEP]
}
identifier[updateStatus] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T cloneBean(T from, Class<T> beanClass) {
if (from == null || from instanceof Collection || from.getClass().isArray()) {
throw new IllegalArgumentException("Only java bean class is allowed here.");
}
JSONObject jsonObject = (JSONObject) JSON.toJSON(from);
return jsonObject.toJavaObject(beanClass);
} | class class_name[name] begin[{]
method[cloneBean, return_type[type[T]], modifier[public static], parameter[from, beanClass]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.from], ==, literal[null]], ||, binary_operation[member[.from], instanceof, type[Collection]]], ||, call[from.getClass, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Only java bean class is allowed here.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[JSONObject], jsonObject]
return[call[jsonObject.toJavaObject, parameter[member[.beanClass]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[cloneBean] operator[SEP] identifier[T] identifier[from] , identifier[Class] operator[<] identifier[T] operator[>] identifier[beanClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[from] operator[==] Other[null] operator[||] identifier[from] Keyword[instanceof] identifier[Collection] operator[||] identifier[from] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[JSONObject] identifier[jsonObject] operator[=] operator[SEP] identifier[JSONObject] operator[SEP] identifier[JSON] operator[SEP] identifier[toJSON] operator[SEP] identifier[from] operator[SEP] operator[SEP] Keyword[return] identifier[jsonObject] operator[SEP] identifier[toJavaObject] operator[SEP] identifier[beanClass] operator[SEP] operator[SEP]
}
|
private boolean isWhitelisted(RoleSensitive subject, Collection<Role> expected) {
for (CallableWhitelist w : CallableWhitelist.all()) {
if (w.isWhitelisted(subject, expected, context))
return true;
}
return false;
} | class class_name[name] begin[{]
method[isWhitelisted, return_type[type[boolean]], modifier[private], parameter[subject, expected]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isWhitelisted, postfix_operators=[], prefix_operators=[], qualifier=w, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=all, postfix_operators=[], prefix_operators=[], qualifier=CallableWhitelist, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=w)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CallableWhitelist, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isWhitelisted] operator[SEP] identifier[RoleSensitive] identifier[subject] , identifier[Collection] operator[<] identifier[Role] operator[>] identifier[expected] operator[SEP] {
Keyword[for] operator[SEP] identifier[CallableWhitelist] identifier[w] operator[:] identifier[CallableWhitelist] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[w] operator[SEP] identifier[isWhitelisted] operator[SEP] identifier[subject] , identifier[expected] , identifier[context] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private CmsPair<String, String> getDefaultValueToDisplay(CmsClientProperty prop, Mode mode) {
if ((mode == Mode.structure) && !CmsStringUtil.isEmpty(prop.getResourceValue())) {
String message = Messages.get().key(Messages.GUI_ORIGIN_SHARED_0);
return CmsPair.create(prop.getResourceValue(), message);
}
CmsClientProperty inheritedProperty = m_handler.getInheritedProperty(prop.getName());
if (CmsClientProperty.isPropertyEmpty(inheritedProperty)) {
return null;
}
CmsPathValue pathValue = inheritedProperty.getPathValue(mode);
String message = Messages.get().key(Messages.GUI_ORIGIN_INHERITED_1, inheritedProperty.getOrigin());
return CmsPair.create(pathValue.getValue(), message);
} | class class_name[name] begin[{]
method[getDefaultValueToDisplay, return_type[type[CmsPair]], modifier[private], parameter[prop, mode]] begin[{]
if[binary_operation[binary_operation[member[.mode], ==, member[Mode.structure]], &&, call[CmsStringUtil.isEmpty, parameter[call[prop.getResourceValue, parameter[]]]]]] begin[{]
local_variable[type[String], message]
return[call[CmsPair.create, parameter[call[prop.getResourceValue, parameter[]], member[.message]]]]
else begin[{]
None
end[}]
local_variable[type[CmsClientProperty], inheritedProperty]
if[call[CmsClientProperty.isPropertyEmpty, parameter[member[.inheritedProperty]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[CmsPathValue], pathValue]
local_variable[type[String], message]
return[call[CmsPair.create, parameter[call[pathValue.getValue, parameter[]], member[.message]]]]
end[}]
END[}] | Keyword[private] identifier[CmsPair] operator[<] identifier[String] , identifier[String] operator[>] identifier[getDefaultValueToDisplay] operator[SEP] identifier[CmsClientProperty] identifier[prop] , identifier[Mode] identifier[mode] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[mode] operator[==] identifier[Mode] operator[SEP] identifier[structure] operator[SEP] operator[&&] operator[!] identifier[CmsStringUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[prop] operator[SEP] identifier[getResourceValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_ORIGIN_SHARED_0] operator[SEP] operator[SEP] Keyword[return] identifier[CmsPair] operator[SEP] identifier[create] operator[SEP] identifier[prop] operator[SEP] identifier[getResourceValue] operator[SEP] operator[SEP] , identifier[message] operator[SEP] operator[SEP]
}
identifier[CmsClientProperty] identifier[inheritedProperty] operator[=] identifier[m_handler] operator[SEP] identifier[getInheritedProperty] operator[SEP] identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsClientProperty] operator[SEP] identifier[isPropertyEmpty] operator[SEP] identifier[inheritedProperty] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[CmsPathValue] identifier[pathValue] operator[=] identifier[inheritedProperty] operator[SEP] identifier[getPathValue] operator[SEP] identifier[mode] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_ORIGIN_INHERITED_1] , identifier[inheritedProperty] operator[SEP] identifier[getOrigin] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[CmsPair] operator[SEP] identifier[create] operator[SEP] identifier[pathValue] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[message] operator[SEP] operator[SEP]
}
|
@Override
public STRATEGYSTAGETYPE resolve(String... coordinates) throws IllegalArgumentException, ResolutionException {
return delegate.resolve(coordinates);
} | class class_name[name] begin[{]
method[resolve, return_type[type[STRATEGYSTAGETYPE]], modifier[public], parameter[coordinates]] begin[{]
return[call[delegate.resolve, parameter[member[.coordinates]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[STRATEGYSTAGETYPE] identifier[resolve] operator[SEP] identifier[String] operator[...] identifier[coordinates] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] , identifier[ResolutionException] {
Keyword[return] identifier[delegate] operator[SEP] identifier[resolve] operator[SEP] identifier[coordinates] operator[SEP] operator[SEP]
}
|
public static boolean isValid(@Nullable final String weeklyOpeningHours) {
if (weeklyOpeningHours == null) {
return true;
}
final List<DayOpeningHours> all = new ArrayList<>();
final StringTokenizer tok = new StringTokenizer(weeklyOpeningHours, ",");
if (tok.countTokens() == 0) {
return false;
}
while (tok.hasMoreTokens()) {
final String part = tok.nextToken();
// Find divider between day(s) and hours
final int p = part.indexOf(' ');
if (p < 0) {
return false;
}
// Make sure first part is one or more days
final String dayPartStr = part.substring(0, p);
if (!MultiDayOfTheWeek.isValid(dayPartStr)) {
return false;
}
final MultiDayOfTheWeek dayPart = MultiDayOfTheWeek.valueOf(dayPartStr);
// Next part should be one or more hours
final String hourPartStr = part.substring(p + 1);
if (!HourRanges.isValid(hourPartStr)) {
return false;
}
final HourRanges hourPart = new HourRanges(hourPartStr);
// Avoid duplicate days
for (DayOfTheWeek dow : dayPart) {
final DayOpeningHours doh = new DayOpeningHours(dow, hourPart);
if (all.contains(doh)) {
return false;
}
all.add(doh);
}
// Make sure the hours of the days do not overlap
for (final DayOpeningHours doh : all) {
final List<DayOpeningHours> normalized = doh.normalize();
if (normalized.size() == 2) {
final DayOpeningHours secondDay = normalized.get(1);
final int idx = all.indexOf(secondDay);
if (idx > -1) {
final DayOpeningHours day = all.get(idx);
if (day.overlaps(secondDay)) {
return false;
}
}
}
}
}
return true;
} | class class_name[name] begin[{]
method[isValid, return_type[type[boolean]], modifier[public static], parameter[weeklyOpeningHours]] begin[{]
if[binary_operation[member[.weeklyOpeningHours], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[List], all]
local_variable[type[StringTokenizer], tok]
if[binary_operation[call[tok.countTokens, parameter[]], ==, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
while[call[tok.hasMoreTokens, parameter[]]] begin[{]
local_variable[type[String], part]
local_variable[type[int], p]
if[binary_operation[member[.p], <, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], dayPartStr]
if[call[MultiDayOfTheWeek.isValid, parameter[member[.dayPartStr]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[MultiDayOfTheWeek], dayPart]
local_variable[type[String], hourPartStr]
if[call[HourRanges.isValid, parameter[member[.hourPartStr]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[HourRanges], hourPart]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=dow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hourPart, 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=DayOpeningHours, sub_type=None)), name=doh)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DayOpeningHours, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=doh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=all, 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)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=all, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dayPart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dow)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DayOfTheWeek, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=normalize, postfix_operators=[], prefix_operators=[], qualifier=doh, selectors=[], type_arguments=None), name=normalized)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DayOpeningHours, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=normalized, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=get, postfix_operators=[], prefix_operators=[], qualifier=normalized, selectors=[], type_arguments=None), name=secondDay)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DayOpeningHours, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=secondDay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=all, selectors=[], type_arguments=None), name=idx)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=all, selectors=[], type_arguments=None), name=day)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DayOpeningHours, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=secondDay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=overlaps, postfix_operators=[], prefix_operators=[], qualifier=day, 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=all, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=doh)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DayOpeningHours, sub_type=None))), label=None)
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isValid] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[weeklyOpeningHours] operator[SEP] {
Keyword[if] operator[SEP] identifier[weeklyOpeningHours] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[DayOpeningHours] operator[>] identifier[all] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringTokenizer] identifier[tok] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[weeklyOpeningHours] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tok] operator[SEP] identifier[countTokens] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[while] operator[SEP] identifier[tok] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[part] operator[=] identifier[tok] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[p] operator[=] identifier[part] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[<] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[String] identifier[dayPartStr] operator[=] identifier[part] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[p] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[MultiDayOfTheWeek] operator[SEP] identifier[isValid] operator[SEP] identifier[dayPartStr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[MultiDayOfTheWeek] identifier[dayPart] operator[=] identifier[MultiDayOfTheWeek] operator[SEP] identifier[valueOf] operator[SEP] identifier[dayPartStr] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[hourPartStr] operator[=] identifier[part] operator[SEP] identifier[substring] operator[SEP] identifier[p] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[HourRanges] operator[SEP] identifier[isValid] operator[SEP] identifier[hourPartStr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[HourRanges] identifier[hourPart] operator[=] Keyword[new] identifier[HourRanges] operator[SEP] identifier[hourPartStr] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DayOfTheWeek] identifier[dow] operator[:] identifier[dayPart] operator[SEP] {
Keyword[final] identifier[DayOpeningHours] identifier[doh] operator[=] Keyword[new] identifier[DayOpeningHours] operator[SEP] identifier[dow] , identifier[hourPart] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[all] operator[SEP] identifier[contains] operator[SEP] identifier[doh] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[all] operator[SEP] identifier[add] operator[SEP] identifier[doh] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[final] identifier[DayOpeningHours] identifier[doh] operator[:] identifier[all] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[DayOpeningHours] operator[>] identifier[normalized] operator[=] identifier[doh] operator[SEP] identifier[normalize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[normalized] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[2] operator[SEP] {
Keyword[final] identifier[DayOpeningHours] identifier[secondDay] operator[=] identifier[normalized] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[idx] operator[=] identifier[all] operator[SEP] identifier[indexOf] operator[SEP] identifier[secondDay] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] operator[-] Other[1] operator[SEP] {
Keyword[final] identifier[DayOpeningHours] identifier[day] operator[=] identifier[all] operator[SEP] identifier[get] operator[SEP] identifier[idx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[day] operator[SEP] identifier[overlaps] operator[SEP] identifier[secondDay] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected void configureDetailedWeekView(
DetailedWeekView newDetailedWeekView, boolean trimTimeBounds) {
newDetailedWeekView.getWeekView().setShowToday(false);
newDetailedWeekView.getWeekView().setTrimTimeBounds(trimTimeBounds);
} | class class_name[name] begin[{]
method[configureDetailedWeekView, return_type[void], modifier[protected], parameter[newDetailedWeekView, trimTimeBounds]] begin[{]
call[newDetailedWeekView.getWeekView, parameter[]]
call[newDetailedWeekView.getWeekView, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[configureDetailedWeekView] operator[SEP] identifier[DetailedWeekView] identifier[newDetailedWeekView] , Keyword[boolean] identifier[trimTimeBounds] operator[SEP] {
identifier[newDetailedWeekView] operator[SEP] identifier[getWeekView] operator[SEP] operator[SEP] operator[SEP] identifier[setShowToday] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[newDetailedWeekView] operator[SEP] identifier[getWeekView] operator[SEP] operator[SEP] operator[SEP] identifier[setTrimTimeBounds] operator[SEP] identifier[trimTimeBounds] operator[SEP] operator[SEP]
}
|
public ServiceFuture<TransformationInner> createOrReplaceAsync(String resourceGroupName, String jobName, String transformationName, TransformationInner transformation, final ServiceCallback<TransformationInner> serviceCallback) {
return ServiceFuture.fromHeaderResponse(createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, transformationName, transformation), serviceCallback);
} | class class_name[name] begin[{]
method[createOrReplaceAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, jobName, transformationName, transformation, serviceCallback]] begin[{]
return[call[ServiceFuture.fromHeaderResponse, parameter[call[.createOrReplaceWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.jobName], member[.transformationName], member[.transformation]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[TransformationInner] operator[>] identifier[createOrReplaceAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[jobName] , identifier[String] identifier[transformationName] , identifier[TransformationInner] identifier[transformation] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[TransformationInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromHeaderResponse] operator[SEP] identifier[createOrReplaceWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[jobName] , identifier[transformationName] , identifier[transformation] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private static List<Attribute> safelyLoadAttributes(
MBeanServerConnection server, ObjectName objectName, List<String> matchingNames) {
try {
// first try batch loading all attributes as this is faster
return batchLoadAttributes(server, objectName, matchingNames);
} catch (Exception e) {
// JBOSS ticket: https://issues.jboss.org/browse/AS7-4404
LOGGER.info("Error batch loading attributes for {} : {}", objectName, e.getMessage());
// some containers (jboss I am looking at you) fail the entire getAttributes request
// if one is broken we can get the working attributes if we ask for them individually
return individuallyLoadAttributes(server, objectName, matchingNames);
}
} | class class_name[name] begin[{]
method[safelyLoadAttributes, return_type[type[List]], modifier[private static], parameter[server, objectName, matchingNames]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=server, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matchingNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=batchLoadAttributes, 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="Error batch loading attributes for {} : {}"), MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=server, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matchingNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=individuallyLoadAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[List] operator[<] identifier[Attribute] operator[>] identifier[safelyLoadAttributes] operator[SEP] identifier[MBeanServerConnection] identifier[server] , identifier[ObjectName] identifier[objectName] , identifier[List] operator[<] identifier[String] operator[>] identifier[matchingNames] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[batchLoadAttributes] operator[SEP] identifier[server] , identifier[objectName] , identifier[matchingNames] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[objectName] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[individuallyLoadAttributes] operator[SEP] identifier[server] , identifier[objectName] , identifier[matchingNames] operator[SEP] operator[SEP]
}
}
|
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
Expression expr = ((ElemVariable)m_obj).getSelect().getExpression();
XObject xobj = expr.execute(xctxt);
xobj.allowDetachToRelease(false);
return xobj;
} | class class_name[name] begin[{]
method[execute, return_type[type[XObject]], modifier[public], parameter[xctxt]] begin[{]
local_variable[type[Expression], expr]
local_variable[type[XObject], xobj]
call[xobj.allowDetachToRelease, parameter[literal[false]]]
return[member[.xobj]]
end[}]
END[}] | Keyword[public] identifier[XObject] identifier[execute] operator[SEP] identifier[XPathContext] identifier[xctxt] operator[SEP] Keyword[throws] identifier[javax] operator[SEP] identifier[xml] operator[SEP] identifier[transform] operator[SEP] identifier[TransformerException] {
identifier[Expression] identifier[expr] operator[=] operator[SEP] operator[SEP] identifier[ElemVariable] operator[SEP] identifier[m_obj] operator[SEP] operator[SEP] identifier[getSelect] operator[SEP] operator[SEP] operator[SEP] identifier[getExpression] operator[SEP] operator[SEP] operator[SEP] identifier[XObject] identifier[xobj] operator[=] identifier[expr] operator[SEP] identifier[execute] operator[SEP] identifier[xctxt] operator[SEP] operator[SEP] identifier[xobj] operator[SEP] identifier[allowDetachToRelease] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[xobj] operator[SEP]
}
|
private static String toColumnName(String fieldName) {
int lastDot = fieldName.indexOf('.');
if (lastDot > -1) {
return fieldName.substring(lastDot + 1);
} else {
return fieldName;
}
} | class class_name[name] begin[{]
method[toColumnName, return_type[type[String]], modifier[private static], parameter[fieldName]] begin[{]
local_variable[type[int], lastDot]
if[binary_operation[member[.lastDot], >, literal[1]]] begin[{]
return[call[fieldName.substring, parameter[binary_operation[member[.lastDot], +, literal[1]]]]]
else begin[{]
return[member[.fieldName]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[toColumnName] operator[SEP] identifier[String] identifier[fieldName] operator[SEP] {
Keyword[int] identifier[lastDot] operator[=] identifier[fieldName] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastDot] operator[>] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[fieldName] operator[SEP] identifier[substring] operator[SEP] identifier[lastDot] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[fieldName] operator[SEP]
}
}
|
private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(KEY_SERVICE_VENDOR, "IBM");
JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
}
return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
} | class class_name[name] begin[{]
method[registerMBeanService, return_type[type[ServiceRegistration]], modifier[private], parameter[jmsResourceName, bundleContext]] begin[{]
local_variable[type[Dictionary], props]
call[props.put, parameter[member[.KEY_SERVICE_VENDOR], literal["IBM"]]]
local_variable[type[JmsServiceProviderMBeanImpl], jmsProviderMBean]
call[props.put, parameter[member[.KEY_JMX_OBJECTNAME], call[jmsProviderMBean.getobjectName, parameter[]]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[literal["JmsQueueMBeanImpl="], +, call[jmsProviderMBean.getobjectName, parameter[]]], +, literal[" props="]], +, member[.props]]]]
else begin[{]
None
end[}]
return[call[bundleContext.registerService, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JmsServiceProviderMBeanImpl, sub_type=None)), member[.jmsProviderMBean], member[.props]]]]
end[}]
END[}] | Keyword[private] identifier[ServiceRegistration] operator[<] operator[?] operator[>] identifier[registerMBeanService] operator[SEP] identifier[String] identifier[jmsResourceName] , identifier[BundleContext] identifier[bundleContext] operator[SEP] {
identifier[Dictionary] operator[<] identifier[String] , identifier[String] operator[>] identifier[props] operator[=] Keyword[new] identifier[Hashtable] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[KEY_SERVICE_VENDOR] , literal[String] operator[SEP] operator[SEP] identifier[JmsServiceProviderMBeanImpl] identifier[jmsProviderMBean] operator[=] Keyword[new] identifier[JmsServiceProviderMBeanImpl] operator[SEP] identifier[getServerName] operator[SEP] operator[SEP] , identifier[KEY_JMS2_PROVIDER] operator[SEP] operator[SEP] identifier[props] operator[SEP] identifier[put] operator[SEP] identifier[KEY_JMX_OBJECTNAME] , identifier[jmsProviderMBean] operator[SEP] identifier[getobjectName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[jmsProviderMBean] operator[SEP] identifier[getobjectName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[props] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bundleContext] operator[SEP] identifier[registerService] operator[SEP] identifier[JmsServiceProviderMBeanImpl] operator[SEP] Keyword[class] , identifier[jmsProviderMBean] , identifier[props] operator[SEP] operator[SEP]
}
|
public int tailOf(String srcStr, String searchStr) {
if (isBlank(srcStr) || isBlank(searchStr)) {
return -1;
}
int cursor = -1;
boolean loop = true;
boolean firstTokenAlreadyFound = false;
do {
int idx = srcStr.indexOf(searchStr);
if (idx >= 0) {
if (firstTokenAlreadyFound && idx >= searchStr.length()) {
loop = false;
break;
}
cursor++;
if (idx == 0 && firstTokenAlreadyFound == false) {
firstTokenAlreadyFound = true;
}
srcStr = removeHead(srcStr, 1);
} else {
loop = false;
}
} while (loop);
return cursor;
} | class class_name[name] begin[{]
method[tailOf, return_type[type[int]], modifier[public], parameter[srcStr, searchStr]] begin[{]
if[binary_operation[call[.isBlank, parameter[member[.srcStr]]], ||, call[.isBlank, parameter[member[.searchStr]]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], cursor]
local_variable[type[boolean], loop]
local_variable[type[boolean], firstTokenAlreadyFound]
do[member[.loop]] begin[{]
local_variable[type[int], idx]
if[binary_operation[member[.idx], >=, literal[0]]] begin[{]
if[binary_operation[member[.firstTokenAlreadyFound], &&, binary_operation[member[.idx], >=, call[searchStr.length, parameter[]]]]] begin[{]
assign[member[.loop], literal[false]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
member[.cursor]
if[binary_operation[binary_operation[member[.idx], ==, literal[0]], &&, binary_operation[member[.firstTokenAlreadyFound], ==, literal[false]]]] begin[{]
assign[member[.firstTokenAlreadyFound], literal[true]]
else begin[{]
None
end[}]
assign[member[.srcStr], call[.removeHead, parameter[member[.srcStr], literal[1]]]]
else begin[{]
assign[member[.loop], literal[false]]
end[}]
end[}]
return[member[.cursor]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[tailOf] operator[SEP] identifier[String] identifier[srcStr] , identifier[String] identifier[searchStr] operator[SEP] {
Keyword[if] operator[SEP] identifier[isBlank] operator[SEP] identifier[srcStr] operator[SEP] operator[||] identifier[isBlank] operator[SEP] identifier[searchStr] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[int] identifier[cursor] operator[=] operator[-] Other[1] operator[SEP] Keyword[boolean] identifier[loop] operator[=] literal[boolean] operator[SEP] Keyword[boolean] identifier[firstTokenAlreadyFound] operator[=] literal[boolean] operator[SEP] Keyword[do] {
Keyword[int] identifier[idx] operator[=] identifier[srcStr] operator[SEP] identifier[indexOf] operator[SEP] identifier[searchStr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[firstTokenAlreadyFound] operator[&&] identifier[idx] operator[>=] identifier[searchStr] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[loop] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
identifier[cursor] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[==] Other[0] operator[&&] identifier[firstTokenAlreadyFound] operator[==] literal[boolean] operator[SEP] {
identifier[firstTokenAlreadyFound] operator[=] literal[boolean] operator[SEP]
}
identifier[srcStr] operator[=] identifier[removeHead] operator[SEP] identifier[srcStr] , Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[loop] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[loop] operator[SEP] operator[SEP] Keyword[return] identifier[cursor] operator[SEP]
}
|
public final void ruleXSwitchExpression() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:921:2: ( ( ( rule__XSwitchExpression__Group__0 ) ) )
// InternalXbase.g:922:2: ( ( rule__XSwitchExpression__Group__0 ) )
{
// InternalXbase.g:922:2: ( ( rule__XSwitchExpression__Group__0 ) )
// InternalXbase.g:923:3: ( rule__XSwitchExpression__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXSwitchExpressionAccess().getGroup());
}
// InternalXbase.g:924:3: ( rule__XSwitchExpression__Group__0 )
// InternalXbase.g:924:4: rule__XSwitchExpression__Group__0
{
pushFollow(FOLLOW_2);
rule__XSwitchExpression__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXSwitchExpressionAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} | class class_name[name] begin[{]
method[ruleXSwitchExpression, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[int], stackSize]
TryStatement(block=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXSwitchExpressionAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=before, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=rule__XSwitchExpression__Group__0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXSwitchExpressionAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getGroup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=after, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stackSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=restoreStackSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[None]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[ruleXSwitchExpression] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[int] identifier[stackSize] operator[=] identifier[keepStackSize] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
{
{
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[before] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXSwitchExpressionAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} {
identifier[pushFollow] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP] identifier[rule__XSwitchExpression__Group__0] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[after] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXSwitchExpressionAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[restoreStackSize] operator[SEP] identifier[stackSize] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
|
public static <V extends View<GenericRecord>> V load(String uriString) {
return Datasets.<GenericRecord, V>load(
uriString, GenericRecord.class);
} | class class_name[name] begin[{]
method[load, return_type[type[V]], modifier[public static], parameter[uriString]] begin[{]
return[call[.Datasets, parameter[member[.uriString], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GenericRecord, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] Keyword[extends] identifier[View] operator[<] identifier[GenericRecord] operator[>] operator[>] identifier[V] identifier[load] operator[SEP] identifier[String] identifier[uriString] operator[SEP] {
Keyword[return] identifier[Datasets] operator[SEP] operator[<] identifier[GenericRecord] , identifier[V] operator[>] identifier[load] operator[SEP] identifier[uriString] , identifier[GenericRecord] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static String replaceAll(CharSequence str, String regex, Func1<Matcher, String> replaceFun) {
return replaceAll(str, Pattern.compile(regex), replaceFun);
} | class class_name[name] begin[{]
method[replaceAll, return_type[type[String]], modifier[public static], parameter[str, regex, replaceFun]] begin[{]
return[call[.replaceAll, parameter[member[.str], call[Pattern.compile, parameter[member[.regex]]], member[.replaceFun]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[replaceAll] operator[SEP] identifier[CharSequence] identifier[str] , identifier[String] identifier[regex] , identifier[Func1] operator[<] identifier[Matcher] , identifier[String] operator[>] identifier[replaceFun] operator[SEP] {
Keyword[return] identifier[replaceAll] operator[SEP] identifier[str] , identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[regex] operator[SEP] , identifier[replaceFun] operator[SEP] operator[SEP]
}
|
@Nullable
private static ScaleType getScaleTypeFromXml(
TypedArray gdhAttrs,
int attrId) {
switch (gdhAttrs.getInt(attrId, -2)) {
case -1: // none
return null;
case 0: // fitXY
return ScaleType.FIT_XY;
case 1: // fitStart
return ScaleType.FIT_START;
case 2: // fitCenter
return ScaleType.FIT_CENTER;
case 3: // fitEnd
return ScaleType.FIT_END;
case 4: // center
return ScaleType.CENTER;
case 5: // centerInside
return ScaleType.CENTER_INSIDE;
case 6: // centerCrop
return ScaleType.CENTER_CROP;
case 7: // focusCrop
return ScaleType.FOCUS_CROP;
case 8: // fitBottomStart
return ScaleType.FIT_BOTTOM_START;
default:
// this method is supposed to be called only when XML attribute is specified.
throw new RuntimeException("XML attribute not specified!");
}
} | class class_name[name] begin[{]
method[getScaleTypeFromXml, return_type[type[ScaleType]], modifier[private static], parameter[gdhAttrs, attrId]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[ReturnStatement(expression=MemberReference(member=FIT_XY, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[ReturnStatement(expression=MemberReference(member=FIT_START, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[ReturnStatement(expression=MemberReference(member=FIT_CENTER, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[ReturnStatement(expression=MemberReference(member=FIT_END, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], statements=[ReturnStatement(expression=MemberReference(member=CENTER, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], statements=[ReturnStatement(expression=MemberReference(member=CENTER_INSIDE, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], statements=[ReturnStatement(expression=MemberReference(member=CENTER_CROP, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7)], statements=[ReturnStatement(expression=MemberReference(member=FOCUS_CROP, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)], statements=[ReturnStatement(expression=MemberReference(member=FIT_BOTTOM_START, postfix_operators=[], prefix_operators=[], qualifier=ScaleType, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="XML attribute not specified!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=attrId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=2)], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=gdhAttrs, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[private] Keyword[static] identifier[ScaleType] identifier[getScaleTypeFromXml] operator[SEP] identifier[TypedArray] identifier[gdhAttrs] , Keyword[int] identifier[attrId] operator[SEP] {
Keyword[switch] operator[SEP] identifier[gdhAttrs] operator[SEP] identifier[getInt] operator[SEP] identifier[attrId] , operator[-] Other[2] operator[SEP] operator[SEP] {
Keyword[case] operator[-] Other[1] operator[:] Keyword[return] Other[null] operator[SEP] Keyword[case] Other[0] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FIT_XY] operator[SEP] Keyword[case] Other[1] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FIT_START] operator[SEP] Keyword[case] Other[2] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FIT_CENTER] operator[SEP] Keyword[case] Other[3] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FIT_END] operator[SEP] Keyword[case] Other[4] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[CENTER] operator[SEP] Keyword[case] Other[5] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[CENTER_INSIDE] operator[SEP] Keyword[case] Other[6] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[CENTER_CROP] operator[SEP] Keyword[case] Other[7] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FOCUS_CROP] operator[SEP] Keyword[case] Other[8] operator[:] Keyword[return] identifier[ScaleType] operator[SEP] identifier[FIT_BOTTOM_START] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public void marshall(StateEnteredEventDetails stateEnteredEventDetails, ProtocolMarshaller protocolMarshaller) {
if (stateEnteredEventDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stateEnteredEventDetails.getName(), NAME_BINDING);
protocolMarshaller.marshall(stateEnteredEventDetails.getInput(), INPUT_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[stateEnteredEventDetails, protocolMarshaller]] begin[{]
if[binary_operation[member[.stateEnteredEventDetails], ==, 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=getName, postfix_operators=[], prefix_operators=[], qualifier=stateEnteredEventDetails, selectors=[], type_arguments=None), MemberReference(member=NAME_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=getInput, postfix_operators=[], prefix_operators=[], qualifier=stateEnteredEventDetails, selectors=[], type_arguments=None), MemberReference(member=INPUT_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[StateEnteredEventDetails] identifier[stateEnteredEventDetails] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[stateEnteredEventDetails] 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[stateEnteredEventDetails] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[stateEnteredEventDetails] operator[SEP] identifier[getInput] operator[SEP] operator[SEP] , identifier[INPUT_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static Observable<GroupedObservable<TypeAndNameKey, Map<String, Object>>> aggregateHttpSSE(StreamDiscovery discovery) {
Observable<StreamAction> streamActions = discovery.getInstanceList().publish().refCount();
Observable<StreamAction> streamAdds = streamActions.filter(a -> a.getType() == ActionType.ADD);
Observable<StreamAction> streamRemoves = streamActions.filter(a -> a.getType() == ActionType.REMOVE);
Observable<GroupedObservable<InstanceKey, Map<String, Object>>> streamPerInstance =
streamAdds.map(streamAction -> {
URI uri = streamAction.getUri();
Observable<Map<String, Object>> io = Observable.defer(() -> {
Observable<Map<String, Object>> flatMap = RxNetty.createHttpClient(uri.getHost(), uri.getPort(), PipelineConfigurators.<ByteBuf>sseClientConfigurator())
.submit(createRequest(uri))
.flatMap(response -> {
if (response.getStatus().code() != 200) {
return Observable.error(new RuntimeException("Failed to connect: " + response.getStatus()));
}
return response.getContent()
.doOnSubscribe(() -> logger.info("Turbine => Aggregate Stream from URI: " + uri.toASCIIString()))
.doOnUnsubscribe(() -> logger.info("Turbine => Unsubscribing Stream: " + uri))
.takeUntil(streamRemoves.filter(a -> a.getUri().equals(streamAction.getUri()))) // unsubscribe when we receive a remove event
.map(sse -> JsonUtility.jsonToMap(sse.getEventData()));
});
// eclipse is having issues with type inference so breaking up
return flatMap.retryWhen(attempts -> {
return attempts.flatMap(e -> {
return Observable.timer(1, TimeUnit.SECONDS)
.doOnEach(n -> logger.info("Turbine => Retrying connection to: " + uri));
});
});
});
return GroupedObservable.from(InstanceKey.create(uri.toASCIIString()), io);
});
return StreamAggregator.aggregateGroupedStreams(streamPerInstance);
} | class class_name[name] begin[{]
method[aggregateHttpSSE, return_type[type[Observable]], modifier[public static], parameter[discovery]] begin[{]
local_variable[type[Observable], streamActions]
local_variable[type[Observable], streamAdds]
local_variable[type[Observable], streamRemoves]
local_variable[type[Observable], streamPerInstance]
return[call[StreamAggregator.aggregateGroupedStreams, parameter[member[.streamPerInstance]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Observable] operator[<] identifier[GroupedObservable] operator[<] identifier[TypeAndNameKey] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[>] identifier[aggregateHttpSSE] operator[SEP] identifier[StreamDiscovery] identifier[discovery] operator[SEP] {
identifier[Observable] operator[<] identifier[StreamAction] operator[>] identifier[streamActions] operator[=] identifier[discovery] operator[SEP] identifier[getInstanceList] operator[SEP] operator[SEP] operator[SEP] identifier[publish] operator[SEP] operator[SEP] operator[SEP] identifier[refCount] operator[SEP] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[StreamAction] operator[>] identifier[streamAdds] operator[=] identifier[streamActions] operator[SEP] identifier[filter] operator[SEP] identifier[a] operator[->] identifier[a] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[ActionType] operator[SEP] identifier[ADD] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[StreamAction] operator[>] identifier[streamRemoves] operator[=] identifier[streamActions] operator[SEP] identifier[filter] operator[SEP] identifier[a] operator[->] identifier[a] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[ActionType] operator[SEP] identifier[REMOVE] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[GroupedObservable] operator[<] identifier[InstanceKey] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[>] identifier[streamPerInstance] operator[=] identifier[streamAdds] operator[SEP] identifier[map] operator[SEP] identifier[streamAction] operator[->] {
identifier[URI] identifier[uri] operator[=] identifier[streamAction] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] identifier[Observable] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[io] operator[=] identifier[Observable] operator[SEP] identifier[defer] operator[SEP] operator[SEP] operator[SEP] operator[->] {
identifier[Observable] operator[<] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[flatMap] operator[=] identifier[RxNetty] operator[SEP] identifier[createHttpClient] operator[SEP] identifier[uri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] , identifier[uri] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] , identifier[PipelineConfigurators] operator[SEP] operator[<] identifier[ByteBuf] operator[>] identifier[sseClientConfigurator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[submit] operator[SEP] identifier[createRequest] operator[SEP] identifier[uri] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[response] operator[->] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[!=] Other[200] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[response] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] identifier[doOnSubscribe] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[uri] operator[SEP] identifier[toASCIIString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doOnUnsubscribe] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[uri] operator[SEP] operator[SEP] operator[SEP] identifier[takeUntil] operator[SEP] identifier[streamRemoves] operator[SEP] identifier[filter] operator[SEP] identifier[a] operator[->] identifier[a] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[streamAction] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[sse] operator[->] identifier[JsonUtility] operator[SEP] identifier[jsonToMap] operator[SEP] identifier[sse] operator[SEP] identifier[getEventData] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[return] identifier[flatMap] operator[SEP] identifier[retryWhen] operator[SEP] identifier[attempts] operator[->] {
Keyword[return] identifier[attempts] operator[SEP] identifier[flatMap] operator[SEP] identifier[e] operator[->] {
Keyword[return] identifier[Observable] operator[SEP] identifier[timer] operator[SEP] Other[1] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP] identifier[doOnEach] operator[SEP] identifier[n] operator[->] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[uri] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[return] identifier[GroupedObservable] operator[SEP] identifier[from] operator[SEP] identifier[InstanceKey] operator[SEP] identifier[create] operator[SEP] identifier[uri] operator[SEP] identifier[toASCIIString] operator[SEP] operator[SEP] operator[SEP] , identifier[io] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[return] identifier[StreamAggregator] operator[SEP] identifier[aggregateGroupedStreams] operator[SEP] identifier[streamPerInstance] operator[SEP] operator[SEP]
}
|
public void set(double[] value) {
checkIndex(value.length);
for (int i = 0; i < value.length; ++i) {
if (value[i] != 0d)
set(i, value[i]);
}
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[value]] begin[{]
call[.checkIndex, parameter[member[value.length]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0d), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=value, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[set] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[value] operator[SEP] {
identifier[checkIndex] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[i] operator[SEP] operator[!=] literal[Float] operator[SEP] identifier[set] operator[SEP] identifier[i] , identifier[value] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "", name = "gaestewc")
public JAXBElement<Boolean> createGaestewc(Boolean value) {
return new JAXBElement<Boolean>(_Gaestewc_QNAME, Boolean.class, null, value);
} | class class_name[name] begin[{]
method[createGaestewc, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Gaestewc_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Boolean, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[Boolean] operator[>] identifier[createGaestewc] operator[SEP] identifier[Boolean] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[Boolean] operator[>] operator[SEP] identifier[_Gaestewc_QNAME] , identifier[Boolean] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public static void assertNotVoidType(final Field field, Class<? extends Annotation> annotation)
{
if ((field.getClass().equals(Void.class)) && (field.getClass().equals(Void.TYPE)))
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | class class_name[name] begin[{]
method[assertNotVoidType, return_type[void], modifier[public static], parameter[field, annotation]] begin[{]
if[binary_operation[call[field.getClass, parameter[]], &&, call[field.getClass, parameter[]]]] begin[{]
ThrowStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=annotation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fieldCannotBeOfPrimitiveOrVoidType2, postfix_operators=[], prefix_operators=[], qualifier=MESSAGES, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fieldCannotBeOfPrimitiveOrVoidType, postfix_operators=[], prefix_operators=[], qualifier=MESSAGES, selectors=[], type_arguments=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[assertNotVoidType] operator[SEP] Keyword[final] identifier[Field] identifier[field] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Annotation] operator[>] identifier[annotation] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Void] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[field] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Void] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[annotation] operator[==] Other[null] operator[?] identifier[MESSAGES] operator[SEP] identifier[fieldCannotBeOfPrimitiveOrVoidType] operator[SEP] identifier[field] operator[SEP] operator[:] identifier[MESSAGES] operator[SEP] identifier[fieldCannotBeOfPrimitiveOrVoidType2] operator[SEP] identifier[field] , identifier[annotation] operator[SEP] operator[SEP]
}
}
|
private Path getCircleClipPath() {
Path path = new Path();
path.addCircle(getActionButton().calculateCenterX(), getActionButton().calculateCenterY(),
getActionButton().calculateCircleRadius(), Path.Direction.CW);
return path;
} | class class_name[name] begin[{]
method[getCircleClipPath, return_type[type[Path]], modifier[private], parameter[]] begin[{]
local_variable[type[Path], path]
call[path.addCircle, parameter[call[.getActionButton, parameter[]], call[.getActionButton, parameter[]], call[.getActionButton, parameter[]], member[Path.Direction.CW]]]
return[member[.path]]
end[}]
END[}] | Keyword[private] identifier[Path] identifier[getCircleClipPath] operator[SEP] operator[SEP] {
identifier[Path] identifier[path] operator[=] Keyword[new] identifier[Path] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[addCircle] operator[SEP] identifier[getActionButton] operator[SEP] operator[SEP] operator[SEP] identifier[calculateCenterX] operator[SEP] operator[SEP] , identifier[getActionButton] operator[SEP] operator[SEP] operator[SEP] identifier[calculateCenterY] operator[SEP] operator[SEP] , identifier[getActionButton] operator[SEP] operator[SEP] operator[SEP] identifier[calculateCircleRadius] operator[SEP] operator[SEP] , identifier[Path] operator[SEP] identifier[Direction] operator[SEP] identifier[CW] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP]
}
|
public static <T> List<T> setOrAppend(List<T> list, int index, T element) {
if (index < list.size()) {
list.set(index, element);
} else {
list.add(element);
}
return list;
} | class class_name[name] begin[{]
method[setOrAppend, return_type[type[List]], modifier[public static], parameter[list, index, element]] begin[{]
if[binary_operation[member[.index], <, call[list.size, parameter[]]]] begin[{]
call[list.set, parameter[member[.index], member[.element]]]
else begin[{]
call[list.add, parameter[member[.element]]]
end[}]
return[member[.list]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[setOrAppend] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[list] , Keyword[int] identifier[index] , identifier[T] identifier[element] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[<] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[list] operator[SEP] identifier[set] operator[SEP] identifier[index] , identifier[element] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
private SoyValueProvider convertLazy(@Nullable final Object obj) {
SoyValueProvider convertedPrimitive = convertCheap(obj);
if (convertedPrimitive != null) {
return convertedPrimitive;
} else {
return new SoyAbstractCachingValueProvider() {
@Override
protected SoyValue compute() {
return convertNonPrimitive(obj).resolve();
}
@Override
public RenderResult status() {
return RenderResult.done();
}
};
}
} | class class_name[name] begin[{]
method[convertLazy, return_type[type[SoyValueProvider]], modifier[private], parameter[obj]] begin[{]
local_variable[type[SoyValueProvider], convertedPrimitive]
if[binary_operation[member[.convertedPrimitive], !=, literal[null]]] begin[{]
return[member[.convertedPrimitive]]
else begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertNonPrimitive, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=resolve, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'protected'}, name=compute, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=SoyValue, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=done, postfix_operators=[], prefix_operators=[], qualifier=RenderResult, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=status, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=RenderResult, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SoyAbstractCachingValueProvider, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[private] identifier[SoyValueProvider] identifier[convertLazy] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[Object] identifier[obj] operator[SEP] {
identifier[SoyValueProvider] identifier[convertedPrimitive] operator[=] identifier[convertCheap] operator[SEP] identifier[obj] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[convertedPrimitive] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[convertedPrimitive] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[SoyAbstractCachingValueProvider] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] identifier[SoyValue] identifier[compute] operator[SEP] operator[SEP] {
Keyword[return] identifier[convertNonPrimitive] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[resolve] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[RenderResult] identifier[status] operator[SEP] operator[SEP] {
Keyword[return] identifier[RenderResult] operator[SEP] identifier[done] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
}
|
private <T> T getFirstHeaderValue(List<T> internalValue) {
return internalValue == null ? null : internalValue.get(0);
} | class class_name[name] begin[{]
method[getFirstHeaderValue, return_type[type[T]], modifier[private], parameter[internalValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=internalValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=internalValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[private] operator[<] identifier[T] operator[>] identifier[T] identifier[getFirstHeaderValue] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[internalValue] operator[SEP] {
Keyword[return] identifier[internalValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[internalValue] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
@Override
public CommerceDiscountRel fetchByCN_CPK_First(long classNameId,
long classPK, OrderByComparator<CommerceDiscountRel> orderByComparator) {
List<CommerceDiscountRel> list = findByCN_CPK(classNameId, classPK, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} | class class_name[name] begin[{]
method[fetchByCN_CPK_First, return_type[type[CommerceDiscountRel]], modifier[public], parameter[classNameId, classPK, orderByComparator]] begin[{]
local_variable[type[List], list]
if[call[list.isEmpty, parameter[]]] begin[{]
return[call[list.get, parameter[literal[0]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CommerceDiscountRel] identifier[fetchByCN_CPK_First] operator[SEP] Keyword[long] identifier[classNameId] , Keyword[long] identifier[classPK] , identifier[OrderByComparator] operator[<] identifier[CommerceDiscountRel] operator[>] identifier[orderByComparator] operator[SEP] {
identifier[List] operator[<] identifier[CommerceDiscountRel] operator[>] identifier[list] operator[=] identifier[findByCN_CPK] operator[SEP] identifier[classNameId] , identifier[classPK] , Other[0] , Other[1] , identifier[orderByComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[list] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[list] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected FtpMessage deleteFile(DeleteCommand delete, TestContext context) {
String remoteFilePath = context.replaceDynamicContentInString(delete.getTarget().getPath());
try {
if (!StringUtils.hasText(remoteFilePath)) {
return null;
}
boolean success = true;
if (isDirectory(remoteFilePath)) {
if (!ftpClient.changeWorkingDirectory(remoteFilePath)) {
throw new CitrusRuntimeException("Failed to change working directory to " + remoteFilePath + ". FTP reply code: " + ftpClient.getReplyString());
}
if (delete.isRecursive()) {
FTPFile[] ftpFiles = ftpClient.listFiles();
for (FTPFile ftpFile : ftpFiles) {
DeleteCommand recursiveDelete = new DeleteCommand();
DeleteCommand.Target target = new DeleteCommand.Target();
target.setPath(remoteFilePath + "/" + ftpFile.getName());
recursiveDelete.setTarget(target);
recursiveDelete.setIncludeCurrent(true);
deleteFile(recursiveDelete, context);
}
}
if (delete.isIncludeCurrent()) {
// we cannot delete the current working directory, so go to root directory and delete from there
ftpClient.changeWorkingDirectory("/");
success = ftpClient.removeDirectory(remoteFilePath);
}
} else {
success = ftpClient.deleteFile(remoteFilePath);
}
if (!success) {
throw new CitrusRuntimeException("Failed to delete path " + remoteFilePath + ". FTP reply code: " + ftpClient.getReplyString());
}
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to delete file from FTP server", e);
}
// If there was no file to delete, the ftpClient has the reply code from the previously executed
// operation. Since we want to have a deterministic behaviour, we need to set the reply code and
// reply string on our own!
if (ftpClient.getReplyCode() != FILE_ACTION_OK) {
return FtpMessage.deleteResult(FILE_ACTION_OK, String.format("%s No files to delete.", FILE_ACTION_OK), true);
}
return FtpMessage.deleteResult(ftpClient.getReplyCode(), ftpClient.getReplyString(), isPositive(ftpClient.getReplyCode()));
} | class class_name[name] begin[{]
method[deleteFile, return_type[type[FtpMessage]], modifier[protected], parameter[delete, context]] begin[{]
local_variable[type[String], remoteFilePath]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasText, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, 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=null), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=success)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deleteFile, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=changeWorkingDirectory, postfix_operators=[], prefix_operators=['!'], qualifier=ftpClient, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to change working directory to "), operandr=MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". FTP reply code: "), operator=+), operandr=MethodInvocation(arguments=[], member=getReplyString, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, 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=CitrusRuntimeException, sub_type=None)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isRecursive, postfix_operators=[], prefix_operators=[], qualifier=delete, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=listFiles, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, selectors=[], type_arguments=None), name=ftpFiles)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=FTPFile, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeleteCommand, sub_type=None)), name=recursiveDelete)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DeleteCommand, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DeleteCommand, sub_type=ReferenceType(arguments=None, dimensions=None, name=Target, sub_type=None))), name=target)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DeleteCommand, sub_type=ReferenceType(arguments=None, dimensions=None, name=Target, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=ftpFile, selectors=[], type_arguments=None), operator=+)], member=setPath, postfix_operators=[], prefix_operators=[], qualifier=target, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=target, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTarget, postfix_operators=[], prefix_operators=[], qualifier=recursiveDelete, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setIncludeCurrent, postfix_operators=[], prefix_operators=[], qualifier=recursiveDelete, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=recursiveDelete, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deleteFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ftpFiles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ftpFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FTPFile, sub_type=None))), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isIncludeCurrent, postfix_operators=[], prefix_operators=[], qualifier=delete, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=changeWorkingDirectory, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeDirectory, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, selectors=[], type_arguments=None)), label=None)]))])), IfStatement(condition=MemberReference(member=success, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to delete path "), operandr=MemberReference(member=remoteFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". FTP reply code: "), operator=+), operandr=MethodInvocation(arguments=[], member=getReplyString, postfix_operators=[], prefix_operators=[], qualifier=ftpClient, 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=CitrusRuntimeException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to delete file from FTP server"), 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=CitrusRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[ftpClient.getReplyCode, parameter[]], !=, member[.FILE_ACTION_OK]]] begin[{]
return[call[FtpMessage.deleteResult, parameter[member[.FILE_ACTION_OK], call[String.format, parameter[literal["%s No files to delete."], member[.FILE_ACTION_OK]]], literal[true]]]]
else begin[{]
None
end[}]
return[call[FtpMessage.deleteResult, parameter[call[ftpClient.getReplyCode, parameter[]], call[ftpClient.getReplyString, parameter[]], call[.isPositive, parameter[call[ftpClient.getReplyCode, parameter[]]]]]]]
end[}]
END[}] | Keyword[protected] identifier[FtpMessage] identifier[deleteFile] operator[SEP] identifier[DeleteCommand] identifier[delete] , identifier[TestContext] identifier[context] operator[SEP] {
identifier[String] identifier[remoteFilePath] operator[=] identifier[context] operator[SEP] identifier[replaceDynamicContentInString] operator[SEP] identifier[delete] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[hasText] operator[SEP] identifier[remoteFilePath] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[boolean] identifier[success] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[isDirectory] operator[SEP] identifier[remoteFilePath] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ftpClient] operator[SEP] identifier[changeWorkingDirectory] operator[SEP] identifier[remoteFilePath] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] literal[String] operator[+] identifier[remoteFilePath] operator[+] literal[String] operator[+] identifier[ftpClient] operator[SEP] identifier[getReplyString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[delete] operator[SEP] identifier[isRecursive] operator[SEP] operator[SEP] operator[SEP] {
identifier[FTPFile] operator[SEP] operator[SEP] identifier[ftpFiles] operator[=] identifier[ftpClient] operator[SEP] identifier[listFiles] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FTPFile] identifier[ftpFile] operator[:] identifier[ftpFiles] operator[SEP] {
identifier[DeleteCommand] identifier[recursiveDelete] operator[=] Keyword[new] identifier[DeleteCommand] operator[SEP] operator[SEP] operator[SEP] identifier[DeleteCommand] operator[SEP] identifier[Target] identifier[target] operator[=] Keyword[new] identifier[DeleteCommand] operator[SEP] identifier[Target] operator[SEP] operator[SEP] operator[SEP] identifier[target] operator[SEP] identifier[setPath] operator[SEP] identifier[remoteFilePath] operator[+] literal[String] operator[+] identifier[ftpFile] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[recursiveDelete] operator[SEP] identifier[setTarget] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[recursiveDelete] operator[SEP] identifier[setIncludeCurrent] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[deleteFile] operator[SEP] identifier[recursiveDelete] , identifier[context] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[delete] operator[SEP] identifier[isIncludeCurrent] operator[SEP] operator[SEP] operator[SEP] {
identifier[ftpClient] operator[SEP] identifier[changeWorkingDirectory] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[success] operator[=] identifier[ftpClient] operator[SEP] identifier[removeDirectory] operator[SEP] identifier[remoteFilePath] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[success] operator[=] identifier[ftpClient] operator[SEP] identifier[deleteFile] operator[SEP] identifier[remoteFilePath] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[success] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] literal[String] operator[+] identifier[remoteFilePath] operator[+] literal[String] operator[+] identifier[ftpClient] operator[SEP] identifier[getReplyString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ftpClient] operator[SEP] identifier[getReplyCode] operator[SEP] operator[SEP] operator[!=] identifier[FILE_ACTION_OK] operator[SEP] {
Keyword[return] identifier[FtpMessage] operator[SEP] identifier[deleteResult] operator[SEP] identifier[FILE_ACTION_OK] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[FILE_ACTION_OK] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[FtpMessage] operator[SEP] identifier[deleteResult] operator[SEP] identifier[ftpClient] operator[SEP] identifier[getReplyCode] operator[SEP] operator[SEP] , identifier[ftpClient] operator[SEP] identifier[getReplyString] operator[SEP] operator[SEP] , identifier[isPositive] operator[SEP] identifier[ftpClient] operator[SEP] identifier[getReplyCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void await() throws InterruptedException, EOFException
{
synchronized(this)
{
while ( (state.get() == State.STARTED) && !hasLeadership.get() )
{
wait();
}
}
if ( state.get() != State.STARTED )
{
throw new EOFException();
}
} | class class_name[name] begin[{]
method[await, return_type[void], modifier[public], parameter[]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
while[binary_operation[binary_operation[call[state.get, parameter[]], ==, member[State.STARTED]], &&, call[hasLeadership.get, parameter[]]]] begin[{]
call[.wait, parameter[]]
end[}]
END[}]
if[binary_operation[call[state.get, parameter[]], !=, member[State.STARTED]]] 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=EOFException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[await] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] , identifier[EOFException] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[while] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] identifier[State] operator[SEP] identifier[STARTED] operator[SEP] operator[&&] operator[!] identifier[hasLeadership] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[!=] identifier[State] operator[SEP] identifier[STARTED] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EOFException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String formatMessage(String key, Object[] args) {
try {
String raw = this.getMessage(key);
return MessageFormat.format(raw, args);
} catch (MissingResourceException ex) {
return "???!"+key+"!???";
}
} | class class_name[name] begin[{]
method[formatMessage, return_type[type[String]], modifier[public], parameter[key, args]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=raw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=raw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=MessageFormat, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="???!"), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="!???"), operator=+), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['MissingResourceException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[formatMessage] operator[SEP] identifier[String] identifier[key] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[try] {
identifier[String] identifier[raw] operator[=] Keyword[this] operator[SEP] identifier[getMessage] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[raw] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MissingResourceException] identifier[ex] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[SEP]
}
}
|
public int getAllCookies(String name, List<HttpCookie> list) {
int added = 0;
if (0 < this.parsedList.size() && null != name) {
for (HttpCookie cookie : this.parsedList) {
if (cookie.getName().equals(name)) {
list.add(cookie.clone());
added++;
}
}
}
return added;
} | class class_name[name] begin[{]
method[getAllCookies, return_type[type[int]], modifier[public], parameter[name, list]] begin[{]
local_variable[type[int], added]
if[binary_operation[binary_operation[literal[0], <, THIS[member[None.parsedList]call[None.size, parameter[]]]], &&, binary_operation[literal[null], !=, member[.name]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=clone, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=added, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=parsedList, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cookie)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpCookie, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.added]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getAllCookies] operator[SEP] identifier[String] identifier[name] , identifier[List] operator[<] identifier[HttpCookie] operator[>] identifier[list] operator[SEP] {
Keyword[int] identifier[added] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] Other[0] operator[<] Keyword[this] operator[SEP] identifier[parsedList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[&&] Other[null] operator[!=] identifier[name] operator[SEP] {
Keyword[for] operator[SEP] identifier[HttpCookie] identifier[cookie] operator[:] Keyword[this] operator[SEP] identifier[parsedList] operator[SEP] {
Keyword[if] operator[SEP] identifier[cookie] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[cookie] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[added] operator[++] operator[SEP]
}
}
}
Keyword[return] identifier[added] operator[SEP]
}
|
private void initialize() {
this.setDefaultCloseOperation(javax.swing.JFrame.DO_NOTHING_ON_CLOSE);
this.setContentPane(getJPanel());
this.setPreferredSize(new Dimension(550, 375));
this.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
btnDecline.doClick();
}
});
showLicense();
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[private], parameter[]] begin[{]
THIS[call[None.setDefaultCloseOperation, parameter[member[javax.swing.JFrame.DO_NOTHING_ON_CLOSE]]]]
THIS[call[None.setContentPane, parameter[call[.getJPanel, parameter[]]]]]
THIS[call[None.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=550), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=375)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]]
THIS[call[None.addWindowListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=doClick, postfix_operators=[], prefix_operators=[], qualifier=btnDecline, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=windowClosing, parameters=[FormalParameter(annotations=[], modifiers=set(), name=e, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=WindowEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=WindowAdapter, sub_type=None)))))]]]
call[.showLicense, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initialize] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[setDefaultCloseOperation] operator[SEP] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JFrame] operator[SEP] identifier[DO_NOTHING_ON_CLOSE] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setContentPane] operator[SEP] identifier[getJPanel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] Other[550] , Other[375] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addWindowListener] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[WindowAdapter] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[windowClosing] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[WindowEvent] identifier[e] operator[SEP] {
identifier[btnDecline] operator[SEP] identifier[doClick] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[showLicense] operator[SEP] operator[SEP] operator[SEP]
}
|
public int divide(char separator, Text[] parts) {
int pointer = pos;
int limit = pos + len;
int mark = pointer;
int count = 0;
while (pointer < limit) {
if (chars[pointer] == separator) {
parts[count].strain(chars, mark, pointer - mark);
mark = pointer + 1;
count++;
if (count == parts.length - 1) {
break;
}
}
pointer++;
}
if(limit > mark)
{
parts[count].strain(chars, mark, limit - mark);
count++;
}
return count;
} | class class_name[name] begin[{]
method[divide, return_type[type[int]], modifier[public], parameter[separator, parts]] begin[{]
local_variable[type[int], pointer]
local_variable[type[int], limit]
local_variable[type[int], mark]
local_variable[type[int], count]
while[binary_operation[member[.pointer], <, member[.limit]]] begin[{]
if[binary_operation[member[.chars], ==, member[.separator]]] begin[{]
member[.parts]
assign[member[.mark], binary_operation[member[.pointer], +, literal[1]]]
member[.count]
if[binary_operation[member[.count], ==, binary_operation[member[parts.length], -, literal[1]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
member[.pointer]
end[}]
if[binary_operation[member[.limit], >, member[.mark]]] begin[{]
member[.parts]
member[.count]
else begin[{]
None
end[}]
return[member[.count]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[divide] operator[SEP] Keyword[char] identifier[separator] , identifier[Text] operator[SEP] operator[SEP] identifier[parts] operator[SEP] {
Keyword[int] identifier[pointer] operator[=] identifier[pos] operator[SEP] Keyword[int] identifier[limit] operator[=] identifier[pos] operator[+] identifier[len] operator[SEP] Keyword[int] identifier[mark] operator[=] identifier[pointer] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[pointer] operator[<] identifier[limit] operator[SEP] {
Keyword[if] operator[SEP] identifier[chars] operator[SEP] identifier[pointer] operator[SEP] operator[==] identifier[separator] operator[SEP] {
identifier[parts] operator[SEP] identifier[count] operator[SEP] operator[SEP] identifier[strain] operator[SEP] identifier[chars] , identifier[mark] , identifier[pointer] operator[-] identifier[mark] operator[SEP] operator[SEP] identifier[mark] operator[=] identifier[pointer] operator[+] Other[1] operator[SEP] identifier[count] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] identifier[parts] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[pointer] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[limit] operator[>] identifier[mark] operator[SEP] {
identifier[parts] operator[SEP] identifier[count] operator[SEP] operator[SEP] identifier[strain] operator[SEP] identifier[chars] , identifier[mark] , identifier[limit] operator[-] identifier[mark] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
private List<Object> readAndProcess() {
logger.entering(sourceClass, "readAndProcess");
List<Object> chunkToWrite = new ArrayList<Object>();
Object itemRead = null;
Object itemProcessed = null;
while (true) {
currentItemStatus = new SingleItemStatus();
itemRead = readItem();
if (currentChunkStatus.wasMarkedForRollbackWithRetry()) {
break;
}
if (!currentItemStatus.isSkipped() && !currentChunkStatus.hasReadNull()) {
itemProcessed = processItem(itemRead);
if (currentChunkStatus.wasMarkedForRollbackWithRetry()) {
break;
}
if (!currentItemStatus.isSkipped() && !currentItemStatus.isFiltered()) {
chunkToWrite.add(itemProcessed);
}
}
// Break out of the loop to deliver one-at-a-time processing after rollback.
// No point calling isReadyToCheckpoint(), we know we're done. Let's not
// complicate the checkpoint algorithm to hold this logic, just break right here.
if (currentChunkStatus.isRetryingAfterRollback()) {
break;
}
// This will force the current item to finish processing on a stop request
if (stepContext.getBatchStatus().equals(BatchStatus.STOPPING)) {
currentChunkStatus.markStopping();
break;
}
// The spec, in Sec. 11.10, Chunk with Custom Checkpoint Processing, clearly
// outlines that this gets called even when we've already read a null (which
// arguably is pointless). But we'll follow the spec.
if (checkpointManager.isReadyToCheckpoint()) {
break;
}
// last record in readerProxy reached
if (currentChunkStatus.hasReadNull()) {
break;
}
}
logger.exiting(sourceClass, "readAndProcess", chunkToWrite);
return chunkToWrite;
} | class class_name[name] begin[{]
method[readAndProcess, return_type[type[List]], modifier[private], parameter[]] begin[{]
call[logger.entering, parameter[member[.sourceClass], literal["readAndProcess"]]]
local_variable[type[List], chunkToWrite]
local_variable[type[Object], itemRead]
local_variable[type[Object], itemProcessed]
while[literal[true]] begin[{]
assign[member[.currentItemStatus], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SingleItemStatus, sub_type=None))]
assign[member[.itemRead], call[.readItem, parameter[]]]
if[call[currentChunkStatus.wasMarkedForRollbackWithRetry, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[call[currentItemStatus.isSkipped, parameter[]], &&, call[currentChunkStatus.hasReadNull, parameter[]]]] begin[{]
assign[member[.itemProcessed], call[.processItem, parameter[member[.itemRead]]]]
if[call[currentChunkStatus.wasMarkedForRollbackWithRetry, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[call[currentItemStatus.isSkipped, parameter[]], &&, call[currentItemStatus.isFiltered, parameter[]]]] begin[{]
call[chunkToWrite.add, parameter[member[.itemProcessed]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[currentChunkStatus.isRetryingAfterRollback, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[stepContext.getBatchStatus, parameter[]]] begin[{]
call[currentChunkStatus.markStopping, parameter[]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[checkpointManager.isReadyToCheckpoint, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[currentChunkStatus.hasReadNull, parameter[]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
call[logger.exiting, parameter[member[.sourceClass], literal["readAndProcess"], member[.chunkToWrite]]]
return[member[.chunkToWrite]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Object] operator[>] identifier[readAndProcess] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[entering] operator[SEP] identifier[sourceClass] , literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[chunkToWrite] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[itemRead] operator[=] Other[null] operator[SEP] identifier[Object] identifier[itemProcessed] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[currentItemStatus] operator[=] Keyword[new] identifier[SingleItemStatus] operator[SEP] operator[SEP] operator[SEP] identifier[itemRead] operator[=] identifier[readItem] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentChunkStatus] operator[SEP] identifier[wasMarkedForRollbackWithRetry] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[currentItemStatus] operator[SEP] identifier[isSkipped] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[currentChunkStatus] operator[SEP] identifier[hasReadNull] operator[SEP] operator[SEP] operator[SEP] {
identifier[itemProcessed] operator[=] identifier[processItem] operator[SEP] identifier[itemRead] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentChunkStatus] operator[SEP] identifier[wasMarkedForRollbackWithRetry] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[currentItemStatus] operator[SEP] identifier[isSkipped] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[currentItemStatus] operator[SEP] identifier[isFiltered] operator[SEP] operator[SEP] operator[SEP] {
identifier[chunkToWrite] operator[SEP] identifier[add] operator[SEP] identifier[itemProcessed] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[currentChunkStatus] operator[SEP] identifier[isRetryingAfterRollback] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[stepContext] operator[SEP] identifier[getBatchStatus] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[BatchStatus] operator[SEP] identifier[STOPPING] operator[SEP] operator[SEP] {
identifier[currentChunkStatus] operator[SEP] identifier[markStopping] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[checkpointManager] operator[SEP] identifier[isReadyToCheckpoint] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentChunkStatus] operator[SEP] identifier[hasReadNull] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[logger] operator[SEP] identifier[exiting] operator[SEP] identifier[sourceClass] , literal[String] , identifier[chunkToWrite] operator[SEP] operator[SEP] Keyword[return] identifier[chunkToWrite] operator[SEP]
}
|
public void clearDeletedList() {
CmsSitemapClipboardData clipboardData = getData().getClipboardData().copy();
clipboardData.getDeletions().clear();
CmsSitemapChange change = new CmsSitemapChange(null, null, ChangeType.clipboardOnly);
change.setClipBoardData(clipboardData);
commitChange(change, null);
} | class class_name[name] begin[{]
method[clearDeletedList, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[CmsSitemapClipboardData], clipboardData]
call[clipboardData.getDeletions, parameter[]]
local_variable[type[CmsSitemapChange], change]
call[change.setClipBoardData, parameter[member[.clipboardData]]]
call[.commitChange, parameter[member[.change], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[clearDeletedList] operator[SEP] operator[SEP] {
identifier[CmsSitemapClipboardData] identifier[clipboardData] operator[=] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[getClipboardData] operator[SEP] operator[SEP] operator[SEP] identifier[copy] operator[SEP] operator[SEP] operator[SEP] identifier[clipboardData] operator[SEP] identifier[getDeletions] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[CmsSitemapChange] identifier[change] operator[=] Keyword[new] identifier[CmsSitemapChange] operator[SEP] Other[null] , Other[null] , identifier[ChangeType] operator[SEP] identifier[clipboardOnly] operator[SEP] operator[SEP] identifier[change] operator[SEP] identifier[setClipBoardData] operator[SEP] identifier[clipboardData] operator[SEP] operator[SEP] identifier[commitChange] operator[SEP] identifier[change] , Other[null] operator[SEP] operator[SEP]
}
|
private boolean contains(String[] names, String name) {
assert name != null;
for (int i = 0; i < names.length; i++) {
if (name.equals(names[i])) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[private], parameter[names, name]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, 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=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=names, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[contains] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[names] , identifier[String] identifier[name] operator[SEP] {
Keyword[assert] identifier[name] operator[!=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[names] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] identifier[names] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Payment get( Payment payment ) {
return RestfulUtils.show( PaymentService.PATH, payment, Payment.class, super.httpClient );
} | class class_name[name] begin[{]
method[get, return_type[type[Payment]], modifier[public], parameter[payment]] begin[{]
return[call[RestfulUtils.show, parameter[member[PaymentService.PATH], member[.payment], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Payment, sub_type=None)), SuperMemberReference(member=httpClient, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])]]]
end[}]
END[}] | Keyword[public] identifier[Payment] identifier[get] operator[SEP] identifier[Payment] identifier[payment] operator[SEP] {
Keyword[return] identifier[RestfulUtils] operator[SEP] identifier[show] operator[SEP] identifier[PaymentService] operator[SEP] identifier[PATH] , identifier[payment] , identifier[Payment] operator[SEP] Keyword[class] , Keyword[super] operator[SEP] identifier[httpClient] operator[SEP] operator[SEP]
}
|
public static double getMass(IMolecularFormula mf, int flav) {
final Isotopes isofact;
try {
isofact = Isotopes.getInstance();
} catch (IOException e) {
throw new IllegalStateException("Could not load Isotopes!");
}
double mass = 0;
switch (flav & 0xf) {
case MolWeight:
for (IIsotope iso : mf.isotopes()) {
mass += mf.getIsotopeCount(iso) *
getMassOrAvg(isofact, iso);
}
break;
case MolWeightIgnoreSpecified:
for (IIsotope iso : mf.isotopes()) {
mass += mf.getIsotopeCount(iso) *
isofact.getNaturalMass(iso.getAtomicNumber());
}
break;
case MonoIsotopic:
for (IIsotope iso : mf.isotopes()) {
mass += mf.getIsotopeCount(iso) *
getExactMass(isofact, iso);
}
break;
case MostAbundant:
IMolecularFormula mamf = getMostAbundant(mf);
if (mamf != null)
mass = getMass(mamf, MonoIsotopic);
break;
}
return mass;
} | class class_name[name] begin[{]
method[getMass, return_type[type[double]], modifier[public static], parameter[mf, flav]] begin[{]
local_variable[type[Isotopes], isofact]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isofact, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Isotopes, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not load Isotopes!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
local_variable[type[double], mass]
SwitchStatement(cases=[SwitchStatementCase(case=['MolWeight'], statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=iso, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIsotopeCount, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=isofact, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iso, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMassOrAvg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=*)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=isotopes, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iso)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IIsotope, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MolWeightIgnoreSpecified'], statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=iso, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIsotopeCount, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAtomicNumber, postfix_operators=[], prefix_operators=[], qualifier=iso, selectors=[], type_arguments=None)], member=getNaturalMass, postfix_operators=[], prefix_operators=[], qualifier=isofact, selectors=[], type_arguments=None), operator=*)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=isotopes, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iso)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IIsotope, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MonoIsotopic'], statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=iso, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIsotopeCount, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=isofact, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iso, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getExactMass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=*)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=isotopes, postfix_operators=[], prefix_operators=[], qualifier=mf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iso)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IIsotope, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MostAbundant'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMostAbundant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=mamf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IMolecularFormula, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mamf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=mass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mamf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MonoIsotopic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)), BreakStatement(goto=None, label=None)])], expression=BinaryOperation(operandl=MemberReference(member=flav, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xf), operator=&), label=None)
return[member[.mass]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[getMass] operator[SEP] identifier[IMolecularFormula] identifier[mf] , Keyword[int] identifier[flav] operator[SEP] {
Keyword[final] identifier[Isotopes] identifier[isofact] operator[SEP] Keyword[try] {
identifier[isofact] operator[=] identifier[Isotopes] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[double] identifier[mass] operator[=] Other[0] operator[SEP] Keyword[switch] operator[SEP] identifier[flav] operator[&] literal[Integer] operator[SEP] {
Keyword[case] identifier[MolWeight] operator[:] Keyword[for] operator[SEP] identifier[IIsotope] identifier[iso] operator[:] identifier[mf] operator[SEP] identifier[isotopes] operator[SEP] operator[SEP] operator[SEP] {
identifier[mass] operator[+=] identifier[mf] operator[SEP] identifier[getIsotopeCount] operator[SEP] identifier[iso] operator[SEP] operator[*] identifier[getMassOrAvg] operator[SEP] identifier[isofact] , identifier[iso] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[MolWeightIgnoreSpecified] operator[:] Keyword[for] operator[SEP] identifier[IIsotope] identifier[iso] operator[:] identifier[mf] operator[SEP] identifier[isotopes] operator[SEP] operator[SEP] operator[SEP] {
identifier[mass] operator[+=] identifier[mf] operator[SEP] identifier[getIsotopeCount] operator[SEP] identifier[iso] operator[SEP] operator[*] identifier[isofact] operator[SEP] identifier[getNaturalMass] operator[SEP] identifier[iso] operator[SEP] identifier[getAtomicNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[MonoIsotopic] operator[:] Keyword[for] operator[SEP] identifier[IIsotope] identifier[iso] operator[:] identifier[mf] operator[SEP] identifier[isotopes] operator[SEP] operator[SEP] operator[SEP] {
identifier[mass] operator[+=] identifier[mf] operator[SEP] identifier[getIsotopeCount] operator[SEP] identifier[iso] operator[SEP] operator[*] identifier[getExactMass] operator[SEP] identifier[isofact] , identifier[iso] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[MostAbundant] operator[:] identifier[IMolecularFormula] identifier[mamf] operator[=] identifier[getMostAbundant] operator[SEP] identifier[mf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mamf] operator[!=] Other[null] operator[SEP] identifier[mass] operator[=] identifier[getMass] operator[SEP] identifier[mamf] , identifier[MonoIsotopic] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[return] identifier[mass] operator[SEP]
}
|
@Override
public void setScheme(String scheme) throws UnsupportedSchemeException {
SchemeValues val = SchemeValues.match(scheme, 0, scheme.length());
if (null == val) {
throw new UnsupportedSchemeException("Illegal scheme " + scheme);
}
setScheme(val);
} | class class_name[name] begin[{]
method[setScheme, return_type[void], modifier[public], parameter[scheme]] begin[{]
local_variable[type[SchemeValues], val]
if[binary_operation[literal[null], ==, member[.val]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal scheme "), operandr=MemberReference(member=scheme, 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=UnsupportedSchemeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.setScheme, parameter[member[.val]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setScheme] operator[SEP] identifier[String] identifier[scheme] operator[SEP] Keyword[throws] identifier[UnsupportedSchemeException] {
identifier[SchemeValues] identifier[val] operator[=] identifier[SchemeValues] operator[SEP] identifier[match] operator[SEP] identifier[scheme] , Other[0] , identifier[scheme] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[val] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedSchemeException] operator[SEP] literal[String] operator[+] identifier[scheme] operator[SEP] operator[SEP]
}
identifier[setScheme] operator[SEP] identifier[val] operator[SEP] operator[SEP]
}
|
private static void checkPreconditions(final String trueValue, final String falseValue) {
if( trueValue == null ) {
throw new NullPointerException("trueValue should not be null");
}
if( falseValue == null ) {
throw new NullPointerException("falseValue should not be null");
}
} | class class_name[name] begin[{]
method[checkPreconditions, return_type[void], modifier[private static], parameter[trueValue, falseValue]] begin[{]
if[binary_operation[member[.trueValue], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="trueValue should not be null")], 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[}]
if[binary_operation[member[.falseValue], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="falseValue should not be null")], 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[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[checkPreconditions] operator[SEP] Keyword[final] identifier[String] identifier[trueValue] , Keyword[final] identifier[String] identifier[falseValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[trueValue] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[falseValue] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
protected final CnvIbnIntegerToCv
createPutCnvIbnIntegerToCv() throws Exception {
CnvIbnIntegerToCv convrt = new CnvIbnIntegerToCv();
this.convertersMap
.put(CnvIbnIntegerToCv.class.getSimpleName(), convrt);
return convrt;
} | class class_name[name] begin[{]
method[createPutCnvIbnIntegerToCv, return_type[type[CnvIbnIntegerToCv]], modifier[final protected], parameter[]] begin[{]
local_variable[type[CnvIbnIntegerToCv], convrt]
THIS[member[None.convertersMap]call[None.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=CnvIbnIntegerToCv, sub_type=None)), member[.convrt]]]]
return[member[.convrt]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[CnvIbnIntegerToCv] identifier[createPutCnvIbnIntegerToCv] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[CnvIbnIntegerToCv] identifier[convrt] operator[=] Keyword[new] identifier[CnvIbnIntegerToCv] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[convertersMap] operator[SEP] identifier[put] operator[SEP] identifier[CnvIbnIntegerToCv] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[convrt] operator[SEP] operator[SEP] Keyword[return] identifier[convrt] operator[SEP]
}
|
public String getExtendsInterface() {
if (this.getExtendsInterfaces().isEmpty()){
// return "Empty";
return this.getInstanceType();
} else {
String tName = this.getExtendsInterfaces().get(0).replaceAll("\\W+", "");
return tName;
}
} | class class_name[name] begin[{]
method[getExtendsInterface, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[THIS[call[None.getExtendsInterfaces, parameter[]]call[None.isEmpty, parameter[]]]] begin[{]
return[THIS[call[None.getInstanceType, parameter[]]]]
else begin[{]
local_variable[type[String], tName]
return[member[.tName]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getExtendsInterface] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getExtendsInterfaces] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[getInstanceType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[tName] operator[=] Keyword[this] operator[SEP] identifier[getExtendsInterfaces] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[tName] operator[SEP]
}
}
|
public static JavaRDD<List<Writable>> zeromeanUnitVariance(Schema schema, JavaRDD<List<Writable>> data) {
return zeromeanUnitVariance(schema, data, Collections.<String>emptyList());
} | class class_name[name] begin[{]
method[zeromeanUnitVariance, return_type[type[JavaRDD]], modifier[public static], parameter[schema, data]] begin[{]
return[call[.zeromeanUnitVariance, parameter[member[.schema], member[.data], call[.Collections, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JavaRDD] operator[<] identifier[List] operator[<] identifier[Writable] operator[>] operator[>] identifier[zeromeanUnitVariance] operator[SEP] identifier[Schema] identifier[schema] , identifier[JavaRDD] operator[<] identifier[List] operator[<] identifier[Writable] operator[>] operator[>] identifier[data] operator[SEP] {
Keyword[return] identifier[zeromeanUnitVariance] operator[SEP] identifier[schema] , identifier[data] , identifier[Collections] operator[SEP] operator[<] identifier[String] operator[>] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Codec getDecoderById(CodecID codecId) throws JavaAVException {
if (codecId == null)
throw new NullPointerException("CodecID is null.");
AVCodec avCodec = avcodec_find_decoder(codecId.value());
if (avCodec == null || avCodec.isNull())
throw new JavaAVException("Decoder not found: " + codecId.toString());
Codec codec = new Codec();
codec.avCodec = avCodec;
return codec;
} | class class_name[name] begin[{]
method[getDecoderById, return_type[type[Codec]], modifier[public static], parameter[codecId]] begin[{]
if[binary_operation[member[.codecId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CodecID is null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[AVCodec], avCodec]
if[binary_operation[binary_operation[member[.avCodec], ==, literal[null]], ||, call[avCodec.isNull, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Decoder not found: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=codecId, 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=JavaAVException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Codec], codec]
assign[member[codec.avCodec], member[.avCodec]]
return[member[.codec]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Codec] identifier[getDecoderById] operator[SEP] identifier[CodecID] identifier[codecId] operator[SEP] Keyword[throws] identifier[JavaAVException] {
Keyword[if] operator[SEP] identifier[codecId] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[AVCodec] identifier[avCodec] operator[=] identifier[avcodec_find_decoder] operator[SEP] identifier[codecId] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[avCodec] operator[==] Other[null] operator[||] identifier[avCodec] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[JavaAVException] operator[SEP] literal[String] operator[+] identifier[codecId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Codec] identifier[codec] operator[=] Keyword[new] identifier[Codec] operator[SEP] operator[SEP] operator[SEP] identifier[codec] operator[SEP] identifier[avCodec] operator[=] identifier[avCodec] operator[SEP] Keyword[return] identifier[codec] operator[SEP]
}
|
private CAInfo createCA(String name, JsonObject jsonCA, OrgInfo org) throws NetworkConfigurationException {
String url = getJsonValueAsString(jsonCA.get("url"));
Properties httpOptions = extractProperties(jsonCA, "httpOptions");
String enrollId = null;
String enrollSecret = null;
List<JsonObject> registrars = getJsonValueAsList(jsonCA.get("registrar"));
List<UserInfo> regUsers = new LinkedList<>();
if (registrars != null) {
for (JsonObject reg : registrars) {
enrollId = getJsonValueAsString(reg.get("enrollId"));
enrollSecret = getJsonValueAsString(reg.get("enrollSecret"));
try {
regUsers.add(new UserInfo(CryptoSuite.Factory.getCryptoSuite(), org.mspId, enrollId, enrollSecret));
} catch (Exception e) {
throw new NetworkConfigurationException(e.getMessage(), e);
}
}
}
CAInfo caInfo = new CAInfo(name, org.mspId, url, regUsers, httpOptions);
String caName = getJsonValueAsString(jsonCA.get("caName"));
if (caName != null) {
caInfo.setCaName(caName);
}
Properties properties = new Properties();
if (null != httpOptions && "false".equals(httpOptions.getProperty("verify"))) {
properties.setProperty("allowAllHostNames", "true");
}
getTLSCerts(name, jsonCA, properties);
caInfo.setProperties(properties);
return caInfo;
} | class class_name[name] begin[{]
method[createCA, return_type[type[CAInfo]], modifier[private], parameter[name, jsonCA, org]] begin[{]
local_variable[type[String], url]
local_variable[type[Properties], httpOptions]
local_variable[type[String], enrollId]
local_variable[type[String], enrollSecret]
local_variable[type[List], registrars]
local_variable[type[List], regUsers]
if[binary_operation[member[.registrars], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=enrollId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="enrollId")], member=get, postfix_operators=[], prefix_operators=[], qualifier=reg, selectors=[], type_arguments=None)], member=getJsonValueAsString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=enrollSecret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="enrollSecret")], member=get, postfix_operators=[], prefix_operators=[], qualifier=reg, selectors=[], type_arguments=None)], member=getJsonValueAsString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getCryptoSuite, postfix_operators=[], prefix_operators=[], qualifier=CryptoSuite.Factory, selectors=[], type_arguments=None), MemberReference(member=mspId, postfix_operators=[], prefix_operators=[], qualifier=org, selectors=[]), MemberReference(member=enrollId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=enrollSecret, 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=UserInfo, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=regUsers, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NetworkConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=registrars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=reg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[CAInfo], caInfo]
local_variable[type[String], caName]
if[binary_operation[member[.caName], !=, literal[null]]] begin[{]
call[caInfo.setCaName, parameter[member[.caName]]]
else begin[{]
None
end[}]
local_variable[type[Properties], properties]
if[binary_operation[binary_operation[literal[null], !=, member[.httpOptions]], &&, literal["false"]]] begin[{]
call[properties.setProperty, parameter[literal["allowAllHostNames"], literal["true"]]]
else begin[{]
None
end[}]
call[.getTLSCerts, parameter[member[.name], member[.jsonCA], member[.properties]]]
call[caInfo.setProperties, parameter[member[.properties]]]
return[member[.caInfo]]
end[}]
END[}] | Keyword[private] identifier[CAInfo] identifier[createCA] operator[SEP] identifier[String] identifier[name] , identifier[JsonObject] identifier[jsonCA] , identifier[OrgInfo] identifier[org] operator[SEP] Keyword[throws] identifier[NetworkConfigurationException] {
identifier[String] identifier[url] operator[=] identifier[getJsonValueAsString] operator[SEP] identifier[jsonCA] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Properties] identifier[httpOptions] operator[=] identifier[extractProperties] operator[SEP] identifier[jsonCA] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[enrollId] operator[=] Other[null] operator[SEP] identifier[String] identifier[enrollSecret] operator[=] Other[null] operator[SEP] identifier[List] operator[<] identifier[JsonObject] operator[>] identifier[registrars] operator[=] identifier[getJsonValueAsList] operator[SEP] identifier[jsonCA] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[UserInfo] operator[>] identifier[regUsers] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[registrars] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[JsonObject] identifier[reg] operator[:] identifier[registrars] operator[SEP] {
identifier[enrollId] operator[=] identifier[getJsonValueAsString] operator[SEP] identifier[reg] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[enrollSecret] operator[=] identifier[getJsonValueAsString] operator[SEP] identifier[reg] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[regUsers] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[UserInfo] operator[SEP] identifier[CryptoSuite] operator[SEP] identifier[Factory] operator[SEP] identifier[getCryptoSuite] operator[SEP] operator[SEP] , identifier[org] operator[SEP] identifier[mspId] , identifier[enrollId] , identifier[enrollSecret] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NetworkConfigurationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
identifier[CAInfo] identifier[caInfo] operator[=] Keyword[new] identifier[CAInfo] operator[SEP] identifier[name] , identifier[org] operator[SEP] identifier[mspId] , identifier[url] , identifier[regUsers] , identifier[httpOptions] operator[SEP] operator[SEP] identifier[String] identifier[caName] operator[=] identifier[getJsonValueAsString] operator[SEP] identifier[jsonCA] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[caName] operator[!=] Other[null] operator[SEP] {
identifier[caInfo] operator[SEP] identifier[setCaName] operator[SEP] identifier[caName] operator[SEP] operator[SEP]
}
identifier[Properties] identifier[properties] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[httpOptions] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[httpOptions] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[properties] operator[SEP] identifier[setProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
identifier[getTLSCerts] operator[SEP] identifier[name] , identifier[jsonCA] , identifier[properties] operator[SEP] operator[SEP] identifier[caInfo] operator[SEP] identifier[setProperties] operator[SEP] identifier[properties] operator[SEP] operator[SEP] Keyword[return] identifier[caInfo] operator[SEP]
}
|
private LayoutManager createLayout() {
SeaGlassContext context = getContext(this);
LayoutManager lm = (LayoutManager) style.get(context, "InternalFrameTitlePane.titlePaneLayout");
context.dispose();
return (lm != null) ? lm : new SeaGlassTitlePaneLayout();
} | class class_name[name] begin[{]
method[createLayout, return_type[type[LayoutManager]], modifier[private], parameter[]] begin[{]
local_variable[type[SeaGlassContext], context]
local_variable[type[LayoutManager], lm]
call[context.dispose, parameter[]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=lm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SeaGlassTitlePaneLayout, sub_type=None)), if_true=MemberReference(member=lm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[private] identifier[LayoutManager] identifier[createLayout] operator[SEP] operator[SEP] {
identifier[SeaGlassContext] identifier[context] operator[=] identifier[getContext] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[LayoutManager] identifier[lm] operator[=] operator[SEP] identifier[LayoutManager] operator[SEP] identifier[style] operator[SEP] identifier[get] operator[SEP] identifier[context] , literal[String] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[lm] operator[!=] Other[null] operator[SEP] operator[?] identifier[lm] operator[:] Keyword[new] identifier[SeaGlassTitlePaneLayout] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String derivedAutomaticModuleName(final String jarPath) {
// If jar path does not end in a file extension (with ".jar" most likely), strip off everything after
// the last '!', in order to remove package root
int endIdx = jarPath.length();
final int lastPlingIdx = jarPath.lastIndexOf('!');
if (lastPlingIdx > 0
// If there is no '.' after the last '/' (if any) after the last '!'
&& jarPath.lastIndexOf('.') <= Math.max(lastPlingIdx, jarPath.lastIndexOf('/'))) {
// Then truncate at last '!'
endIdx = lastPlingIdx;
}
// Find the second to last '!' (or -1, if none)
final int secondToLastPlingIdx = endIdx == 0 ? -1 : jarPath.lastIndexOf("!", endIdx - 1);
// Find last '/' between the second to last and the last '!'
final int startIdx = Math.max(secondToLastPlingIdx, jarPath.lastIndexOf('/', endIdx - 1)) + 1;
// Find last '.' after that '/'
final int lastDotBeforeLastPlingIdx = jarPath.lastIndexOf('.', endIdx - 1);
if (lastDotBeforeLastPlingIdx > startIdx) {
// Strip off extension
endIdx = lastDotBeforeLastPlingIdx;
}
// Remove .jar extension
String moduleName = jarPath.substring(startIdx, endIdx);
// Find first occurrence of "-[0-9]"
final Matcher matcher = DASH_VERSION.matcher(moduleName);
if (matcher.find()) {
moduleName = moduleName.substring(0, matcher.start());
}
// Replace non-alphanumeric characters with dots
moduleName = NON_ALPHANUM.matcher(moduleName).replaceAll(".");
// Collapse repeating dots into a single dot
moduleName = REPEATING_DOTS.matcher(moduleName).replaceAll(".");
// Drop leading dots
if (moduleName.length() > 0 && moduleName.charAt(0) == '.') {
moduleName = LEADING_DOTS.matcher(moduleName).replaceAll("");
}
// Drop trailing dots
final int len = moduleName.length();
if (len > 0 && moduleName.charAt(len - 1) == '.') {
moduleName = TRAILING_DOTS.matcher(moduleName).replaceAll("");
}
return moduleName;
} | class class_name[name] begin[{]
method[derivedAutomaticModuleName, return_type[type[String]], modifier[public static], parameter[jarPath]] begin[{]
local_variable[type[int], endIdx]
local_variable[type[int], lastPlingIdx]
if[binary_operation[binary_operation[member[.lastPlingIdx], >, literal[0]], &&, binary_operation[call[jarPath.lastIndexOf, parameter[literal['.']]], <=, call[Math.max, parameter[member[.lastPlingIdx], call[jarPath.lastIndexOf, parameter[literal['/']]]]]]]] begin[{]
assign[member[.endIdx], member[.lastPlingIdx]]
else begin[{]
None
end[}]
local_variable[type[int], secondToLastPlingIdx]
local_variable[type[int], startIdx]
local_variable[type[int], lastDotBeforeLastPlingIdx]
if[binary_operation[member[.lastDotBeforeLastPlingIdx], >, member[.startIdx]]] begin[{]
assign[member[.endIdx], member[.lastDotBeforeLastPlingIdx]]
else begin[{]
None
end[}]
local_variable[type[String], moduleName]
local_variable[type[Matcher], matcher]
if[call[matcher.find, parameter[]]] begin[{]
assign[member[.moduleName], call[moduleName.substring, parameter[literal[0], call[matcher.start, parameter[]]]]]
else begin[{]
None
end[}]
assign[member[.moduleName], call[NON_ALPHANUM.matcher, parameter[member[.moduleName]]]]
assign[member[.moduleName], call[REPEATING_DOTS.matcher, parameter[member[.moduleName]]]]
if[binary_operation[binary_operation[call[moduleName.length, parameter[]], >, literal[0]], &&, binary_operation[call[moduleName.charAt, parameter[literal[0]]], ==, literal['.']]]] begin[{]
assign[member[.moduleName], call[LEADING_DOTS.matcher, parameter[member[.moduleName]]]]
else begin[{]
None
end[}]
local_variable[type[int], len]
if[binary_operation[binary_operation[member[.len], >, literal[0]], &&, binary_operation[call[moduleName.charAt, parameter[binary_operation[member[.len], -, literal[1]]]], ==, literal['.']]]] begin[{]
assign[member[.moduleName], call[TRAILING_DOTS.matcher, parameter[member[.moduleName]]]]
else begin[{]
None
end[}]
return[member[.moduleName]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[derivedAutomaticModuleName] operator[SEP] Keyword[final] identifier[String] identifier[jarPath] operator[SEP] {
Keyword[int] identifier[endIdx] operator[=] identifier[jarPath] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[lastPlingIdx] operator[=] identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastPlingIdx] operator[>] Other[0] operator[&&] identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[<=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[lastPlingIdx] , identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[endIdx] operator[=] identifier[lastPlingIdx] operator[SEP]
}
Keyword[final] Keyword[int] identifier[secondToLastPlingIdx] operator[=] identifier[endIdx] operator[==] Other[0] operator[?] operator[-] Other[1] operator[:] identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[endIdx] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[startIdx] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[secondToLastPlingIdx] , identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[endIdx] operator[-] Other[1] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[final] Keyword[int] identifier[lastDotBeforeLastPlingIdx] operator[=] identifier[jarPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[endIdx] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastDotBeforeLastPlingIdx] operator[>] identifier[startIdx] operator[SEP] {
identifier[endIdx] operator[=] identifier[lastDotBeforeLastPlingIdx] operator[SEP]
}
identifier[String] identifier[moduleName] operator[=] identifier[jarPath] operator[SEP] identifier[substring] operator[SEP] identifier[startIdx] , identifier[endIdx] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[matcher] operator[=] identifier[DASH_VERSION] operator[SEP] identifier[matcher] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[moduleName] operator[=] identifier[moduleName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[matcher] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[moduleName] operator[=] identifier[NON_ALPHANUM] operator[SEP] identifier[matcher] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[moduleName] operator[=] identifier[REPEATING_DOTS] operator[SEP] identifier[matcher] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[moduleName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] identifier[moduleName] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[moduleName] operator[=] identifier[LEADING_DOTS] operator[SEP] identifier[matcher] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[len] operator[=] identifier[moduleName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[>] Other[0] operator[&&] identifier[moduleName] operator[SEP] identifier[charAt] operator[SEP] identifier[len] operator[-] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[moduleName] operator[=] identifier[TRAILING_DOTS] operator[SEP] identifier[matcher] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[moduleName] operator[SEP]
}
|
@Override
public void write( final DateTime obj, final javolution.xml.XMLFormat.OutputElement output ) throws XMLStreamException {
output.setAttribute( MILLIS, obj.getMillis() );
final String chronologyId = getChronologyId( obj.getChronology() );
if ( chronologyId != null ) {
output.setAttribute( CHRONOLOGY, chronologyId );
}
if ( obj.getZone() != null && obj.getZone() != DateTimeZone.getDefault() ) {
output.setAttribute( TIME_ZONE, obj.getZone().getID() );
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[obj, output]] begin[{]
call[output.setAttribute, parameter[member[.MILLIS], call[obj.getMillis, parameter[]]]]
local_variable[type[String], chronologyId]
if[binary_operation[member[.chronologyId], !=, literal[null]]] begin[{]
call[output.setAttribute, parameter[member[.CHRONOLOGY], member[.chronologyId]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[obj.getZone, parameter[]], !=, literal[null]], &&, binary_operation[call[obj.getZone, parameter[]], !=, call[DateTimeZone.getDefault, parameter[]]]]] begin[{]
call[output.setAttribute, parameter[member[.TIME_ZONE], call[obj.getZone, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[write] operator[SEP] Keyword[final] identifier[DateTime] identifier[obj] , Keyword[final] identifier[javolution] operator[SEP] identifier[xml] operator[SEP] identifier[XMLFormat] operator[SEP] identifier[OutputElement] identifier[output] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
identifier[output] operator[SEP] identifier[setAttribute] operator[SEP] identifier[MILLIS] , identifier[obj] operator[SEP] identifier[getMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[chronologyId] operator[=] identifier[getChronologyId] operator[SEP] identifier[obj] operator[SEP] identifier[getChronology] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[chronologyId] operator[!=] Other[null] operator[SEP] {
identifier[output] operator[SEP] identifier[setAttribute] operator[SEP] identifier[CHRONOLOGY] , identifier[chronologyId] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[obj] operator[SEP] identifier[getZone] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[obj] operator[SEP] identifier[getZone] operator[SEP] operator[SEP] operator[!=] identifier[DateTimeZone] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] {
identifier[output] operator[SEP] identifier[setAttribute] operator[SEP] identifier[TIME_ZONE] , identifier[obj] operator[SEP] identifier[getZone] operator[SEP] operator[SEP] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public EntityAnnotation getEntityAnnotation(final String entityUri) {
return Iterables.find(getEntityAnnotations(),
new Predicate<EntityAnnotation>() {
@Override
public boolean apply(EntityAnnotation ea) {
return ea.getEntityReference().getUri()
.equals(entityUri);
}
}
);
} | class class_name[name] begin[{]
method[getEntityAnnotation, return_type[type[EntityAnnotation]], modifier[public], parameter[entityUri]] begin[{]
return[call[Iterables.find, parameter[call[.getEntityAnnotations, parameter[]], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getEntityReference, postfix_operators=[], prefix_operators=[], qualifier=ea, selectors=[MethodInvocation(arguments=[], member=getUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=entityUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=apply, parameters=[FormalParameter(annotations=[], modifiers=set(), name=ea, type=ReferenceType(arguments=None, dimensions=[], name=EntityAnnotation, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EntityAnnotation, sub_type=None))], dimensions=None, name=Predicate, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[EntityAnnotation] identifier[getEntityAnnotation] operator[SEP] Keyword[final] identifier[String] identifier[entityUri] operator[SEP] {
Keyword[return] identifier[Iterables] operator[SEP] identifier[find] operator[SEP] identifier[getEntityAnnotations] operator[SEP] operator[SEP] , Keyword[new] identifier[Predicate] operator[<] identifier[EntityAnnotation] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[apply] operator[SEP] identifier[EntityAnnotation] identifier[ea] operator[SEP] {
Keyword[return] identifier[ea] operator[SEP] identifier[getEntityReference] operator[SEP] operator[SEP] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[entityUri] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public final int buildAt(final String fullName,
final ConfigBuildRef configBuildRef, final int atRow,
final Map<String, Object> context,
final List<RowsMapping> currentRowsMappingList) {
if (commandList != null) {
for (int i = 0; i < commandList.size(); i++) {
Command command = commandList.get(i);
command.setFinalLength(0);
int populatedLength = command.buildAt(fullName,
configBuildRef,
command.getConfigRange().getFirstRowRef()
.getRowIndex(),
context, currentRowsMappingList);
command.setFinalLength(populatedLength);
}
}
buildCells(fullName, configBuildRef, atRow, context,
currentRowsMappingList);
return this.getLastRowPlusRef().getRowIndex()
- this.getFirstRowRef().getRowIndex();
} | class class_name[name] begin[{]
method[buildAt, return_type[type[int]], modifier[final public], parameter[fullName, configBuildRef, atRow, context, currentRowsMappingList]] begin[{]
if[binary_operation[member[.commandList], !=, literal[null]]] begin[{]
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=commandList, selectors=[], type_arguments=None), name=command)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Command, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setFinalLength, postfix_operators=[], prefix_operators=[], qualifier=command, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fullName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=configBuildRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getConfigRange, postfix_operators=[], prefix_operators=[], qualifier=command, selectors=[MethodInvocation(arguments=[], member=getFirstRowRef, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRowIndex, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentRowsMappingList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildAt, postfix_operators=[], prefix_operators=[], qualifier=command, selectors=[], type_arguments=None), name=populatedLength)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=populatedLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFinalLength, postfix_operators=[], prefix_operators=[], qualifier=command, 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=commandList, 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)
else begin[{]
None
end[}]
call[.buildCells, parameter[member[.fullName], member[.configBuildRef], member[.atRow], member[.context], member[.currentRowsMappingList]]]
return[binary_operation[THIS[call[None.getLastRowPlusRef, parameter[]]call[None.getRowIndex, parameter[]]], -, THIS[call[None.getFirstRowRef, parameter[]]call[None.getRowIndex, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[int] identifier[buildAt] operator[SEP] Keyword[final] identifier[String] identifier[fullName] , Keyword[final] identifier[ConfigBuildRef] identifier[configBuildRef] , Keyword[final] Keyword[int] identifier[atRow] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[context] , Keyword[final] identifier[List] operator[<] identifier[RowsMapping] operator[>] identifier[currentRowsMappingList] operator[SEP] {
Keyword[if] operator[SEP] identifier[commandList] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[commandList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Command] identifier[command] operator[=] identifier[commandList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[command] operator[SEP] identifier[setFinalLength] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[populatedLength] operator[=] identifier[command] operator[SEP] identifier[buildAt] operator[SEP] identifier[fullName] , identifier[configBuildRef] , identifier[command] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] operator[SEP] identifier[getFirstRowRef] operator[SEP] operator[SEP] operator[SEP] identifier[getRowIndex] operator[SEP] operator[SEP] , identifier[context] , identifier[currentRowsMappingList] operator[SEP] operator[SEP] identifier[command] operator[SEP] identifier[setFinalLength] operator[SEP] identifier[populatedLength] operator[SEP] operator[SEP]
}
}
identifier[buildCells] operator[SEP] identifier[fullName] , identifier[configBuildRef] , identifier[atRow] , identifier[context] , identifier[currentRowsMappingList] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[getLastRowPlusRef] operator[SEP] operator[SEP] operator[SEP] identifier[getRowIndex] operator[SEP] operator[SEP] operator[-] Keyword[this] operator[SEP] identifier[getFirstRowRef] operator[SEP] operator[SEP] operator[SEP] identifier[getRowIndex] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private <T> Creator<T> get(ConstructorKey key) {
Creator<T> creator = (Creator<T>) cache.get(key);
if (creator != null) {
return creator;
} else {
synchronized (lock) {
// if the creator is still null... try and find one and register it
if ((creator = (Creator<T>) cache.get(key)) == null) {
creator = find(key);
creator = register(key, creator); // avoids invoking find again
}
}
}
return creator;
} | class class_name[name] begin[{]
method[get, return_type[type[Creator]], modifier[private], parameter[key]] begin[{]
local_variable[type[Creator], creator]
if[binary_operation[member[.creator], !=, literal[null]]] begin[{]
return[member[.creator]]
else begin[{]
SYNCHRONIZED[member[.lock]] BEGIN[{]
if[binary_operation[assign[member[.creator], Cast(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Creator, sub_type=None))], ==, literal[null]]] begin[{]
assign[member[.creator], call[.find, parameter[member[.key]]]]
assign[member[.creator], call[.register, parameter[member[.key], member[.creator]]]]
else begin[{]
None
end[}]
END[}]
end[}]
return[member[.creator]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] operator[<] identifier[T] operator[>] identifier[Creator] operator[<] identifier[T] operator[>] identifier[get] operator[SEP] identifier[ConstructorKey] identifier[key] operator[SEP] {
identifier[Creator] operator[<] identifier[T] operator[>] identifier[creator] operator[=] operator[SEP] identifier[Creator] operator[<] identifier[T] operator[>] operator[SEP] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[creator] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[creator] operator[SEP]
}
Keyword[else] {
Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[creator] operator[=] operator[SEP] identifier[Creator] operator[<] identifier[T] operator[>] operator[SEP] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[creator] operator[=] identifier[find] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[creator] operator[=] identifier[register] operator[SEP] identifier[key] , identifier[creator] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[creator] operator[SEP]
}
|
public List<MetaProperty> getProperties() {
checkInitalised();
SingleKeyHashMap propertyMap = classPropertyIndex.getNullable(theCachedClass);
if (propertyMap==null) {
// GROOVY-6903: May happen in some special environment, like under Android, due
// to classloading issues
propertyMap = new SingleKeyHashMap();
}
// simply return the values of the metaproperty map as a List
List ret = new ArrayList(propertyMap.size());
for (ComplexKeyHashMap.EntryIterator iter = propertyMap.getEntrySetIterator(); iter.hasNext();) {
MetaProperty element = (MetaProperty) ((SingleKeyHashMap.Entry) iter.next()).value;
if (element instanceof CachedField) continue;
// filter out DGM beans
if (element instanceof MetaBeanProperty) {
MetaBeanProperty mp = (MetaBeanProperty) element;
boolean setter = true;
boolean getter = true;
if (mp.getGetter() == null || mp.getGetter() instanceof GeneratedMetaMethod || mp.getGetter() instanceof NewInstanceMetaMethod) {
getter = false;
}
if (mp.getSetter() == null || mp.getSetter() instanceof GeneratedMetaMethod || mp.getSetter() instanceof NewInstanceMetaMethod) {
setter = false;
}
if (!setter && !getter) continue;
// TODO: I (ait) don't know why these strange tricks needed and comment following as it effects some Grails tests
// if (!setter && mp.getSetter() != null) {
// element = new MetaBeanProperty(mp.getName(), mp.getType(), mp.getGetter(), null);
// }
// if (!getter && mp.getGetter() != null) {
// element = new MetaBeanProperty(mp.getName(), mp.getType(), null, mp.getSetter());
// }
}
ret.add(element);
}
return ret;
} | class class_name[name] begin[{]
method[getProperties, return_type[type[List]], modifier[public], parameter[]] begin[{]
call[.checkInitalised, parameter[]]
local_variable[type[SingleKeyHashMap], propertyMap]
if[binary_operation[member[.propertyMap], ==, literal[null]]] begin[{]
assign[member[.propertyMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SingleKeyHashMap, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[List], ret]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SingleKeyHashMap, sub_type=ReferenceType(arguments=None, dimensions=None, name=Entry, sub_type=None))), type=ReferenceType(arguments=None, dimensions=[], name=MetaProperty, sub_type=None)), name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetaProperty, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CachedField, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=MetaBeanProperty, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MetaBeanProperty, sub_type=None)), name=mp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetaBeanProperty, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=setter)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=getter)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getGetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getGetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=GeneratedMetaMethod, sub_type=None), operator=instanceof), operator=||), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getGetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=NewInstanceMetaMethod, sub_type=None), operator=instanceof), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=GeneratedMetaMethod, sub_type=None), operator=instanceof), operator=||), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getSetter, postfix_operators=[], prefix_operators=[], qualifier=mp, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=NewInstanceMetaMethod, sub_type=None), operator=instanceof), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=setter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=setter, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=MemberReference(member=getter, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getEntrySetIterator, postfix_operators=[], prefix_operators=[], qualifier=propertyMap, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ComplexKeyHashMap, sub_type=ReferenceType(arguments=None, dimensions=None, name=EntryIterator, sub_type=None))), update=None), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[MetaProperty] operator[>] identifier[getProperties] operator[SEP] operator[SEP] {
identifier[checkInitalised] operator[SEP] operator[SEP] operator[SEP] identifier[SingleKeyHashMap] identifier[propertyMap] operator[=] identifier[classPropertyIndex] operator[SEP] identifier[getNullable] operator[SEP] identifier[theCachedClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyMap] operator[==] Other[null] operator[SEP] {
identifier[propertyMap] operator[=] Keyword[new] identifier[SingleKeyHashMap] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] identifier[propertyMap] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ComplexKeyHashMap] operator[SEP] identifier[EntryIterator] identifier[iter] operator[=] identifier[propertyMap] operator[SEP] identifier[getEntrySetIterator] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[MetaProperty] identifier[element] operator[=] operator[SEP] identifier[MetaProperty] operator[SEP] operator[SEP] operator[SEP] identifier[SingleKeyHashMap] operator[SEP] identifier[Entry] operator[SEP] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[CachedField] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[MetaBeanProperty] operator[SEP] {
identifier[MetaBeanProperty] identifier[mp] operator[=] operator[SEP] identifier[MetaBeanProperty] operator[SEP] identifier[element] operator[SEP] Keyword[boolean] identifier[setter] operator[=] literal[boolean] operator[SEP] Keyword[boolean] identifier[getter] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[mp] operator[SEP] identifier[getGetter] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[mp] operator[SEP] identifier[getGetter] operator[SEP] operator[SEP] Keyword[instanceof] identifier[GeneratedMetaMethod] operator[||] identifier[mp] operator[SEP] identifier[getGetter] operator[SEP] operator[SEP] Keyword[instanceof] identifier[NewInstanceMetaMethod] operator[SEP] {
identifier[getter] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mp] operator[SEP] identifier[getSetter] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[mp] operator[SEP] identifier[getSetter] operator[SEP] operator[SEP] Keyword[instanceof] identifier[GeneratedMetaMethod] operator[||] identifier[mp] operator[SEP] identifier[getSetter] operator[SEP] operator[SEP] Keyword[instanceof] identifier[NewInstanceMetaMethod] operator[SEP] {
identifier[setter] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[setter] operator[&&] operator[!] identifier[getter] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public ShardingRuleConfiguration loadShardingRuleConfiguration(final String shardingSchemaName) {
return new ShardingRuleConfigurationYamlSwapper().swap(YamlEngine.unmarshal(regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)), YamlShardingRuleConfiguration.class));
} | class class_name[name] begin[{]
method[loadShardingRuleConfiguration, return_type[type[ShardingRuleConfiguration]], modifier[public], parameter[shardingSchemaName]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=shardingSchemaName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRulePath, postfix_operators=[], prefix_operators=[], qualifier=configNode, selectors=[], type_arguments=None)], member=getDirectly, postfix_operators=[], prefix_operators=[], qualifier=regCenter, selectors=[], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=YamlShardingRuleConfiguration, sub_type=None))], member=unmarshal, postfix_operators=[], prefix_operators=[], qualifier=YamlEngine, selectors=[], type_arguments=None)], member=swap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ShardingRuleConfigurationYamlSwapper, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ShardingRuleConfiguration] identifier[loadShardingRuleConfiguration] operator[SEP] Keyword[final] identifier[String] identifier[shardingSchemaName] operator[SEP] {
Keyword[return] Keyword[new] identifier[ShardingRuleConfigurationYamlSwapper] operator[SEP] operator[SEP] operator[SEP] identifier[swap] operator[SEP] identifier[YamlEngine] operator[SEP] identifier[unmarshal] operator[SEP] identifier[regCenter] operator[SEP] identifier[getDirectly] operator[SEP] identifier[configNode] operator[SEP] identifier[getRulePath] operator[SEP] identifier[shardingSchemaName] operator[SEP] operator[SEP] , identifier[YamlShardingRuleConfiguration] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
private static void setValue(Postcard postcard, Integer typeDef, String key, String value) {
if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) {
return;
}
try {
if (null != typeDef) {
if (typeDef == TypeKind.BOOLEAN.ordinal()) {
postcard.withBoolean(key, Boolean.parseBoolean(value));
} else if (typeDef == TypeKind.BYTE.ordinal()) {
postcard.withByte(key, Byte.valueOf(value));
} else if (typeDef == TypeKind.SHORT.ordinal()) {
postcard.withShort(key, Short.valueOf(value));
} else if (typeDef == TypeKind.INT.ordinal()) {
postcard.withInt(key, Integer.valueOf(value));
} else if (typeDef == TypeKind.LONG.ordinal()) {
postcard.withLong(key, Long.valueOf(value));
} else if (typeDef == TypeKind.FLOAT.ordinal()) {
postcard.withFloat(key, Float.valueOf(value));
} else if (typeDef == TypeKind.DOUBLE.ordinal()) {
postcard.withDouble(key, Double.valueOf(value));
} else if (typeDef == TypeKind.STRING.ordinal()) {
postcard.withString(key, value);
} else if (typeDef == TypeKind.PARCELABLE.ordinal()) {
// TODO : How to description parcelable value with string?
} else if (typeDef == TypeKind.OBJECT.ordinal()) {
postcard.withString(key, value);
} else { // Compatible compiler sdk 1.0.3, in that version, the string type = 18
postcard.withString(key, value);
}
} else {
postcard.withString(key, value);
}
} catch (Throwable ex) {
logger.warning(Consts.TAG, "LogisticsCenter setValue failed! " + ex.getMessage());
}
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[private static], parameter[postcard, typeDef, key, value]] begin[{]
if[binary_operation[call[TextUtils.isEmpty, parameter[member[.key]]], ||, call[TextUtils.isEmpty, parameter[member[.value]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withString, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.BOOLEAN, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.BYTE, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.SHORT, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.INT, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.LONG, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.FLOAT, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.DOUBLE, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.STRING, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.PARCELABLE, selectors=[], type_arguments=None), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=TypeKind.OBJECT, selectors=[], type_arguments=None), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withString, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withString, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withString, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None)], member=withDouble, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[], type_arguments=None)], member=withFloat, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None)], member=withLong, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)], member=withInt, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Short, selectors=[], type_arguments=None)], member=withShort, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Byte, selectors=[], type_arguments=None)], member=withByte, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseBoolean, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None)], member=withBoolean, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=Consts, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="LogisticsCenter setValue failed! "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[setValue] operator[SEP] identifier[Postcard] identifier[postcard] , identifier[Integer] identifier[typeDef] , identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[key] operator[SEP] operator[||] identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[typeDef] operator[SEP] {
Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[BOOLEAN] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withBoolean] operator[SEP] identifier[key] , identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[BYTE] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withByte] operator[SEP] identifier[key] , identifier[Byte] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[SHORT] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withShort] operator[SEP] identifier[key] , identifier[Short] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[INT] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withInt] operator[SEP] identifier[key] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[LONG] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withLong] operator[SEP] identifier[key] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[FLOAT] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withFloat] operator[SEP] identifier[key] , identifier[Float] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[DOUBLE] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withDouble] operator[SEP] identifier[key] , identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[STRING] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withString] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[PARCELABLE] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeDef] operator[==] identifier[TypeKind] operator[SEP] identifier[OBJECT] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] {
identifier[postcard] operator[SEP] identifier[withString] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[postcard] operator[SEP] identifier[withString] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[postcard] operator[SEP] identifier[withString] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[Consts] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static ICellValue resolveCellValue(Cell c) {
if (c == null) { return CellValue.BLANK; }
switch (c.getCellType()) {
case CELL_TYPE_NUMERIC: { return CellValue.from(c.getNumericCellValue()); }
case CELL_TYPE_STRING: { return CellValue.from(c.getStringCellValue()); }
case CELL_TYPE_BOOLEAN: { return CellValue.from(c.getBooleanCellValue()); }
case CELL_TYPE_ERROR: { return CellValue.from(forInt(c.getErrorCellValue()).getString()); }
case CELL_TYPE_BLANK: { return CellValue.BLANK; }
case CELL_TYPE_FORMULA: { return CellValue.from(String.format("%s%s", FORMULA_PREFIX, c.getCellFormula())); }
default: { throw new CalculationEngineException(String.format("Cell's type %s is not supported.", c.getCellType())); }
}
} | class class_name[name] begin[{]
method[resolveCellValue, return_type[type[ICellValue]], modifier[public static], parameter[c]] begin[{]
if[binary_operation[member[.c], ==, literal[null]]] begin[{]
return[member[CellValue.BLANK]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['CELL_TYPE_NUMERIC'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNumericCellValue, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=['CELL_TYPE_STRING'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStringCellValue, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=['CELL_TYPE_BOOLEAN'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBooleanCellValue, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=['CELL_TYPE_ERROR'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getErrorCellValue, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=forInt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=['CELL_TYPE_BLANK'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=BLANK, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[]), label=None)])]), SwitchStatementCase(case=['CELL_TYPE_FORMULA'], statements=[BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s%s"), MemberReference(member=FORMULA_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getCellFormula, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=from, postfix_operators=[], prefix_operators=[], qualifier=CellValue, selectors=[], type_arguments=None), label=None)])]), SwitchStatementCase(case=[], statements=[BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cell's type %s is not supported."), MethodInvocation(arguments=[], member=getCellType, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CalculationEngineException, sub_type=None)), label=None)])])], expression=MethodInvocation(arguments=[], member=getCellType, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ICellValue] identifier[resolveCellValue] operator[SEP] identifier[Cell] identifier[c] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[BLANK] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[c] operator[SEP] identifier[getCellType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[CELL_TYPE_NUMERIC] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[from] operator[SEP] identifier[c] operator[SEP] identifier[getNumericCellValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[case] identifier[CELL_TYPE_STRING] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[from] operator[SEP] identifier[c] operator[SEP] identifier[getStringCellValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[case] identifier[CELL_TYPE_BOOLEAN] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[from] operator[SEP] identifier[c] operator[SEP] identifier[getBooleanCellValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[case] identifier[CELL_TYPE_ERROR] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[from] operator[SEP] identifier[forInt] operator[SEP] identifier[c] operator[SEP] identifier[getErrorCellValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[case] identifier[CELL_TYPE_BLANK] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[BLANK] operator[SEP]
}
Keyword[case] identifier[CELL_TYPE_FORMULA] operator[:] {
Keyword[return] identifier[CellValue] operator[SEP] identifier[from] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[FORMULA_PREFIX] , identifier[c] operator[SEP] identifier[getCellFormula] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[default] operator[:] {
Keyword[throw] Keyword[new] identifier[CalculationEngineException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[c] operator[SEP] identifier[getCellType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public void marshall(CreateExportJobRequest createExportJobRequest, ProtocolMarshaller protocolMarshaller) {
if (createExportJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createExportJobRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(createExportJobRequest.getExportJobRequest(), EXPORTJOBREQUEST_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[createExportJobRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createExportJobRequest], ==, 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=getApplicationId, postfix_operators=[], prefix_operators=[], qualifier=createExportJobRequest, selectors=[], type_arguments=None), MemberReference(member=APPLICATIONID_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=getExportJobRequest, postfix_operators=[], prefix_operators=[], qualifier=createExportJobRequest, selectors=[], type_arguments=None), MemberReference(member=EXPORTJOBREQUEST_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[CreateExportJobRequest] identifier[createExportJobRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createExportJobRequest] 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[createExportJobRequest] operator[SEP] identifier[getApplicationId] operator[SEP] operator[SEP] , identifier[APPLICATIONID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[createExportJobRequest] operator[SEP] identifier[getExportJobRequest] operator[SEP] operator[SEP] , identifier[EXPORTJOBREQUEST_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static BufferedImage createCopy(final BufferedImage pImage) {
if (pImage == null) {
throw new IllegalArgumentException("image == null");
}
ColorModel cm = pImage.getColorModel();
BufferedImage img = new BufferedImage(cm,
cm.createCompatibleWritableRaster(pImage.getWidth(), pImage.getHeight()),
cm.isAlphaPremultiplied(), null);
drawOnto(img, pImage);
return img;
} | class class_name[name] begin[{]
method[createCopy, return_type[type[BufferedImage]], modifier[public static], parameter[pImage]] begin[{]
if[binary_operation[member[.pImage], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="image == null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ColorModel], cm]
local_variable[type[BufferedImage], img]
call[.drawOnto, parameter[member[.img], member[.pImage]]]
return[member[.img]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BufferedImage] identifier[createCopy] operator[SEP] Keyword[final] identifier[BufferedImage] identifier[pImage] operator[SEP] {
Keyword[if] operator[SEP] identifier[pImage] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ColorModel] identifier[cm] operator[=] identifier[pImage] operator[SEP] identifier[getColorModel] operator[SEP] operator[SEP] operator[SEP] identifier[BufferedImage] identifier[img] operator[=] Keyword[new] identifier[BufferedImage] operator[SEP] identifier[cm] , identifier[cm] operator[SEP] identifier[createCompatibleWritableRaster] operator[SEP] identifier[pImage] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[pImage] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] , identifier[cm] operator[SEP] identifier[isAlphaPremultiplied] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[drawOnto] operator[SEP] identifier[img] , identifier[pImage] operator[SEP] operator[SEP] Keyword[return] identifier[img] operator[SEP]
}
|
public static <S1, I, T1, S2, T2, SP2, TP2> Mapping<S1, S2> rawCopy(AutomatonCopyMethod method,
Automaton<S1, ? super I, T1> in,
Collection<? extends I> inputs,
MutableAutomaton<S2, I, T2, SP2, TP2> out,
Function<? super S1, ? extends SP2> spMapping,
Function<? super T1, ? extends TP2> tpMapping) {
return rawCopy(method, in, inputs, out, spMapping, tpMapping, s -> true, (s, i, t) -> true);
} | class class_name[name] begin[{]
method[rawCopy, return_type[type[Mapping]], modifier[public static], parameter[method, in, inputs, out, spMapping, tpMapping]] begin[{]
return[call[.rawCopy, parameter[member[.method], member[.in], member[.inputs], member[.out], member[.spMapping], member[.tpMapping], LambdaExpression(body=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), parameters=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), LambdaExpression(body=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), parameters=[InferredFormalParameter(name=s), InferredFormalParameter(name=i), InferredFormalParameter(name=t)])]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[S1] , identifier[I] , identifier[T1] , identifier[S2] , identifier[T2] , identifier[SP2] , identifier[TP2] operator[>] identifier[Mapping] operator[<] identifier[S1] , identifier[S2] operator[>] identifier[rawCopy] operator[SEP] identifier[AutomatonCopyMethod] identifier[method] , identifier[Automaton] operator[<] identifier[S1] , operator[?] Keyword[super] identifier[I] , identifier[T1] operator[>] identifier[in] , identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[I] operator[>] identifier[inputs] , identifier[MutableAutomaton] operator[<] identifier[S2] , identifier[I] , identifier[T2] , identifier[SP2] , identifier[TP2] operator[>] identifier[out] , identifier[Function] operator[<] operator[?] Keyword[super] identifier[S1] , operator[?] Keyword[extends] identifier[SP2] operator[>] identifier[spMapping] , identifier[Function] operator[<] operator[?] Keyword[super] identifier[T1] , operator[?] Keyword[extends] identifier[TP2] operator[>] identifier[tpMapping] operator[SEP] {
Keyword[return] identifier[rawCopy] operator[SEP] identifier[method] , identifier[in] , identifier[inputs] , identifier[out] , identifier[spMapping] , identifier[tpMapping] , identifier[s] operator[->] literal[boolean] , operator[SEP] identifier[s] , identifier[i] , identifier[t] operator[SEP] operator[->] literal[boolean] operator[SEP] operator[SEP]
}
|
private void compact(boolean overlap)
{
if (m_isCompacted_) {
return; // nothing left to do
}
// compaction
// initialize the index map with "block is used/unused" flags
findUnusedBlocks();
// if Latin-1 is preallocated and linear, then do not compact Latin-1
// data
int overlapStart = DATA_BLOCK_LENGTH;
if (m_isLatin1Linear_ && SHIFT_ <= 8) {
overlapStart += 256;
}
int newStart = DATA_BLOCK_LENGTH;
int i;
for (int start = newStart; start < m_dataLength_;) {
// start: index of first entry of current block
// newStart: index where the current block is to be moved
// (right after current end of already-compacted data)
// skip blocks that are not used
if (m_map_[start >>> SHIFT_] < 0) {
// advance start to the next block
start += DATA_BLOCK_LENGTH;
// leave newStart with the previous block!
continue;
}
// search for an identical block
if (start >= overlapStart) {
i = findSameDataBlock(m_data_, newStart, start,
overlap ? DATA_GRANULARITY_ : DATA_BLOCK_LENGTH);
if (i >= 0) {
// found an identical block, set the other block's index
// value for the current block
m_map_[start >>> SHIFT_] = i;
// advance start to the next block
start += DATA_BLOCK_LENGTH;
// leave newStart with the previous block!
continue;
}
}
// see if the beginning of this block can be overlapped with the
// end of the previous block
if(overlap && start>=overlapStart) {
/* look for maximum overlap (modulo granularity) with the previous, adjacent block */
for(i=DATA_BLOCK_LENGTH-DATA_GRANULARITY_;
i>0 && !equal_int(m_data_, newStart-i, start, i);
i-=DATA_GRANULARITY_) {}
} else {
i=0;
}
if (i > 0) {
// some overlap
m_map_[start >>> SHIFT_] = newStart - i;
// move the non-overlapping indexes to their new positions
start += i;
for (i = DATA_BLOCK_LENGTH - i; i > 0; -- i) {
m_data_[newStart ++] = m_data_[start ++];
}
}
else if (newStart < start) {
// no overlap, just move the indexes to their new positions
m_map_[start >>> SHIFT_] = newStart;
for (i = DATA_BLOCK_LENGTH; i > 0; -- i) {
m_data_[newStart ++] = m_data_[start ++];
}
}
else { // no overlap && newStart==start
m_map_[start >>> SHIFT_] = start;
newStart += DATA_BLOCK_LENGTH;
start = newStart;
}
}
// now adjust the index (stage 1) table
for (i = 0; i < m_indexLength_; ++ i) {
m_index_[i] = m_map_[Math.abs(m_index_[i]) >>> SHIFT_];
}
m_dataLength_ = newStart;
} | class class_name[name] begin[{]
method[compact, return_type[void], modifier[private], parameter[overlap]] begin[{]
if[member[.m_isCompacted_]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.findUnusedBlocks, parameter[]]
local_variable[type[int], overlapStart]
if[binary_operation[member[.m_isLatin1Linear_], &&, binary_operation[member[.SHIFT_], <=, literal[8]]]] begin[{]
assign[member[.overlapStart], literal[256]]
else begin[{]
None
end[}]
local_variable[type[int], newStart]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=overlapStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=MemberReference(member=overlap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=DATA_GRANULARITY_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], member=findSameDataBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ContinueStatement(goto=None, label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=overlap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=overlapStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MethodInvocation(arguments=[MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal_int, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DATA_GRANULARITY_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))], update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=-=, value=MemberReference(member=DATA_GRANULARITY_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))]), type==, value=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))]), type==, value=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=newStart, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=start, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))]), type==, value=BinaryOperation(operandl=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=newStart, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=start, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=DATA_BLOCK_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m_dataLength_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=newStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=start)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_index_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=m_map_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=m_index_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=MemberReference(member=SHIFT_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m_indexLength_, postfix_operators=[], prefix_operators=[], qualifier=, 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)
assign[member[.m_dataLength_], member[.newStart]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[compact] operator[SEP] Keyword[boolean] identifier[overlap] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_isCompacted_] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[findUnusedBlocks] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[overlapStart] operator[=] identifier[DATA_BLOCK_LENGTH] operator[SEP] Keyword[if] operator[SEP] identifier[m_isLatin1Linear_] operator[&&] identifier[SHIFT_] operator[<=] Other[8] operator[SEP] {
identifier[overlapStart] operator[+=] Other[256] operator[SEP]
}
Keyword[int] identifier[newStart] operator[=] identifier[DATA_BLOCK_LENGTH] operator[SEP] Keyword[int] identifier[i] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[start] operator[=] identifier[newStart] operator[SEP] identifier[start] operator[<] identifier[m_dataLength_] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_map_] operator[SEP] identifier[start] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[<] Other[0] operator[SEP] {
identifier[start] operator[+=] identifier[DATA_BLOCK_LENGTH] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[start] operator[>=] identifier[overlapStart] operator[SEP] {
identifier[i] operator[=] identifier[findSameDataBlock] operator[SEP] identifier[m_data_] , identifier[newStart] , identifier[start] , identifier[overlap] operator[?] identifier[DATA_GRANULARITY_] operator[:] identifier[DATA_BLOCK_LENGTH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] {
identifier[m_map_] operator[SEP] identifier[start] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[=] identifier[i] operator[SEP] identifier[start] operator[+=] identifier[DATA_BLOCK_LENGTH] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[overlap] operator[&&] identifier[start] operator[>=] identifier[overlapStart] operator[SEP] {
Keyword[for] operator[SEP] identifier[i] operator[=] identifier[DATA_BLOCK_LENGTH] operator[-] identifier[DATA_GRANULARITY_] operator[SEP] identifier[i] operator[>] Other[0] operator[&&] operator[!] identifier[equal_int] operator[SEP] identifier[m_data_] , identifier[newStart] operator[-] identifier[i] , identifier[start] , identifier[i] operator[SEP] operator[SEP] identifier[i] operator[-=] identifier[DATA_GRANULARITY_] operator[SEP] {
}
}
Keyword[else] {
identifier[i] operator[=] Other[0] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[m_map_] operator[SEP] identifier[start] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[=] identifier[newStart] operator[-] identifier[i] operator[SEP] identifier[start] operator[+=] identifier[i] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] identifier[DATA_BLOCK_LENGTH] operator[-] identifier[i] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] operator[--] identifier[i] operator[SEP] {
identifier[m_data_] operator[SEP] identifier[newStart] operator[++] operator[SEP] operator[=] identifier[m_data_] operator[SEP] identifier[start] operator[++] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[newStart] operator[<] identifier[start] operator[SEP] {
identifier[m_map_] operator[SEP] identifier[start] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[=] identifier[newStart] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] identifier[DATA_BLOCK_LENGTH] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] operator[--] identifier[i] operator[SEP] {
identifier[m_data_] operator[SEP] identifier[newStart] operator[++] operator[SEP] operator[=] identifier[m_data_] operator[SEP] identifier[start] operator[++] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[m_map_] operator[SEP] identifier[start] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[=] identifier[start] operator[SEP] identifier[newStart] operator[+=] identifier[DATA_BLOCK_LENGTH] operator[SEP] identifier[start] operator[=] identifier[newStart] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[m_indexLength_] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[m_index_] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[m_map_] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[m_index_] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[>] operator[>] operator[>] identifier[SHIFT_] operator[SEP] operator[SEP]
}
identifier[m_dataLength_] operator[=] identifier[newStart] operator[SEP]
}
|
public <T> Observable<T> asObservable(final Class<T> eventType) {
return Observable.create(new OnSubscribe<T>() {
@Override
public void call(final Subscriber<? super T> observer) {
final DynamicSubscriber consumer = new DynamicSubscriber() {
@Override
public Class<?> getEventType() {
return eventType;
}
@Subscribe
public void consume(Object obj) {
observer.onNext((T) obj);
}
};
observer.add(BooleanSubscription.create(new Action0() {
@Override
public void call() {
eventBus.unregisterSubscriber(consumer);
observer.onCompleted();
}
}));
try {
eventBus.registerSubscriber(consumer);
} catch (InvalidSubscriberException e) {
observer.onError(e);
}
}
});
} | class class_name[name] begin[{]
method[asObservable, return_type[type[Observable]], modifier[public], parameter[eventType]] begin[{]
return[call[Observable.create, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=eventType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getEventType, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Subscribe)], body=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], member=onNext, postfix_operators=[], prefix_operators=[], qualifier=observer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=consume, parameters=[FormalParameter(annotations=[], modifiers=set(), name=obj, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DynamicSubscriber, sub_type=None)), name=consumer)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DynamicSubscriber, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unregisterSubscriber, postfix_operators=[], prefix_operators=[], qualifier=eventBus, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=onCompleted, postfix_operators=[], prefix_operators=[], qualifier=observer, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Action0, sub_type=None))], member=create, postfix_operators=[], prefix_operators=[], qualifier=BooleanSubscription, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=observer, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerSubscriber, postfix_operators=[], prefix_operators=[], qualifier=eventBus, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onError, postfix_operators=[], prefix_operators=[], qualifier=observer, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidSubscriberException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=call, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=observer, type=ReferenceType(arguments=[TypeArgument(pattern_type=super, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Subscriber, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=OnSubscribe, sub_type=None))]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[Observable] operator[<] identifier[T] operator[>] identifier[asObservable] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[eventType] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[create] operator[SEP] Keyword[new] identifier[OnSubscribe] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] Keyword[final] identifier[Subscriber] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[observer] operator[SEP] {
Keyword[final] identifier[DynamicSubscriber] identifier[consumer] operator[=] Keyword[new] identifier[DynamicSubscriber] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Class] operator[<] operator[?] operator[>] identifier[getEventType] operator[SEP] operator[SEP] {
Keyword[return] identifier[eventType] operator[SEP]
} annotation[@] identifier[Subscribe] Keyword[public] Keyword[void] identifier[consume] operator[SEP] identifier[Object] identifier[obj] operator[SEP] {
identifier[observer] operator[SEP] identifier[onNext] operator[SEP] operator[SEP] identifier[T] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[observer] operator[SEP] identifier[add] operator[SEP] identifier[BooleanSubscription] operator[SEP] identifier[create] operator[SEP] Keyword[new] identifier[Action0] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[call] operator[SEP] operator[SEP] {
identifier[eventBus] operator[SEP] identifier[unregisterSubscriber] operator[SEP] identifier[consumer] operator[SEP] operator[SEP] identifier[observer] operator[SEP] identifier[onCompleted] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[eventBus] operator[SEP] identifier[registerSubscriber] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvalidSubscriberException] identifier[e] operator[SEP] {
identifier[observer] operator[SEP] identifier[onError] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
private Vec feedForward(Vec input)
{
Vec x = input;
for(int i = 0; i < Ws.size(); i++)
{
Matrix W_i = Ws.get(i);
Vec b_i = bs.get(i);
Vec a_i = W_i.multiply(x);
a_i.mutableAdd(b_i);
a_i.applyFunction(f);
x = a_i;
}
return x;
} | class class_name[name] begin[{]
method[feedForward, return_type[type[Vec]], modifier[private], parameter[input]] begin[{]
local_variable[type[Vec], x]
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=Ws, selectors=[], type_arguments=None), name=W_i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Matrix, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=bs, selectors=[], type_arguments=None), name=b_i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Vec, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=multiply, postfix_operators=[], prefix_operators=[], qualifier=W_i, selectors=[], type_arguments=None), name=a_i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Vec, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=b_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mutableAdd, postfix_operators=[], prefix_operators=[], qualifier=a_i, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyFunction, postfix_operators=[], prefix_operators=[], qualifier=a_i, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=a_i, 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=Ws, 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[.x]]
end[}]
END[}] | Keyword[private] identifier[Vec] identifier[feedForward] operator[SEP] identifier[Vec] identifier[input] operator[SEP] {
identifier[Vec] identifier[x] operator[=] identifier[input] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[Ws] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Matrix] identifier[W_i] operator[=] identifier[Ws] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[Vec] identifier[b_i] operator[=] identifier[bs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[Vec] identifier[a_i] operator[=] identifier[W_i] operator[SEP] identifier[multiply] operator[SEP] identifier[x] operator[SEP] operator[SEP] identifier[a_i] operator[SEP] identifier[mutableAdd] operator[SEP] identifier[b_i] operator[SEP] operator[SEP] identifier[a_i] operator[SEP] identifier[applyFunction] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[x] operator[=] identifier[a_i] operator[SEP]
}
Keyword[return] identifier[x] operator[SEP]
}
|
@Override
public List<Object[]> findUpcomingTasks(long partition, long maxNextExecTime, Integer maxResults) throws Exception {
StringBuilder find = new StringBuilder(129)
.append("SELECT t.ID,t.MBITS,t.NEXTEXEC,t.TXTIMEOUT FROM Task t WHERE t.PARTN=:p AND t.STATES<")
.append(TaskState.SUSPENDED.bit)
.append(" AND t.NEXTEXEC<=:m ORDER BY t.NEXTEXEC");
final boolean trace = TraceComponent.isAnyTracingEnabled();
if (trace && tc.isEntryEnabled())
Tr.entry(this, tc, "findUpcomingTasks", partition, Utils.appendDate(new StringBuilder(30), maxNextExecTime), maxResults, find);
List<Object[]> resultList;
EntityManager em = getPersistenceServiceUnit().createEntityManager();
try {
TypedQuery<Object[]> query = em.createQuery(find.toString(), Object[].class);
query.setParameter("p", partition);
query.setParameter("m", maxNextExecTime);
if (maxResults != null)
query.setMaxResults(maxResults);
List<Object[]> results = query.getResultList();
resultList = results;
} finally {
em.close();
}
if (trace && tc.isEntryEnabled())
Tr.exit(this, tc, "findUpcomingTasks", resultList.size());
return resultList;
} | class class_name[name] begin[{]
method[findUpcomingTasks, return_type[type[List]], modifier[public], parameter[partition, maxNextExecTime, maxResults]] begin[{]
local_variable[type[StringBuilder], find]
local_variable[type[boolean], trace]
if[binary_operation[member[.trace], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["findUpcomingTasks"], member[.partition], call[Utils.appendDate, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=30)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), member[.maxNextExecTime]]], member[.maxResults], member[.find]]]
else begin[{]
None
end[}]
local_variable[type[List], resultList]
local_variable[type[EntityManager], em]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=find, selectors=[], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=createQuery, postfix_operators=[], prefix_operators=[], qualifier=em, selectors=[], type_arguments=None), name=query)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))], dimensions=[], name=TypedQuery, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="p"), MemberReference(member=partition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="m"), MemberReference(member=maxNextExecTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=maxResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=maxResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setMaxResults, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResultList, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), name=results)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=resultList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=em, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
if[binary_operation[member[.trace], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["findUpcomingTasks"], call[resultList.size, parameter[]]]]
else begin[{]
None
end[}]
return[member[.resultList]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[findUpcomingTasks] operator[SEP] Keyword[long] identifier[partition] , Keyword[long] identifier[maxNextExecTime] , identifier[Integer] identifier[maxResults] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[StringBuilder] identifier[find] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] Other[129] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[TaskState] operator[SEP] identifier[SUSPENDED] operator[SEP] identifier[bit] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[trace] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trace] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[partition] , identifier[Utils] operator[SEP] identifier[appendDate] operator[SEP] Keyword[new] identifier[StringBuilder] operator[SEP] Other[30] operator[SEP] , identifier[maxNextExecTime] operator[SEP] , identifier[maxResults] , identifier[find] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[resultList] operator[SEP] identifier[EntityManager] identifier[em] operator[=] identifier[getPersistenceServiceUnit] operator[SEP] operator[SEP] operator[SEP] identifier[createEntityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[TypedQuery] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[query] operator[=] identifier[em] operator[SEP] identifier[createQuery] operator[SEP] identifier[find] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[Object] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[partition] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[maxNextExecTime] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxResults] operator[!=] Other[null] operator[SEP] identifier[query] operator[SEP] identifier[setMaxResults] operator[SEP] identifier[maxResults] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[results] operator[=] identifier[query] operator[SEP] identifier[getResultList] operator[SEP] operator[SEP] operator[SEP] identifier[resultList] operator[=] identifier[results] operator[SEP]
}
Keyword[finally] {
identifier[em] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[trace] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[resultList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[resultList] operator[SEP]
}
|
@Override
public CreateSampleFindingsResult createSampleFindings(CreateSampleFindingsRequest request) {
request = beforeClientExecution(request);
return executeCreateSampleFindings(request);
} | class class_name[name] begin[{]
method[createSampleFindings, return_type[type[CreateSampleFindingsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeCreateSampleFindings, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CreateSampleFindingsResult] identifier[createSampleFindings] operator[SEP] identifier[CreateSampleFindingsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeCreateSampleFindings] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private void twoPointCrossover(BitString father, BitString mother, BitString[] offsprings) {
int point1 = 0; // first crossover point
while (point1 == 0 || point1 == length - 1) {
point1 = Math.randomInt(length);
}
int point2 = 0; // second crossover point
while (point2 == point1 || point2 == 0 || point2 == length - 1) {
point2 = Math.randomInt(length);
}
if (point2 < point1) {
int p = point1;
point1 = point2;
point2 = p;
}
int[] son = new int[length];
System.arraycopy(father.bits, 0, son, 0, point1);
System.arraycopy(mother.bits, point1, son, point1, point2 - point1);
System.arraycopy(father.bits, point2, son, point2, length - point2);
int[] daughter = new int[length];
System.arraycopy(mother.bits, 0, daughter, 0, point1);
System.arraycopy(father.bits, point1, daughter, point1, point2 - point1);
System.arraycopy(mother.bits, point2, daughter, point2, length - point2);
offsprings[0] = new BitString(son, measure, crossover, crossoverRate, mutationRate);
offsprings[1] = new BitString(daughter, measure, crossover, crossoverRate, mutationRate);
} | class class_name[name] begin[{]
method[twoPointCrossover, return_type[void], modifier[private], parameter[father, mother, offsprings]] begin[{]
local_variable[type[int], point1]
while[binary_operation[binary_operation[member[.point1], ==, literal[0]], ||, binary_operation[member[.point1], ==, binary_operation[member[.length], -, literal[1]]]]] begin[{]
assign[member[.point1], call[Math.randomInt, parameter[member[.length]]]]
end[}]
local_variable[type[int], point2]
while[binary_operation[binary_operation[binary_operation[member[.point2], ==, member[.point1]], ||, binary_operation[member[.point2], ==, literal[0]]], ||, binary_operation[member[.point2], ==, binary_operation[member[.length], -, literal[1]]]]] begin[{]
assign[member[.point2], call[Math.randomInt, parameter[member[.length]]]]
end[}]
if[binary_operation[member[.point2], <, member[.point1]]] begin[{]
local_variable[type[int], p]
assign[member[.point1], member[.point2]]
assign[member[.point2], member[.p]]
else begin[{]
None
end[}]
local_variable[type[int], son]
call[System.arraycopy, parameter[member[father.bits], literal[0], member[.son], literal[0], member[.point1]]]
call[System.arraycopy, parameter[member[mother.bits], member[.point1], member[.son], member[.point1], binary_operation[member[.point2], -, member[.point1]]]]
call[System.arraycopy, parameter[member[father.bits], member[.point2], member[.son], member[.point2], binary_operation[member[.length], -, member[.point2]]]]
local_variable[type[int], daughter]
call[System.arraycopy, parameter[member[mother.bits], literal[0], member[.daughter], literal[0], member[.point1]]]
call[System.arraycopy, parameter[member[father.bits], member[.point1], member[.daughter], member[.point1], binary_operation[member[.point2], -, member[.point1]]]]
call[System.arraycopy, parameter[member[mother.bits], member[.point2], member[.daughter], member[.point2], binary_operation[member[.length], -, member[.point2]]]]
assign[member[.offsprings], ClassCreator(arguments=[MemberReference(member=son, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=measure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=crossover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=crossoverRate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mutationRate, 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=BitString, sub_type=None))]
assign[member[.offsprings], ClassCreator(arguments=[MemberReference(member=daughter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=measure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=crossover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=crossoverRate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mutationRate, 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=BitString, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[twoPointCrossover] operator[SEP] identifier[BitString] identifier[father] , identifier[BitString] identifier[mother] , identifier[BitString] operator[SEP] operator[SEP] identifier[offsprings] operator[SEP] {
Keyword[int] identifier[point1] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[point1] operator[==] Other[0] operator[||] identifier[point1] operator[==] identifier[length] operator[-] Other[1] operator[SEP] {
identifier[point1] operator[=] identifier[Math] operator[SEP] identifier[randomInt] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[int] identifier[point2] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[point2] operator[==] identifier[point1] operator[||] identifier[point2] operator[==] Other[0] operator[||] identifier[point2] operator[==] identifier[length] operator[-] Other[1] operator[SEP] {
identifier[point2] operator[=] identifier[Math] operator[SEP] identifier[randomInt] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[point2] operator[<] identifier[point1] operator[SEP] {
Keyword[int] identifier[p] operator[=] identifier[point1] operator[SEP] identifier[point1] operator[=] identifier[point2] operator[SEP] identifier[point2] operator[=] identifier[p] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[son] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[father] operator[SEP] identifier[bits] , Other[0] , identifier[son] , Other[0] , identifier[point1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[mother] operator[SEP] identifier[bits] , identifier[point1] , identifier[son] , identifier[point1] , identifier[point2] operator[-] identifier[point1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[father] operator[SEP] identifier[bits] , identifier[point2] , identifier[son] , identifier[point2] , identifier[length] operator[-] identifier[point2] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[daughter] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[mother] operator[SEP] identifier[bits] , Other[0] , identifier[daughter] , Other[0] , identifier[point1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[father] operator[SEP] identifier[bits] , identifier[point1] , identifier[daughter] , identifier[point1] , identifier[point2] operator[-] identifier[point1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[mother] operator[SEP] identifier[bits] , identifier[point2] , identifier[daughter] , identifier[point2] , identifier[length] operator[-] identifier[point2] operator[SEP] operator[SEP] identifier[offsprings] operator[SEP] Other[0] operator[SEP] operator[=] Keyword[new] identifier[BitString] operator[SEP] identifier[son] , identifier[measure] , identifier[crossover] , identifier[crossoverRate] , identifier[mutationRate] operator[SEP] operator[SEP] identifier[offsprings] operator[SEP] Other[1] operator[SEP] operator[=] Keyword[new] identifier[BitString] operator[SEP] identifier[daughter] , identifier[measure] , identifier[crossover] , identifier[crossoverRate] , identifier[mutationRate] operator[SEP] operator[SEP]
}
|
public Integer getInt (String name) {
try {
return Integer.parseInt(get(name, "").trim());
} catch (Exception e) {
return null;
}
} | class class_name[name] begin[{]
method[getInt, return_type[type[Integer]], modifier[public], parameter[name]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Integer] identifier[getInt] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[get] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public void keyReleased(KeyEvent event)
{
lastKeyName = EMPTY_KEY_NAME;
lastCode = NO_KEY_CODE;
final Integer key = Integer.valueOf(event.getCode());
keys.remove(key);
pressed.remove(key);
} | class class_name[name] begin[{]
method[keyReleased, return_type[void], modifier[public], parameter[event]] begin[{]
assign[member[.lastKeyName], member[.EMPTY_KEY_NAME]]
assign[member[.lastCode], member[.NO_KEY_CODE]]
local_variable[type[Integer], key]
call[keys.remove, parameter[member[.key]]]
call[pressed.remove, parameter[member[.key]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[keyReleased] operator[SEP] identifier[KeyEvent] identifier[event] operator[SEP] {
identifier[lastKeyName] operator[=] identifier[EMPTY_KEY_NAME] operator[SEP] identifier[lastCode] operator[=] identifier[NO_KEY_CODE] operator[SEP] Keyword[final] identifier[Integer] identifier[key] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[event] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[keys] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[pressed] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public void processRows(RowProcessingMetrics rowProcessingMetrics) {
final RowProcessingQueryOptimizer queryOptimizer = getQueryOptimizer();
final Query finalQuery = queryOptimizer.getOptimizedQuery();
final RowIdGenerator idGenerator;
if (finalQuery.getFirstRow() == null) {
idGenerator = new SimpleRowIdGenerator();
} else {
idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
}
final AnalysisJob analysisJob = _publishers.getAnalysisJob();
final AnalysisListener analysisListener = _publishers.getAnalysisListener();
final TaskRunner taskRunner = _publishers.getTaskRunner();
for (RowProcessingConsumer rowProcessingConsumer : _consumers) {
if (rowProcessingConsumer instanceof AnalyzerConsumer) {
final AnalyzerConsumer analyzerConsumer = (AnalyzerConsumer) rowProcessingConsumer;
final AnalyzerJob analyzerJob = analyzerConsumer.getComponentJob();
final AnalyzerMetrics metrics = rowProcessingMetrics.getAnalysisJobMetrics().getAnalyzerMetrics(
analyzerJob);
analysisListener.analyzerBegin(analysisJob, analyzerJob, metrics);
}
if (rowProcessingConsumer instanceof TransformerConsumer) {
((TransformerConsumer) rowProcessingConsumer).setRowIdGenerator(idGenerator);
}
}
final List<RowProcessingConsumer> consumers = queryOptimizer.getOptimizedConsumers();
final Collection<? extends FilterOutcome> availableOutcomes = queryOptimizer.getOptimizedAvailableOutcomes();
analysisListener.rowProcessingBegin(analysisJob, rowProcessingMetrics);
final RowConsumerTaskListener taskListener = new RowConsumerTaskListener(analysisJob, analysisListener,
taskRunner);
final Datastore datastore = _publishers.getDatastore();
try (final DatastoreConnection con = datastore.openConnection()) {
final DataContext dataContext = con.getDataContext();
if (logger.isDebugEnabled()) {
final String queryString;
if (dataContext instanceof JdbcDataContext) {
final JdbcDataContext jdbcDataContext = (JdbcDataContext) dataContext;
queryString = jdbcDataContext.getQueryRewriter().rewriteQuery(finalQuery);
} else {
queryString = finalQuery.toSql();
}
logger.debug("Final query: {}", queryString);
logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());
}
// represents the distinct count of rows as well as the number of
// tasks to execute
int numTasks = 0;
try (final DataSet dataSet = dataContext.executeQuery(finalQuery)) {
final ConsumeRowHandler consumeRowHandler = new ConsumeRowHandler(consumers, availableOutcomes);
while (dataSet.next()) {
if (taskListener.isErrornous()) {
break;
}
numTasks++;
final Row metaModelRow = dataSet.getRow();
final int rowId = idGenerator.nextPhysicalRowId();
final MetaModelInputRow inputRow = new MetaModelInputRow(rowId, metaModelRow);
final ConsumeRowTask task = new ConsumeRowTask(consumeRowHandler, rowProcessingMetrics, inputRow,
analysisListener, numTasks);
taskRunner.run(task, taskListener);
}
}
taskListener.awaitTasks(numTasks);
}
if (taskListener.isErrornous()) {
_successful.set(false);
return;
}
analysisListener.rowProcessingSuccess(analysisJob, rowProcessingMetrics);
} | class class_name[name] begin[{]
method[processRows, return_type[void], modifier[public], parameter[rowProcessingMetrics]] begin[{]
local_variable[type[RowProcessingQueryOptimizer], queryOptimizer]
local_variable[type[Query], finalQuery]
local_variable[type[RowIdGenerator], idGenerator]
if[binary_operation[call[finalQuery.getFirstRow, parameter[]], ==, literal[null]]] begin[{]
assign[member[.idGenerator], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleRowIdGenerator, sub_type=None))]
else begin[{]
assign[member[.idGenerator], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getFirstRow, postfix_operators=[], prefix_operators=[], qualifier=finalQuery, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleRowIdGenerator, sub_type=None))]
end[}]
local_variable[type[AnalysisJob], analysisJob]
local_variable[type[AnalysisListener], analysisListener]
local_variable[type[TaskRunner], taskRunner]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rowProcessingConsumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=AnalyzerConsumer, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=rowProcessingConsumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AnalyzerConsumer, sub_type=None)), name=analyzerConsumer)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AnalyzerConsumer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getComponentJob, postfix_operators=[], prefix_operators=[], qualifier=analyzerConsumer, selectors=[], type_arguments=None), name=analyzerJob)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AnalyzerJob, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAnalysisJobMetrics, postfix_operators=[], prefix_operators=[], qualifier=rowProcessingMetrics, selectors=[MethodInvocation(arguments=[MemberReference(member=analyzerJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAnalyzerMetrics, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=metrics)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AnalyzerMetrics, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=analysisJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=analyzerJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyzerBegin, postfix_operators=[], prefix_operators=[], qualifier=analysisListener, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rowProcessingConsumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=TransformerConsumer, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=rowProcessingConsumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TransformerConsumer, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=_consumers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rowProcessingConsumer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RowProcessingConsumer, sub_type=None))), label=None)
local_variable[type[List], consumers]
local_variable[type[Collection], availableOutcomes]
call[analysisListener.rowProcessingBegin, parameter[member[.analysisJob], member[.rowProcessingMetrics]]]
local_variable[type[RowConsumerTaskListener], taskListener]
local_variable[type[Datastore], datastore]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDataContext, postfix_operators=[], prefix_operators=[], qualifier=con, selectors=[], type_arguments=None), name=dataContext)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DataContext, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=queryString)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dataContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JdbcDataContext, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=queryString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toSql, postfix_operators=[], prefix_operators=[], qualifier=finalQuery, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=dataContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JdbcDataContext, sub_type=None)), name=jdbcDataContext)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JdbcDataContext, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=queryString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getQueryRewriter, postfix_operators=[], prefix_operators=[], qualifier=jdbcDataContext, selectors=[MethodInvocation(arguments=[MemberReference(member=finalQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rewriteQuery, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Final query: {}"), MemberReference(member=queryString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Final query firstRow={}, maxRows={}"), MethodInvocation(arguments=[], member=getFirstRow, postfix_operators=[], prefix_operators=[], qualifier=finalQuery, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMaxRows, postfix_operators=[], prefix_operators=[], qualifier=finalQuery, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=numTasks)], modifiers=set(), type=BasicType(dimensions=[], name=int)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=consumers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=availableOutcomes, 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=ConsumeRowHandler, sub_type=None)), name=consumeRowHandler)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ConsumeRowHandler, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isErrornous, postfix_operators=[], prefix_operators=[], qualifier=taskListener, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=MemberReference(member=numTasks, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRow, postfix_operators=[], prefix_operators=[], qualifier=dataSet, selectors=[], type_arguments=None), name=metaModelRow)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Row, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextPhysicalRowId, postfix_operators=[], prefix_operators=[], qualifier=idGenerator, selectors=[], type_arguments=None), name=rowId)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=rowId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaModelRow, 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=MetaModelInputRow, sub_type=None)), name=inputRow)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=MetaModelInputRow, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=consumeRowHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowProcessingMetrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inputRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=analysisListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=numTasks, 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=ConsumeRowTask, sub_type=None)), name=task)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ConsumeRowTask, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=taskListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=run, postfix_operators=[], prefix_operators=[], qualifier=taskRunner, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=dataSet, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers={'final'}, name=dataSet, type=ReferenceType(arguments=None, dimensions=[], name=DataSet, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=finalQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=dataContext, selectors=[], type_arguments=None))]), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=numTasks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=awaitTasks, postfix_operators=[], prefix_operators=[], qualifier=taskListener, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers={'final'}, name=con, type=ReferenceType(arguments=None, dimensions=[], name=DatastoreConnection, sub_type=None), value=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=datastore, selectors=[], type_arguments=None))])
if[call[taskListener.isErrornous, parameter[]]] begin[{]
call[_successful.set, parameter[literal[false]]]
return[None]
else begin[{]
None
end[}]
call[analysisListener.rowProcessingSuccess, parameter[member[.analysisJob], member[.rowProcessingMetrics]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[processRows] operator[SEP] identifier[RowProcessingMetrics] identifier[rowProcessingMetrics] operator[SEP] {
Keyword[final] identifier[RowProcessingQueryOptimizer] identifier[queryOptimizer] operator[=] identifier[getQueryOptimizer] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Query] identifier[finalQuery] operator[=] identifier[queryOptimizer] operator[SEP] identifier[getOptimizedQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[RowIdGenerator] identifier[idGenerator] operator[SEP] Keyword[if] operator[SEP] identifier[finalQuery] operator[SEP] identifier[getFirstRow] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[idGenerator] operator[=] Keyword[new] identifier[SimpleRowIdGenerator] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[idGenerator] operator[=] Keyword[new] identifier[SimpleRowIdGenerator] operator[SEP] identifier[finalQuery] operator[SEP] identifier[getFirstRow] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[AnalysisJob] identifier[analysisJob] operator[=] identifier[_publishers] operator[SEP] identifier[getAnalysisJob] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[AnalysisListener] identifier[analysisListener] operator[=] identifier[_publishers] operator[SEP] identifier[getAnalysisListener] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[TaskRunner] identifier[taskRunner] operator[=] identifier[_publishers] operator[SEP] identifier[getTaskRunner] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[RowProcessingConsumer] identifier[rowProcessingConsumer] operator[:] identifier[_consumers] operator[SEP] {
Keyword[if] operator[SEP] identifier[rowProcessingConsumer] Keyword[instanceof] identifier[AnalyzerConsumer] operator[SEP] {
Keyword[final] identifier[AnalyzerConsumer] identifier[analyzerConsumer] operator[=] operator[SEP] identifier[AnalyzerConsumer] operator[SEP] identifier[rowProcessingConsumer] operator[SEP] Keyword[final] identifier[AnalyzerJob] identifier[analyzerJob] operator[=] identifier[analyzerConsumer] operator[SEP] identifier[getComponentJob] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[AnalyzerMetrics] identifier[metrics] operator[=] identifier[rowProcessingMetrics] operator[SEP] identifier[getAnalysisJobMetrics] operator[SEP] operator[SEP] operator[SEP] identifier[getAnalyzerMetrics] operator[SEP] identifier[analyzerJob] operator[SEP] operator[SEP] identifier[analysisListener] operator[SEP] identifier[analyzerBegin] operator[SEP] identifier[analysisJob] , identifier[analyzerJob] , identifier[metrics] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rowProcessingConsumer] Keyword[instanceof] identifier[TransformerConsumer] operator[SEP] {
operator[SEP] operator[SEP] identifier[TransformerConsumer] operator[SEP] identifier[rowProcessingConsumer] operator[SEP] operator[SEP] identifier[setRowIdGenerator] operator[SEP] identifier[idGenerator] operator[SEP] operator[SEP]
}
}
Keyword[final] identifier[List] operator[<] identifier[RowProcessingConsumer] operator[>] identifier[consumers] operator[=] identifier[queryOptimizer] operator[SEP] identifier[getOptimizedConsumers] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[FilterOutcome] operator[>] identifier[availableOutcomes] operator[=] identifier[queryOptimizer] operator[SEP] identifier[getOptimizedAvailableOutcomes] operator[SEP] operator[SEP] operator[SEP] identifier[analysisListener] operator[SEP] identifier[rowProcessingBegin] operator[SEP] identifier[analysisJob] , identifier[rowProcessingMetrics] operator[SEP] operator[SEP] Keyword[final] identifier[RowConsumerTaskListener] identifier[taskListener] operator[=] Keyword[new] identifier[RowConsumerTaskListener] operator[SEP] identifier[analysisJob] , identifier[analysisListener] , identifier[taskRunner] operator[SEP] operator[SEP] Keyword[final] identifier[Datastore] identifier[datastore] operator[=] identifier[_publishers] operator[SEP] identifier[getDatastore] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] Keyword[final] identifier[DatastoreConnection] identifier[con] operator[=] identifier[datastore] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[DataContext] identifier[dataContext] operator[=] identifier[con] operator[SEP] identifier[getDataContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[queryString] operator[SEP] Keyword[if] operator[SEP] identifier[dataContext] Keyword[instanceof] identifier[JdbcDataContext] operator[SEP] {
Keyword[final] identifier[JdbcDataContext] identifier[jdbcDataContext] operator[=] operator[SEP] identifier[JdbcDataContext] operator[SEP] identifier[dataContext] operator[SEP] identifier[queryString] operator[=] identifier[jdbcDataContext] operator[SEP] identifier[getQueryRewriter] operator[SEP] operator[SEP] operator[SEP] identifier[rewriteQuery] operator[SEP] identifier[finalQuery] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[queryString] operator[=] identifier[finalQuery] operator[SEP] identifier[toSql] operator[SEP] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[queryString] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[finalQuery] operator[SEP] identifier[getFirstRow] operator[SEP] operator[SEP] , identifier[finalQuery] operator[SEP] identifier[getMaxRows] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[numTasks] operator[=] Other[0] operator[SEP] Keyword[try] operator[SEP] Keyword[final] identifier[DataSet] identifier[dataSet] operator[=] identifier[dataContext] operator[SEP] identifier[executeQuery] operator[SEP] identifier[finalQuery] operator[SEP] operator[SEP] {
Keyword[final] identifier[ConsumeRowHandler] identifier[consumeRowHandler] operator[=] Keyword[new] identifier[ConsumeRowHandler] operator[SEP] identifier[consumers] , identifier[availableOutcomes] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[dataSet] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[taskListener] operator[SEP] identifier[isErrornous] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[numTasks] operator[++] operator[SEP] Keyword[final] identifier[Row] identifier[metaModelRow] operator[=] identifier[dataSet] operator[SEP] identifier[getRow] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[rowId] operator[=] identifier[idGenerator] operator[SEP] identifier[nextPhysicalRowId] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[MetaModelInputRow] identifier[inputRow] operator[=] Keyword[new] identifier[MetaModelInputRow] operator[SEP] identifier[rowId] , identifier[metaModelRow] operator[SEP] operator[SEP] Keyword[final] identifier[ConsumeRowTask] identifier[task] operator[=] Keyword[new] identifier[ConsumeRowTask] operator[SEP] identifier[consumeRowHandler] , identifier[rowProcessingMetrics] , identifier[inputRow] , identifier[analysisListener] , identifier[numTasks] operator[SEP] operator[SEP] identifier[taskRunner] operator[SEP] identifier[run] operator[SEP] identifier[task] , identifier[taskListener] operator[SEP] operator[SEP]
}
}
identifier[taskListener] operator[SEP] identifier[awaitTasks] operator[SEP] identifier[numTasks] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[taskListener] operator[SEP] identifier[isErrornous] operator[SEP] operator[SEP] operator[SEP] {
identifier[_successful] operator[SEP] identifier[set] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[analysisListener] operator[SEP] identifier[rowProcessingSuccess] operator[SEP] identifier[analysisJob] , identifier[rowProcessingMetrics] operator[SEP] operator[SEP]
}
|
public List<GvmResult<K>> results() {
ArrayList<GvmResult<K>> list = new ArrayList<GvmResult<K>>(count);
for (int i = 0; i < count; i++) {
GvmCluster<S,K> cluster = clusters[i];
//TODO exclude massless clusters?
list.add(new GvmResult<K>(cluster));
}
return list;
} | class class_name[name] begin[{]
method[results, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], list]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=clusters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=cluster)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=S, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None))], dimensions=[], name=GvmCluster, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=cluster, 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))], dimensions=None, name=GvmResult, sub_type=None))], member=add, 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=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.list]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[GvmResult] operator[<] identifier[K] operator[>] operator[>] identifier[results] operator[SEP] operator[SEP] {
identifier[ArrayList] operator[<] identifier[GvmResult] operator[<] identifier[K] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[GvmResult] operator[<] identifier[K] operator[>] operator[>] operator[SEP] identifier[count] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[GvmCluster] operator[<] identifier[S] , identifier[K] operator[>] identifier[cluster] operator[=] identifier[clusters] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[GvmResult] operator[<] identifier[K] operator[>] operator[SEP] identifier[cluster] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
@Override
protected Content getNavLinkPrevious() {
if (prev == null) {
return getNavLinkPrevious(null);
} else {
DocPath path = DocPath.relativePath(packageElement, prev);
return getNavLinkPrevious(path.resolve(DocPaths.PACKAGE_TREE));
}
} | class class_name[name] begin[{]
method[getNavLinkPrevious, return_type[type[Content]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.prev], ==, literal[null]]] begin[{]
return[call[.getNavLinkPrevious, parameter[literal[null]]]]
else begin[{]
local_variable[type[DocPath], path]
return[call[.getNavLinkPrevious, parameter[call[path.resolve, parameter[member[DocPaths.PACKAGE_TREE]]]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[Content] identifier[getNavLinkPrevious] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[prev] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[getNavLinkPrevious] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[DocPath] identifier[path] operator[=] identifier[DocPath] operator[SEP] identifier[relativePath] operator[SEP] identifier[packageElement] , identifier[prev] operator[SEP] operator[SEP] Keyword[return] identifier[getNavLinkPrevious] operator[SEP] identifier[path] operator[SEP] identifier[resolve] operator[SEP] identifier[DocPaths] operator[SEP] identifier[PACKAGE_TREE] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public final <T> void insertEntity(final Map<String, Object> pAddParam,
final T pEntity) throws Exception {
ColumnsValues columnsValues = evalColumnsValues(pAddParam, pEntity);
long result = getSrvDatabase().executeInsert(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues);
if (result != 1) {
String query = getHlpInsertUpdate().evalSqlInsert(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues);
throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
"It should be 1 row inserted but it is "
+ result + ", query:\n" + query + ";\n");
}
String[] idName = columnsValues.getIdColumnsNames();
if (idName.length == 1) { // if non-composite PK
Field fieldId = getUtlReflection()
.retrieveField(pEntity.getClass(), idName[0]);
fieldId.setAccessible(true);
Object idValue = fieldId.get(pEntity);
if (idValue == null) {
//It must be an autogenerated Integer or Long ID
IRecordSet<RS> recordSet = null;
try {
String insertedIdName = "INSERTEDID";
recordSet = getSrvDatabase().retrieveRecords(
"select SCOPE_IDENTITY() as " + insertedIdName + ";");
recordSet.moveToFirst();
if (fieldId.getType() == Long.class) {
fieldId.set(pEntity, recordSet.getLong(insertedIdName));
} else if (fieldId.getType() == Integer.class) {
fieldId.set(pEntity, recordSet.getInteger(insertedIdName));
} else {
String msg = "There is no rule to fill ID "
+ fieldId.getName().toUpperCase()
+ " of " + fieldId.getType() + " in "
+ pEntity;
throw new ExceptionWithCode(ExceptionWithCode.NOT_YET_IMPLEMENTED,
msg);
}
} finally {
if (recordSet != null) {
recordSet.close();
}
}
}
}
} | class class_name[name] begin[{]
method[insertEntity, return_type[void], modifier[final public], parameter[pAddParam, pEntity]] begin[{]
local_variable[type[ColumnsValues], columnsValues]
local_variable[type[long], result]
if[binary_operation[member[.result], !=, literal[1]]] begin[{]
local_variable[type[String], query]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ERROR_INSERT_UPDATE, postfix_operators=[], prefix_operators=[], qualifier=ISrvDatabase, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="It should be 1 row inserted but it is "), operandr=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", query:\n"), operator=+), operandr=MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";\n"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExceptionWithCode, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], idName]
if[binary_operation[member[idName.length], ==, literal[1]]] begin[{]
local_variable[type[Field], fieldId]
call[fieldId.setAccessible, parameter[literal[true]]]
local_variable[type[Object], idValue]
if[binary_operation[member[.idValue], ==, literal[null]]] begin[{]
local_variable[type[IRecordSet], recordSet]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INSERTEDID"), name=insertedIdName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=recordSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSrvDatabase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="select SCOPE_IDENTITY() as "), operandr=MemberReference(member=insertedIdName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";"), operator=+)], member=retrieveRecords, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=moveToFirst, postfix_operators=[], prefix_operators=[], qualifier=recordSet, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[], type_arguments=None), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None)), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[], type_arguments=None), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There is no rule to fill ID "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[MethodInvocation(arguments=[], member=toUpperCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" of "), operator=+), operandr=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in "), operator=+), operandr=MemberReference(member=pEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=NOT_YET_IMPLEMENTED, postfix_operators=[], prefix_operators=[], qualifier=ExceptionWithCode, selectors=[]), MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExceptionWithCode, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=insertedIdName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInteger, postfix_operators=[], prefix_operators=[], qualifier=recordSet, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=insertedIdName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=recordSet, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=fieldId, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=recordSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=recordSet, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] operator[<] identifier[T] operator[>] Keyword[void] identifier[insertEntity] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pAddParam] , Keyword[final] identifier[T] identifier[pEntity] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ColumnsValues] identifier[columnsValues] operator[=] identifier[evalColumnsValues] operator[SEP] identifier[pAddParam] , identifier[pEntity] operator[SEP] operator[SEP] Keyword[long] identifier[result] operator[=] identifier[getSrvDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[executeInsert] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] , identifier[columnsValues] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[1] operator[SEP] {
identifier[String] identifier[query] operator[=] identifier[getHlpInsertUpdate] operator[SEP] operator[SEP] operator[SEP] identifier[evalSqlInsert] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] , identifier[columnsValues] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ExceptionWithCode] operator[SEP] identifier[ISrvDatabase] operator[SEP] identifier[ERROR_INSERT_UPDATE] , literal[String] operator[+] identifier[result] operator[+] literal[String] operator[+] identifier[query] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[idName] operator[=] identifier[columnsValues] operator[SEP] identifier[getIdColumnsNames] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idName] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[Field] identifier[fieldId] operator[=] identifier[getUtlReflection] operator[SEP] operator[SEP] operator[SEP] identifier[retrieveField] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[idName] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[fieldId] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Object] identifier[idValue] operator[=] identifier[fieldId] operator[SEP] identifier[get] operator[SEP] identifier[pEntity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idValue] operator[==] Other[null] operator[SEP] {
identifier[IRecordSet] operator[<] identifier[RS] operator[>] identifier[recordSet] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[String] identifier[insertedIdName] operator[=] literal[String] operator[SEP] identifier[recordSet] operator[=] identifier[getSrvDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[retrieveRecords] operator[SEP] literal[String] operator[+] identifier[insertedIdName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[recordSet] operator[SEP] identifier[moveToFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fieldId] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[Long] operator[SEP] Keyword[class] operator[SEP] {
identifier[fieldId] operator[SEP] identifier[set] operator[SEP] identifier[pEntity] , identifier[recordSet] operator[SEP] identifier[getLong] operator[SEP] identifier[insertedIdName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fieldId] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[Integer] operator[SEP] Keyword[class] operator[SEP] {
identifier[fieldId] operator[SEP] identifier[set] operator[SEP] identifier[pEntity] , identifier[recordSet] operator[SEP] identifier[getInteger] operator[SEP] identifier[insertedIdName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[fieldId] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[fieldId] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[pEntity] operator[SEP] Keyword[throw] Keyword[new] identifier[ExceptionWithCode] operator[SEP] identifier[ExceptionWithCode] operator[SEP] identifier[NOT_YET_IMPLEMENTED] , identifier[msg] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[recordSet] operator[!=] Other[null] operator[SEP] {
identifier[recordSet] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
|
public Object execute(final Map<Object, Object> iArgs) {
if (clazz == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
ODatabaseRecord database = getDatabase();
if (!(database instanceof OGraphDatabase))
database = new OGraphDatabase((ODatabaseRecordTx) database);
final ORecordId fromId = new ORecordId(from);
final ORecordId toId = new ORecordId(to);
final ODocument edge = ((OGraphDatabase) database).createEdge(fromId, toId, clazz.getName());
OSQLHelper.bindParameters(edge, fields, new OCommandParameters(iArgs));
edge.save(clusterName);
return edge;
} | class class_name[name] begin[{]
method[execute, return_type[type[Object]], modifier[public], parameter[iArgs]] begin[{]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot execute the command because it has not been parsed yet")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OCommandExecutionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ODatabaseRecord], database]
if[binary_operation[member[.database], instanceof, type[OGraphDatabase]]] begin[{]
assign[member[.database], ClassCreator(arguments=[Cast(expression=MemberReference(member=database, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ODatabaseRecordTx, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OGraphDatabase, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[ORecordId], fromId]
local_variable[type[ORecordId], toId]
local_variable[type[ODocument], edge]
call[OSQLHelper.bindParameters, parameter[member[.edge], member[.fields], ClassCreator(arguments=[MemberReference(member=iArgs, 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=OCommandParameters, sub_type=None))]]
call[edge.save, parameter[member[.clusterName]]]
return[member[.edge]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[execute] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[iArgs] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[OCommandExecutionException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ODatabaseRecord] identifier[database] operator[=] identifier[getDatabase] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[database] Keyword[instanceof] identifier[OGraphDatabase] operator[SEP] operator[SEP] identifier[database] operator[=] Keyword[new] identifier[OGraphDatabase] operator[SEP] operator[SEP] identifier[ODatabaseRecordTx] operator[SEP] identifier[database] operator[SEP] operator[SEP] Keyword[final] identifier[ORecordId] identifier[fromId] operator[=] Keyword[new] identifier[ORecordId] operator[SEP] identifier[from] operator[SEP] operator[SEP] Keyword[final] identifier[ORecordId] identifier[toId] operator[=] Keyword[new] identifier[ORecordId] operator[SEP] identifier[to] operator[SEP] operator[SEP] Keyword[final] identifier[ODocument] identifier[edge] operator[=] operator[SEP] operator[SEP] identifier[OGraphDatabase] operator[SEP] identifier[database] operator[SEP] operator[SEP] identifier[createEdge] operator[SEP] identifier[fromId] , identifier[toId] , identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[OSQLHelper] operator[SEP] identifier[bindParameters] operator[SEP] identifier[edge] , identifier[fields] , Keyword[new] identifier[OCommandParameters] operator[SEP] identifier[iArgs] operator[SEP] operator[SEP] operator[SEP] identifier[edge] operator[SEP] identifier[save] operator[SEP] identifier[clusterName] operator[SEP] operator[SEP] Keyword[return] identifier[edge] operator[SEP]
}
|
public void deleteProjectMember(Integer projectId, Integer userId) throws IOException {
String tailUrl = GitlabProject.URL + "/" + projectId + "/" + GitlabProjectMember.URL + "/" + userId;
retrieve().method(DELETE).to(tailUrl, Void.class);
} | class class_name[name] begin[{]
method[deleteProjectMember, return_type[void], modifier[public], parameter[projectId, userId]] begin[{]
local_variable[type[String], tailUrl]
call[.retrieve, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deleteProjectMember] operator[SEP] identifier[Integer] identifier[projectId] , identifier[Integer] identifier[userId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[tailUrl] operator[=] identifier[GitlabProject] operator[SEP] identifier[URL] operator[+] literal[String] operator[+] identifier[projectId] operator[+] literal[String] operator[+] identifier[GitlabProjectMember] operator[SEP] identifier[URL] operator[+] literal[String] operator[+] identifier[userId] operator[SEP] identifier[retrieve] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[DELETE] operator[SEP] operator[SEP] identifier[to] operator[SEP] identifier[tailUrl] , identifier[Void] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
private static void injectImplicitly(Injector.Configuration config) {
ImplicitInjectors.APPLICATION.inject(config);
ImplicitInjectors.RESOURCES.inject(config);
ImplicitInjectors.SYSTEM_SERVICES.inject(config);
ImplicitInjectors.ICKLE_SERVICES.inject(config);
ImplicitInjectors.POJOS.inject(config);
} | class class_name[name] begin[{]
method[injectImplicitly, return_type[void], modifier[private static], parameter[config]] begin[{]
call[ImplicitInjectors.APPLICATION.inject, parameter[member[.config]]]
call[ImplicitInjectors.RESOURCES.inject, parameter[member[.config]]]
call[ImplicitInjectors.SYSTEM_SERVICES.inject, parameter[member[.config]]]
call[ImplicitInjectors.ICKLE_SERVICES.inject, parameter[member[.config]]]
call[ImplicitInjectors.POJOS.inject, parameter[member[.config]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[injectImplicitly] operator[SEP] identifier[Injector] operator[SEP] identifier[Configuration] identifier[config] operator[SEP] {
identifier[ImplicitInjectors] operator[SEP] identifier[APPLICATION] operator[SEP] identifier[inject] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[ImplicitInjectors] operator[SEP] identifier[RESOURCES] operator[SEP] identifier[inject] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[ImplicitInjectors] operator[SEP] identifier[SYSTEM_SERVICES] operator[SEP] identifier[inject] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[ImplicitInjectors] operator[SEP] identifier[ICKLE_SERVICES] operator[SEP] identifier[inject] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[ImplicitInjectors] operator[SEP] identifier[POJOS] operator[SEP] identifier[inject] operator[SEP] identifier[config] operator[SEP] operator[SEP]
}
|
public void printUsage(final OutputStream os) {
final StringBuilder bldr = new StringBuilder();
bldr.append("Usage: ");
bldr.append(getUsage());
bldr.append("\n");
bldr.append("Try '--help' for more information.\n");
PrintWriter pw = new PrintWriter(os);
pw.write(bldr.toString());
pw.close();
} | class class_name[name] begin[{]
method[printUsage, return_type[void], modifier[public], parameter[os]] begin[{]
local_variable[type[StringBuilder], bldr]
call[bldr.append, parameter[literal["Usage: "]]]
call[bldr.append, parameter[call[.getUsage, parameter[]]]]
call[bldr.append, parameter[literal["\n"]]]
call[bldr.append, parameter[literal["Try '--help' for more information.\n"]]]
local_variable[type[PrintWriter], pw]
call[pw.write, parameter[call[bldr.toString, parameter[]]]]
call[pw.close, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printUsage] operator[SEP] Keyword[final] identifier[OutputStream] identifier[os] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[bldr] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[bldr] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[bldr] operator[SEP] identifier[append] operator[SEP] identifier[getUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bldr] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[bldr] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[pw] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[os] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[write] operator[SEP] identifier[bldr] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getAbsoluteParent(@NotNull String path, int parentLevel, @NotNull ResourceResolver resourceResolver) {
if (parentLevel < 0) {
return "";
}
int level = parentLevel + getAbsoluteLevelOffset(path, resourceResolver);
return Text.getAbsoluteParent(path, level);
} | class class_name[name] begin[{]
method[getAbsoluteParent, return_type[type[String]], modifier[public static], parameter[path, parentLevel, resourceResolver]] begin[{]
if[binary_operation[member[.parentLevel], <, literal[0]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
local_variable[type[int], level]
return[call[Text.getAbsoluteParent, parameter[member[.path], member[.level]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getAbsoluteParent] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[path] , Keyword[int] identifier[parentLevel] , annotation[@] identifier[NotNull] identifier[ResourceResolver] identifier[resourceResolver] operator[SEP] {
Keyword[if] operator[SEP] identifier[parentLevel] operator[<] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[int] identifier[level] operator[=] identifier[parentLevel] operator[+] identifier[getAbsoluteLevelOffset] operator[SEP] identifier[path] , identifier[resourceResolver] operator[SEP] operator[SEP] Keyword[return] identifier[Text] operator[SEP] identifier[getAbsoluteParent] operator[SEP] identifier[path] , identifier[level] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unused") // called through reflection by RequestServer
public FramesV3 column(int version, FramesV3 s) { // TODO: should return a Vec schema
Frame frame = getFromDKV("key", s.frame_id.key());
Vec vec = frame.vec(s.column);
if (null == vec)
throw new H2OColumnNotFoundArgumentException("column", s.frame_id.toString(), s.column);
Vec[] vecs = { vec };
String[] names = { s.column };
Frame new_frame = new Frame(names, vecs);
s.frames = new FrameV3[1];
s.frames[0] = new FrameV3(new_frame);
((FrameV3)s.frames[0]).clearBinsField();
return s;
} | class class_name[name] begin[{]
method[column, return_type[type[FramesV3]], modifier[public], parameter[version, s]] begin[{]
local_variable[type[Frame], frame]
local_variable[type[Vec], vec]
if[binary_operation[literal[null], ==, member[.vec]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="column"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=s.frame_id, selectors=[], type_arguments=None), MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=H2OColumnNotFoundArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Vec], vecs]
local_variable[type[String], names]
local_variable[type[Frame], new_frame]
assign[member[s.frames], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FrameV3, sub_type=None))]
assign[member[s.frames], ClassCreator(arguments=[MemberReference(member=new_frame, 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=FrameV3, sub_type=None))]
Cast(expression=MemberReference(member=frames, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type=ReferenceType(arguments=None, dimensions=[], name=FrameV3, sub_type=None))
return[member[.s]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[FramesV3] identifier[column] operator[SEP] Keyword[int] identifier[version] , identifier[FramesV3] identifier[s] operator[SEP] {
identifier[Frame] identifier[frame] operator[=] identifier[getFromDKV] operator[SEP] literal[String] , identifier[s] operator[SEP] identifier[frame_id] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Vec] identifier[vec] operator[=] identifier[frame] operator[SEP] identifier[vec] operator[SEP] identifier[s] operator[SEP] identifier[column] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[vec] operator[SEP] Keyword[throw] Keyword[new] identifier[H2OColumnNotFoundArgumentException] operator[SEP] literal[String] , identifier[s] operator[SEP] identifier[frame_id] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[s] operator[SEP] identifier[column] operator[SEP] operator[SEP] identifier[Vec] operator[SEP] operator[SEP] identifier[vecs] operator[=] {
identifier[vec]
} operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[names] operator[=] {
identifier[s] operator[SEP] identifier[column]
} operator[SEP] identifier[Frame] identifier[new_frame] operator[=] Keyword[new] identifier[Frame] operator[SEP] identifier[names] , identifier[vecs] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[frames] operator[=] Keyword[new] identifier[FrameV3] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[frames] operator[SEP] Other[0] operator[SEP] operator[=] Keyword[new] identifier[FrameV3] operator[SEP] identifier[new_frame] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[FrameV3] operator[SEP] identifier[s] operator[SEP] identifier[frames] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[clearBinsField] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
|
protected<Q> Q execute(RelationCategory returnType, ResultConstructor<Q> resultConstructor) {
BaseVertexCentricQuery bq = super.constructQuery(returnType);
if (bq.isEmpty()) return resultConstructor.emptyResult();
if (returnType==RelationCategory.PROPERTY && hasSingleType() && !hasQueryOnlyLoaded()
&& tx.getConfiguration().hasPropertyPrefetching()) {
//Preload properties
vertex.query().properties().iterator().hasNext();
}
if (isPartitionedVertex(vertex) && !hasQueryOnlyGivenVertex()) { //If it's a preloaded vertex we shouldn't preload data explicitly
List<InternalVertex> vertices = allRequiredRepresentatives(vertex);
profiler.setAnnotation(QueryProfiler.PARTITIONED_VERTEX_ANNOTATION,true);
profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,vertices.size());
if (vertices.size()>1) {
for (BackendQueryHolder<SliceQuery> sq : bq.getQueries()) {
tx.executeMultiQuery(vertices, sq.getBackendQuery(),sq.getProfiler());
}
}
} else profiler.setAnnotation(QueryProfiler.NUMVERTICES_ANNOTATION,1);
return resultConstructor.getResult(vertex,bq);
} | class class_name[name] begin[{]
method[execute, return_type[type[Q]], modifier[protected], parameter[returnType, resultConstructor]] begin[{]
local_variable[type[BaseVertexCentricQuery], bq]
if[call[bq.isEmpty, parameter[]]] begin[{]
return[call[resultConstructor.emptyResult, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.returnType], ==, member[RelationCategory.PROPERTY]], &&, call[.hasSingleType, parameter[]]], &&, call[.hasQueryOnlyLoaded, parameter[]]], &&, call[tx.getConfiguration, parameter[]]]] begin[{]
call[vertex.query, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[call[.isPartitionedVertex, parameter[member[.vertex]]], &&, call[.hasQueryOnlyGivenVertex, parameter[]]]] begin[{]
local_variable[type[List], vertices]
call[profiler.setAnnotation, parameter[member[QueryProfiler.PARTITIONED_VERTEX_ANNOTATION], literal[true]]]
call[profiler.setAnnotation, parameter[member[QueryProfiler.NUMVERTICES_ANNOTATION], call[vertices.size, parameter[]]]]
if[binary_operation[call[vertices.size, parameter[]], >, literal[1]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=vertices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBackendQuery, postfix_operators=[], prefix_operators=[], qualifier=sq, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getProfiler, postfix_operators=[], prefix_operators=[], qualifier=sq, selectors=[], type_arguments=None)], member=executeMultiQuery, postfix_operators=[], prefix_operators=[], qualifier=tx, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getQueries, postfix_operators=[], prefix_operators=[], qualifier=bq, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sq)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SliceQuery, sub_type=None))], dimensions=[], name=BackendQueryHolder, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
call[profiler.setAnnotation, parameter[member[QueryProfiler.NUMVERTICES_ANNOTATION], literal[1]]]
end[}]
return[call[resultConstructor.getResult, parameter[member[.vertex], member[.bq]]]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[Q] operator[>] identifier[Q] identifier[execute] operator[SEP] identifier[RelationCategory] identifier[returnType] , identifier[ResultConstructor] operator[<] identifier[Q] operator[>] identifier[resultConstructor] operator[SEP] {
identifier[BaseVertexCentricQuery] identifier[bq] operator[=] Keyword[super] operator[SEP] identifier[constructQuery] operator[SEP] identifier[returnType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bq] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[resultConstructor] operator[SEP] identifier[emptyResult] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[returnType] operator[==] identifier[RelationCategory] operator[SEP] identifier[PROPERTY] operator[&&] identifier[hasSingleType] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[hasQueryOnlyLoaded] operator[SEP] operator[SEP] operator[&&] identifier[tx] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[hasPropertyPrefetching] operator[SEP] operator[SEP] operator[SEP] {
identifier[vertex] operator[SEP] identifier[query] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isPartitionedVertex] operator[SEP] identifier[vertex] operator[SEP] operator[&&] operator[!] identifier[hasQueryOnlyGivenVertex] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[InternalVertex] operator[>] identifier[vertices] operator[=] identifier[allRequiredRepresentatives] operator[SEP] identifier[vertex] operator[SEP] operator[SEP] identifier[profiler] operator[SEP] identifier[setAnnotation] operator[SEP] identifier[QueryProfiler] operator[SEP] identifier[PARTITIONED_VERTEX_ANNOTATION] , literal[boolean] operator[SEP] operator[SEP] identifier[profiler] operator[SEP] identifier[setAnnotation] operator[SEP] identifier[QueryProfiler] operator[SEP] identifier[NUMVERTICES_ANNOTATION] , identifier[vertices] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vertices] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[for] operator[SEP] identifier[BackendQueryHolder] operator[<] identifier[SliceQuery] operator[>] identifier[sq] operator[:] identifier[bq] operator[SEP] identifier[getQueries] operator[SEP] operator[SEP] operator[SEP] {
identifier[tx] operator[SEP] identifier[executeMultiQuery] operator[SEP] identifier[vertices] , identifier[sq] operator[SEP] identifier[getBackendQuery] operator[SEP] operator[SEP] , identifier[sq] operator[SEP] identifier[getProfiler] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] identifier[profiler] operator[SEP] identifier[setAnnotation] operator[SEP] identifier[QueryProfiler] operator[SEP] identifier[NUMVERTICES_ANNOTATION] , Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[resultConstructor] operator[SEP] identifier[getResult] operator[SEP] identifier[vertex] , identifier[bq] operator[SEP] operator[SEP]
}
|
private boolean isAttributeRegistrationAllowed(AttributeDefinition definition) {
boolean runtime = definition.getImmutableFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME);
if (!runtime) {
return true;
}
boolean runtimeServiceNotRequired = definition.getImmutableFlags().contains(AttributeAccess.Flag.RUNTIME_SERVICE_NOT_REQUIRED);
if (runtimeServiceNotRequired) {
return true;
}
return getProcessType().isServer();
} | class class_name[name] begin[{]
method[isAttributeRegistrationAllowed, return_type[type[boolean]], modifier[private], parameter[definition]] begin[{]
local_variable[type[boolean], runtime]
if[member[.runtime]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], runtimeServiceNotRequired]
if[member[.runtimeServiceNotRequired]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[.getProcessType, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isAttributeRegistrationAllowed] operator[SEP] identifier[AttributeDefinition] identifier[definition] operator[SEP] {
Keyword[boolean] identifier[runtime] operator[=] identifier[definition] operator[SEP] identifier[getImmutableFlags] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[AttributeAccess] operator[SEP] identifier[Flag] operator[SEP] identifier[STORAGE_RUNTIME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[runtime] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[runtimeServiceNotRequired] operator[=] identifier[definition] operator[SEP] identifier[getImmutableFlags] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[AttributeAccess] operator[SEP] identifier[Flag] operator[SEP] identifier[RUNTIME_SERVICE_NOT_REQUIRED] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[runtimeServiceNotRequired] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[getProcessType] operator[SEP] operator[SEP] operator[SEP] identifier[isServer] operator[SEP] operator[SEP] operator[SEP]
}
|
public void updateVersionHistory(double timestamp, Integer newVersionCode, String newVersionName) {
boolean exists = false;
for (VersionHistoryItem item : versionHistoryItems) {
if (item.getVersionCode() == newVersionCode && item.getVersionName().equals(newVersionName)) {
exists = true;
break;
}
}
if (!exists) {
VersionHistoryItem newVersionHistoryItem = new VersionHistoryItem(timestamp, newVersionCode, newVersionName);
versionHistoryItems.add(newVersionHistoryItem);
notifyDataChanged();
}
} | class class_name[name] begin[{]
method[updateVersionHistory, return_type[void], modifier[public], parameter[timestamp, newVersionCode, newVersionName]] begin[{]
local_variable[type[boolean], exists]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getVersionCode, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operandr=MemberReference(member=newVersionCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=MethodInvocation(arguments=[], member=getVersionName, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[MethodInvocation(arguments=[MemberReference(member=newVersionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=exists, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=versionHistoryItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VersionHistoryItem, sub_type=None))), label=None)
if[member[.exists]] begin[{]
local_variable[type[VersionHistoryItem], newVersionHistoryItem]
call[versionHistoryItems.add, parameter[member[.newVersionHistoryItem]]]
call[.notifyDataChanged, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateVersionHistory] operator[SEP] Keyword[double] identifier[timestamp] , identifier[Integer] identifier[newVersionCode] , identifier[String] identifier[newVersionName] operator[SEP] {
Keyword[boolean] identifier[exists] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[VersionHistoryItem] identifier[item] operator[:] identifier[versionHistoryItems] operator[SEP] {
Keyword[if] operator[SEP] identifier[item] operator[SEP] identifier[getVersionCode] operator[SEP] operator[SEP] operator[==] identifier[newVersionCode] operator[&&] identifier[item] operator[SEP] identifier[getVersionName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[newVersionName] operator[SEP] operator[SEP] {
identifier[exists] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[exists] operator[SEP] {
identifier[VersionHistoryItem] identifier[newVersionHistoryItem] operator[=] Keyword[new] identifier[VersionHistoryItem] operator[SEP] identifier[timestamp] , identifier[newVersionCode] , identifier[newVersionName] operator[SEP] operator[SEP] identifier[versionHistoryItems] operator[SEP] identifier[add] operator[SEP] identifier[newVersionHistoryItem] operator[SEP] operator[SEP] identifier[notifyDataChanged] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public OrientVertexType getVertexBaseType() {
makeActive();
return new OrientVertexType(this, getRawGraph().getMetadata().getSchema().getClass(OrientVertexType.CLASS_NAME));
} | class class_name[name] begin[{]
method[getVertexBaseType, return_type[type[OrientVertexType]], modifier[public], parameter[]] begin[{]
call[.makeActive, parameter[]]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=getRawGraph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getMetadata, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getSchema, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=OrientVertexType, selectors=[])], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OrientVertexType, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[OrientVertexType] identifier[getVertexBaseType] operator[SEP] operator[SEP] {
identifier[makeActive] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[OrientVertexType] operator[SEP] Keyword[this] , identifier[getRawGraph] operator[SEP] operator[SEP] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getSchema] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] identifier[OrientVertexType] operator[SEP] identifier[CLASS_NAME] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<String> extractAttributeEmptyCheck(List<Entry> entries, String attributeType) {
List<String> result = new LinkedList<String>();
for (Entry e : entries) {
result.add(extractAttributeEmptyCheck(e, attributeType));
}
return result;
} | class class_name[name] begin[{]
method[extractAttributeEmptyCheck, return_type[type[List]], modifier[public static], parameter[entries, attributeType]] begin[{]
local_variable[type[List], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attributeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractAttributeEmptyCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=entries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Entry, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[extractAttributeEmptyCheck] operator[SEP] identifier[List] operator[<] identifier[Entry] operator[>] identifier[entries] , identifier[String] identifier[attributeType] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] identifier[e] operator[:] identifier[entries] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[extractAttributeEmptyCheck] operator[SEP] identifier[e] , identifier[attributeType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void prependChildren(final AbstractHtml... children) {
final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock();
boolean listenerInvoked = false;
try {
lock.lock();
final Iterator<AbstractHtml> iterator = this.children.iterator();
if (iterator.hasNext()) {
final AbstractHtml firstChild = iterator.next();
final AbstractHtml[] removedParentChildren = this.children
.toArray(new AbstractHtml[this.children.size()]);
listenerInvoked = firstChild.insertBefore(removedParentChildren,
children);
if (listenerInvoked) {
final InsertBeforeListener insertBeforeListener = sharedObject
.getInsertBeforeListener(ACCESS_OBJECT);
if (insertBeforeListener == null) {
listenerInvoked = false;
}
}
} else {
// NB: similar impl is done in appendChildren(AbstractHtml...
// children) so any improvements here will be applicable in
// there also
final Collection<ChildMovedEvent> movedOrAppended = new ArrayDeque<>(
children.length);
for (final AbstractHtml child : children) {
final AbstractHtml previousParent = child.parent;
addChild(child, false);
final ChildMovedEvent event = new ChildMovedEvent(
previousParent, this, child);
movedOrAppended.add(event);
}
final ChildTagAppendListener listener = sharedObject
.getChildTagAppendListener(ACCESS_OBJECT);
if (listener != null) {
listener.childrendAppendedOrMoved(movedOrAppended);
listenerInvoked = true;
}
}
} finally {
lock.unlock();
}
if (listenerInvoked) {
final PushQueue pushQueue = sharedObject
.getPushQueue(ACCESS_OBJECT);
if (pushQueue != null) {
pushQueue.push();
}
}
} | class class_name[name] begin[{]
method[prependChildren, return_type[void], modifier[public], parameter[children]] begin[{]
local_variable[type[Lock], lock]
local_variable[type[boolean], listenerInvoked]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=lock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=children, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=iterator)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AbstractHtml, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayDeque, sub_type=None)), name=movedOrAppended)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ChildMovedEvent, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[]), name=previousParent)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AbstractHtml, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=addChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=previousParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=child, 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=ChildMovedEvent, sub_type=None)), name=event)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ChildMovedEvent, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=movedOrAppended, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AbstractHtml, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ACCESS_OBJECT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getChildTagAppendListener, postfix_operators=[], prefix_operators=[], qualifier=sharedObject, selectors=[], type_arguments=None), name=listener)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ChildTagAppendListener, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=movedOrAppended, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=childrendAppendedOrMoved, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=listenerInvoked, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), name=firstChild)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AbstractHtml, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=children, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[ArrayCreator(dimensions=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=children, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AbstractHtml, sub_type=None))], member=toArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=removedParentChildren)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=AbstractHtml, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=listenerInvoked, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=removedParentChildren, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insertBefore, postfix_operators=[], prefix_operators=[], qualifier=firstChild, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MemberReference(member=listenerInvoked, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ACCESS_OBJECT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInsertBeforeListener, postfix_operators=[], prefix_operators=[], qualifier=sharedObject, selectors=[], type_arguments=None), name=insertBeforeListener)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InsertBeforeListener, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=insertBeforeListener, 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=listenerInvoked, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))]))]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
if[member[.listenerInvoked]] begin[{]
local_variable[type[PushQueue], pushQueue]
if[binary_operation[member[.pushQueue], !=, literal[null]]] begin[{]
call[pushQueue.push, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[prependChildren] operator[SEP] Keyword[final] identifier[AbstractHtml] operator[...] identifier[children] operator[SEP] {
Keyword[final] identifier[Lock] identifier[lock] operator[=] identifier[sharedObject] operator[SEP] identifier[getLock] operator[SEP] identifier[ACCESS_OBJECT] operator[SEP] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[listenerInvoked] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[AbstractHtml] operator[>] identifier[iterator] operator[=] Keyword[this] operator[SEP] identifier[children] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[AbstractHtml] identifier[firstChild] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[AbstractHtml] operator[SEP] operator[SEP] identifier[removedParentChildren] operator[=] Keyword[this] operator[SEP] identifier[children] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[AbstractHtml] operator[SEP] Keyword[this] operator[SEP] identifier[children] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[listenerInvoked] operator[=] identifier[firstChild] operator[SEP] identifier[insertBefore] operator[SEP] identifier[removedParentChildren] , identifier[children] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listenerInvoked] operator[SEP] {
Keyword[final] identifier[InsertBeforeListener] identifier[insertBeforeListener] operator[=] identifier[sharedObject] operator[SEP] identifier[getInsertBeforeListener] operator[SEP] identifier[ACCESS_OBJECT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[insertBeforeListener] operator[==] Other[null] operator[SEP] {
identifier[listenerInvoked] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[else] {
Keyword[final] identifier[Collection] operator[<] identifier[ChildMovedEvent] operator[>] identifier[movedOrAppended] operator[=] Keyword[new] identifier[ArrayDeque] operator[<] operator[>] operator[SEP] identifier[children] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[AbstractHtml] identifier[child] operator[:] identifier[children] operator[SEP] {
Keyword[final] identifier[AbstractHtml] identifier[previousParent] operator[=] identifier[child] operator[SEP] identifier[parent] operator[SEP] identifier[addChild] operator[SEP] identifier[child] , literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[ChildMovedEvent] identifier[event] operator[=] Keyword[new] identifier[ChildMovedEvent] operator[SEP] identifier[previousParent] , Keyword[this] , identifier[child] operator[SEP] operator[SEP] identifier[movedOrAppended] operator[SEP] identifier[add] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ChildTagAppendListener] identifier[listener] operator[=] identifier[sharedObject] operator[SEP] identifier[getChildTagAppendListener] operator[SEP] identifier[ACCESS_OBJECT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] operator[!=] Other[null] operator[SEP] {
identifier[listener] operator[SEP] identifier[childrendAppendedOrMoved] operator[SEP] identifier[movedOrAppended] operator[SEP] operator[SEP] identifier[listenerInvoked] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[listenerInvoked] operator[SEP] {
Keyword[final] identifier[PushQueue] identifier[pushQueue] operator[=] identifier[sharedObject] operator[SEP] identifier[getPushQueue] operator[SEP] identifier[ACCESS_OBJECT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pushQueue] operator[!=] Other[null] operator[SEP] {
identifier[pushQueue] operator[SEP] identifier[push] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.