code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public void setFieldValue(Object fieldValue) {
ReflectionUtils.callSetter(parentWrapper.getItem(), field.getName(), fieldValue);
} | class class_name[name] begin[{]
method[setFieldValue, return_type[void], modifier[public], parameter[fieldValue]] begin[{]
call[ReflectionUtils.callSetter, parameter[call[parentWrapper.getItem, parameter[]], call[field.getName, parameter[]], member[.fieldValue]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setFieldValue] operator[SEP] identifier[Object] identifier[fieldValue] operator[SEP] {
identifier[ReflectionUtils] operator[SEP] identifier[callSetter] operator[SEP] identifier[parentWrapper] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] , identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[fieldValue] operator[SEP] operator[SEP]
}
|
public static AuthInfo parseAuth(String authString) {
String[] authComponents = getComponents(authString, "authString", "scheme:authString");
return new AuthInfo(authComponents[0], authComponents[1].getBytes(Charsets.UTF_8));
} | class class_name[name] begin[{]
method[parseAuth, return_type[type[AuthInfo]], modifier[public static], parameter[authString]] begin[{]
local_variable[type[String], authComponents]
return[ClassCreator(arguments=[MemberReference(member=authComponents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=authComponents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), MethodInvocation(arguments=[MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=Charsets, selectors=[])], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuthInfo, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[AuthInfo] identifier[parseAuth] operator[SEP] identifier[String] identifier[authString] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[authComponents] operator[=] identifier[getComponents] operator[SEP] identifier[authString] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AuthInfo] operator[SEP] identifier[authComponents] operator[SEP] Other[0] operator[SEP] , identifier[authComponents] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
|
public Vertigo deployNetwork(String cluster, NetworkConfig network) {
return deployNetwork(cluster, network, null);
} | class class_name[name] begin[{]
method[deployNetwork, return_type[type[Vertigo]], modifier[public], parameter[cluster, network]] begin[{]
return[call[.deployNetwork, parameter[member[.cluster], member[.network], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[Vertigo] identifier[deployNetwork] operator[SEP] identifier[String] identifier[cluster] , identifier[NetworkConfig] identifier[network] operator[SEP] {
Keyword[return] identifier[deployNetwork] operator[SEP] identifier[cluster] , identifier[network] , Other[null] operator[SEP] operator[SEP]
}
|
public void setRoot(int root)
{
// %OPT% Get this directly from the lpi.
XPathContext xctxt = wi().getXPathContext();
m_dtm = xctxt.getDTM(root);
m_traverser = m_dtm.getAxisTraverser(m_axis);
m_isFresh = true;
m_foundLast = false;
m_root = root;
m_currentNode = root;
if (DTM.NULL == root)
{
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SETTING_WALKER_ROOT_TO_NULL, null)); //"\n !!!! Error! Setting the root of a walker to null!!!");
}
resetProximityPositions();
} | class class_name[name] begin[{]
method[setRoot, return_type[void], modifier[public], parameter[root]] begin[{]
local_variable[type[XPathContext], xctxt]
assign[member[.m_dtm], call[xctxt.getDTM, parameter[member[.root]]]]
assign[member[.m_traverser], call[m_dtm.getAxisTraverser, parameter[member[.m_axis]]]]
assign[member[.m_isFresh], literal[true]]
assign[member[.m_foundLast], literal[false]]
assign[member[.m_root], member[.root]]
assign[member[.m_currentNode], member[.root]]
if[binary_operation[member[DTM.NULL], ==, member[.root]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ER_SETTING_WALKER_ROOT_TO_NULL, postfix_operators=[], prefix_operators=[], qualifier=XPATHErrorResources, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=createXPATHMessage, postfix_operators=[], prefix_operators=[], qualifier=XSLMessages, selectors=[], type_arguments=None)], 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)
else begin[{]
None
end[}]
call[.resetProximityPositions, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setRoot] operator[SEP] Keyword[int] identifier[root] operator[SEP] {
identifier[XPathContext] identifier[xctxt] operator[=] identifier[wi] operator[SEP] operator[SEP] operator[SEP] identifier[getXPathContext] operator[SEP] operator[SEP] operator[SEP] identifier[m_dtm] operator[=] identifier[xctxt] operator[SEP] identifier[getDTM] operator[SEP] identifier[root] operator[SEP] operator[SEP] identifier[m_traverser] operator[=] identifier[m_dtm] operator[SEP] identifier[getAxisTraverser] operator[SEP] identifier[m_axis] operator[SEP] operator[SEP] identifier[m_isFresh] operator[=] literal[boolean] operator[SEP] identifier[m_foundLast] operator[=] literal[boolean] operator[SEP] identifier[m_root] operator[=] identifier[root] operator[SEP] identifier[m_currentNode] operator[=] identifier[root] operator[SEP] Keyword[if] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] operator[==] identifier[root] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[XSLMessages] operator[SEP] identifier[createXPATHMessage] operator[SEP] identifier[XPATHErrorResources] operator[SEP] identifier[ER_SETTING_WALKER_ROOT_TO_NULL] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
identifier[resetProximityPositions] operator[SEP] operator[SEP] operator[SEP]
}
|
public Record getNextGridRecord(boolean bFirstTime) throws DBException
{
Record record = this.getMainRecord();
Record recNew = null;
if (bFirstTime)
{
String mainString = this.getScreenRecord().getField(ProjectTaskScreenRecord.PROJECT_TASK_ID).toString();
recNew = this.getCurrentLevelInfo(+0, record);
recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null));
}
else
{ // See if there are any sub-records to the last valid record
recNew = this.getCurrentLevelInfo(+1, record);
String mainString = record.getCounterField().toString();
if (recNew.getListener(StringSubFileFilter.class) == null)
recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null));
}
boolean bHasNext = recNew.hasNext();
if (!bHasNext)
{
int dLevel = (int)this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).getValue();
if (dLevel == 0)
return null; // All done
Record recTemp = this.getCurrentLevelInfo(+0, record);
recTemp.removeListener(recTemp.getListener(StringSubFileFilter.class), true);
recTemp.close();
dLevel = dLevel - 2; // Since it is incremented next time
this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).setValue(dLevel);
return this.getNextGridRecord(false);
}
Record recNext = (Record)recNew.next();
record.moveFields(recNext, null, true, DBConstants.SCREEN_MOVE, false, false, false, false);
return record;
} | class class_name[name] begin[{]
method[getNextGridRecord, return_type[type[Record]], modifier[public], parameter[bFirstTime]] begin[{]
local_variable[type[Record], record]
local_variable[type[Record], recNew]
if[member[.bFirstTime]] begin[{]
local_variable[type[String], mainString]
assign[member[.recNew], THIS[call[None.getCurrentLevelInfo, parameter[literal[0], member[.record]]]]]
call[recNew.addListener, parameter[ClassCreator(arguments=[MemberReference(member=mainString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PARENT_PROJECT_TASK_ID, postfix_operators=[], prefix_operators=[], qualifier=ProjectTask, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), 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=StringSubFileFilter, sub_type=None))]]
else begin[{]
assign[member[.recNew], THIS[call[None.getCurrentLevelInfo, parameter[literal[1], member[.record]]]]]
local_variable[type[String], mainString]
if[binary_operation[call[recNew.getListener, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringSubFileFilter, sub_type=None))]], ==, literal[null]]] begin[{]
call[recNew.addListener, parameter[ClassCreator(arguments=[MemberReference(member=mainString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PARENT_PROJECT_TASK_ID, postfix_operators=[], prefix_operators=[], qualifier=ProjectTask, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), 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=StringSubFileFilter, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
local_variable[type[boolean], bHasNext]
if[member[.bHasNext]] begin[{]
local_variable[type[int], dLevel]
if[binary_operation[member[.dLevel], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Record], recTemp]
call[recTemp.removeListener, parameter[call[recTemp.getListener, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringSubFileFilter, sub_type=None))]], literal[true]]]
call[recTemp.close, parameter[]]
assign[member[.dLevel], binary_operation[member[.dLevel], -, literal[2]]]
THIS[call[None.getScreenRecord, parameter[]]call[None.getField, parameter[member[ProjectTaskScreenRecord.CURRENT_LEVEL]]]call[None.setValue, parameter[member[.dLevel]]]]
return[THIS[call[None.getNextGridRecord, parameter[literal[false]]]]]
else begin[{]
None
end[}]
local_variable[type[Record], recNext]
call[record.moveFields, parameter[member[.recNext], literal[null], literal[true], member[DBConstants.SCREEN_MOVE], literal[false], literal[false], literal[false], literal[false]]]
return[member[.record]]
end[}]
END[}] | Keyword[public] identifier[Record] identifier[getNextGridRecord] operator[SEP] Keyword[boolean] identifier[bFirstTime] operator[SEP] Keyword[throws] identifier[DBException] {
identifier[Record] identifier[record] operator[=] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[SEP] identifier[Record] identifier[recNew] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[bFirstTime] operator[SEP] {
identifier[String] identifier[mainString] operator[=] Keyword[this] operator[SEP] identifier[getScreenRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[ProjectTaskScreenRecord] operator[SEP] identifier[PROJECT_TASK_ID] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[recNew] operator[=] Keyword[this] operator[SEP] identifier[getCurrentLevelInfo] operator[SEP] operator[+] Other[0] , identifier[record] operator[SEP] operator[SEP] identifier[recNew] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[StringSubFileFilter] operator[SEP] identifier[mainString] , identifier[ProjectTask] operator[SEP] identifier[PARENT_PROJECT_TASK_ID] , Other[null] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[recNew] operator[=] Keyword[this] operator[SEP] identifier[getCurrentLevelInfo] operator[SEP] operator[+] Other[1] , identifier[record] operator[SEP] operator[SEP] identifier[String] identifier[mainString] operator[=] identifier[record] operator[SEP] identifier[getCounterField] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[recNew] operator[SEP] identifier[getListener] operator[SEP] identifier[StringSubFileFilter] operator[SEP] Keyword[class] operator[SEP] operator[==] Other[null] operator[SEP] identifier[recNew] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[StringSubFileFilter] operator[SEP] identifier[mainString] , identifier[ProjectTask] operator[SEP] identifier[PARENT_PROJECT_TASK_ID] , Other[null] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[bHasNext] operator[=] identifier[recNew] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[bHasNext] operator[SEP] {
Keyword[int] identifier[dLevel] operator[=] operator[SEP] Keyword[int] operator[SEP] Keyword[this] operator[SEP] identifier[getScreenRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[ProjectTaskScreenRecord] operator[SEP] identifier[CURRENT_LEVEL] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dLevel] operator[==] Other[0] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Record] identifier[recTemp] operator[=] Keyword[this] operator[SEP] identifier[getCurrentLevelInfo] operator[SEP] operator[+] Other[0] , identifier[record] operator[SEP] operator[SEP] identifier[recTemp] operator[SEP] identifier[removeListener] operator[SEP] identifier[recTemp] operator[SEP] identifier[getListener] operator[SEP] identifier[StringSubFileFilter] operator[SEP] Keyword[class] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[recTemp] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[dLevel] operator[=] identifier[dLevel] operator[-] Other[2] operator[SEP] Keyword[this] operator[SEP] identifier[getScreenRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[ProjectTaskScreenRecord] operator[SEP] identifier[CURRENT_LEVEL] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[dLevel] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[getNextGridRecord] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[Record] identifier[recNext] operator[=] operator[SEP] identifier[Record] operator[SEP] identifier[recNew] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[record] operator[SEP] identifier[moveFields] operator[SEP] identifier[recNext] , Other[null] , literal[boolean] , identifier[DBConstants] operator[SEP] identifier[SCREEN_MOVE] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[record] operator[SEP]
}
|
public void setFullname(String v) {
if (Title_Type.featOkTst && ((Title_Type)jcasType).casFeat_fullname == null)
jcasType.jcas.throwFeatMissing("fullname", "de.julielab.jules.types.wikipedia.Title");
jcasType.ll_cas.ll_setStringValue(addr, ((Title_Type)jcasType).casFeatCode_fullname, v);} | class class_name[name] begin[{]
method[setFullname, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[Title_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Title_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["fullname"], literal["de.julielab.jules.types.wikipedia.Title"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Title_Type, sub_type=None)), member[.v]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setFullname] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[Title_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Title_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_fullname] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Title_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_fullname] , identifier[v] operator[SEP] operator[SEP]
}
|
@Override
public Iterator<Path> iterator() {
final List<String> tokens = tokenize(this);
final int tokensSize = tokens.size();
final List<Path> paths = new ArrayList<>(tokensSize);
for (int i = 0; i < tokensSize; i++) {
ArchivePath newPath = ArchivePaths.root();
for (int j = 0; j <= i; j++) {
newPath = ArchivePaths.create(newPath, tokens.get(j));
}
paths.add(new ShrinkWrapPath(newPath, this.fileSystem));
}
return paths.iterator();
} | class class_name[name] begin[{]
method[iterator, return_type[type[Iterator]], modifier[public], parameter[]] begin[{]
local_variable[type[List], tokens]
local_variable[type[int], tokensSize]
local_variable[type[List], paths]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=root, postfix_operators=[], prefix_operators=[], qualifier=ArchivePaths, selectors=[], type_arguments=None), name=newPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ArchivePath, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=newPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tokens, selectors=[], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=ArchivePaths, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, 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=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=newPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fileSystem, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ShrinkWrapPath, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=paths, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=tokensSize, 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[call[paths.iterator, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Iterator] operator[<] identifier[Path] operator[>] identifier[iterator] operator[SEP] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[tokens] operator[=] identifier[tokenize] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[tokensSize] operator[=] identifier[tokens] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Path] operator[>] identifier[paths] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[tokensSize] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[tokensSize] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ArchivePath] identifier[newPath] operator[=] identifier[ArchivePaths] operator[SEP] identifier[root] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<=] identifier[i] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[newPath] operator[=] identifier[ArchivePaths] operator[SEP] identifier[create] operator[SEP] identifier[newPath] , identifier[tokens] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
identifier[paths] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ShrinkWrapPath] operator[SEP] identifier[newPath] , Keyword[this] operator[SEP] identifier[fileSystem] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[paths] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
public static snmpcommunity[] get(nitro_service service, String communityname[]) throws Exception{
if (communityname !=null && communityname.length>0) {
snmpcommunity response[] = new snmpcommunity[communityname.length];
snmpcommunity obj[] = new snmpcommunity[communityname.length];
for (int i=0;i<communityname.length;i++) {
obj[i] = new snmpcommunity();
obj[i].set_communityname(communityname[i]);
response[i] = (snmpcommunity) obj[i].get_resource(service);
}
return response;
}
return null;
} | class class_name[name] begin[{]
method[get, return_type[type[snmpcommunity]], modifier[public static], parameter[service, communityname]] begin[{]
if[binary_operation[binary_operation[member[.communityname], !=, literal[null]], &&, binary_operation[member[communityname.length], >, literal[0]]]] begin[{]
local_variable[type[snmpcommunity], response]
local_variable[type[snmpcommunity], obj]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=snmpcommunity, sub_type=None))), label=None), StatementExpression(expression=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=communityname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=set_communityname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get_resource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=snmpcommunity, sub_type=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=communityname, 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[.response]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[snmpcommunity] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[communityname] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[communityname] operator[!=] Other[null] operator[&&] identifier[communityname] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[snmpcommunity] identifier[response] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[snmpcommunity] operator[SEP] identifier[communityname] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[snmpcommunity] identifier[obj] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[snmpcommunity] operator[SEP] identifier[communityname] 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[communityname] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[obj] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[snmpcommunity] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[set_communityname] operator[SEP] identifier[communityname] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] identifier[snmpcommunity] operator[SEP] identifier[obj] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP]
}
Keyword[return] identifier[response] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Bean Reporter<Span> reporter(
Sender sender,
@Value("${zipkin.self-tracing.message-timeout:1}") int messageTimeout,
CollectorMetrics metrics) {
return AsyncReporter.builder(sender)
.messageTimeout(messageTimeout, TimeUnit.SECONDS)
.metrics(new ReporterMetricsAdapter(metrics.forTransport("local")))
.build();
} | class class_name[name] begin[{]
method[reporter, return_type[type[Reporter]], modifier[default], parameter[sender, messageTimeout, metrics]] begin[{]
return[call[AsyncReporter.builder, parameter[member[.sender]]]]
end[}]
END[}] | annotation[@] identifier[Bean] identifier[Reporter] operator[<] identifier[Span] operator[>] identifier[reporter] operator[SEP] identifier[Sender] identifier[sender] , annotation[@] identifier[Value] operator[SEP] literal[String] operator[SEP] Keyword[int] identifier[messageTimeout] , identifier[CollectorMetrics] identifier[metrics] operator[SEP] {
Keyword[return] identifier[AsyncReporter] operator[SEP] identifier[builder] operator[SEP] identifier[sender] operator[SEP] operator[SEP] identifier[messageTimeout] operator[SEP] identifier[messageTimeout] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP] identifier[metrics] operator[SEP] Keyword[new] identifier[ReporterMetricsAdapter] operator[SEP] identifier[metrics] operator[SEP] identifier[forTransport] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private void linkLast(E e) {
final Node<E> newNode = new Node<E>(Objects.requireNonNull(e));
restartFromTail:
for (;;)
for (Node<E> t = tail, p = t, q;;) {
if ((q = p.next) != null &&
(q = (p = q).next) != null)
// Check for tail updates every other hop.
// If p == q, we are sure to follow tail instead.
p = (t != (t = tail)) ? t : q;
else if (p.prev == p) // NEXT_TERMINATOR
continue restartFromTail;
else {
// p is last node
newNode.lazySetPrev(p); // CAS piggyback
if (p.casNext(null, newNode)) {
// Successful CAS is the linearization point
// for e to become an element of this deque,
// and for newNode to become "live".
if (p != t) // hop two nodes at a time
casTail(t, newNode); // Failure is OK.
return;
}
// Lost CAS race to another thread; re-read next
}
}
} | class class_name[name] begin[{]
method[linkLast, return_type[void], modifier[private], parameter[e]] begin[{]
local_variable[type[Node], newNode]
ForStatement(body=ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[])), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=prev, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]), operandr=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lazySetPrev, postfix_operators=[], prefix_operators=[], qualifier=newNode, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=newNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=casNext, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=casTail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=None, label=None)]))]), label=None, then_statement=ContinueStatement(goto=restartFromTail, label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=tail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), operator=!=), if_false=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None))]), control=ForControl(condition=None, init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=tail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=t), VariableDeclarator(dimensions=[], initializer=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=p), VariableDeclarator(dimensions=[], initializer=None, name=q)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=Node, sub_type=None)), update=None), label=None), control=ForControl(condition=None, init=None, update=None), label=restartFromTail)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[linkLast] operator[SEP] identifier[E] identifier[e] operator[SEP] {
Keyword[final] identifier[Node] operator[<] identifier[E] operator[>] identifier[newNode] operator[=] Keyword[new] identifier[Node] operator[<] identifier[E] operator[>] operator[SEP] identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP] identifier[restartFromTail] operator[:] Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] operator[<] identifier[E] operator[>] identifier[t] operator[=] identifier[tail] , identifier[p] operator[=] identifier[t] , identifier[q] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[q] operator[=] identifier[p] operator[SEP] identifier[next] operator[SEP] operator[!=] Other[null] operator[&&] operator[SEP] identifier[q] operator[=] operator[SEP] identifier[p] operator[=] identifier[q] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[p] operator[=] operator[SEP] identifier[t] operator[!=] operator[SEP] identifier[t] operator[=] identifier[tail] operator[SEP] operator[SEP] operator[?] identifier[t] operator[:] identifier[q] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[p] operator[SEP] identifier[prev] operator[==] identifier[p] operator[SEP] Keyword[continue] identifier[restartFromTail] operator[SEP] Keyword[else] {
identifier[newNode] operator[SEP] identifier[lazySetPrev] operator[SEP] identifier[p] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[SEP] identifier[casNext] operator[SEP] Other[null] , identifier[newNode] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[p] operator[!=] identifier[t] operator[SEP] identifier[casTail] operator[SEP] identifier[t] , identifier[newNode] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
}
}
|
@VisibleForTesting
static void appendJavadoc(
IndentedLinesBuilder ilb, String doc, boolean forceMultiline, boolean wrapAt100Chars) {
if (wrapAt100Chars) {
// Actual wrap length is less because of indent and because of space used by Javadoc chars.
int wrapLen = 100 - ilb.getCurrIndentLen() - 7;
List<String> wrappedLines = Lists.newArrayList();
for (String line : Splitter.on('\n').split(doc)) {
while (line.length() > wrapLen) {
int spaceIndex = line.lastIndexOf(' ', wrapLen);
if (spaceIndex >= 0) {
wrappedLines.add(line.substring(0, spaceIndex));
line = line.substring(spaceIndex + 1); // add 1 to skip the space
} else {
// No spaces. Just wrap at wrapLen.
wrappedLines.add(line.substring(0, wrapLen));
line = line.substring(wrapLen);
}
}
wrappedLines.add(line);
}
doc = Joiner.on("\n").join(wrappedLines);
}
if (doc.contains("\n") || forceMultiline) {
// Multiline.
ilb.appendLine("/**");
for (String line : Splitter.on('\n').split(doc)) {
ilb.appendLine(" * ", line);
}
ilb.appendLine(" */");
} else {
// One line.
ilb.appendLine("/** ", doc, " */");
}
} | class class_name[name] begin[{]
method[appendJavadoc, return_type[void], modifier[static], parameter[ilb, doc, forceMultiline, wrapAt100Chars]] begin[{]
if[member[.wrapAt100Chars]] begin[{]
local_variable[type[int], wrapLen]
local_variable[type[List], wrappedLines]
ForStatement(body=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), MemberReference(member=wrapLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lastIndexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=spaceIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=spaceIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=wrapLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=wrappedLines, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=wrapLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=spaceIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=wrappedLines, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=spaceIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)), label=None)]))]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=MemberReference(member=wrapLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=wrappedLines, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=on, postfix_operators=[], prefix_operators=[], qualifier=Splitter, selectors=[MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
assign[member[.doc], call[Joiner.on, parameter[literal["\n"]]]]
else begin[{]
None
end[}]
if[binary_operation[call[doc.contains, parameter[literal["\n"]]], ||, member[.forceMultiline]]] begin[{]
call[ilb.appendLine, parameter[literal["/**"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" * "), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendLine, postfix_operators=[], prefix_operators=[], qualifier=ilb, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=on, postfix_operators=[], prefix_operators=[], qualifier=Splitter, selectors=[MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[ilb.appendLine, parameter[literal[" */"]]]
else begin[{]
call[ilb.appendLine, parameter[literal["/** "], member[.doc], literal[" */"]]]
end[}]
end[}]
END[}] | annotation[@] identifier[VisibleForTesting] Keyword[static] Keyword[void] identifier[appendJavadoc] operator[SEP] identifier[IndentedLinesBuilder] identifier[ilb] , identifier[String] identifier[doc] , Keyword[boolean] identifier[forceMultiline] , Keyword[boolean] identifier[wrapAt100Chars] operator[SEP] {
Keyword[if] operator[SEP] identifier[wrapAt100Chars] operator[SEP] {
Keyword[int] identifier[wrapLen] operator[=] Other[100] operator[-] identifier[ilb] operator[SEP] identifier[getCurrIndentLen] operator[SEP] operator[SEP] operator[-] Other[7] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[wrappedLines] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[line] operator[:] identifier[Splitter] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[doc] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] identifier[wrapLen] operator[SEP] {
Keyword[int] identifier[spaceIndex] operator[=] identifier[line] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[wrapLen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[spaceIndex] operator[>=] Other[0] operator[SEP] {
identifier[wrappedLines] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[spaceIndex] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[spaceIndex] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[wrappedLines] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[wrapLen] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[wrapLen] operator[SEP] operator[SEP]
}
}
identifier[wrappedLines] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
identifier[doc] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] identifier[wrappedLines] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[doc] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[||] identifier[forceMultiline] operator[SEP] {
identifier[ilb] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[line] operator[:] identifier[Splitter] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[split] operator[SEP] identifier[doc] operator[SEP] operator[SEP] {
identifier[ilb] operator[SEP] identifier[appendLine] operator[SEP] literal[String] , identifier[line] operator[SEP] operator[SEP]
}
identifier[ilb] operator[SEP] identifier[appendLine] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ilb] operator[SEP] identifier[appendLine] operator[SEP] literal[String] , identifier[doc] , literal[String] operator[SEP] operator[SEP]
}
}
|
public void setValue (String name, float value)
{
Float oldValue = null;
if (_prefs.get(name, null) != null || _props.getProperty(name) != null) {
oldValue = Float.valueOf(_prefs.getFloat(name, super.getValue(name, 0f)));
}
_prefs.putFloat(name, value);
_propsup.firePropertyChange(name, oldValue, Float.valueOf(value));
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[public], parameter[name, value]] begin[{]
local_variable[type[Float], oldValue]
if[binary_operation[binary_operation[call[_prefs.get, parameter[member[.name], literal[null]]], !=, literal[null]], ||, binary_operation[call[_props.getProperty, parameter[member[.name]]], !=, literal[null]]]] begin[{]
assign[member[.oldValue], call[Float.valueOf, parameter[call[_prefs.getFloat, parameter[member[.name], SuperMethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0f)], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]]]]]
else begin[{]
None
end[}]
call[_prefs.putFloat, parameter[member[.name], member[.value]]]
call[_propsup.firePropertyChange, parameter[member[.name], member[.oldValue], call[Float.valueOf, parameter[member[.value]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setValue] operator[SEP] identifier[String] identifier[name] , Keyword[float] identifier[value] operator[SEP] {
identifier[Float] identifier[oldValue] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[_prefs] operator[SEP] identifier[get] operator[SEP] identifier[name] , Other[null] operator[SEP] operator[!=] Other[null] operator[||] identifier[_props] operator[SEP] identifier[getProperty] operator[SEP] identifier[name] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[oldValue] operator[=] identifier[Float] operator[SEP] identifier[valueOf] operator[SEP] identifier[_prefs] operator[SEP] identifier[getFloat] operator[SEP] identifier[name] , Keyword[super] operator[SEP] identifier[getValue] operator[SEP] identifier[name] , literal[Float] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_prefs] operator[SEP] identifier[putFloat] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] identifier[_propsup] operator[SEP] identifier[firePropertyChange] operator[SEP] identifier[name] , identifier[oldValue] , identifier[Float] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public AnnotationValueBuilder<T> member(String name, @Nullable Class<?> type) {
if (type != null) {
values.put(name, new AnnotationClassValue<>(type));
}
return this;
} | class class_name[name] begin[{]
method[member, return_type[type[AnnotationValueBuilder]], modifier[public], parameter[name, type]] begin[{]
if[binary_operation[member[.type], !=, literal[null]]] begin[{]
call[values.put, parameter[member[.name], ClassCreator(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=AnnotationClassValue, sub_type=None))]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AnnotationValueBuilder] operator[<] identifier[T] operator[>] identifier[member] operator[SEP] identifier[String] identifier[name] , annotation[@] identifier[Nullable] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[!=] Other[null] operator[SEP] {
identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[name] , Keyword[new] identifier[AnnotationClassValue] operator[<] operator[>] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SarlPackage.SARL_AGENT__EXTENDS:
setExtends((JvmParameterizedTypeReference)null);
return;
}
super.eUnset(featureID);
} | class class_name[name] begin[{]
method[eUnset, return_type[void], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=SARL_AGENT__EXTENDS, postfix_operators=[], prefix_operators=[], qualifier=SarlPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=JvmParameterizedTypeReference, sub_type=None))], member=setExtends, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eUnset, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eUnset] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[SarlPackage] operator[SEP] identifier[SARL_AGENT__EXTENDS] operator[:] identifier[setExtends] operator[SEP] operator[SEP] identifier[JvmParameterizedTypeReference] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eUnset] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
private Box makeViewPort(Length x, Length y, Length width, Length height)
{
float _x = (x != null) ? x.floatValueX(this) : 0f;
float _y = (y != null) ? y.floatValueY(this) : 0f;
Box viewPortUser = getCurrentViewPortInUserUnits();
float _w = (width != null) ? width.floatValueX(this) : viewPortUser.width; // default 100%
float _h = (height != null) ? height.floatValueY(this) : viewPortUser.height;
return new Box(_x, _y, _w, _h);
} | class class_name[name] begin[{]
method[makeViewPort, return_type[type[Box]], modifier[private], parameter[x, y, width, height]] begin[{]
local_variable[type[float], _x]
local_variable[type[float], _y]
local_variable[type[Box], viewPortUser]
local_variable[type[float], _w]
local_variable[type[float], _h]
return[ClassCreator(arguments=[MemberReference(member=_x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_h, 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=Box, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[Box] identifier[makeViewPort] operator[SEP] identifier[Length] identifier[x] , identifier[Length] identifier[y] , identifier[Length] identifier[width] , identifier[Length] identifier[height] operator[SEP] {
Keyword[float] identifier[_x] operator[=] operator[SEP] identifier[x] operator[!=] Other[null] operator[SEP] operator[?] identifier[x] operator[SEP] identifier[floatValueX] operator[SEP] Keyword[this] operator[SEP] operator[:] literal[Float] operator[SEP] Keyword[float] identifier[_y] operator[=] operator[SEP] identifier[y] operator[!=] Other[null] operator[SEP] operator[?] identifier[y] operator[SEP] identifier[floatValueY] operator[SEP] Keyword[this] operator[SEP] operator[:] literal[Float] operator[SEP] identifier[Box] identifier[viewPortUser] operator[=] identifier[getCurrentViewPortInUserUnits] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[_w] operator[=] operator[SEP] identifier[width] operator[!=] Other[null] operator[SEP] operator[?] identifier[width] operator[SEP] identifier[floatValueX] operator[SEP] Keyword[this] operator[SEP] operator[:] identifier[viewPortUser] operator[SEP] identifier[width] operator[SEP] Keyword[float] identifier[_h] operator[=] operator[SEP] identifier[height] operator[!=] Other[null] operator[SEP] operator[?] identifier[height] operator[SEP] identifier[floatValueY] operator[SEP] Keyword[this] operator[SEP] operator[:] identifier[viewPortUser] operator[SEP] identifier[height] operator[SEP] Keyword[return] Keyword[new] identifier[Box] operator[SEP] identifier[_x] , identifier[_y] , identifier[_w] , identifier[_h] operator[SEP] operator[SEP]
}
|
@Override
public double validate(IMolecularFormula formula) throws CDKException {
logger.info("Start validation of ", formula);
if (formula.getCharge() == null) {
return 0.0;
} else if (formula.getCharge() == charge) {
return 1.0;
} else {
return 0.0;
}
} | class class_name[name] begin[{]
method[validate, return_type[type[double]], modifier[public], parameter[formula]] begin[{]
call[logger.info, parameter[literal["Start validation of "], member[.formula]]]
if[binary_operation[call[formula.getCharge, parameter[]], ==, literal[null]]] begin[{]
return[literal[0.0]]
else begin[{]
if[binary_operation[call[formula.getCharge, parameter[]], ==, member[.charge]]] begin[{]
return[literal[1.0]]
else begin[{]
return[literal[0.0]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[validate] operator[SEP] identifier[IMolecularFormula] identifier[formula] operator[SEP] Keyword[throws] identifier[CDKException] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[formula] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formula] operator[SEP] identifier[getCharge] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[Float] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[formula] operator[SEP] identifier[getCharge] operator[SEP] operator[SEP] operator[==] identifier[charge] operator[SEP] {
Keyword[return] literal[Float] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[Float] operator[SEP]
}
}
|
@Override
public boolean hasNext() {
if (null != pathsIterator && !pathsIterator.hasNext()) {
if (null != currentBundle && null != currentBundle.getExplorerConditionalExpression())
commentCallbackHandler.closeConditionalComment();
}
boolean rets = false;
if (null != pathsIterator) {
rets = pathsIterator.hasNext() || bundlesIterator.hasNext();
} else {
rets = bundlesIterator.hasNext();
}
return rets;
} | class class_name[name] begin[{]
method[hasNext, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[literal[null], !=, member[.pathsIterator]], &&, call[pathsIterator.hasNext, parameter[]]]] begin[{]
if[binary_operation[binary_operation[literal[null], !=, member[.currentBundle]], &&, binary_operation[literal[null], !=, call[currentBundle.getExplorerConditionalExpression, parameter[]]]]] begin[{]
call[commentCallbackHandler.closeConditionalComment, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[boolean], rets]
if[binary_operation[literal[null], !=, member[.pathsIterator]]] begin[{]
assign[member[.rets], binary_operation[call[pathsIterator.hasNext, parameter[]], ||, call[bundlesIterator.hasNext, parameter[]]]]
else begin[{]
assign[member[.rets], call[bundlesIterator.hasNext, parameter[]]]
end[}]
return[member[.rets]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[pathsIterator] operator[&&] operator[!] identifier[pathsIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[currentBundle] operator[&&] Other[null] operator[!=] identifier[currentBundle] operator[SEP] identifier[getExplorerConditionalExpression] operator[SEP] operator[SEP] operator[SEP] identifier[commentCallbackHandler] operator[SEP] identifier[closeConditionalComment] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[rets] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[pathsIterator] operator[SEP] {
identifier[rets] operator[=] identifier[pathsIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[||] identifier[bundlesIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rets] operator[=] identifier[bundlesIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rets] operator[SEP]
}
|
private static void display(String format, Object... args) {
System.out.println(MessageFormatter.arrayFormat(format, args).getMessage());
} | class class_name[name] begin[{]
method[display, return_type[void], modifier[private static], parameter[format, args]] begin[{]
call[System.out.println, parameter[call[MessageFormatter.arrayFormat, parameter[member[.format], member[.args]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[display] operator[SEP] identifier[String] identifier[format] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[MessageFormatter] operator[SEP] identifier[arrayFormat] operator[SEP] identifier[format] , identifier[args] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getFileMD5String(File file) throws IOException {
MessageDigest messageDigest = getMessageDigest(MD5);
return getFileHashString(file, messageDigest);
} | class class_name[name] begin[{]
method[getFileMD5String, return_type[type[String]], modifier[public static], parameter[file]] begin[{]
local_variable[type[MessageDigest], messageDigest]
return[call[.getFileHashString, parameter[member[.file], member[.messageDigest]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getFileMD5String] operator[SEP] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[MessageDigest] identifier[messageDigest] operator[=] identifier[getMessageDigest] operator[SEP] identifier[MD5] operator[SEP] operator[SEP] Keyword[return] identifier[getFileHashString] operator[SEP] identifier[file] , identifier[messageDigest] operator[SEP] operator[SEP]
}
|
public static boolean loadDriver(ClassLoader classLoader, String driverClassName) {
try {
classLoader.loadClass(driverClassName).newInstance();
return true;
} catch (IllegalAccessException e) {
// Constructor is private, OK for DriverManager contract
return true;
} catch (Exception e) {
return false;
}
} | class class_name[name] begin[{]
method[loadDriver, return_type[type[boolean]], modifier[public static], parameter[classLoader, driverClassName]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=driverClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[MethodInvocation(arguments=[], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException'])), CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[loadDriver] operator[SEP] identifier[ClassLoader] identifier[classLoader] , identifier[String] identifier[driverClassName] operator[SEP] {
Keyword[try] {
identifier[classLoader] operator[SEP] identifier[loadClass] operator[SEP] identifier[driverClassName] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
protected void prepareValueModel(ValueModel valueModel) {
if (valueModel instanceof BufferedValueModel) {
((BufferedValueModel) valueModel).setCommitTrigger(commitTrigger);
}
// If the value model that we were built on is "dirty trackable" then we
// need to monitor it for changes in its dirty state
if (valueModel instanceof DirtyTrackingValueModel) {
((DirtyTrackingValueModel) valueModel).addPropertyChangeListener(DIRTY_PROPERTY, childStateChangeHandler);
}
} | class class_name[name] begin[{]
method[prepareValueModel, return_type[void], modifier[protected], parameter[valueModel]] begin[{]
if[binary_operation[member[.valueModel], instanceof, type[BufferedValueModel]]] begin[{]
Cast(expression=MemberReference(member=valueModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BufferedValueModel, sub_type=None))
else begin[{]
None
end[}]
if[binary_operation[member[.valueModel], instanceof, type[DirtyTrackingValueModel]]] begin[{]
Cast(expression=MemberReference(member=valueModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DirtyTrackingValueModel, sub_type=None))
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[prepareValueModel] operator[SEP] identifier[ValueModel] identifier[valueModel] operator[SEP] {
Keyword[if] operator[SEP] identifier[valueModel] Keyword[instanceof] identifier[BufferedValueModel] operator[SEP] {
operator[SEP] operator[SEP] identifier[BufferedValueModel] operator[SEP] identifier[valueModel] operator[SEP] operator[SEP] identifier[setCommitTrigger] operator[SEP] identifier[commitTrigger] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[valueModel] Keyword[instanceof] identifier[DirtyTrackingValueModel] operator[SEP] {
operator[SEP] operator[SEP] identifier[DirtyTrackingValueModel] operator[SEP] identifier[valueModel] operator[SEP] operator[SEP] identifier[addPropertyChangeListener] operator[SEP] identifier[DIRTY_PROPERTY] , identifier[childStateChangeHandler] operator[SEP] operator[SEP]
}
}
|
public synchronized byte[] compile() {
long start = System.currentTimeMillis();
try {
if (null != javaByteCode) {
return javaByteCode;
}
if (null == javaSource) {
throw new IllegalStateException("Cannot find java source when compiling " + getKey());
}
engine().classes().compiler.compile(new String[]{name});
if (logger.isTraceEnabled()) {
logger.trace("%sms to compile template: %s", System.currentTimeMillis() - start, getKey());
}
return javaByteCode;
} catch (CompileException.CompilerException e) {
String cn = e.className;
TemplateClass tc = S.isEqual(cn, name) ? this : engine().classes().getByClassName(cn);
if (null == tc) {
tc = this;
}
CompileException ce = new CompileException(engine(), tc, e.javaLineNumber, e.message); // init ce before reset java source to get template line info
javaSource = null; // force parser to regenerate source. This helps to reload after fixing the tag file compilation failure
logger.warn("compile failed for %s at line %d",tc.tagName,e.javaLineNumber);
for (TemplateClass itc:this.includedTemplateClasses) {
logger.info("\tincluded: %s",itc.tagName);
}
throw ce;
} catch (NullPointerException e) {
String clazzName = name;
TemplateClass tc = engine().classes().getByClassName(clazzName);
if (this != tc) {
logger.error("tc is not this");
}
if (!this.equals(tc)) {
logger.error("tc not match this");
}
logger.error("NPE encountered when compiling template class:" + name);
throw e;
} finally {
if (logger.isTraceEnabled()) {
logger.trace("%sms to compile template class %s", System.currentTimeMillis() - start, getKey());
}
}
} | class class_name[name] begin[{]
method[compile, return_type[type[byte]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[long], start]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=javaByteCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=javaByteCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=javaSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot find java source when compiling "), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=, 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=IllegalStateException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=classes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MemberReference(member=compiler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=compile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%sms to compile template: %s"), BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=javaByteCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), name=cn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=cn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEqual, postfix_operators=[], prefix_operators=[], qualifier=S, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[], member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=classes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=cn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByClassName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])), name=tc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TemplateClass, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=javaLineNumber, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CompileException, sub_type=None)), name=ce)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CompileException, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=javaSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compile failed for %s at line %d"), MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[]), MemberReference(member=javaLineNumber, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\tincluded: %s"), MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=itc, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=includedTemplateClasses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=itc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TemplateClass, sub_type=None))), label=None), ThrowStatement(expression=MemberReference(member=ce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CompileException.CompilerException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=clazzName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=classes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=clazzName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByClassName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=tc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TemplateClass, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), operandr=MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="tc is not this")], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=This(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, 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="tc not match this")], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NPE encountered when compiling template class:"), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NullPointerException']))], finally_block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%sms to compile template class %s"), BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[byte] operator[SEP] operator[SEP] identifier[compile] operator[SEP] operator[SEP] {
Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[javaByteCode] operator[SEP] {
Keyword[return] identifier[javaByteCode] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[==] identifier[javaSource] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[engine] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[SEP] operator[SEP] operator[SEP] identifier[compiler] operator[SEP] identifier[compile] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[name]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[start] , identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[javaByteCode] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CompileException] operator[SEP] identifier[CompilerException] identifier[e] operator[SEP] {
identifier[String] identifier[cn] operator[=] identifier[e] operator[SEP] identifier[className] operator[SEP] identifier[TemplateClass] identifier[tc] operator[=] identifier[S] operator[SEP] identifier[isEqual] operator[SEP] identifier[cn] , identifier[name] operator[SEP] operator[?] Keyword[this] operator[:] identifier[engine] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[SEP] operator[SEP] operator[SEP] identifier[getByClassName] operator[SEP] identifier[cn] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[tc] operator[SEP] {
identifier[tc] operator[=] Keyword[this] operator[SEP]
}
identifier[CompileException] identifier[ce] operator[=] Keyword[new] identifier[CompileException] operator[SEP] identifier[engine] operator[SEP] operator[SEP] , identifier[tc] , identifier[e] operator[SEP] identifier[javaLineNumber] , identifier[e] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[javaSource] operator[=] Other[null] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[tc] operator[SEP] identifier[tagName] , identifier[e] operator[SEP] identifier[javaLineNumber] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TemplateClass] identifier[itc] operator[:] Keyword[this] operator[SEP] identifier[includedTemplateClasses] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[itc] operator[SEP] identifier[tagName] operator[SEP] operator[SEP]
}
Keyword[throw] identifier[ce] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NullPointerException] identifier[e] operator[SEP] {
identifier[String] identifier[clazzName] operator[=] identifier[name] operator[SEP] identifier[TemplateClass] identifier[tc] operator[=] identifier[engine] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[SEP] operator[SEP] operator[SEP] identifier[getByClassName] operator[SEP] identifier[clazzName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[!=] identifier[tc] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[equals] operator[SEP] identifier[tc] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[start] , identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Override
public EClass getIfcIrregularTimeSeries() {
if (ifcIrregularTimeSeriesEClass == null) {
ifcIrregularTimeSeriesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(328);
}
return ifcIrregularTimeSeriesEClass;
} | class class_name[name] begin[{]
method[getIfcIrregularTimeSeries, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcIrregularTimeSeriesEClass], ==, literal[null]]] begin[{]
assign[member[.ifcIrregularTimeSeriesEClass], 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=328)], 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[.ifcIrregularTimeSeriesEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcIrregularTimeSeries] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcIrregularTimeSeriesEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcIrregularTimeSeriesEClass] 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[328] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcIrregularTimeSeriesEClass] operator[SEP]
}
|
public static InputStream doPOST(URL url, String data, int timeout) throws IOException
{
URLConnection conn = openURLConnection(url, timeout);
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
return conn.getInputStream();
} | class class_name[name] begin[{]
method[doPOST, return_type[type[InputStream]], modifier[public static], parameter[url, data, timeout]] begin[{]
local_variable[type[URLConnection], conn]
call[conn.setDoOutput, parameter[literal[true]]]
local_variable[type[OutputStreamWriter], wr]
call[wr.write, parameter[member[.data]]]
call[wr.flush, parameter[]]
return[call[conn.getInputStream, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InputStream] identifier[doPOST] operator[SEP] identifier[URL] identifier[url] , identifier[String] identifier[data] , Keyword[int] identifier[timeout] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[URLConnection] identifier[conn] operator[=] identifier[openURLConnection] operator[SEP] identifier[url] , identifier[timeout] operator[SEP] operator[SEP] identifier[conn] operator[SEP] identifier[setDoOutput] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[OutputStreamWriter] identifier[wr] operator[=] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[conn] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[wr] operator[SEP] identifier[write] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[wr] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[conn] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP]
}
|
public int getRunStart(int run)
{
verifyValidParaOrLine();
BidiLine.getRuns(this);
verifyRange(run, 0, runCount);
getLogicalToVisualRunsMap();
return runs[logicalToVisualRunsMap[run]].start;
} | class class_name[name] begin[{]
method[getRunStart, return_type[type[int]], modifier[public], parameter[run]] begin[{]
call[.verifyValidParaOrLine, parameter[]]
call[BidiLine.getRuns, parameter[THIS[]]]
call[.verifyRange, parameter[member[.run], literal[0], member[.runCount]]]
call[.getLogicalToVisualRunsMap, parameter[]]
return[member[.runs]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getRunStart] operator[SEP] Keyword[int] identifier[run] operator[SEP] {
identifier[verifyValidParaOrLine] operator[SEP] operator[SEP] operator[SEP] identifier[BidiLine] operator[SEP] identifier[getRuns] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[verifyRange] operator[SEP] identifier[run] , Other[0] , identifier[runCount] operator[SEP] operator[SEP] identifier[getLogicalToVisualRunsMap] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[runs] operator[SEP] identifier[logicalToVisualRunsMap] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] identifier[start] operator[SEP]
}
|
protected void initializeQueryHandler() throws RepositoryException, RepositoryConfigurationException
{
// initialize query handler
String className = config.getType();
if (className == null)
{
throw new RepositoryConfigurationException("Content hanler configuration fail");
}
try
{
Class<?> qHandlerClass = ClassLoading.forName(className, this);
try
{
// We first try a constructor with the workspace id
Constructor<?> constuctor =
qHandlerClass.getConstructor(String.class, QueryHandlerEntry.class, ConfigurationManager.class);
handler = (QueryHandler)constuctor.newInstance(wsContainerId, config, cfm);
}
catch (NoSuchMethodException e)
{
// No constructor with the workspace id can be found so we use the default constructor
Constructor<?> constuctor =
qHandlerClass.getConstructor(QueryHandlerEntry.class, ConfigurationManager.class);
handler = (QueryHandler)constuctor.newInstance(config, cfm);
}
QueryHandler parentHandler = (this.parentSearchManager != null) ? parentSearchManager.getHandler() : null;
QueryHandlerContext context = createQueryHandlerContext(parentHandler);
handler.setContext(context);
if (parentSearchManager != null)
{
changesFilter = initializeChangesFilter();
parentSearchManager.setChangesFilter(changesFilter);
}
}
catch (SecurityException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalArgumentException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (ClassNotFoundException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (NoSuchMethodException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InstantiationException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (IllegalAccessException e)
{
throw new RepositoryException(e.getMessage(), e);
}
catch (InvocationTargetException e)
{
throw new RepositoryException(e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[initializeQueryHandler, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[String], className]
if[binary_operation[member[.className], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Content hanler configuration fail")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RepositoryConfigurationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=ClassLoading, selectors=[], type_arguments=None), name=qHandlerClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QueryHandlerEntry, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigurationManager, sub_type=None))], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=qHandlerClass, selectors=[], type_arguments=None), name=constuctor)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Constructor, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=wsContainerId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cfm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=constuctor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=QueryHandler, sub_type=None))), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QueryHandlerEntry, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigurationManager, sub_type=None))], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=qHandlerClass, selectors=[], type_arguments=None), name=constuctor)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Constructor, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cfm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=constuctor, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=QueryHandler, sub_type=None))), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=parentSearchManager, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=getHandler, postfix_operators=[], prefix_operators=[], qualifier=parentSearchManager, selectors=[], type_arguments=None)), name=parentHandler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QueryHandler, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=parentHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createQueryHandlerContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=context)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QueryHandlerContext, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContext, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=parentSearchManager, 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=changesFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=initializeChangesFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=changesFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setChangesFilter, postfix_operators=[], prefix_operators=[], qualifier=parentSearchManager, 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstantiationException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException'])), 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=RepositoryException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[initializeQueryHandler] operator[SEP] operator[SEP] Keyword[throws] identifier[RepositoryException] , identifier[RepositoryConfigurationException] {
identifier[String] identifier[className] operator[=] identifier[config] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[className] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryConfigurationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Class] operator[<] operator[?] operator[>] identifier[qHandlerClass] operator[=] identifier[ClassLoading] operator[SEP] identifier[forName] operator[SEP] identifier[className] , Keyword[this] operator[SEP] operator[SEP] Keyword[try] {
identifier[Constructor] operator[<] operator[?] operator[>] identifier[constuctor] operator[=] identifier[qHandlerClass] operator[SEP] identifier[getConstructor] operator[SEP] identifier[String] operator[SEP] Keyword[class] , identifier[QueryHandlerEntry] operator[SEP] Keyword[class] , identifier[ConfigurationManager] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[handler] operator[=] operator[SEP] identifier[QueryHandler] operator[SEP] identifier[constuctor] operator[SEP] identifier[newInstance] operator[SEP] identifier[wsContainerId] , identifier[config] , identifier[cfm] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
identifier[Constructor] operator[<] operator[?] operator[>] identifier[constuctor] operator[=] identifier[qHandlerClass] operator[SEP] identifier[getConstructor] operator[SEP] identifier[QueryHandlerEntry] operator[SEP] Keyword[class] , identifier[ConfigurationManager] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[handler] operator[=] operator[SEP] identifier[QueryHandler] operator[SEP] identifier[constuctor] operator[SEP] identifier[newInstance] operator[SEP] identifier[config] , identifier[cfm] operator[SEP] operator[SEP]
}
identifier[QueryHandler] identifier[parentHandler] operator[=] operator[SEP] Keyword[this] operator[SEP] identifier[parentSearchManager] operator[!=] Other[null] operator[SEP] operator[?] identifier[parentSearchManager] operator[SEP] identifier[getHandler] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] identifier[QueryHandlerContext] identifier[context] operator[=] identifier[createQueryHandlerContext] operator[SEP] identifier[parentHandler] operator[SEP] operator[SEP] identifier[handler] operator[SEP] identifier[setContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parentSearchManager] operator[!=] Other[null] operator[SEP] {
identifier[changesFilter] operator[=] identifier[initializeChangesFilter] operator[SEP] operator[SEP] operator[SEP] identifier[parentSearchManager] operator[SEP] identifier[setChangesFilter] operator[SEP] identifier[changesFilter] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InstantiationException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void visitStringConstructor(GroovySourceAST t,int visit) {
if (visit == OPENING_VISIT) {
stringConstructorCounter = 0;
print(t,visit,"\"");
}
if (visit == SUBSEQUENT_VISIT) {
// every other subsequent visit use an escaping $
if (stringConstructorCounter % 2 == 0) {
print(t,visit,"$");
}
stringConstructorCounter++;
}
if (visit == CLOSING_VISIT) {
print(t,visit,"\"");
}
} | class class_name[name] begin[{]
method[visitStringConstructor, return_type[void], modifier[public], parameter[t, visit]] begin[{]
if[binary_operation[member[.visit], ==, member[.OPENING_VISIT]]] begin[{]
assign[member[.stringConstructorCounter], literal[0]]
call[.print, parameter[member[.t], member[.visit], literal["\""]]]
else begin[{]
None
end[}]
if[binary_operation[member[.visit], ==, member[.SUBSEQUENT_VISIT]]] begin[{]
if[binary_operation[binary_operation[member[.stringConstructorCounter], %, literal[2]], ==, literal[0]]] begin[{]
call[.print, parameter[member[.t], member[.visit], literal["$"]]]
else begin[{]
None
end[}]
member[.stringConstructorCounter]
else begin[{]
None
end[}]
if[binary_operation[member[.visit], ==, member[.CLOSING_VISIT]]] begin[{]
call[.print, parameter[member[.t], member[.visit], literal["\""]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[visitStringConstructor] operator[SEP] identifier[GroovySourceAST] identifier[t] , Keyword[int] identifier[visit] operator[SEP] {
Keyword[if] operator[SEP] identifier[visit] operator[==] identifier[OPENING_VISIT] operator[SEP] {
identifier[stringConstructorCounter] operator[=] Other[0] operator[SEP] identifier[print] operator[SEP] identifier[t] , identifier[visit] , literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[visit] operator[==] identifier[SUBSEQUENT_VISIT] operator[SEP] {
Keyword[if] operator[SEP] identifier[stringConstructorCounter] operator[%] Other[2] operator[==] Other[0] operator[SEP] {
identifier[print] operator[SEP] identifier[t] , identifier[visit] , literal[String] operator[SEP] operator[SEP]
}
identifier[stringConstructorCounter] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[visit] operator[==] identifier[CLOSING_VISIT] operator[SEP] {
identifier[print] operator[SEP] identifier[t] , identifier[visit] , literal[String] operator[SEP] operator[SEP]
}
}
|
public Response handle(
AuthleteApi api, AuthorizationRequestHandlerSpi spi,
MultivaluedMap<String, String> parameters)
{
try
{
// Create a handler.
AuthorizationRequestHandler handler = new AuthorizationRequestHandler(api, spi);
// Delegate the task to the handler.
return handler.handle(parameters);
}
catch (WebApplicationException e)
{
// An error occurred in the handler.
onError(e);
// Convert the error to a Response.
return e.getResponse();
}
} | class class_name[name] begin[{]
method[handle, return_type[type[Response]], modifier[public], parameter[api, spi, parameters]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=api, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=spi, 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=AuthorizationRequestHandler, sub_type=None)), name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AuthorizationRequestHandler, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=handler, 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=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=getResponse, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['WebApplicationException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Response] identifier[handle] operator[SEP] identifier[AuthleteApi] identifier[api] , identifier[AuthorizationRequestHandlerSpi] identifier[spi] , identifier[MultivaluedMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] operator[SEP] {
Keyword[try] {
identifier[AuthorizationRequestHandler] identifier[handler] operator[=] Keyword[new] identifier[AuthorizationRequestHandler] operator[SEP] identifier[api] , identifier[spi] operator[SEP] operator[SEP] Keyword[return] identifier[handler] operator[SEP] identifier[handle] operator[SEP] identifier[parameters] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[WebApplicationException] identifier[e] operator[SEP] {
identifier[onError] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public HardSoftScore calculateScore(CloudBalance cloudBalance) {
int hardScore = 0;
int softScore = 0;
for (CloudComputer computer : cloudBalance.getComputerList()) {
int cpuPowerUsage = 0;
int memoryUsage = 0;
int networkBandwidthUsage = 0;
boolean used = false;
// Calculate usage
for (CloudProcess process : cloudBalance.getProcessList()) {
if (computer.equals(process.getComputer())) {
cpuPowerUsage += process.getRequiredCpuPower();
memoryUsage += process.getRequiredMemory();
networkBandwidthUsage += process.getRequiredNetworkBandwidth();
used = true;
}
}
// Hard constraints
int cpuPowerAvailable = computer.getCpuPower() - cpuPowerUsage;
if (cpuPowerAvailable < 0) {
hardScore += cpuPowerAvailable;
}
int memoryAvailable = computer.getMemory() - memoryUsage;
if (memoryAvailable < 0) {
hardScore += memoryAvailable;
}
int networkBandwidthAvailable = computer.getNetworkBandwidth() - networkBandwidthUsage;
if (networkBandwidthAvailable < 0) {
hardScore += networkBandwidthAvailable;
}
// Soft constraints
if (used) {
softScore -= computer.getCost();
}
}
return HardSoftScore.of(hardScore, softScore);
} | class class_name[name] begin[{]
method[calculateScore, return_type[type[HardSoftScore]], modifier[public], parameter[cloudBalance]] begin[{]
local_variable[type[int], hardScore]
local_variable[type[int], softScore]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=cpuPowerUsage)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=memoryUsage)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=networkBandwidthUsage)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=used)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getComputer, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cpuPowerUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getRequiredCpuPower, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=memoryUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getRequiredMemory, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=networkBandwidthUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getRequiredNetworkBandwidth, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=used, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getProcessList, postfix_operators=[], prefix_operators=[], qualifier=cloudBalance, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=process)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CloudProcess, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCpuPower, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None), operandr=MemberReference(member=cpuPowerUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=cpuPowerAvailable)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cpuPowerAvailable, 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=hardScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=cpuPowerAvailable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMemory, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None), operandr=MemberReference(member=memoryUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=memoryAvailable)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=memoryAvailable, 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=hardScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=memoryAvailable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getNetworkBandwidth, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None), operandr=MemberReference(member=networkBandwidthUsage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=networkBandwidthAvailable)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=networkBandwidthAvailable, 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=hardScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=networkBandwidthAvailable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), IfStatement(condition=MemberReference(member=used, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=softScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=-=, value=MethodInvocation(arguments=[], member=getCost, postfix_operators=[], prefix_operators=[], qualifier=computer, selectors=[], type_arguments=None)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getComputerList, postfix_operators=[], prefix_operators=[], qualifier=cloudBalance, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=computer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CloudComputer, sub_type=None))), label=None)
return[call[HardSoftScore.of, parameter[member[.hardScore], member[.softScore]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[HardSoftScore] identifier[calculateScore] operator[SEP] identifier[CloudBalance] identifier[cloudBalance] operator[SEP] {
Keyword[int] identifier[hardScore] operator[=] Other[0] operator[SEP] Keyword[int] identifier[softScore] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[CloudComputer] identifier[computer] operator[:] identifier[cloudBalance] operator[SEP] identifier[getComputerList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[cpuPowerUsage] operator[=] Other[0] operator[SEP] Keyword[int] identifier[memoryUsage] operator[=] Other[0] operator[SEP] Keyword[int] identifier[networkBandwidthUsage] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[used] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[CloudProcess] identifier[process] operator[:] identifier[cloudBalance] operator[SEP] identifier[getProcessList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[computer] operator[SEP] identifier[equals] operator[SEP] identifier[process] operator[SEP] identifier[getComputer] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[cpuPowerUsage] operator[+=] identifier[process] operator[SEP] identifier[getRequiredCpuPower] operator[SEP] operator[SEP] operator[SEP] identifier[memoryUsage] operator[+=] identifier[process] operator[SEP] identifier[getRequiredMemory] operator[SEP] operator[SEP] operator[SEP] identifier[networkBandwidthUsage] operator[+=] identifier[process] operator[SEP] identifier[getRequiredNetworkBandwidth] operator[SEP] operator[SEP] operator[SEP] identifier[used] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[int] identifier[cpuPowerAvailable] operator[=] identifier[computer] operator[SEP] identifier[getCpuPower] operator[SEP] operator[SEP] operator[-] identifier[cpuPowerUsage] operator[SEP] Keyword[if] operator[SEP] identifier[cpuPowerAvailable] operator[<] Other[0] operator[SEP] {
identifier[hardScore] operator[+=] identifier[cpuPowerAvailable] operator[SEP]
}
Keyword[int] identifier[memoryAvailable] operator[=] identifier[computer] operator[SEP] identifier[getMemory] operator[SEP] operator[SEP] operator[-] identifier[memoryUsage] operator[SEP] Keyword[if] operator[SEP] identifier[memoryAvailable] operator[<] Other[0] operator[SEP] {
identifier[hardScore] operator[+=] identifier[memoryAvailable] operator[SEP]
}
Keyword[int] identifier[networkBandwidthAvailable] operator[=] identifier[computer] operator[SEP] identifier[getNetworkBandwidth] operator[SEP] operator[SEP] operator[-] identifier[networkBandwidthUsage] operator[SEP] Keyword[if] operator[SEP] identifier[networkBandwidthAvailable] operator[<] Other[0] operator[SEP] {
identifier[hardScore] operator[+=] identifier[networkBandwidthAvailable] operator[SEP]
}
Keyword[if] operator[SEP] identifier[used] operator[SEP] {
identifier[softScore] operator[-=] identifier[computer] operator[SEP] identifier[getCost] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[HardSoftScore] operator[SEP] identifier[of] operator[SEP] identifier[hardScore] , identifier[softScore] operator[SEP] operator[SEP]
}
|
public static void setValueOfModel(Object model, OpenEngSBModelEntry entry, Object value) throws
NoSuchFieldException,
IllegalArgumentException,
IllegalAccessException {
Class clazz = model.getClass();
Field field = clazz.getDeclaredField(entry.getKey());
field.setAccessible(true);
field.set(model, value);
} | class class_name[name] begin[{]
method[setValueOfModel, return_type[void], modifier[public static], parameter[model, entry, value]] begin[{]
local_variable[type[Class], clazz]
local_variable[type[Field], field]
call[field.setAccessible, parameter[literal[true]]]
call[field.set, parameter[member[.model], member[.value]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setValueOfModel] operator[SEP] identifier[Object] identifier[model] , identifier[OpenEngSBModelEntry] identifier[entry] , identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[NoSuchFieldException] , identifier[IllegalArgumentException] , identifier[IllegalAccessException] {
identifier[Class] identifier[clazz] operator[=] identifier[model] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[field] operator[=] identifier[clazz] operator[SEP] identifier[getDeclaredField] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[set] operator[SEP] identifier[model] , identifier[value] operator[SEP] operator[SEP]
}
|
public HashMap<String, Object> getFunctions(ClassModel classModel) {
HashMap<String, Object> result = newHashMap();
for (String name : functions.keySet()) {
result.put(name, new TemplateFunction(functions.get(name), classModel));
}
return result;
} | class class_name[name] begin[{]
method[getFunctions, return_type[type[HashMap]], modifier[public], parameter[classModel]] begin[{]
local_variable[type[HashMap], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=functions, selectors=[], type_arguments=None), MemberReference(member=classModel, 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=TemplateFunction, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=functions, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getFunctions] operator[SEP] identifier[ClassModel] identifier[classModel] operator[SEP] {
identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[result] operator[=] identifier[newHashMap] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[functions] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[name] , Keyword[new] identifier[TemplateFunction] operator[SEP] identifier[functions] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] , identifier[classModel] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public synchronized Message[] getByIds(final long start, final long end/* final Folder folder*/) {
checkExists();
final List<MockMessage> sms = new ArrayList<MockMessage>();
int num = 0;
MockMessage lastMsg = null;
for (final MockMessage mockMessage : new TreeSet<MockMessage>(messages.values())) {
lastMsg = mockMessage;
if (end == UIDFolder.LASTUID) {
if (getMessageCount() != 1 && mockMessage.getMockid() < start) { // TODO
// check?
continue;
}
} else {
if (mockMessage.getMockid() < start || mockMessage.getMockid() > end) {
continue;
}
}
mockMessage.setMessageNumber(++num);
// mockMessage.setFolder(folder);
sms.add(mockMessage);
}
if (end == UIDFolder.LASTUID && sms.size() == 0) {
lastMsg.setMessageNumber(++num);
// lastMsg.setFolder(folder);
sms.add(lastMsg);
}
logger.debug("getByIds(" + start + "," + end + " for " + getFullName() + " returns " + sms.size());
return sms.toArray(new Message[sms.size()]);
} | class class_name[name] begin[{]
method[getByIds, return_type[type[Message]], modifier[synchronized public], parameter[start, end]] begin[{]
call[.checkExists, parameter[]]
local_variable[type[List], sms]
local_variable[type[int], num]
local_variable[type[MockMessage], lastMsg]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=mockMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LASTUID, postfix_operators=[], prefix_operators=[], qualifier=UIDFolder, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMockid, postfix_operators=[], prefix_operators=[], qualifier=mockMessage, selectors=[], type_arguments=None), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMockid, postfix_operators=[], prefix_operators=[], qualifier=mockMessage, selectors=[], type_arguments=None), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMessageCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMockid, postfix_operators=[], prefix_operators=[], qualifier=mockMessage, selectors=[], type_arguments=None), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=num, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])], member=setMessageNumber, postfix_operators=[], prefix_operators=[], qualifier=mockMessage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mockMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=sms, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=ClassCreator(arguments=[MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=messages, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MockMessage, sub_type=None))], dimensions=None, name=TreeSet, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mockMessage)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=MockMessage, sub_type=None))), label=None)
if[binary_operation[binary_operation[member[.end], ==, member[UIDFolder.LASTUID]], &&, binary_operation[call[sms.size, parameter[]], ==, literal[0]]]] begin[{]
call[lastMsg.setMessageNumber, parameter[member[.num]]]
call[sms.add, parameter[member[.lastMsg]]]
else begin[{]
None
end[}]
call[logger.debug, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["getByIds("], +, member[.start]], +, literal[","]], +, member[.end]], +, literal[" for "]], +, call[.getFullName, parameter[]]], +, literal[" returns "]], +, call[sms.size, parameter[]]]]]
return[call[sms.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sms, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Message, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[Message] operator[SEP] operator[SEP] identifier[getByIds] operator[SEP] Keyword[final] Keyword[long] identifier[start] , Keyword[final] Keyword[long] identifier[end] operator[SEP] {
identifier[checkExists] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[MockMessage] operator[>] identifier[sms] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MockMessage] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[num] operator[=] Other[0] operator[SEP] identifier[MockMessage] identifier[lastMsg] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[MockMessage] identifier[mockMessage] operator[:] Keyword[new] identifier[TreeSet] operator[<] identifier[MockMessage] operator[>] operator[SEP] identifier[messages] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[lastMsg] operator[=] identifier[mockMessage] operator[SEP] Keyword[if] operator[SEP] identifier[end] operator[==] identifier[UIDFolder] operator[SEP] identifier[LASTUID] operator[SEP] {
Keyword[if] operator[SEP] identifier[getMessageCount] operator[SEP] operator[SEP] operator[!=] Other[1] operator[&&] identifier[mockMessage] operator[SEP] identifier[getMockid] operator[SEP] operator[SEP] operator[<] identifier[start] operator[SEP] {
Keyword[continue] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[mockMessage] operator[SEP] identifier[getMockid] operator[SEP] operator[SEP] operator[<] identifier[start] operator[||] identifier[mockMessage] operator[SEP] identifier[getMockid] operator[SEP] operator[SEP] operator[>] identifier[end] operator[SEP] {
Keyword[continue] operator[SEP]
}
}
identifier[mockMessage] operator[SEP] identifier[setMessageNumber] operator[SEP] operator[++] identifier[num] operator[SEP] operator[SEP] identifier[sms] operator[SEP] identifier[add] operator[SEP] identifier[mockMessage] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[end] operator[==] identifier[UIDFolder] operator[SEP] identifier[LASTUID] operator[&&] identifier[sms] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[lastMsg] operator[SEP] identifier[setMessageNumber] operator[SEP] operator[++] identifier[num] operator[SEP] operator[SEP] identifier[sms] operator[SEP] identifier[add] operator[SEP] identifier[lastMsg] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[start] operator[+] literal[String] operator[+] identifier[end] operator[+] literal[String] operator[+] identifier[getFullName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[sms] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[sms] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Message] operator[SEP] identifier[sms] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object value(final Field f, final Object bean) {
try {
f.setAccessible(true);
return f.get(bean);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new UroborosqlRuntimeException(e);
}
} | class class_name[name] begin[{]
method[value, return_type[type[Object]], modifier[public static], parameter[f, bean]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=bean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UroborosqlRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException', 'IllegalAccessException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[value] operator[SEP] Keyword[final] identifier[Field] identifier[f] , Keyword[final] identifier[Object] identifier[bean] operator[SEP] {
Keyword[try] {
identifier[f] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP] identifier[get] operator[SEP] identifier[bean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] operator[|] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UroborosqlRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static <E> E last(Iterator<E> iterator) {
return new LastElement<E>().apply(iterator);
} | class class_name[name] begin[{]
method[last, return_type[type[E]], modifier[public static], parameter[iterator]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=None, name=LastElement, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[E] identifier[last] operator[SEP] identifier[Iterator] operator[<] identifier[E] operator[>] identifier[iterator] operator[SEP] {
Keyword[return] Keyword[new] identifier[LastElement] operator[<] identifier[E] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[iterator] operator[SEP] operator[SEP]
}
|
public Map<String, CmsContainerBean> getParentContainers() {
if (m_parentContainers == null) {
initPageData();
}
return Collections.unmodifiableMap(m_parentContainers);
} | class class_name[name] begin[{]
method[getParentContainers, return_type[type[Map]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_parentContainers], ==, literal[null]]] begin[{]
call[.initPageData, parameter[]]
else begin[{]
None
end[}]
return[call[Collections.unmodifiableMap, parameter[member[.m_parentContainers]]]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[CmsContainerBean] operator[>] identifier[getParentContainers] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_parentContainers] operator[==] Other[null] operator[SEP] {
identifier[initPageData] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[m_parentContainers] operator[SEP] operator[SEP]
}
|
public static SshConnection getConnection(String host, int port, String proxy,
Authentication authentication) throws IOException {
return getConnection(host, port, proxy, authentication, null,
GerritDefaultValues.DEFAULT_GERRIT_SSH_CONNECTION_TIMEOUT);
} | class class_name[name] begin[{]
method[getConnection, return_type[type[SshConnection]], modifier[public static], parameter[host, port, proxy, authentication]] begin[{]
return[call[.getConnection, parameter[member[.host], member[.port], member[.proxy], member[.authentication], literal[null], member[GerritDefaultValues.DEFAULT_GERRIT_SSH_CONNECTION_TIMEOUT]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SshConnection] identifier[getConnection] operator[SEP] identifier[String] identifier[host] , Keyword[int] identifier[port] , identifier[String] identifier[proxy] , identifier[Authentication] identifier[authentication] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[getConnection] operator[SEP] identifier[host] , identifier[port] , identifier[proxy] , identifier[authentication] , Other[null] , identifier[GerritDefaultValues] operator[SEP] identifier[DEFAULT_GERRIT_SSH_CONNECTION_TIMEOUT] operator[SEP] operator[SEP]
}
|
public void setDouble(Double attrValue) {
if (attrValue != null) {
setString(attrValue.toString());
}
else {
setString(null);
}
} | class class_name[name] begin[{]
method[setDouble, return_type[void], modifier[public], parameter[attrValue]] begin[{]
if[binary_operation[member[.attrValue], !=, literal[null]]] begin[{]
call[.setString, parameter[call[attrValue.toString, parameter[]]]]
else begin[{]
call[.setString, parameter[literal[null]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setDouble] operator[SEP] identifier[Double] identifier[attrValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[attrValue] operator[!=] Other[null] operator[SEP] {
identifier[setString] operator[SEP] identifier[attrValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setString] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
|
@RequestMapping(value = "/api/plugins", method = RequestMethod.GET)
public
@ResponseBody
HashMap<String, Object> getPluginInformation() {
return pluginInformation();
} | class class_name[name] begin[{]
method[getPluginInformation, return_type[type[HashMap]], modifier[public], parameter[]] begin[{]
return[call[.pluginInformation, parameter[]]]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[GET] operator[SEP] Keyword[public] annotation[@] identifier[ResponseBody] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getPluginInformation] operator[SEP] operator[SEP] {
Keyword[return] identifier[pluginInformation] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean quotesRequired(final String csvColumn, final CsvContext context, final CsvPreference preference) {
return columnNumbers.contains(context.getColumnNumber());
} | class class_name[name] begin[{]
method[quotesRequired, return_type[type[boolean]], modifier[public], parameter[csvColumn, context, preference]] begin[{]
return[call[columnNumbers.contains, parameter[call[context.getColumnNumber, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[quotesRequired] operator[SEP] Keyword[final] identifier[String] identifier[csvColumn] , Keyword[final] identifier[CsvContext] identifier[context] , Keyword[final] identifier[CsvPreference] identifier[preference] operator[SEP] {
Keyword[return] identifier[columnNumbers] operator[SEP] identifier[contains] operator[SEP] identifier[context] operator[SEP] identifier[getColumnNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static base_response update(nitro_service client, cachepolicy resource) throws Exception {
cachepolicy updateresource = new cachepolicy();
updateresource.policyname = resource.policyname;
updateresource.rule = resource.rule;
updateresource.action = resource.action;
updateresource.storeingroup = resource.storeingroup;
updateresource.invalgroups = resource.invalgroups;
updateresource.invalobjects = resource.invalobjects;
updateresource.undefaction = resource.undefaction;
return updateresource.update_resource(client);
} | class class_name[name] begin[{]
method[update, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[cachepolicy], updateresource]
assign[member[updateresource.policyname], member[resource.policyname]]
assign[member[updateresource.rule], member[resource.rule]]
assign[member[updateresource.action], member[resource.action]]
assign[member[updateresource.storeingroup], member[resource.storeingroup]]
assign[member[updateresource.invalgroups], member[resource.invalgroups]]
assign[member[updateresource.invalobjects], member[resource.invalobjects]]
assign[member[updateresource.undefaction], member[resource.undefaction]]
return[call[updateresource.update_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[cachepolicy] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[cachepolicy] identifier[updateresource] operator[=] Keyword[new] identifier[cachepolicy] operator[SEP] operator[SEP] operator[SEP] identifier[updateresource] operator[SEP] identifier[policyname] operator[=] identifier[resource] operator[SEP] identifier[policyname] operator[SEP] identifier[updateresource] operator[SEP] identifier[rule] operator[=] identifier[resource] operator[SEP] identifier[rule] operator[SEP] identifier[updateresource] operator[SEP] identifier[action] operator[=] identifier[resource] operator[SEP] identifier[action] operator[SEP] identifier[updateresource] operator[SEP] identifier[storeingroup] operator[=] identifier[resource] operator[SEP] identifier[storeingroup] operator[SEP] identifier[updateresource] operator[SEP] identifier[invalgroups] operator[=] identifier[resource] operator[SEP] identifier[invalgroups] operator[SEP] identifier[updateresource] operator[SEP] identifier[invalobjects] operator[=] identifier[resource] operator[SEP] identifier[invalobjects] operator[SEP] identifier[updateresource] operator[SEP] identifier[undefaction] operator[=] identifier[resource] operator[SEP] identifier[undefaction] operator[SEP] Keyword[return] identifier[updateresource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final UIObject uiObject,
final Class<E> enumClass) {
for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {
final String cssClass = ((Style.HasCssName) constant).getCssName();
if (cssClass != null && !cssClass.isEmpty()) {
uiObject.removeStyleName(cssClass);
}
}
} | class class_name[name] begin[{]
method[removeEnumStyleNames, return_type[void], modifier[public static], parameter[uiObject, enumClass]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=constant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Style, sub_type=ReferenceType(arguments=None, dimensions=None, name=HasCssName, sub_type=None))), name=cssClass)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cssClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=cssClass, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cssClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeStyleName, postfix_operators=[], prefix_operators=[], qualifier=uiObject, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getEnumConstants, postfix_operators=[], prefix_operators=[], qualifier=enumClass, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=constant)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=Style, sub_type=ReferenceType(arguments=None, dimensions=None, name=HasCssName, sub_type=None)))], dimensions=[], name=Enum, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] Keyword[extends] identifier[Enum] operator[<] operator[?] Keyword[extends] identifier[Style] operator[SEP] identifier[HasCssName] operator[>] operator[>] Keyword[void] identifier[removeEnumStyleNames] operator[SEP] Keyword[final] identifier[UIObject] identifier[uiObject] , Keyword[final] identifier[Class] operator[<] identifier[E] operator[>] identifier[enumClass] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Enum] operator[<] operator[?] Keyword[extends] identifier[Style] operator[SEP] identifier[HasCssName] operator[>] identifier[constant] operator[:] identifier[enumClass] operator[SEP] identifier[getEnumConstants] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[cssClass] operator[=] operator[SEP] operator[SEP] identifier[Style] operator[SEP] identifier[HasCssName] operator[SEP] identifier[constant] operator[SEP] operator[SEP] identifier[getCssName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cssClass] operator[!=] Other[null] operator[&&] operator[!] identifier[cssClass] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[uiObject] operator[SEP] identifier[removeStyleName] operator[SEP] identifier[cssClass] operator[SEP] operator[SEP]
}
}
}
|
public static ClassResolver softCachingConcurrentResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new SoftReferenceMap<String, Class<?>>(
PlatformDependent.<String, Reference<Class<?>>>newConcurrentHashMap()));
} | class class_name[name] begin[{]
method[softCachingConcurrentResolver, return_type[type[ClassResolver]], modifier[public static], parameter[classLoader]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=defaultClassLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassLoaderClassResolver, sub_type=None)), ClassCreator(arguments=[MethodInvocation(arguments=[], member=PlatformDependent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=[], name=Reference, sub_type=None))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=None, name=SoftReferenceMap, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CachingClassResolver, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ClassResolver] identifier[softCachingConcurrentResolver] operator[SEP] identifier[ClassLoader] identifier[classLoader] operator[SEP] {
Keyword[return] Keyword[new] identifier[CachingClassResolver] operator[SEP] Keyword[new] identifier[ClassLoaderClassResolver] operator[SEP] identifier[defaultClassLoader] operator[SEP] identifier[classLoader] operator[SEP] operator[SEP] , Keyword[new] identifier[SoftReferenceMap] operator[<] identifier[String] , identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[SEP] identifier[PlatformDependent] operator[SEP] operator[<] identifier[String] , identifier[Reference] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[>] identifier[newConcurrentHashMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public EpisodeList getEpisodeList(String showID) throws TVRageException {
if (!isValidString(showID)) {
return new EpisodeList();
}
String tvrageURL = buildURL(API_EPISODE_LIST, showID).toString();
return TVRageParser.getEpisodeList(tvrageURL);
} | class class_name[name] begin[{]
method[getEpisodeList, return_type[type[EpisodeList]], modifier[public], parameter[showID]] begin[{]
if[call[.isValidString, parameter[member[.showID]]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EpisodeList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], tvrageURL]
return[call[TVRageParser.getEpisodeList, parameter[member[.tvrageURL]]]]
end[}]
END[}] | Keyword[public] identifier[EpisodeList] identifier[getEpisodeList] operator[SEP] identifier[String] identifier[showID] operator[SEP] Keyword[throws] identifier[TVRageException] {
Keyword[if] operator[SEP] operator[!] identifier[isValidString] operator[SEP] identifier[showID] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[EpisodeList] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[tvrageURL] operator[=] identifier[buildURL] operator[SEP] identifier[API_EPISODE_LIST] , identifier[showID] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[TVRageParser] operator[SEP] identifier[getEpisodeList] operator[SEP] identifier[tvrageURL] operator[SEP] operator[SEP]
}
|
private static String stripKey(final String key) {
int index = key.indexOf(".");
if (index > 0) {
return key.substring(0, index);
}
return null;
} | class class_name[name] begin[{]
method[stripKey, return_type[type[String]], modifier[private static], parameter[key]] begin[{]
local_variable[type[int], index]
if[binary_operation[member[.index], >, literal[0]]] begin[{]
return[call[key.substring, parameter[literal[0], member[.index]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[stripKey] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[key] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[key] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static boolean areEquals(final Class<?> firstClass,
final Class<?> secondClass) {
final boolean isFirstShort = firstClass.isAssignableFrom(Short.class);
final boolean isSecondShort = secondClass.isAssignableFrom(Short.class);
if (isFirstShort && isSecondShort
|| isFirstShort && secondClass.equals(short.class)
|| firstClass.equals(short.class) && isSecondShort)
return true;
final boolean isFirstByte = firstClass.isAssignableFrom(Byte.class);
final boolean isSecondByte = secondClass.isAssignableFrom(Byte.class);
if (isFirstByte && isSecondByte
|| isFirstByte && secondClass.equals(byte.class)
|| firstClass.equals(byte.class) && isSecondByte)
return true;
final boolean isFirstInt = firstClass.isAssignableFrom(Integer.class);
final boolean isSecondInt = secondClass.isAssignableFrom(Integer.class);
if (isFirstInt && isSecondInt
|| isFirstInt && secondClass.equals(int.class)
|| firstClass.equals(int.class) && isSecondInt)
return true;
final boolean isFirstLong = firstClass.isAssignableFrom(Long.class);
final boolean isSecondLong = secondClass.isAssignableFrom(Long.class);
if (isFirstLong && isSecondLong
|| isFirstLong && secondClass.equals(long.class)
|| firstClass.equals(long.class) && isSecondLong)
return true;
final boolean isFirstDouble = firstClass.isAssignableFrom(Double.class);
final boolean isSecondDouble = secondClass.isAssignableFrom(Double.class);
if (isFirstDouble && isSecondDouble
|| isFirstDouble && secondClass.equals(double.class)
|| firstClass.equals(double.class) && isSecondDouble)
return true;
final boolean isFirstFloat = firstClass.isAssignableFrom(Float.class);
final boolean isSecondFloat = secondClass.isAssignableFrom(Float.class);
if (isFirstFloat && isSecondFloat
|| isFirstFloat && secondClass.equals(float.class)
|| firstClass.equals(float.class) && isSecondFloat)
return true;
final boolean isFirstChar = firstClass.isAssignableFrom(Character.class);
final boolean isSecondChar = secondClass.isAssignableFrom(Character.class);
if (isFirstChar && isSecondChar
|| isFirstChar && secondClass.equals(char.class)
|| firstClass.equals(char.class) && isSecondChar)
return true;
final boolean isFirstBool = firstClass.isAssignableFrom(Boolean.class);
final boolean isSecondBool = secondClass.isAssignableFrom(Boolean.class);
if (isFirstBool && isSecondBool
|| isFirstChar && secondClass.equals(boolean.class)
|| firstClass.equals(boolean.class) && isSecondChar)
return true;
return firstClass.equals(secondClass);
} | class class_name[name] begin[{]
method[areEquals, return_type[type[boolean]], modifier[public static], parameter[firstClass, secondClass]] begin[{]
local_variable[type[boolean], isFirstShort]
local_variable[type[boolean], isSecondShort]
if[binary_operation[binary_operation[binary_operation[member[.isFirstShort], &&, member[.isSecondShort]], ||, binary_operation[member[.isFirstShort], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=short))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=short))]], &&, member[.isSecondShort]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstByte]
local_variable[type[boolean], isSecondByte]
if[binary_operation[binary_operation[binary_operation[member[.isFirstByte], &&, member[.isSecondByte]], ||, binary_operation[member[.isFirstByte], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=byte))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=byte))]], &&, member[.isSecondByte]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstInt]
local_variable[type[boolean], isSecondInt]
if[binary_operation[binary_operation[binary_operation[member[.isFirstInt], &&, member[.isSecondInt]], ||, binary_operation[member[.isFirstInt], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=int))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=int))]], &&, member[.isSecondInt]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstLong]
local_variable[type[boolean], isSecondLong]
if[binary_operation[binary_operation[binary_operation[member[.isFirstLong], &&, member[.isSecondLong]], ||, binary_operation[member[.isFirstLong], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=long))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=long))]], &&, member[.isSecondLong]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstDouble]
local_variable[type[boolean], isSecondDouble]
if[binary_operation[binary_operation[binary_operation[member[.isFirstDouble], &&, member[.isSecondDouble]], ||, binary_operation[member[.isFirstDouble], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=double))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=double))]], &&, member[.isSecondDouble]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstFloat]
local_variable[type[boolean], isSecondFloat]
if[binary_operation[binary_operation[binary_operation[member[.isFirstFloat], &&, member[.isSecondFloat]], ||, binary_operation[member[.isFirstFloat], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=float))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=float))]], &&, member[.isSecondFloat]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstChar]
local_variable[type[boolean], isSecondChar]
if[binary_operation[binary_operation[binary_operation[member[.isFirstChar], &&, member[.isSecondChar]], ||, binary_operation[member[.isFirstChar], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=char))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=char))]], &&, member[.isSecondChar]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[boolean], isFirstBool]
local_variable[type[boolean], isSecondBool]
if[binary_operation[binary_operation[binary_operation[member[.isFirstBool], &&, member[.isSecondBool]], ||, binary_operation[member[.isFirstChar], &&, call[secondClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=boolean))]]]], ||, binary_operation[call[firstClass.equals, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=boolean))]], &&, member[.isSecondChar]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[firstClass.equals, parameter[member[.secondClass]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[areEquals] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[firstClass] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[secondClass] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[isFirstShort] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Short] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondShort] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Short] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstShort] operator[&&] identifier[isSecondShort] operator[||] identifier[isFirstShort] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[short] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[short] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondShort] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstByte] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Byte] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondByte] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Byte] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstByte] operator[&&] identifier[isSecondByte] operator[||] identifier[isFirstByte] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[byte] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[byte] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondByte] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstInt] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondInt] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstInt] operator[&&] identifier[isSecondInt] operator[||] identifier[isFirstInt] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[int] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[int] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondInt] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstLong] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Long] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondLong] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Long] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstLong] operator[&&] identifier[isSecondLong] operator[||] identifier[isFirstLong] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[long] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[long] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondLong] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstDouble] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Double] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondDouble] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Double] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstDouble] operator[&&] identifier[isSecondDouble] operator[||] identifier[isFirstDouble] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[double] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[double] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondDouble] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstFloat] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Float] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondFloat] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Float] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstFloat] operator[&&] identifier[isSecondFloat] operator[||] identifier[isFirstFloat] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[float] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[float] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondFloat] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstChar] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Character] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondChar] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Character] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstChar] operator[&&] identifier[isSecondChar] operator[||] identifier[isFirstChar] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[char] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[char] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondChar] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[final] Keyword[boolean] identifier[isFirstBool] operator[=] identifier[firstClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isSecondBool] operator[=] identifier[secondClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFirstBool] operator[&&] identifier[isSecondBool] operator[||] identifier[isFirstChar] operator[&&] identifier[secondClass] operator[SEP] identifier[equals] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] operator[SEP] operator[||] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] operator[SEP] operator[&&] identifier[isSecondChar] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[firstClass] operator[SEP] identifier[equals] operator[SEP] identifier[secondClass] operator[SEP] operator[SEP]
}
|
public static String getPhrase(String name, String memberValue) {
String rslt = null;
// We can cut & run now if the element is a <literal>...
if (name.equals("literal")) {
return memberValue;
}
try {
// Next see if it's a <channel> element...
if (name.equals("channel")) {
IPortletDefinition def =
PortletDefinitionRegistryLocator.getPortletDefinitionRegistry()
.getPortletDefinitionByFname(memberValue);
return String.valueOf(def.getPortletDefinitionId().getStringId());
}
// Must be a group...
Class[] leafTypes = new Class[] {IPerson.class, IPortletDefinition.class};
for (int i = 0; i < leafTypes.length && rslt == null; i++) {
EntityIdentifier[] eis =
GroupService.searchForGroups(
memberValue, IGroupConstants.SearchMethod.DISCRETE, leafTypes[i]);
if (eis.length == 1) {
// Match!
IEntityGroup g = GroupService.findGroup(eis[0].getKey());
rslt = g.getLocalKey();
break;
} else if (eis.length > 1) {
String msg = "Ambiguous member name: " + memberValue;
throw new RuntimeException(msg);
}
}
} catch (Throwable t) {
String msg = "Error looking up the specified member: " + memberValue;
throw new RuntimeException(msg, t);
}
if (rslt == null) {
String msg = "The specified member was not found: " + memberValue;
throw new RuntimeException(msg);
}
return rslt;
} | class class_name[name] begin[{]
method[getPhrase, return_type[type[String]], modifier[public static], parameter[name, memberValue]] begin[{]
local_variable[type[String], rslt]
if[call[name.equals, parameter[literal["literal"]]]] begin[{]
return[member[.memberValue]]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="channel")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPortletDefinitionRegistry, postfix_operators=[], prefix_operators=[], qualifier=PortletDefinitionRegistryLocator, selectors=[MethodInvocation(arguments=[MemberReference(member=memberValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPortletDefinitionByFname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=def)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPortletDefinition, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPortletDefinitionId, postfix_operators=[], prefix_operators=[], qualifier=def, selectors=[MethodInvocation(arguments=[], member=getStringId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IPerson, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IPortletDefinition, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None)), name=leafTypes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Class, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=memberValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DISCRETE, postfix_operators=[], prefix_operators=[], qualifier=IGroupConstants.SearchMethod, selectors=[]), MemberReference(member=leafTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=searchForGroups, postfix_operators=[], prefix_operators=[], qualifier=GroupService, selectors=[], type_arguments=None), name=eis)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=EntityIdentifier, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=eis, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=eis, 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=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ambiguous member name: "), operandr=MemberReference(member=memberValue, 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=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=RuntimeException, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=eis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[], member=getKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=findGroup, postfix_operators=[], prefix_operators=[], qualifier=GroupService, selectors=[], type_arguments=None), name=g)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IEntityGroup, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rslt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLocalKey, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=leafTypes, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=rslt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), 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)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error looking up the specified member: "), operandr=MemberReference(member=memberValue, 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=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, 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=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.rslt], ==, literal[null]]] begin[{]
local_variable[type[String], msg]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.rslt]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getPhrase] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[memberValue] operator[SEP] {
identifier[String] identifier[rslt] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[memberValue] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[IPortletDefinition] identifier[def] operator[=] identifier[PortletDefinitionRegistryLocator] operator[SEP] identifier[getPortletDefinitionRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[getPortletDefinitionByFname] operator[SEP] identifier[memberValue] operator[SEP] operator[SEP] Keyword[return] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[def] operator[SEP] identifier[getPortletDefinitionId] operator[SEP] operator[SEP] operator[SEP] identifier[getStringId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Class] operator[SEP] operator[SEP] identifier[leafTypes] operator[=] Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[IPerson] operator[SEP] Keyword[class] , identifier[IPortletDefinition] operator[SEP] Keyword[class]
} operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[leafTypes] operator[SEP] identifier[length] operator[&&] identifier[rslt] operator[==] Other[null] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[EntityIdentifier] operator[SEP] operator[SEP] identifier[eis] operator[=] identifier[GroupService] operator[SEP] identifier[searchForGroups] operator[SEP] identifier[memberValue] , identifier[IGroupConstants] operator[SEP] identifier[SearchMethod] operator[SEP] identifier[DISCRETE] , identifier[leafTypes] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eis] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[IEntityGroup] identifier[g] operator[=] identifier[GroupService] operator[SEP] identifier[findGroup] operator[SEP] identifier[eis] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rslt] operator[=] identifier[g] operator[SEP] identifier[getLocalKey] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[eis] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[memberValue] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[memberValue] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[msg] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rslt] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[memberValue] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rslt] operator[SEP]
}
|
public void freeRemoteSession() throws RemoteException
{
try {
if (m_database.getTableCount() == 0)
m_database.free(); // Free if this is my private database, or there are no tables left
} catch (Exception ex) {
ex.printStackTrace();
}
super.freeRemoteSession();
} | class class_name[name] begin[{]
method[freeRemoteSession, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getTableCount, postfix_operators=[], prefix_operators=[], qualifier=m_database, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=free, postfix_operators=[], prefix_operators=[], qualifier=m_database, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
SuperMethodInvocation(arguments=[], member=freeRemoteSession, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[freeRemoteSession] operator[SEP] operator[SEP] Keyword[throws] identifier[RemoteException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[m_database] operator[SEP] identifier[getTableCount] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[m_database] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[freeRemoteSession] operator[SEP] operator[SEP] operator[SEP]
}
|
private void updateMovementVector() {
dirX = (float) Math.sin(Math.toRadians(ang));
dirY = (float) -Math.cos(Math.toRadians(ang));
} | class class_name[name] begin[{]
method[updateMovementVector, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.dirX], Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=ang, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toRadians, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=sin, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
assign[member[.dirY], Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=ang, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toRadians, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=cos, postfix_operators=[], prefix_operators=['-'], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateMovementVector] operator[SEP] operator[SEP] {
identifier[dirX] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[ang] operator[SEP] operator[SEP] operator[SEP] identifier[dirY] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[-] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] identifier[ang] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> T createModel(Class<T> clazz, boolean withPolicies) throws CreateModelException {
Erector erector = erectors.get(clazz);
if (erector == null) {
throw new CreateModelException("Unregistered class: " + clazz);
}
return createModel(erector, null, withPolicies);
} | class class_name[name] begin[{]
method[createModel, return_type[type[T]], modifier[public], parameter[clazz, withPolicies]] begin[{]
local_variable[type[Erector], erector]
if[binary_operation[member[.erector], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unregistered class: "), operandr=MemberReference(member=clazz, 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=CreateModelException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.createModel, parameter[member[.erector], literal[null], member[.withPolicies]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[createModel] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] , Keyword[boolean] identifier[withPolicies] operator[SEP] Keyword[throws] identifier[CreateModelException] {
identifier[Erector] identifier[erector] operator[=] identifier[erectors] operator[SEP] identifier[get] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[erector] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CreateModelException] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createModel] operator[SEP] identifier[erector] , Other[null] , identifier[withPolicies] operator[SEP] operator[SEP]
}
|
public void prettyLog(RedwoodChannels channels, String description) {
PrettyLogger.log(channels, description, this.asList());
} | class class_name[name] begin[{]
method[prettyLog, return_type[void], modifier[public], parameter[channels, description]] begin[{]
call[PrettyLogger.log, parameter[member[.channels], member[.description], THIS[call[None.asList, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[prettyLog] operator[SEP] identifier[RedwoodChannels] identifier[channels] , identifier[String] identifier[description] operator[SEP] {
identifier[PrettyLogger] operator[SEP] identifier[log] operator[SEP] identifier[channels] , identifier[description] , Keyword[this] operator[SEP] identifier[asList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void printPattern(int[] index, int offset) {
int size = index.length;
for (int i = 0; i < size; ++i)
format(Locale.ENGLISH, "%10d%n", index[i] + offset);
} | class class_name[name] begin[{]
method[printPattern, return_type[void], modifier[public], parameter[index, offset]] begin[{]
local_variable[type[int], size]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ENGLISH, postfix_operators=[], prefix_operators=[], qualifier=Locale, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%10d%n"), BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=format, 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=size, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printPattern] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[index] , Keyword[int] identifier[offset] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[index] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] operator[++] identifier[i] operator[SEP] identifier[format] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] , literal[String] , identifier[index] operator[SEP] identifier[i] operator[SEP] operator[+] identifier[offset] operator[SEP] operator[SEP]
}
|
private static final boolean isNameChar(char c) {
return c == '.' || c == '-' || c == '_' || c == ':' || isDigit(c) || isLetter(c) || isCombiningChar(c) || isExtender(c);
} | class class_name[name] begin[{]
method[isNameChar, return_type[type[boolean]], modifier[final private static], parameter[c]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.c], ==, literal['.']], ||, binary_operation[member[.c], ==, literal['-']]], ||, binary_operation[member[.c], ==, literal['_']]], ||, binary_operation[member[.c], ==, literal[':']]], ||, call[.isDigit, parameter[member[.c]]]], ||, call[.isLetter, parameter[member[.c]]]], ||, call[.isCombiningChar, parameter[member[.c]]]], ||, call[.isExtender, parameter[member[.c]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] Keyword[boolean] identifier[isNameChar] operator[SEP] Keyword[char] identifier[c] operator[SEP] {
Keyword[return] identifier[c] operator[==] literal[String] operator[||] identifier[c] operator[==] literal[String] operator[||] identifier[c] operator[==] literal[String] operator[||] identifier[c] operator[==] literal[String] operator[||] identifier[isDigit] operator[SEP] identifier[c] operator[SEP] operator[||] identifier[isLetter] operator[SEP] identifier[c] operator[SEP] operator[||] identifier[isCombiningChar] operator[SEP] identifier[c] operator[SEP] operator[||] identifier[isExtender] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
|
static Codec<NamingMessage> createRegistryCodec(final IdentifierFactory factory) {
final Map<Class<? extends NamingMessage>, Codec<? extends NamingMessage>> clazzToCodecMap
= new HashMap<>();
clazzToCodecMap.put(NamingRegisterRequest.class, new NamingRegisterRequestCodec(factory));
clazzToCodecMap.put(NamingRegisterResponse.class,
new NamingRegisterResponseCodec(new NamingRegisterRequestCodec(factory)));
clazzToCodecMap.put(NamingUnregisterRequest.class, new NamingUnregisterRequestCodec(factory));
final Codec<NamingMessage> codec = new MultiCodec<>(clazzToCodecMap);
return codec;
} | class class_name[name] begin[{]
method[createRegistryCodec, return_type[type[Codec]], modifier[static], parameter[factory]] begin[{]
local_variable[type[Map], clazzToCodecMap]
call[clazzToCodecMap.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamingRegisterRequest, sub_type=None)), ClassCreator(arguments=[MemberReference(member=factory, 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=NamingRegisterRequestCodec, sub_type=None))]]
call[clazzToCodecMap.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamingRegisterResponse, sub_type=None)), ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=factory, 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=NamingRegisterRequestCodec, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamingRegisterResponseCodec, sub_type=None))]]
call[clazzToCodecMap.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamingUnregisterRequest, sub_type=None)), ClassCreator(arguments=[MemberReference(member=factory, 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=NamingUnregisterRequestCodec, sub_type=None))]]
local_variable[type[Codec], codec]
return[member[.codec]]
end[}]
END[}] | Keyword[static] identifier[Codec] operator[<] identifier[NamingMessage] operator[>] identifier[createRegistryCodec] operator[SEP] Keyword[final] identifier[IdentifierFactory] identifier[factory] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[NamingMessage] operator[>] , identifier[Codec] operator[<] operator[?] Keyword[extends] identifier[NamingMessage] operator[>] operator[>] identifier[clazzToCodecMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[clazzToCodecMap] operator[SEP] identifier[put] operator[SEP] identifier[NamingRegisterRequest] operator[SEP] Keyword[class] , Keyword[new] identifier[NamingRegisterRequestCodec] operator[SEP] identifier[factory] operator[SEP] operator[SEP] operator[SEP] identifier[clazzToCodecMap] operator[SEP] identifier[put] operator[SEP] identifier[NamingRegisterResponse] operator[SEP] Keyword[class] , Keyword[new] identifier[NamingRegisterResponseCodec] operator[SEP] Keyword[new] identifier[NamingRegisterRequestCodec] operator[SEP] identifier[factory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[clazzToCodecMap] operator[SEP] identifier[put] operator[SEP] identifier[NamingUnregisterRequest] operator[SEP] Keyword[class] , Keyword[new] identifier[NamingUnregisterRequestCodec] operator[SEP] identifier[factory] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Codec] operator[<] identifier[NamingMessage] operator[>] identifier[codec] operator[=] Keyword[new] identifier[MultiCodec] operator[<] operator[>] operator[SEP] identifier[clazzToCodecMap] operator[SEP] operator[SEP] Keyword[return] identifier[codec] operator[SEP]
}
|
public static BigIntStringChecksum fromStringOrNull(String bics)
{
BigIntStringChecksum ret;
if (bics == null)
{
ret = null;
}
else if (! startsWithPrefix(bics))
{
ret = null;
}
else
{
try
{
ret = fromString(bics);
// completely test the input: make sure
// asBigInteger will throw a SecretShareException on error
if (ret.asBigInteger() == null)
{
// asBigInteger() is not allowed to return null.
// but just in case it does:
throw new SecretShareException("Programmer error converting '" +
bics + "' to BigInteger");
}
}
catch (SecretShareException e)
{
ret = null;
}
}
return ret;
} | class class_name[name] begin[{]
method[fromStringOrNull, return_type[type[BigIntStringChecksum]], modifier[public static], parameter[bics]] begin[{]
local_variable[type[BigIntStringChecksum], ret]
if[binary_operation[member[.bics], ==, literal[null]]] begin[{]
assign[member[.ret], literal[null]]
else begin[{]
if[call[.startsWithPrefix, parameter[member[.bics]]]] begin[{]
assign[member[.ret], literal[null]]
else begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=bics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=asBigInteger, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Programmer error converting '"), operandr=MemberReference(member=bics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' to BigInteger"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SecretShareException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecretShareException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigIntStringChecksum] identifier[fromStringOrNull] operator[SEP] identifier[String] identifier[bics] operator[SEP] {
identifier[BigIntStringChecksum] identifier[ret] operator[SEP] Keyword[if] operator[SEP] identifier[bics] operator[==] Other[null] operator[SEP] {
identifier[ret] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[startsWithPrefix] operator[SEP] identifier[bics] operator[SEP] operator[SEP] {
identifier[ret] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[ret] operator[=] identifier[fromString] operator[SEP] identifier[bics] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] operator[SEP] identifier[asBigInteger] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SecretShareException] operator[SEP] literal[String] operator[+] identifier[bics] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SecretShareException] identifier[e] operator[SEP] {
identifier[ret] operator[=] Other[null] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static void setMultifactorAuthenticationTrustedInScope(final RequestContext requestContext) {
val flashScope = requestContext.getFlashScope();
flashScope.put(AbstractMultifactorTrustedDeviceWebflowConfigurer.MFA_TRUSTED_AUTHN_SCOPE_ATTR, Boolean.TRUE);
} | class class_name[name] begin[{]
method[setMultifactorAuthenticationTrustedInScope, return_type[void], modifier[public static], parameter[requestContext]] begin[{]
local_variable[type[val], flashScope]
call[flashScope.put, parameter[member[AbstractMultifactorTrustedDeviceWebflowConfigurer.MFA_TRUSTED_AUTHN_SCOPE_ATTR], member[Boolean.TRUE]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setMultifactorAuthenticationTrustedInScope] operator[SEP] Keyword[final] identifier[RequestContext] identifier[requestContext] operator[SEP] {
identifier[val] identifier[flashScope] operator[=] identifier[requestContext] operator[SEP] identifier[getFlashScope] operator[SEP] operator[SEP] operator[SEP] identifier[flashScope] operator[SEP] identifier[put] operator[SEP] identifier[AbstractMultifactorTrustedDeviceWebflowConfigurer] operator[SEP] identifier[MFA_TRUSTED_AUTHN_SCOPE_ATTR] , identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] operator[SEP]
}
|
public Double distance3d(Position other) {
if (other == null || latitude == null || longitude == null || altitude == null)
return null;
double[] xyz1 = this.toECEF();
double[] xyz2 = other.toECEF();
return Math.sqrt(
Math.pow(xyz2[0] - xyz1[0], 2) +
Math.pow(xyz2[1] - xyz1[1], 2) +
Math.pow(xyz2[2] - xyz1[2], 2)
);
} | class class_name[name] begin[{]
method[distance3d, return_type[type[Double]], modifier[public], parameter[other]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.other], ==, literal[null]], ||, binary_operation[member[.latitude], ==, literal[null]]], ||, binary_operation[member[.longitude], ==, literal[null]]], ||, binary_operation[member[.altitude], ==, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[double], xyz1]
local_variable[type[double], xyz2]
return[call[Math.sqrt, parameter[binary_operation[binary_operation[call[Math.pow, parameter[binary_operation[member[.xyz2], -, member[.xyz1]], literal[2]]], +, call[Math.pow, parameter[binary_operation[member[.xyz2], -, member[.xyz1]], literal[2]]]], +, call[Math.pow, parameter[binary_operation[member[.xyz2], -, member[.xyz1]], literal[2]]]]]]]
end[}]
END[}] | Keyword[public] identifier[Double] identifier[distance3d] operator[SEP] identifier[Position] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[other] operator[==] Other[null] operator[||] identifier[latitude] operator[==] Other[null] operator[||] identifier[longitude] operator[==] Other[null] operator[||] identifier[altitude] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[xyz1] operator[=] Keyword[this] operator[SEP] identifier[toECEF] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[xyz2] operator[=] identifier[other] operator[SEP] identifier[toECEF] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[xyz2] operator[SEP] Other[0] operator[SEP] operator[-] identifier[xyz1] operator[SEP] Other[0] operator[SEP] , Other[2] operator[SEP] operator[+] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[xyz2] operator[SEP] Other[1] operator[SEP] operator[-] identifier[xyz1] operator[SEP] Other[1] operator[SEP] , Other[2] operator[SEP] operator[+] identifier[Math] operator[SEP] identifier[pow] operator[SEP] identifier[xyz2] operator[SEP] Other[2] operator[SEP] operator[-] identifier[xyz1] operator[SEP] Other[2] operator[SEP] , Other[2] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean isInheritedMapped(Class<?> classToCheck){
for (Class<?> clazz : getAllsuperClasses(classToCheck))
if(isMapped(clazz))return true;
return false;
} | class class_name[name] begin[{]
method[isInheritedMapped, return_type[type[boolean]], modifier[public], parameter[classToCheck]] begin[{]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isMapped, postfix_operators=[], prefix_operators=[], qualifier=, 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=[MemberReference(member=classToCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAllsuperClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=clazz)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isInheritedMapped] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[classToCheck] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[:] identifier[getAllsuperClasses] operator[SEP] identifier[classToCheck] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isMapped] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public MonetaryAmountFactory<T> setContext(MonetaryContext monetaryContext) {
Objects.requireNonNull(monetaryContext);
int maxScale = getMaximalMonetaryContext().getMaxScale();
if (maxScale != -1 && maxScale < monetaryContext.getMaxScale()) {
throw new MonetaryException(
"Context exceeds maximal capabilities (scale) of this type: " + monetaryContext);
}
int precision = getMaximalMonetaryContext().getPrecision();
if (precision != 0 && precision < monetaryContext.getPrecision()) {
throw new MonetaryException(
"Contexts exceeds maximal capabilities (precision) of this type: " + monetaryContext);
}
this.monetaryContext = monetaryContext;
return this;
} | class class_name[name] begin[{]
method[setContext, return_type[type[MonetaryAmountFactory]], modifier[public], parameter[monetaryContext]] begin[{]
call[Objects.requireNonNull, parameter[member[.monetaryContext]]]
local_variable[type[int], maxScale]
if[binary_operation[binary_operation[member[.maxScale], !=, literal[1]], &&, binary_operation[member[.maxScale], <, call[monetaryContext.getMaxScale, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Context exceeds maximal capabilities (scale) of this type: "), operandr=MemberReference(member=monetaryContext, 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=MonetaryException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], precision]
if[binary_operation[binary_operation[member[.precision], !=, literal[0]], &&, binary_operation[member[.precision], <, call[monetaryContext.getPrecision, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Contexts exceeds maximal capabilities (precision) of this type: "), operandr=MemberReference(member=monetaryContext, 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=MonetaryException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[THIS[member[None.monetaryContext]], member[.monetaryContext]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[MonetaryAmountFactory] operator[<] identifier[T] operator[>] identifier[setContext] operator[SEP] identifier[MonetaryContext] identifier[monetaryContext] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[monetaryContext] operator[SEP] operator[SEP] Keyword[int] identifier[maxScale] operator[=] identifier[getMaximalMonetaryContext] operator[SEP] operator[SEP] operator[SEP] identifier[getMaxScale] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxScale] operator[!=] operator[-] Other[1] operator[&&] identifier[maxScale] operator[<] identifier[monetaryContext] operator[SEP] identifier[getMaxScale] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MonetaryException] operator[SEP] literal[String] operator[+] identifier[monetaryContext] operator[SEP] operator[SEP]
}
Keyword[int] identifier[precision] operator[=] identifier[getMaximalMonetaryContext] operator[SEP] operator[SEP] operator[SEP] identifier[getPrecision] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[precision] operator[!=] Other[0] operator[&&] identifier[precision] operator[<] identifier[monetaryContext] operator[SEP] identifier[getPrecision] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MonetaryException] operator[SEP] literal[String] operator[+] identifier[monetaryContext] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[monetaryContext] operator[=] identifier[monetaryContext] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private String determineBaseEcosystem(String description) {
if (description == null) {
return null;
}
int idx = StringUtils.indexOfIgnoreCase(description, ".php");
if ((idx > 0 && (idx + 4 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 4))))
|| StringUtils.containsIgnoreCase(description, "wordpress")
|| StringUtils.containsIgnoreCase(description, "drupal")
|| StringUtils.containsIgnoreCase(description, "joomla")
|| StringUtils.containsIgnoreCase(description, "moodle")
|| StringUtils.containsIgnoreCase(description, "typo3")) {
return ComposerLockAnalyzer.DEPENDENCY_ECOSYSTEM;
}
if (StringUtils.containsIgnoreCase(description, " npm ")
|| StringUtils.containsIgnoreCase(description, " node.js")) {
return AbstractNpmAnalyzer.NPM_DEPENDENCY_ECOSYSTEM;
}
idx = StringUtils.indexOfIgnoreCase(description, ".pm");
if (idx > 0 && (idx + 3 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 3)))) {
return "perl";
} else {
idx = StringUtils.indexOfIgnoreCase(description, ".pl");
if (idx > 0 && (idx + 3 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 3)))) {
return "perl";
}
}
idx = StringUtils.indexOfIgnoreCase(description, ".java");
if (idx > 0 && (idx + 5 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 5)))) {
return JarAnalyzer.DEPENDENCY_ECOSYSTEM;
} else {
idx = StringUtils.indexOfIgnoreCase(description, ".jsp");
if (idx > 0 && (idx + 4 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 4)))) {
return JarAnalyzer.DEPENDENCY_ECOSYSTEM;
}
}
if (StringUtils.containsIgnoreCase(description, " grails ")) {
return JarAnalyzer.DEPENDENCY_ECOSYSTEM;
}
idx = StringUtils.indexOfIgnoreCase(description, ".rb");
if (idx > 0 && (idx + 3 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 3)))) {
return RubyBundleAuditAnalyzer.DEPENDENCY_ECOSYSTEM;
}
if (StringUtils.containsIgnoreCase(description, "ruby gem")) {
return RubyBundleAuditAnalyzer.DEPENDENCY_ECOSYSTEM;
}
idx = StringUtils.indexOfIgnoreCase(description, ".py");
if ((idx > 0 && (idx + 3 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 3))))
|| StringUtils.containsIgnoreCase(description, "django")) {
return PythonPackageAnalyzer.DEPENDENCY_ECOSYSTEM;
}
if (StringUtils.containsIgnoreCase(description, "buffer overflow")
&& !StringUtils.containsIgnoreCase(description, "android")) {
return CMakeAnalyzer.DEPENDENCY_ECOSYSTEM;
}
idx = StringUtils.indexOfIgnoreCase(description, ".c");
if (idx > 0 && (idx + 2 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 2)))) {
return CMakeAnalyzer.DEPENDENCY_ECOSYSTEM;
} else {
idx = StringUtils.indexOfIgnoreCase(description, ".cpp");
if (idx > 0 && (idx + 4 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 4)))) {
return CMakeAnalyzer.DEPENDENCY_ECOSYSTEM;
} else {
idx = StringUtils.indexOfIgnoreCase(description, ".h");
if (idx > 0 && (idx + 2 == description.length() || !Character.isLetterOrDigit(description.charAt(idx + 2)))) {
return CMakeAnalyzer.DEPENDENCY_ECOSYSTEM;
}
}
}
return null;
} | class class_name[name] begin[{]
method[determineBaseEcosystem, return_type[type[String]], modifier[private], parameter[description]] begin[{]
if[binary_operation[member[.description], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], idx]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[4]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[4]]]]]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["wordpress"]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["drupal"]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["joomla"]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["moodle"]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["typo3"]]]]] begin[{]
return[member[ComposerLockAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
if[binary_operation[call[StringUtils.containsIgnoreCase, parameter[member[.description], literal[" npm "]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal[" node.js"]]]]] begin[{]
return[member[AbstractNpmAnalyzer.NPM_DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".pm"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[3]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[3]]]]]]]]] begin[{]
return[literal["perl"]]
else begin[{]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".pl"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[3]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[3]]]]]]]]] begin[{]
return[literal["perl"]]
else begin[{]
None
end[}]
end[}]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".java"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[5]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[5]]]]]]]]] begin[{]
return[member[JarAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".jsp"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[4]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[4]]]]]]]]] begin[{]
return[member[JarAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
end[}]
if[call[StringUtils.containsIgnoreCase, parameter[member[.description], literal[" grails "]]]] begin[{]
return[member[JarAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".rb"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[3]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[3]]]]]]]]] begin[{]
return[member[RubyBundleAuditAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
if[call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["ruby gem"]]]] begin[{]
return[member[RubyBundleAuditAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".py"]]]]
if[binary_operation[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[3]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[3]]]]]]]], ||, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["django"]]]]] begin[{]
return[member[PythonPackageAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
if[binary_operation[call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["buffer overflow"]]], &&, call[StringUtils.containsIgnoreCase, parameter[member[.description], literal["android"]]]]] begin[{]
return[member[CMakeAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".c"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[2]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[2]]]]]]]]] begin[{]
return[member[CMakeAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".cpp"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[4]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[4]]]]]]]]] begin[{]
return[member[CMakeAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
assign[member[.idx], call[StringUtils.indexOfIgnoreCase, parameter[member[.description], literal[".h"]]]]
if[binary_operation[binary_operation[member[.idx], >, literal[0]], &&, binary_operation[binary_operation[binary_operation[member[.idx], +, literal[2]], ==, call[description.length, parameter[]]], ||, call[Character.isLetterOrDigit, parameter[call[description.charAt, parameter[binary_operation[member[.idx], +, literal[2]]]]]]]]] begin[{]
return[member[CMakeAnalyzer.DEPENDENCY_ECOSYSTEM]]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[determineBaseEcosystem] operator[SEP] identifier[String] identifier[description] operator[SEP] {
Keyword[if] operator[SEP] identifier[description] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[4] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[4] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[ComposerLockAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[AbstractNpmAnalyzer] operator[SEP] identifier[NPM_DEPENDENCY_ECOSYSTEM] operator[SEP]
}
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[3] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[3] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
}
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[5] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[5] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[JarAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[else] {
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[4] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[4] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[JarAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[JarAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[3] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[RubyBundleAuditAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[RubyBundleAuditAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[3] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[PythonPackageAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[&&] operator[!] identifier[StringUtils] operator[SEP] identifier[containsIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[CMakeAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[2] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[2] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[CMakeAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[else] {
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[4] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[4] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[CMakeAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
Keyword[else] {
identifier[idx] operator[=] identifier[StringUtils] operator[SEP] identifier[indexOfIgnoreCase] operator[SEP] identifier[description] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[&&] operator[SEP] identifier[idx] operator[+] Other[2] operator[==] identifier[description] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[description] operator[SEP] identifier[charAt] operator[SEP] identifier[idx] operator[+] Other[2] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[CMakeAnalyzer] operator[SEP] identifier[DEPENDENCY_ECOSYSTEM] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void freeRemoteSession() throws RemoteException
{
try {
Utility.getLogger().info("EJB Free" + ((this.getMainRecord() != null) ? this.getMainRecord().getTable() : ""));
if (this.getMainRecord() != null)
this.getMainRecord().free();
this.free();
} catch (Exception ex) {
Debug.print(ex, TableSession.class.getName());
}
} | class class_name[name] begin[{]
method[freeRemoteSession, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=Utility, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="EJB Free"), operandr=TernaryExpression(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getMainRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getMainRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTable, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), operator=+)], member=info, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getMainRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getMainRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=free, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=free, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=TableSession, sub_type=None))], member=print, postfix_operators=[], prefix_operators=[], qualifier=Debug, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[freeRemoteSession] operator[SEP] operator[SEP] Keyword[throws] identifier[RemoteException] {
Keyword[try] {
identifier[Utility] operator[SEP] identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[?] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[SEP] identifier[getTable] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[getMainRecord] operator[SEP] operator[SEP] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[Debug] operator[SEP] identifier[print] operator[SEP] identifier[ex] , identifier[TableSession] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected void closeFile() {
if (this.qw != null) {
try {
this.qw.close();
}
catch (java.io.IOException e) {
// Exceptionally, it does not make sense to delegate to an
// ErrorHandler. Since a closed appender is basically dead.
LogLog.error("Could not close " + qw, e);
}
}
} | class class_name[name] begin[{]
method[closeFile, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[THIS[member[None.qw]], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=qw, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not close "), operandr=MemberReference(member=qw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LogLog, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['java.io.IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[closeFile] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[qw] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[qw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LogLog] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[qw] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
private List< Dashboard > findExistingDashboardsFromRequest( DashboardRemoteRequest request ) {
String businessService = request.getMetaData().getBusinessService();
String businessApplication = request.getMetaData().getBusinessApplication();
if( !StringUtils.isEmpty( businessService ) && !StringUtils.isEmpty( businessApplication ) ){
return dashboardRepository.findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase( businessService, businessApplication );
}else {
return dashboardRepository.findByTitle( request.getMetaData().getTitle() );
}
} | class class_name[name] begin[{]
method[findExistingDashboardsFromRequest, return_type[type[List]], modifier[private], parameter[request]] begin[{]
local_variable[type[String], businessService]
local_variable[type[String], businessApplication]
if[binary_operation[call[StringUtils.isEmpty, parameter[member[.businessService]]], &&, call[StringUtils.isEmpty, parameter[member[.businessApplication]]]]] begin[{]
return[call[dashboardRepository.findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase, parameter[member[.businessService], member[.businessApplication]]]]
else begin[{]
return[call[dashboardRepository.findByTitle, parameter[call[request.getMetaData, parameter[]]]]]
end[}]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Dashboard] operator[>] identifier[findExistingDashboardsFromRequest] operator[SEP] identifier[DashboardRemoteRequest] identifier[request] operator[SEP] {
identifier[String] identifier[businessService] operator[=] identifier[request] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] identifier[getBusinessService] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[businessApplication] operator[=] identifier[request] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] identifier[getBusinessApplication] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[businessService] operator[SEP] operator[&&] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[businessApplication] operator[SEP] operator[SEP] {
Keyword[return] identifier[dashboardRepository] operator[SEP] identifier[findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase] operator[SEP] identifier[businessService] , identifier[businessApplication] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[dashboardRepository] operator[SEP] identifier[findByTitle] operator[SEP] identifier[request] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private RegisterDocumentResponse registerDocument(RegisterDocumentRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, DOC);
internalRequest.addParameter("register", null);
String strJson = JsonUtils.toJsonString(request);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
return invokeHttpClient(internalRequest, RegisterDocumentResponse.class);
} | class class_name[name] begin[{]
method[registerDocument, return_type[type[RegisterDocumentResponse]], modifier[private], parameter[request]] begin[{]
call[.checkNotNull, parameter[member[.request], literal["The parameter request should NOT be null."]]]
local_variable[type[InternalRequest], internalRequest]
call[internalRequest.addParameter, parameter[literal["register"], literal[null]]]
local_variable[type[String], strJson]
local_variable[type[byte], requestJson]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=requestJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=DEFAULT_ENCODING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=strJson, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported encode."), 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=BceClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
call[internalRequest.addHeader, parameter[member[Headers.CONTENT_LENGTH], call[String.valueOf, parameter[member[requestJson.length]]]]]
call[internalRequest.addHeader, parameter[member[Headers.CONTENT_TYPE], member[.DEFAULT_CONTENT_TYPE]]]
call[internalRequest.setContent, parameter[call[RestartableInputStream.wrap, parameter[member[.requestJson]]]]]
return[call[.invokeHttpClient, parameter[member[.internalRequest], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RegisterDocumentResponse, sub_type=None))]]]
end[}]
END[}] | Keyword[private] identifier[RegisterDocumentResponse] identifier[registerDocument] operator[SEP] identifier[RegisterDocumentRequest] identifier[request] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] identifier[InternalRequest] identifier[internalRequest] operator[=] identifier[createRequest] operator[SEP] identifier[HttpMethodName] operator[SEP] identifier[POST] , identifier[request] , identifier[DOC] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] identifier[String] identifier[strJson] operator[=] identifier[JsonUtils] operator[SEP] identifier[toJsonString] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[requestJson] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[requestJson] operator[=] identifier[strJson] operator[SEP] identifier[getBytes] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BceClientException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_LENGTH] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[requestJson] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_TYPE] , identifier[DEFAULT_CONTENT_TYPE] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[setContent] operator[SEP] identifier[RestartableInputStream] operator[SEP] identifier[wrap] operator[SEP] identifier[requestJson] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[invokeHttpClient] operator[SEP] identifier[internalRequest] , identifier[RegisterDocumentResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
@Override
protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws NoSuchBeanDefinitionException, NoUniqueBeanDefinitionException
{
// 如果未指定groupTemplate,取上下文中唯一的GroupTemplate对象
if (groupTemplate == null)
{
groupTemplate = getApplicationContext().getBean(GroupTemplate.class);
}
// 渲染方法
WebRender render = new WebRender(groupTemplate) {
@Override
protected void modifyTemplate(Template template, String key, HttpServletRequest request,
HttpServletResponse response, Object... args)
{
Map<?, ?> model = (Map<?, ?>) args[0];
for (Entry<?, ?> entry : model.entrySet())
{
String name = (String) entry.getKey();
Object value = entry.getValue();
template.binding(name, value);
}
}
};
String path = getUrl();
render.render(path, request, response, model);
} | class class_name[name] begin[{]
method[renderMergedTemplateModel, return_type[void], modifier[protected], parameter[model, request, response]] begin[{]
if[binary_operation[member[.groupTemplate], ==, literal[null]]] begin[{]
assign[member[.groupTemplate], call[.getApplicationContext, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[WebRender], render]
local_variable[type[String], path]
call[render.render, parameter[member[.path], member[.request], member[.response], member[.model]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[renderMergedTemplateModel] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[model] , identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[NoSuchBeanDefinitionException] , identifier[NoUniqueBeanDefinitionException] {
Keyword[if] operator[SEP] identifier[groupTemplate] operator[==] Other[null] operator[SEP] {
identifier[groupTemplate] operator[=] identifier[getApplicationContext] operator[SEP] operator[SEP] operator[SEP] identifier[getBean] operator[SEP] identifier[GroupTemplate] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
identifier[WebRender] identifier[render] operator[=] Keyword[new] identifier[WebRender] operator[SEP] identifier[groupTemplate] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[modifyTemplate] operator[SEP] identifier[Template] identifier[template] , identifier[String] identifier[key] , identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[Map] operator[<] operator[?] , operator[?] operator[>] identifier[model] operator[=] operator[SEP] identifier[Map] operator[<] operator[?] , operator[?] operator[>] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] operator[?] , operator[?] operator[>] identifier[entry] operator[:] identifier[model] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[name] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[value] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[template] operator[SEP] identifier[binding] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
}
} operator[SEP] identifier[String] identifier[path] operator[=] identifier[getUrl] operator[SEP] operator[SEP] operator[SEP] identifier[render] operator[SEP] identifier[render] operator[SEP] identifier[path] , identifier[request] , identifier[response] , identifier[model] operator[SEP] operator[SEP]
}
|
private void putImpl(RowCursor cursor,
BackupKelp backupCallback,
PutType putType,
Result<Boolean> result)
{
RowCursor workCursor = _table.cursor();
// update version in case of foreign clock skew
_lastVersion = Math.max(_lastVersion, cursor.getVersion());
// int leafPid;
int leafPid = getTree(cursor, _rootPid);
if (leafPid <= 0) {
throw new IllegalStateException("Missing leaf for " + String.valueOf(cursor) + " " + _rootPid);
}
PageLeafImpl leaf = loadLeafForUpdate(leafPid);
if (leaf.compareTo(cursor) != 0) {
// repair parent tree
// If an updated split leaf is saved but the updated parent tree is not,
// the loaded database needs to repair the parent tree.
// System.out.println("REPAIR PARENT TREE: " + cursor);
leaf = getLeafByCursor(cursor);
if (leaf == null) {
throw new IllegalStateException("Cursor " + cursor + " is not in leaf " + leaf
+ " parent " + getTreeParent(cursor.getKey(),
_rootPid,
leafPid));
}
}
PageLeafImpl newLeaf = leaf.put(_table, this, cursor, workCursor,
backupCallback, putType,
result);
if (newLeaf == null) {
//cursor.freeBlobs();
return;
}
if (leaf != newLeaf) {
if (! compareAndSetLeaf(leaf, newLeaf)) {
throw new IllegalStateException("Leaf unable to compact " + leaf + " " + newLeaf);
}
PageLeafStub stub = (PageLeafStub) leaf.getStub();
if (stub != null) {
stub.copyToCompact(newLeaf);
}
}
if (_table.getMaxNodeLength() < newLeaf.size()) {
int parentPid = getTreeParent(cursor.getKey(), _rootPid, newLeaf.getId());
splitPage(parentPid, newLeaf.getId());
}
//notifyOnPut(cursor, putType);
//cursor.freeBlobs();
} | class class_name[name] begin[{]
method[putImpl, return_type[void], modifier[private], parameter[cursor, backupCallback, putType, result]] begin[{]
local_variable[type[RowCursor], workCursor]
assign[member[._lastVersion], call[Math.max, parameter[member[._lastVersion], call[cursor.getVersion, parameter[]]]]]
local_variable[type[int], leafPid]
if[binary_operation[member[.leafPid], <=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing leaf for "), operandr=MethodInvocation(arguments=[MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=_rootPid, 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=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[PageLeafImpl], leaf]
if[binary_operation[call[leaf.compareTo, parameter[member[.cursor]]], !=, literal[0]]] begin[{]
assign[member[.leaf], call[.getLeafByCursor, parameter[member[.cursor]]]]
if[binary_operation[member[.leaf], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cursor "), operandr=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is not in leaf "), operator=+), operandr=MemberReference(member=leaf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" parent "), operator=+), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=cursor, selectors=[], type_arguments=None), MemberReference(member=_rootPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=leafPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTreeParent, postfix_operators=[], prefix_operators=[], qualifier=, 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=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[PageLeafImpl], newLeaf]
if[binary_operation[member[.newLeaf], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.leaf], !=, member[.newLeaf]]] begin[{]
if[call[.compareAndSetLeaf, parameter[member[.leaf], member[.newLeaf]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Leaf unable to compact "), operandr=MemberReference(member=leaf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=newLeaf, 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=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[PageLeafStub], stub]
if[binary_operation[member[.stub], !=, literal[null]]] begin[{]
call[stub.copyToCompact, parameter[member[.newLeaf]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[_table.getMaxNodeLength, parameter[]], <, call[newLeaf.size, parameter[]]]] begin[{]
local_variable[type[int], parentPid]
call[.splitPage, parameter[member[.parentPid], call[newLeaf.getId, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[putImpl] operator[SEP] identifier[RowCursor] identifier[cursor] , identifier[BackupKelp] identifier[backupCallback] , identifier[PutType] identifier[putType] , identifier[Result] operator[<] identifier[Boolean] operator[>] identifier[result] operator[SEP] {
identifier[RowCursor] identifier[workCursor] operator[=] identifier[_table] operator[SEP] identifier[cursor] operator[SEP] operator[SEP] operator[SEP] identifier[_lastVersion] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[_lastVersion] , identifier[cursor] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[leafPid] operator[=] identifier[getTree] operator[SEP] identifier[cursor] , identifier[_rootPid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leafPid] operator[<=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[cursor] operator[SEP] operator[+] literal[String] operator[+] identifier[_rootPid] operator[SEP] operator[SEP]
}
identifier[PageLeafImpl] identifier[leaf] operator[=] identifier[loadLeafForUpdate] operator[SEP] identifier[leafPid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leaf] operator[SEP] identifier[compareTo] operator[SEP] identifier[cursor] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[leaf] operator[=] identifier[getLeafByCursor] operator[SEP] identifier[cursor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leaf] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[cursor] operator[+] literal[String] operator[+] identifier[leaf] operator[+] literal[String] operator[+] identifier[getTreeParent] operator[SEP] identifier[cursor] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[_rootPid] , identifier[leafPid] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[PageLeafImpl] identifier[newLeaf] operator[=] identifier[leaf] operator[SEP] identifier[put] operator[SEP] identifier[_table] , Keyword[this] , identifier[cursor] , identifier[workCursor] , identifier[backupCallback] , identifier[putType] , identifier[result] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newLeaf] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[leaf] operator[!=] identifier[newLeaf] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[compareAndSetLeaf] operator[SEP] identifier[leaf] , identifier[newLeaf] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[leaf] operator[+] literal[String] operator[+] identifier[newLeaf] operator[SEP] operator[SEP]
}
identifier[PageLeafStub] identifier[stub] operator[=] operator[SEP] identifier[PageLeafStub] operator[SEP] identifier[leaf] operator[SEP] identifier[getStub] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stub] operator[!=] Other[null] operator[SEP] {
identifier[stub] operator[SEP] identifier[copyToCompact] operator[SEP] identifier[newLeaf] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[_table] operator[SEP] identifier[getMaxNodeLength] operator[SEP] operator[SEP] operator[<] identifier[newLeaf] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[parentPid] operator[=] identifier[getTreeParent] operator[SEP] identifier[cursor] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[_rootPid] , identifier[newLeaf] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[splitPage] operator[SEP] identifier[parentPid] , identifier[newLeaf] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public ElemAttributeSet getAttributeSet(int i)
throws ArrayIndexOutOfBoundsException
{
if (null == m_attributeSets)
throw new ArrayIndexOutOfBoundsException();
return (ElemAttributeSet) m_attributeSets.elementAt(i);
} | class class_name[name] begin[{]
method[getAttributeSet, return_type[type[ElemAttributeSet]], modifier[public], parameter[i]] begin[{]
if[binary_operation[literal[null], ==, member[.m_attributeSets]]] 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=ArrayIndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=m_attributeSets, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ElemAttributeSet, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ElemAttributeSet] identifier[getAttributeSet] operator[SEP] Keyword[int] identifier[i] operator[SEP] Keyword[throws] identifier[ArrayIndexOutOfBoundsException] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[m_attributeSets] operator[SEP] Keyword[throw] Keyword[new] identifier[ArrayIndexOutOfBoundsException] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[ElemAttributeSet] operator[SEP] identifier[m_attributeSets] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
|
@BackpressureSupport(BackpressureKind.SPECIAL)
@SchedulerSupport(SchedulerSupport.NONE)
public final void blockingSubscribe(Subscriber<? super T> subscriber) {
FlowableBlockingSubscribe.subscribe(this, subscriber);
} | class class_name[name] begin[{]
method[blockingSubscribe, return_type[void], modifier[final public], parameter[subscriber]] begin[{]
call[FlowableBlockingSubscribe.subscribe, parameter[THIS[], member[.subscriber]]]
end[}]
END[}] | annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[SPECIAL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] Keyword[void] identifier[blockingSubscribe] operator[SEP] identifier[Subscriber] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[subscriber] operator[SEP] {
identifier[FlowableBlockingSubscribe] operator[SEP] identifier[subscribe] operator[SEP] Keyword[this] , identifier[subscriber] operator[SEP] operator[SEP]
}
|
@Override
public SerIterable createIterable(final String metaTypeDescription, final JodaBeanSer settings, final Map<String, Class<?>> knownTypes) {
if (metaTypeDescription.equals("Grid")) {
return grid(Object.class, EMPTY_VALUE_TYPES);
}
return super.createIterable(metaTypeDescription, settings, knownTypes);
} | class class_name[name] begin[{]
method[createIterable, return_type[type[SerIterable]], modifier[public], parameter[metaTypeDescription, settings, knownTypes]] begin[{]
if[call[metaTypeDescription.equals, parameter[literal["Grid"]]]] begin[{]
return[call[.grid, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), member[.EMPTY_VALUE_TYPES]]]]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[MemberReference(member=metaTypeDescription, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=settings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=knownTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createIterable, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SerIterable] identifier[createIterable] operator[SEP] Keyword[final] identifier[String] identifier[metaTypeDescription] , Keyword[final] identifier[JodaBeanSer] identifier[settings] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[knownTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[metaTypeDescription] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[grid] operator[SEP] identifier[Object] operator[SEP] Keyword[class] , identifier[EMPTY_VALUE_TYPES] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[createIterable] operator[SEP] identifier[metaTypeDescription] , identifier[settings] , identifier[knownTypes] operator[SEP] operator[SEP]
}
|
public ChronoElement<Integer> yearOfEra(YearDefinition yearDefinition) {
switch (yearDefinition) {
case DUAL_DATING:
return this.yearOfEraElement;
case AFTER_NEW_YEAR:
return this.yearAfterElement;
case BEFORE_NEW_YEAR:
return this.yearBeforeElement;
default:
throw new UnsupportedOperationException(yearDefinition.name());
}
} | class class_name[name] begin[{]
method[yearOfEra, return_type[type[ChronoElement]], modifier[public], parameter[yearDefinition]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['DUAL_DATING'], statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=yearOfEraElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)]), SwitchStatementCase(case=['AFTER_NEW_YEAR'], statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=yearAfterElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)]), SwitchStatementCase(case=['BEFORE_NEW_YEAR'], statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=yearBeforeElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=yearDefinition, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)])], expression=MemberReference(member=yearDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] identifier[ChronoElement] operator[<] identifier[Integer] operator[>] identifier[yearOfEra] operator[SEP] identifier[YearDefinition] identifier[yearDefinition] operator[SEP] {
Keyword[switch] operator[SEP] identifier[yearDefinition] operator[SEP] {
Keyword[case] identifier[DUAL_DATING] operator[:] Keyword[return] Keyword[this] operator[SEP] identifier[yearOfEraElement] operator[SEP] Keyword[case] identifier[AFTER_NEW_YEAR] operator[:] Keyword[return] Keyword[this] operator[SEP] identifier[yearAfterElement] operator[SEP] Keyword[case] identifier[BEFORE_NEW_YEAR] operator[:] Keyword[return] Keyword[this] operator[SEP] identifier[yearBeforeElement] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] identifier[yearDefinition] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Observable<OperationStatus> updateHierarchicalEntityAsync(UUID appId, String versionId, UUID hEntityId, HierarchicalEntityModel hierarchicalModelUpdateObject) {
return updateHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId, hierarchicalModelUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[updateHierarchicalEntityAsync, return_type[type[Observable]], modifier[public], parameter[appId, versionId, hEntityId, hierarchicalModelUpdateObject]] begin[{]
return[call[.updateHierarchicalEntityWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.hEntityId], member[.hierarchicalModelUpdateObject]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[OperationStatus] operator[>] identifier[updateHierarchicalEntityAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[UUID] identifier[hEntityId] , identifier[HierarchicalEntityModel] identifier[hierarchicalModelUpdateObject] operator[SEP] {
Keyword[return] identifier[updateHierarchicalEntityWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[hEntityId] , identifier[hierarchicalModelUpdateObject] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[OperationStatus] operator[>] , identifier[OperationStatus] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[OperationStatus] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[OperationStatus] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
String getOutputStringForChar(char value)
{
// CharKey m_charKey = new CharKey(); //Alternative to synchronized
m_charKey.setChar(value);
return (String) m_charToString.get(m_charKey);
} | class class_name[name] begin[{]
method[getOutputStringForChar, return_type[type[String]], modifier[default], parameter[value]] begin[{]
call[m_charKey.setChar, parameter[member[.value]]]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=m_charKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=m_charToString, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
end[}]
END[}] | identifier[String] identifier[getOutputStringForChar] operator[SEP] Keyword[char] identifier[value] operator[SEP] {
identifier[m_charKey] operator[SEP] identifier[setChar] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[String] operator[SEP] identifier[m_charToString] operator[SEP] identifier[get] operator[SEP] identifier[m_charKey] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public boolean remove(final Object key) {
// validate key
if (key == null) {
throw new IllegalArgumentException("Null element is not supported.");
}
LinkedElement<T> removed = removeElem((T) key);
shrinkIfNecessary();
return removed == null ? false : true;
} | class class_name[name] begin[{]
method[remove, return_type[type[boolean]], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.key], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null element is not supported.")], 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[LinkedElement], removed]
call[.shrinkIfNecessary, parameter[]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=removed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[boolean] identifier[remove] operator[SEP] Keyword[final] identifier[Object] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[LinkedElement] operator[<] identifier[T] operator[>] identifier[removed] operator[=] identifier[removeElem] operator[SEP] operator[SEP] identifier[T] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[shrinkIfNecessary] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[removed] operator[==] Other[null] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public EList<IfcRoot> getRelatedObjects() {
return (EList<IfcRoot>) eGet(Ifc2x3tc1Package.Literals.IFC_REL_ASSOCIATES__RELATED_OBJECTS, true);
} | class class_name[name] begin[{]
method[getRelatedObjects, return_type[type[EList]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=IFC_REL_ASSOCIATES__RELATED_OBJECTS, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package.Literals, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IfcRoot, sub_type=None))], dimensions=[], name=EList, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[EList] operator[<] identifier[IfcRoot] operator[>] identifier[getRelatedObjects] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[EList] operator[<] identifier[IfcRoot] operator[>] operator[SEP] identifier[eGet] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[Literals] operator[SEP] identifier[IFC_REL_ASSOCIATES__RELATED_OBJECTS] , literal[boolean] operator[SEP] operator[SEP]
}
|
public T setId(int id) {
Preconditions.checkState(this.id == null);
this.id = id;
return (T) this;
} | class class_name[name] begin[{]
method[setId, return_type[type[T]], modifier[public], parameter[id]] begin[{]
call[Preconditions.checkState, parameter[binary_operation[THIS[member[None.id]], ==, literal[null]]]]
assign[THIS[member[None.id]], member[.id]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[T] identifier[setId] operator[SEP] Keyword[int] identifier[id] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] Keyword[this] operator[SEP] identifier[id] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[id] operator[=] identifier[id] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP]
}
|
public static boolean checkAcaciaEditorAvailable(CmsObject cms, CmsResource resource) {
if (resource == null) {
try {
// we want a stack trace
throw new Exception();
} catch (Exception e) {
LOG.error("Can't check widget availability because resource is null!", e);
}
return false;
}
try {
CmsFile file = (resource instanceof CmsFile) ? (CmsFile)resource : cms.readFile(resource);
CmsXmlContent content = CmsXmlContentFactory.unmarshal(cms, file);
if (content.getContentDefinition().getContentHandler().isAcaciaEditorDisabled()) {
return false;
}
CmsContentTypeVisitor visitor = new CmsContentTypeVisitor(cms, file, cms.getRequestContext().getLocale());
return visitor.isEditorCompatible(content.getContentDefinition());
} catch (CmsException e) {
LOG.info("error thrown in checkAcaciaEditorAvailable for " + resource + " : " + e.getLocalizedMessage(), e);
return true;
}
} | class class_name[name] begin[{]
method[checkAcaciaEditorAvailable, return_type[type[boolean]], modifier[public static], parameter[cms, resource]] begin[{]
if[binary_operation[member[.resource], ==, literal[null]]] begin[{]
TryStatement(block=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't check widget availability because resource is null!"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[literal[false]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CmsFile, sub_type=None), operator=instanceof), if_false=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFile, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None), if_true=Cast(expression=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CmsFile, sub_type=None))), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsFile, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmarshal, postfix_operators=[], prefix_operators=[], qualifier=CmsXmlContentFactory, selectors=[], type_arguments=None), name=content)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsXmlContent, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getContentDefinition, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[MethodInvocation(arguments=[], member=getContentHandler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=isAcaciaEditorDisabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRequestContext, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[MethodInvocation(arguments=[], member=getLocale, 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=CmsContentTypeVisitor, sub_type=None)), name=visitor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsContentTypeVisitor, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getContentDefinition, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None)], member=isEditorCompatible, postfix_operators=[], prefix_operators=[], qualifier=visitor, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error thrown in checkAcaciaEditorAvailable for "), operandr=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" : "), operator=+), operandr=MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[checkAcaciaEditorAvailable] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[CmsResource] identifier[resource] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[==] Other[null] operator[SEP] {
Keyword[try] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[try] {
identifier[CmsFile] identifier[file] operator[=] operator[SEP] identifier[resource] Keyword[instanceof] identifier[CmsFile] operator[SEP] operator[?] operator[SEP] identifier[CmsFile] operator[SEP] identifier[resource] operator[:] identifier[cms] operator[SEP] identifier[readFile] operator[SEP] identifier[resource] operator[SEP] operator[SEP] identifier[CmsXmlContent] identifier[content] operator[=] identifier[CmsXmlContentFactory] operator[SEP] identifier[unmarshal] operator[SEP] identifier[cms] , identifier[file] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[content] operator[SEP] identifier[getContentDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[getContentHandler] operator[SEP] operator[SEP] operator[SEP] identifier[isAcaciaEditorDisabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[CmsContentTypeVisitor] identifier[visitor] operator[=] Keyword[new] identifier[CmsContentTypeVisitor] operator[SEP] identifier[cms] , identifier[file] , identifier[cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[visitor] operator[SEP] identifier[isEditorCompatible] operator[SEP] identifier[content] operator[SEP] identifier[getContentDefinition] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[resource] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
@VisibleForTesting
String resolveNextPageUrl(String sourceOffset) throws ELEvalException {
String url;
if (LINK_PAGINATION.contains(conf.pagination.mode) && next != null) {
url = next.getUri().toString();
setResolvedUrl(url);
} else if (conf.pagination.mode == PaginationMode.BY_OFFSET || conf.pagination.mode == PaginationMode.BY_PAGE) {
if (sourceOffset != null) {
setPageOffset(sourceOffset);
}
url = resourceEval.eval(resourceVars, conf.resourceUrl, String.class);
} else {
url = getResolvedUrl();
}
return url;
} | class class_name[name] begin[{]
method[resolveNextPageUrl, return_type[type[String]], modifier[default], parameter[sourceOffset]] begin[{]
local_variable[type[String], url]
if[binary_operation[call[LINK_PAGINATION.contains, parameter[member[conf.pagination.mode]]], &&, binary_operation[member[.next], !=, literal[null]]]] begin[{]
assign[member[.url], call[next.getUri, parameter[]]]
call[.setResolvedUrl, parameter[member[.url]]]
else begin[{]
if[binary_operation[binary_operation[member[conf.pagination.mode], ==, member[PaginationMode.BY_OFFSET]], ||, binary_operation[member[conf.pagination.mode], ==, member[PaginationMode.BY_PAGE]]]] begin[{]
if[binary_operation[member[.sourceOffset], !=, literal[null]]] begin[{]
call[.setPageOffset, parameter[member[.sourceOffset]]]
else begin[{]
None
end[}]
assign[member[.url], call[resourceEval.eval, parameter[member[.resourceVars], member[conf.resourceUrl], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]
else begin[{]
assign[member[.url], call[.getResolvedUrl, parameter[]]]
end[}]
end[}]
return[member[.url]]
end[}]
END[}] | annotation[@] identifier[VisibleForTesting] identifier[String] identifier[resolveNextPageUrl] operator[SEP] identifier[String] identifier[sourceOffset] operator[SEP] Keyword[throws] identifier[ELEvalException] {
identifier[String] identifier[url] operator[SEP] Keyword[if] operator[SEP] identifier[LINK_PAGINATION] operator[SEP] identifier[contains] operator[SEP] identifier[conf] operator[SEP] identifier[pagination] operator[SEP] identifier[mode] operator[SEP] operator[&&] identifier[next] operator[!=] Other[null] operator[SEP] {
identifier[url] operator[=] identifier[next] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[setResolvedUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[conf] operator[SEP] identifier[pagination] operator[SEP] identifier[mode] operator[==] identifier[PaginationMode] operator[SEP] identifier[BY_OFFSET] operator[||] identifier[conf] operator[SEP] identifier[pagination] operator[SEP] identifier[mode] operator[==] identifier[PaginationMode] operator[SEP] identifier[BY_PAGE] operator[SEP] {
Keyword[if] operator[SEP] identifier[sourceOffset] operator[!=] Other[null] operator[SEP] {
identifier[setPageOffset] operator[SEP] identifier[sourceOffset] operator[SEP] operator[SEP]
}
identifier[url] operator[=] identifier[resourceEval] operator[SEP] identifier[eval] operator[SEP] identifier[resourceVars] , identifier[conf] operator[SEP] identifier[resourceUrl] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[url] operator[=] identifier[getResolvedUrl] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[url] operator[SEP]
}
|
public Javalin patch(@NotNull String path, @NotNull Handler handler, @NotNull Set<Role> permittedRoles) {
return addHandler(HandlerType.PATCH, path, handler, permittedRoles);
} | class class_name[name] begin[{]
method[patch, return_type[type[Javalin]], modifier[public], parameter[path, handler, permittedRoles]] begin[{]
return[call[.addHandler, parameter[member[HandlerType.PATCH], member[.path], member[.handler], member[.permittedRoles]]]]
end[}]
END[}] | Keyword[public] identifier[Javalin] identifier[patch] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[path] , annotation[@] identifier[NotNull] identifier[Handler] identifier[handler] , annotation[@] identifier[NotNull] identifier[Set] operator[<] identifier[Role] operator[>] identifier[permittedRoles] operator[SEP] {
Keyword[return] identifier[addHandler] operator[SEP] identifier[HandlerType] operator[SEP] identifier[PATCH] , identifier[path] , identifier[handler] , identifier[permittedRoles] operator[SEP] operator[SEP]
}
|
@Override
public Destination createDestination(final IndividualAddress remote,
final boolean connectionOriented, final boolean keepAlive, final boolean verifyMode)
{
if (detached)
throw new IllegalStateException("TL detached");
synchronized (proxies) {
if (proxies.containsKey(remote))
throw new KNXIllegalArgumentException("destination already created: " + remote);
final AggregatorProxy p = new AggregatorProxy(this);
final Destination d = new Destination(p, remote, connectionOriented, keepAlive, verifyMode);
proxies.put(remote, p);
logger.trace("created {} destination for {}", (connectionOriented ? "co" : "cl"), remote);
return d;
}
} | class class_name[name] begin[{]
method[createDestination, return_type[type[Destination]], modifier[public], parameter[remote, connectionOriented, keepAlive, verifyMode]] begin[{]
if[member[.detached]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TL detached")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
SYNCHRONIZED[member[.proxies]] BEGIN[{]
if[call[proxies.containsKey, parameter[member[.remote]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="destination already created: "), operandr=MemberReference(member=remote, 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=KNXIllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[AggregatorProxy], p]
local_variable[type[Destination], d]
call[proxies.put, parameter[member[.remote], member[.p]]]
call[logger.trace, parameter[literal["created {} destination for {}"], TernaryExpression(condition=MemberReference(member=connectionOriented, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="cl"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="co")), member[.remote]]]
return[member[.d]]
END[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Destination] identifier[createDestination] operator[SEP] Keyword[final] identifier[IndividualAddress] identifier[remote] , Keyword[final] Keyword[boolean] identifier[connectionOriented] , Keyword[final] Keyword[boolean] identifier[keepAlive] , Keyword[final] Keyword[boolean] identifier[verifyMode] operator[SEP] {
Keyword[if] operator[SEP] identifier[detached] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[proxies] operator[SEP] {
Keyword[if] operator[SEP] identifier[proxies] operator[SEP] identifier[containsKey] operator[SEP] identifier[remote] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXIllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[remote] operator[SEP] operator[SEP] Keyword[final] identifier[AggregatorProxy] identifier[p] operator[=] Keyword[new] identifier[AggregatorProxy] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[final] identifier[Destination] identifier[d] operator[=] Keyword[new] identifier[Destination] operator[SEP] identifier[p] , identifier[remote] , identifier[connectionOriented] , identifier[keepAlive] , identifier[verifyMode] operator[SEP] operator[SEP] identifier[proxies] operator[SEP] identifier[put] operator[SEP] identifier[remote] , identifier[p] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , operator[SEP] identifier[connectionOriented] operator[?] literal[String] operator[:] literal[String] operator[SEP] , identifier[remote] operator[SEP] operator[SEP] Keyword[return] identifier[d] operator[SEP]
}
}
|
@Override
public boolean createGeometryIndexTable() {
verifyWritable();
boolean created = false;
GeometryIndexDao dao = getGeometryIndexDao();
try {
if (!dao.isTableExists()) {
created = tableCreator.createGeometryIndex() > 0;
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to check if "
+ GeometryIndex.class.getSimpleName()
+ " table exists and create it", e);
}
return created;
} | class class_name[name] begin[{]
method[createGeometryIndexTable, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
call[.verifyWritable, parameter[]]
local_variable[type[boolean], created]
local_variable[type[GeometryIndexDao], dao]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTableExists, postfix_operators=[], prefix_operators=['!'], qualifier=dao, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=created, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[], member=createGeometryIndex, postfix_operators=[], prefix_operators=[], qualifier=tableCreator, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to check if "), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=GeometryIndex, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" table exists and create it"), 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=GeoPackageException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
return[member[.created]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[createGeometryIndexTable] operator[SEP] operator[SEP] {
identifier[verifyWritable] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[created] operator[=] literal[boolean] operator[SEP] identifier[GeometryIndexDao] identifier[dao] operator[=] identifier[getGeometryIndexDao] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[dao] operator[SEP] identifier[isTableExists] operator[SEP] operator[SEP] operator[SEP] {
identifier[created] operator[=] identifier[tableCreator] operator[SEP] identifier[createGeometryIndex] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[GeometryIndex] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[created] operator[SEP]
}
|
protected void initWithWrapperType() {
// =========== wrapper type ==============
transformers.put(Boolean.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.BOOL, value);
}
});
transformers.put(Byte.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.BYTE, value);
}
});
transformers.put(Character.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.BYTE, (byte)((Character)value).charValue());
}
});
transformers.put(Double.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.DOUBLE, value);
}
});
transformers.put(Float.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.FLOAT, value);
}
});
transformers.put(Integer.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.INT, value);
}
});
transformers.put(Long.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.LONG, value);
}
});
transformers.put(Short.class, new Transformer() {
@Override
public SFSDataWrapper transform(Object value) {
return new SFSDataWrapper(SFSDataType.SHORT, value);
}
});
} | class class_name[name] begin[{]
method[initWithWrapperType, return_type[void], modifier[protected], parameter[]] begin[{]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Boolean, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=BOOL, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Byte, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=BYTE, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Character, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=BYTE, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), Cast(expression=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None)), type=BasicType(dimensions=[], name=byte))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Double, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Float, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=FLOAT, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=INT, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
call[transformers.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Short, sub_type=None)), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=SHORT, postfix_operators=[], prefix_operators=[], qualifier=SFSDataType, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFSDataWrapper, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=transform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=SFSDataWrapper, 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=Transformer, sub_type=None))]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[initWithWrapperType] operator[SEP] operator[SEP] {
identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Boolean] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[BOOL] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Byte] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[BYTE] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Character] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[BYTE] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[Character] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[charValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Double] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[DOUBLE] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Float] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[FLOAT] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Integer] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[INT] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Long] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[LONG] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[transformers] operator[SEP] identifier[put] operator[SEP] identifier[Short] operator[SEP] Keyword[class] , Keyword[new] identifier[Transformer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SFSDataWrapper] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[SFSDataWrapper] operator[SEP] identifier[SFSDataType] operator[SEP] identifier[SHORT] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public EnvironmentConfig setSetting(@NotNull final String key, @NotNull final Object value) {
return (EnvironmentConfig) super.setSetting(key, value);
} | class class_name[name] begin[{]
method[setSetting, return_type[type[EnvironmentConfig]], modifier[public], parameter[key, value]] begin[{]
return[Cast(expression=SuperMethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSetting, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EnvironmentConfig, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EnvironmentConfig] identifier[setSetting] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[String] identifier[key] , annotation[@] identifier[NotNull] Keyword[final] identifier[Object] identifier[value] operator[SEP] {
Keyword[return] operator[SEP] identifier[EnvironmentConfig] operator[SEP] Keyword[super] operator[SEP] identifier[setSetting] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.MBC__RG:
return rg != null && !rg.isEmpty();
}
return super.eIsSet(featureID);
} | class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=MBC__RG, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=rg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=rg, selectors=[], type_arguments=None), operator=&&), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[MBC__RG] operator[:] Keyword[return] identifier[rg] operator[!=] Other[null] operator[&&] operator[!] identifier[rg] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
protected Method getSetter(Class type, String name)
{
return introspector(type).getSetter( toJavaIdentifierForm(name));
} | class class_name[name] begin[{]
method[getSetter, return_type[type[Method]], modifier[protected], parameter[type, name]] begin[{]
return[call[.introspector, parameter[member[.type]]]]
end[}]
END[}] | Keyword[protected] identifier[Method] identifier[getSetter] operator[SEP] identifier[Class] identifier[type] , identifier[String] identifier[name] operator[SEP] {
Keyword[return] identifier[introspector] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[getSetter] operator[SEP] identifier[toJavaIdentifierForm] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
|
public Histogram histogram(String name, final MetricSupplier<Histogram> supplier) {
return getOrAdd(name, new MetricBuilder<Histogram>() {
@Override
public Histogram newMetric() {
return supplier.newMetric();
}
@Override
public boolean isInstance(Metric metric) {
return Histogram.class.isInstance(metric);
}
});
} | class class_name[name] begin[{]
method[histogram, return_type[type[Histogram]], modifier[public], parameter[name, supplier]] begin[{]
return[call[.getOrAdd, parameter[member[.name], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=newMetric, postfix_operators=[], prefix_operators=[], qualifier=supplier, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=newMetric, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Histogram, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=metric, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Histogram, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=isInstance, parameters=[FormalParameter(annotations=[], modifiers=set(), name=metric, type=ReferenceType(arguments=None, dimensions=[], name=Metric, 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=Histogram, sub_type=None))], dimensions=None, name=MetricBuilder, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Histogram] identifier[histogram] operator[SEP] identifier[String] identifier[name] , Keyword[final] identifier[MetricSupplier] operator[<] identifier[Histogram] operator[>] identifier[supplier] operator[SEP] {
Keyword[return] identifier[getOrAdd] operator[SEP] identifier[name] , Keyword[new] identifier[MetricBuilder] operator[<] identifier[Histogram] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Histogram] identifier[newMetric] operator[SEP] operator[SEP] {
Keyword[return] identifier[supplier] operator[SEP] identifier[newMetric] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isInstance] operator[SEP] identifier[Metric] identifier[metric] operator[SEP] {
Keyword[return] identifier[Histogram] operator[SEP] Keyword[class] operator[SEP] identifier[isInstance] operator[SEP] identifier[metric] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected static <T extends MPBase> T processMethod(Class clazz, String methodName, String param1, Boolean useCache) throws MPException {
HashMap<String, String> mapParams = new HashMap<String, String>();
mapParams.put("param1", param1);
return processMethod(clazz, null, methodName, mapParams, useCache);
} | class class_name[name] begin[{]
method[processMethod, return_type[type[T]], modifier[static protected], parameter[clazz, methodName, param1, useCache]] begin[{]
local_variable[type[HashMap], mapParams]
call[mapParams.put, parameter[literal["param1"], member[.param1]]]
return[call[.processMethod, parameter[member[.clazz], literal[null], member[.methodName], member[.mapParams], member[.useCache]]]]
end[}]
END[}] | Keyword[protected] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[MPBase] operator[>] identifier[T] identifier[processMethod] operator[SEP] identifier[Class] identifier[clazz] , identifier[String] identifier[methodName] , identifier[String] identifier[param1] , identifier[Boolean] identifier[useCache] operator[SEP] Keyword[throws] identifier[MPException] {
identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[mapParams] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[mapParams] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[param1] operator[SEP] operator[SEP] Keyword[return] identifier[processMethod] operator[SEP] identifier[clazz] , Other[null] , identifier[methodName] , identifier[mapParams] , identifier[useCache] operator[SEP] operator[SEP]
}
|
@Override
public DetachSecurityProfileResult detachSecurityProfile(DetachSecurityProfileRequest request) {
request = beforeClientExecution(request);
return executeDetachSecurityProfile(request);
} | class class_name[name] begin[{]
method[detachSecurityProfile, return_type[type[DetachSecurityProfileResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDetachSecurityProfile, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DetachSecurityProfileResult] identifier[detachSecurityProfile] operator[SEP] identifier[DetachSecurityProfileRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDetachSecurityProfile] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static boolean is100ContinueExpected(HttpMessage message) {
return isExpectHeaderValid(message)
// unquoted tokens in the expect header are case-insensitive, thus 100-continue is case insensitive
&& message.headers().contains(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE, true);
} | class class_name[name] begin[{]
method[is100ContinueExpected, return_type[type[boolean]], modifier[public static], parameter[message]] begin[{]
return[binary_operation[call[.isExpectHeaderValid, parameter[member[.message]]], &&, call[message.headers, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[is100ContinueExpected] operator[SEP] identifier[HttpMessage] identifier[message] operator[SEP] {
Keyword[return] identifier[isExpectHeaderValid] operator[SEP] identifier[message] operator[SEP] operator[&&] identifier[message] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[EXPECT] , identifier[HttpHeaderValues] operator[SEP] identifier[CONTINUE] , literal[boolean] operator[SEP] operator[SEP]
}
|
public CmsJspInstanceDateBean getPreviousFor(Object date) {
Date d = toDate(date);
if ((d != null) && (m_dates != null) && (!m_dates.isEmpty())) {
Date lastDate = m_dates.first();
for (Date instanceDate : m_dates) {
if (instanceDate.after(d)) {
return new CmsJspInstanceDateBean((Date)lastDate.clone(), CmsJspDateSeriesBean.this);
}
lastDate = instanceDate;
}
return new CmsJspInstanceDateBean((Date)lastDate.clone(), CmsJspDateSeriesBean.this);
}
return getLast();
} | class class_name[name] begin[{]
method[getPreviousFor, return_type[type[CmsJspInstanceDateBean]], modifier[public], parameter[date]] begin[{]
local_variable[type[Date], d]
if[binary_operation[binary_operation[binary_operation[member[.d], !=, literal[null]], &&, binary_operation[member[.m_dates], !=, literal[null]]], &&, call[m_dates.isEmpty, parameter[]]]] begin[{]
local_variable[type[Date], lastDate]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=after, postfix_operators=[], prefix_operators=[], qualifier=instanceDate, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[Cast(expression=MethodInvocation(arguments=[], member=clone, postfix_operators=[], prefix_operators=[], qualifier=lastDate, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), This(postfix_operators=[], prefix_operators=[], qualifier=CmsJspDateSeriesBean, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsJspInstanceDateBean, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=instanceDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=m_dates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=instanceDate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None))), label=None)
return[ClassCreator(arguments=[Cast(expression=MethodInvocation(arguments=[], member=clone, postfix_operators=[], prefix_operators=[], qualifier=lastDate, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), This(postfix_operators=[], prefix_operators=[], qualifier=CmsJspDateSeriesBean, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsJspInstanceDateBean, sub_type=None))]
else begin[{]
None
end[}]
return[call[.getLast, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[CmsJspInstanceDateBean] identifier[getPreviousFor] operator[SEP] identifier[Object] identifier[date] operator[SEP] {
identifier[Date] identifier[d] operator[=] identifier[toDate] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[d] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[m_dates] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[m_dates] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Date] identifier[lastDate] operator[=] identifier[m_dates] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Date] identifier[instanceDate] operator[:] identifier[m_dates] operator[SEP] {
Keyword[if] operator[SEP] identifier[instanceDate] operator[SEP] identifier[after] operator[SEP] identifier[d] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[CmsJspInstanceDateBean] operator[SEP] operator[SEP] identifier[Date] operator[SEP] identifier[lastDate] operator[SEP] identifier[clone] operator[SEP] operator[SEP] , identifier[CmsJspDateSeriesBean] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[lastDate] operator[=] identifier[instanceDate] operator[SEP]
}
Keyword[return] Keyword[new] identifier[CmsJspInstanceDateBean] operator[SEP] operator[SEP] identifier[Date] operator[SEP] identifier[lastDate] operator[SEP] identifier[clone] operator[SEP] operator[SEP] , identifier[CmsJspDateSeriesBean] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getLast] operator[SEP] operator[SEP] operator[SEP]
}
|
public void clearTypes() {
List<String> selectedTypes = m_searchObject.getTypes();
m_handler.onClearTypes(selectedTypes);
m_searchObject.clearTypes();
updateResultsTab(false);
ValueChangeEvent.fire(this, m_searchObject);
} | class class_name[name] begin[{]
method[clearTypes, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[List], selectedTypes]
call[m_handler.onClearTypes, parameter[member[.selectedTypes]]]
call[m_searchObject.clearTypes, parameter[]]
call[.updateResultsTab, parameter[literal[false]]]
call[ValueChangeEvent.fire, parameter[THIS[], member[.m_searchObject]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[clearTypes] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[selectedTypes] operator[=] identifier[m_searchObject] operator[SEP] identifier[getTypes] operator[SEP] operator[SEP] operator[SEP] identifier[m_handler] operator[SEP] identifier[onClearTypes] operator[SEP] identifier[selectedTypes] operator[SEP] operator[SEP] identifier[m_searchObject] operator[SEP] identifier[clearTypes] operator[SEP] operator[SEP] operator[SEP] identifier[updateResultsTab] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[ValueChangeEvent] operator[SEP] identifier[fire] operator[SEP] Keyword[this] , identifier[m_searchObject] operator[SEP] operator[SEP]
}
|
@Override
public Type[] getAudioFileTypes(AudioInputStream stream) {
AudioFileFormat.Type[] filetypes = getAudioFileTypes();
// make sure we can write this stream
AudioFormat format = stream.getFormat();
if(AudioStreamEncoder.getDataFormatSupport(format) == AudioStreamEncoder.SUPPORTED ) {
return filetypes;
}
return new AudioFileFormat.Type[0];
} | class class_name[name] begin[{]
method[getAudioFileTypes, return_type[type[Type]], modifier[public], parameter[stream]] begin[{]
local_variable[type[AudioFileFormat], filetypes]
local_variable[type[AudioFormat], format]
if[binary_operation[call[AudioStreamEncoder.getDataFormatSupport, parameter[member[.format]]], ==, member[AudioStreamEncoder.SUPPORTED]]] begin[{]
return[member[.filetypes]]
else begin[{]
None
end[}]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AudioFileFormat, sub_type=ReferenceType(arguments=None, dimensions=None, name=Type, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Type] operator[SEP] operator[SEP] identifier[getAudioFileTypes] operator[SEP] identifier[AudioInputStream] identifier[stream] operator[SEP] {
identifier[AudioFileFormat] operator[SEP] identifier[Type] operator[SEP] operator[SEP] identifier[filetypes] operator[=] identifier[getAudioFileTypes] operator[SEP] operator[SEP] operator[SEP] identifier[AudioFormat] identifier[format] operator[=] identifier[stream] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[AudioStreamEncoder] operator[SEP] identifier[getDataFormatSupport] operator[SEP] identifier[format] operator[SEP] operator[==] identifier[AudioStreamEncoder] operator[SEP] identifier[SUPPORTED] operator[SEP] {
Keyword[return] identifier[filetypes] operator[SEP]
}
Keyword[return] Keyword[new] identifier[AudioFileFormat] operator[SEP] identifier[Type] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public double getFalsePositiveRate(int elements) {
return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs);
} | class class_name[name] begin[{]
method[getFalsePositiveRate, return_type[type[double]], modifier[public], parameter[elements]] begin[{]
return[call[.pow, parameter[binary_operation[literal[1], -, call[.pow, parameter[member[.E], binary_operation[binary_operation[literal[1.0], *, binary_operation[member[.hashFuncs], *, member[.elements]]], /, binary_operation[member[data.length], *, literal[8]]]]]], member[.hashFuncs]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[getFalsePositiveRate] operator[SEP] Keyword[int] identifier[elements] operator[SEP] {
Keyword[return] identifier[pow] operator[SEP] Other[1] operator[-] identifier[pow] operator[SEP] identifier[E] , operator[-] literal[Float] operator[*] operator[SEP] identifier[hashFuncs] operator[*] identifier[elements] operator[SEP] operator[/] operator[SEP] identifier[data] operator[SEP] identifier[length] operator[*] Other[8] operator[SEP] operator[SEP] , identifier[hashFuncs] operator[SEP] operator[SEP]
}
|
public void out(Object key, int type, String struct) throws SQLException {
if (key instanceof Integer) {
if (struct == null) {
base.registerOutParameter((Integer) key, type);
} else {
base.registerOutParameter((Integer) key, type, struct);
}
} else {
if (struct == null) {
base.registerOutParameter((String) key, type);
} else {
base.registerOutParameter((String) key, type, struct);
}
}
} | class class_name[name] begin[{]
method[out, return_type[void], modifier[public], parameter[key, type, struct]] begin[{]
if[binary_operation[member[.key], instanceof, type[Integer]]] begin[{]
if[binary_operation[member[.struct], ==, literal[null]]] begin[{]
call[base.registerOutParameter, parameter[Cast(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), member[.type]]]
else begin[{]
call[base.registerOutParameter, parameter[Cast(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), member[.type], member[.struct]]]
end[}]
else begin[{]
if[binary_operation[member[.struct], ==, literal[null]]] begin[{]
call[base.registerOutParameter, parameter[Cast(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), member[.type]]]
else begin[{]
call[base.registerOutParameter, parameter[Cast(expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), member[.type], member[.struct]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[out] operator[SEP] identifier[Object] identifier[key] , Keyword[int] identifier[type] , identifier[String] identifier[struct] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[Integer] operator[SEP] {
Keyword[if] operator[SEP] identifier[struct] operator[==] Other[null] operator[SEP] {
identifier[base] operator[SEP] identifier[registerOutParameter] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[key] , identifier[type] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[base] operator[SEP] identifier[registerOutParameter] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[key] , identifier[type] , identifier[struct] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[struct] operator[==] Other[null] operator[SEP] {
identifier[base] operator[SEP] identifier[registerOutParameter] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[key] , identifier[type] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[base] operator[SEP] identifier[registerOutParameter] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[key] , identifier[type] , identifier[struct] operator[SEP] operator[SEP]
}
}
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.MEDIUM_ORIENTATION__MED_ORIENT:
return MED_ORIENT_EDEFAULT == null ? medOrient != null : !MED_ORIENT_EDEFAULT.equals(medOrient);
}
return super.eIsSet(featureID);
} | class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=MEDIUM_ORIENTATION__MED_ORIENT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=MED_ORIENT_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=medOrient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=MED_ORIENT_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=medOrient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[MEDIUM_ORIENTATION__MED_ORIENT] operator[:] Keyword[return] identifier[MED_ORIENT_EDEFAULT] operator[==] Other[null] operator[?] identifier[medOrient] operator[!=] Other[null] operator[:] operator[!] identifier[MED_ORIENT_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[medOrient] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public static void showBooks(final ListOfBooks booksList){
if(booksList != null && booksList.getBook() != null && !booksList.getBook().isEmpty()){
List<BookType> books = booksList.getBook();
System.out.println("\nNumber of books: " + books.size());
int cnt = 0;
for (BookType book : books) {
System.out.println("\nBookNum: " + (cnt++ + 1));
List<PersonType> authors = book.getAuthor();
if(authors != null && !authors.isEmpty()){
for (PersonType author : authors) {
System.out.println("Author: " + author.getFirstName() +
" " + author.getLastName());
}
}
System.out.println("Title: " + book.getTitle());
System.out.println("Year: " + book.getYearPublished());
if(book.getISBN()!=null){
System.out.println("ISBN: " + book.getISBN());
}
}
}else{
System.out.println("List of books is empty");
}
System.out.println("");
} | class class_name[name] begin[{]
method[showBooks, return_type[void], modifier[public static], parameter[booksList]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.booksList], !=, literal[null]], &&, binary_operation[call[booksList.getBook, parameter[]], !=, literal[null]]], &&, call[booksList.getBook, parameter[]]]] begin[{]
local_variable[type[List], books]
call[System.out.println, parameter[binary_operation[literal["\nNumber of books: "], +, call[books.size, parameter[]]]]]
local_variable[type[int], cnt]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nBookNum: "), operandr=BinaryOperation(operandl=MemberReference(member=cnt, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAuthor, postfix_operators=[], prefix_operators=[], qualifier=book, selectors=[], type_arguments=None), name=authors)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PersonType, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=authors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=authors, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Author: "), operandr=MethodInvocation(arguments=[], member=getFirstName, postfix_operators=[], prefix_operators=[], qualifier=author, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MethodInvocation(arguments=[], member=getLastName, postfix_operators=[], prefix_operators=[], qualifier=author, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=authors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=author)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PersonType, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Title: "), operandr=MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=book, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Year: "), operandr=MethodInvocation(arguments=[], member=getYearPublished, postfix_operators=[], prefix_operators=[], qualifier=book, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getISBN, postfix_operators=[], prefix_operators=[], qualifier=book, selectors=[], type_arguments=None), 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=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ISBN: "), operandr=MethodInvocation(arguments=[], member=getISBN, postfix_operators=[], prefix_operators=[], qualifier=book, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=books, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=book)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BookType, sub_type=None))), label=None)
else begin[{]
call[System.out.println, parameter[literal["List of books is empty"]]]
end[}]
call[System.out.println, parameter[literal[""]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[showBooks] operator[SEP] Keyword[final] identifier[ListOfBooks] identifier[booksList] operator[SEP] {
Keyword[if] operator[SEP] identifier[booksList] operator[!=] Other[null] operator[&&] identifier[booksList] operator[SEP] identifier[getBook] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[booksList] operator[SEP] identifier[getBook] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[BookType] operator[>] identifier[books] operator[=] identifier[booksList] operator[SEP] identifier[getBook] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[books] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[cnt] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[BookType] identifier[book] operator[:] identifier[books] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] operator[SEP] identifier[cnt] operator[++] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[PersonType] operator[>] identifier[authors] operator[=] identifier[book] operator[SEP] identifier[getAuthor] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[authors] operator[!=] Other[null] operator[&&] operator[!] identifier[authors] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[PersonType] identifier[author] operator[:] identifier[authors] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[author] operator[SEP] identifier[getFirstName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[author] operator[SEP] identifier[getLastName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[book] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[book] operator[SEP] identifier[getYearPublished] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[book] operator[SEP] identifier[getISBN] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[book] operator[SEP] identifier[getISBN] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public ServiceFuture<AssetFilterInner> updateAsync(String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters, final ServiceCallback<AssetFilterInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[updateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, accountName, assetName, filterName, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.updateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName], member[.assetName], member[.filterName], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[AssetFilterInner] operator[>] identifier[updateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] , identifier[String] identifier[assetName] , identifier[String] identifier[filterName] , identifier[AssetFilterInner] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[AssetFilterInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[updateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] , identifier[assetName] , identifier[filterName] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public OtpErlangPort read_port() throws OtpErlangDecodeException {
String node;
int id;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.portTag &&
tag != OtpExternal.newPortTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.portTag
+ " or " + OtpExternal.newPortTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
if (tag == OtpExternal.portTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPort(tag, node, id, creation);
} | class class_name[name] begin[{]
method[read_port, return_type[type[OtpErlangPort]], modifier[public], parameter[]] begin[{]
local_variable[type[String], node]
local_variable[type[int], id]
local_variable[type[int], creation]
local_variable[type[int], tag]
assign[member[.tag], call[.read1skip_version, parameter[]]]
if[binary_operation[binary_operation[member[.tag], !=, member[OtpExternal.portTag]], &&, binary_operation[member[.tag], !=, member[OtpExternal.newPortTag]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Wrong tag encountered, expected "), operandr=MemberReference(member=portTag, postfix_operators=[], prefix_operators=[], qualifier=OtpExternal, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" or "), operator=+), operandr=MemberReference(member=newPortTag, postfix_operators=[], prefix_operators=[], qualifier=OtpExternal, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", got "), operator=+), operandr=MemberReference(member=tag, 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=OtpErlangDecodeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.node], call[.read_atom, parameter[]]]
assign[member[.id], call[.read4BE, parameter[]]]
if[binary_operation[member[.tag], ==, member[OtpExternal.portTag]]] begin[{]
assign[member[.creation], call[.read1, parameter[]]]
else begin[{]
assign[member[.creation], call[.read4BE, parameter[]]]
end[}]
return[ClassCreator(arguments=[MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=creation, 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=OtpErlangPort, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[OtpErlangPort] identifier[read_port] operator[SEP] operator[SEP] Keyword[throws] identifier[OtpErlangDecodeException] {
identifier[String] identifier[node] operator[SEP] Keyword[int] identifier[id] operator[SEP] Keyword[int] identifier[creation] operator[SEP] Keyword[int] identifier[tag] operator[SEP] identifier[tag] operator[=] identifier[read1skip_version] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[!=] identifier[OtpExternal] operator[SEP] identifier[portTag] operator[&&] identifier[tag] operator[!=] identifier[OtpExternal] operator[SEP] identifier[newPortTag] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OtpErlangDecodeException] operator[SEP] literal[String] operator[+] identifier[OtpExternal] operator[SEP] identifier[portTag] operator[+] literal[String] operator[+] identifier[OtpExternal] operator[SEP] identifier[newPortTag] operator[+] literal[String] operator[+] identifier[tag] operator[SEP] operator[SEP]
}
identifier[node] operator[=] identifier[read_atom] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[=] identifier[read4BE] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag] operator[==] identifier[OtpExternal] operator[SEP] identifier[portTag] operator[SEP] identifier[creation] operator[=] identifier[read1] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[creation] operator[=] identifier[read4BE] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[OtpErlangPort] operator[SEP] identifier[tag] , identifier[node] , identifier[id] , identifier[creation] operator[SEP] operator[SEP]
}
|
public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy1st(TriPredicate<T1, T2, T3> predicate, Box<T1> param1) {
return spy(predicate, Box.<Boolean>empty(), param1, Box.<T2>empty(), Box.<T3>empty());
} | class class_name[name] begin[{]
method[spy1st, return_type[type[TriPredicate]], modifier[public static], parameter[predicate, param1]] begin[{]
return[call[.spy, parameter[member[.predicate], call[.Box, parameter[]], member[.param1], call[.Box, parameter[]], call[.Box, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[TriPredicate] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[spy1st] operator[SEP] identifier[TriPredicate] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[predicate] , identifier[Box] operator[<] identifier[T1] operator[>] identifier[param1] operator[SEP] {
Keyword[return] identifier[spy] operator[SEP] identifier[predicate] , identifier[Box] operator[SEP] operator[<] identifier[Boolean] operator[>] identifier[empty] operator[SEP] operator[SEP] , identifier[param1] , identifier[Box] operator[SEP] operator[<] identifier[T2] operator[>] identifier[empty] operator[SEP] operator[SEP] , identifier[Box] operator[SEP] operator[<] identifier[T3] operator[>] identifier[empty] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<Integer> sequence(int min, int max) {
int count = nextInteger(min, max);
List<Integer> result = new ArrayList<Integer>();
for (int i = 0; i < count; i++)
result.add(i);
return result;
} | class class_name[name] begin[{]
method[sequence, return_type[type[List]], modifier[public static], parameter[min, max]] begin[{]
local_variable[type[int], count]
local_variable[type[List], result]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, 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[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Integer] operator[>] identifier[sequence] operator[SEP] Keyword[int] identifier[min] , Keyword[int] identifier[max] operator[SEP] {
Keyword[int] identifier[count] operator[=] identifier[nextInteger] operator[SEP] identifier[min] , identifier[max] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Integer] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Integer] operator[>] operator[SEP] 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[result] operator[SEP] identifier[add] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void blockMe(int cyclesToBlock) {
long unblock = cycles + cyclesToBlock;
BlockedEntry newEntry = new BlockedEntry(unblock);
blockedCollection.add(newEntry);
while (unblock > cycles) {
try {
newEntry.getSync().acquire(); // blocks
} catch (InterruptedException exc) {
log.error("[temporaryBlock] Spurious wakeup", exc);
}
}
} | class class_name[name] begin[{]
method[blockMe, return_type[void], modifier[private], parameter[cyclesToBlock]] begin[{]
local_variable[type[long], unblock]
local_variable[type[BlockedEntry], newEntry]
call[blockedCollection.add, parameter[member[.newEntry]]]
while[binary_operation[member[.unblock], >, member[.cycles]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getSync, postfix_operators=[], prefix_operators=[], qualifier=newEntry, selectors=[MethodInvocation(arguments=[], member=acquire, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[temporaryBlock] Spurious wakeup"), MemberReference(member=exc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[blockMe] operator[SEP] Keyword[int] identifier[cyclesToBlock] operator[SEP] {
Keyword[long] identifier[unblock] operator[=] identifier[cycles] operator[+] identifier[cyclesToBlock] operator[SEP] identifier[BlockedEntry] identifier[newEntry] operator[=] Keyword[new] identifier[BlockedEntry] operator[SEP] identifier[unblock] operator[SEP] operator[SEP] identifier[blockedCollection] operator[SEP] identifier[add] operator[SEP] identifier[newEntry] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[unblock] operator[>] identifier[cycles] operator[SEP] {
Keyword[try] {
identifier[newEntry] operator[SEP] identifier[getSync] operator[SEP] operator[SEP] operator[SEP] identifier[acquire] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[exc] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[exc] operator[SEP] operator[SEP]
}
}
}
|
public EEnum getIOBYoaOrent() {
if (iobYoaOrentEEnum == null) {
iobYoaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(40);
}
return iobYoaOrentEEnum;
} | class class_name[name] begin[{]
method[getIOBYoaOrent, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.iobYoaOrentEEnum], ==, literal[null]]] begin[{]
assign[member[.iobYoaOrentEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, 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=40)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.iobYoaOrentEEnum]]
end[}]
END[}] | Keyword[public] identifier[EEnum] identifier[getIOBYoaOrent] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[iobYoaOrentEEnum] operator[==] Other[null] operator[SEP] {
identifier[iobYoaOrentEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[40] operator[SEP] operator[SEP]
}
Keyword[return] identifier[iobYoaOrentEEnum] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.