code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public String[] replaceParameter(String name, String value)
{
Map<String, String[]> map = getMap();
String[] v = map.put(name, new String[] { value });
rebuildQuery();
return v;
} | class class_name[name] begin[{]
method[replaceParameter, return_type[type[String]], modifier[public], parameter[name, value]] begin[{]
local_variable[type[Map], map]
local_variable[type[String], v]
call[.rebuildQuery, parameter[]]
return[member[.v]]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[replaceParameter] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[map] operator[=] identifier[getMap] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[v] operator[=] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[name] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[value]
} operator[SEP] operator[SEP] identifier[rebuildQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[v] operator[SEP]
}
|
public static List<CommerceTierPriceEntry> findByCommercePriceEntryId(
long commercePriceEntryId, int start, int end) {
return getPersistence()
.findByCommercePriceEntryId(commercePriceEntryId, start, end);
} | class class_name[name] begin[{]
method[findByCommercePriceEntryId, return_type[type[List]], modifier[public static], parameter[commercePriceEntryId, start, end]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[CommerceTierPriceEntry] operator[>] identifier[findByCommercePriceEntryId] operator[SEP] Keyword[long] identifier[commercePriceEntryId] , Keyword[int] identifier[start] , Keyword[int] identifier[end] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCommercePriceEntryId] operator[SEP] identifier[commercePriceEntryId] , identifier[start] , identifier[end] operator[SEP] operator[SEP]
}
|
public RecordedRequest takeRequest(long timeout, TimeUnit unit) throws InterruptedException {
return requestQueue.poll(timeout, unit);
} | class class_name[name] begin[{]
method[takeRequest, return_type[type[RecordedRequest]], modifier[public], parameter[timeout, unit]] begin[{]
return[call[requestQueue.poll, parameter[member[.timeout], member[.unit]]]]
end[}]
END[}] | Keyword[public] identifier[RecordedRequest] identifier[takeRequest] operator[SEP] Keyword[long] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[return] identifier[requestQueue] operator[SEP] identifier[poll] operator[SEP] identifier[timeout] , identifier[unit] operator[SEP] operator[SEP]
}
|
@Override
public EClass getIfcMassDensityMeasure() {
if (ifcMassDensityMeasureEClass == null) {
ifcMassDensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(834);
}
return ifcMassDensityMeasureEClass;
} | class class_name[name] begin[{]
method[getIfcMassDensityMeasure, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcMassDensityMeasureEClass], ==, literal[null]]] begin[{]
assign[member[.ifcMassDensityMeasureEClass], 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=834)], 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[.ifcMassDensityMeasureEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcMassDensityMeasure] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcMassDensityMeasureEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcMassDensityMeasureEClass] 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[834] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcMassDensityMeasureEClass] operator[SEP]
}
|
private void addMouseListenerImpl(MouseListener listener) {
if (mouseListeners.contains(listener)) {
return;
}
mouseListeners.add(listener);
allListeners.add(listener);
} | class class_name[name] begin[{]
method[addMouseListenerImpl, return_type[void], modifier[private], parameter[listener]] begin[{]
if[call[mouseListeners.contains, parameter[member[.listener]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[mouseListeners.add, parameter[member[.listener]]]
call[allListeners.add, parameter[member[.listener]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addMouseListenerImpl] operator[SEP] identifier[MouseListener] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[mouseListeners] operator[SEP] identifier[contains] operator[SEP] identifier[listener] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[mouseListeners] operator[SEP] identifier[add] operator[SEP] identifier[listener] operator[SEP] operator[SEP] identifier[allListeners] operator[SEP] identifier[add] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
|
public static long getTileColumn(BoundingBox totalBox, long matrixWidth,
double longitude) {
double minX = totalBox.getMinLongitude();
double maxX = totalBox.getMaxLongitude();
long tileId;
if (longitude < minX) {
tileId = -1;
} else if (longitude >= maxX) {
tileId = matrixWidth;
} else {
double matrixWidthMeters = totalBox.getMaxLongitude()
- totalBox.getMinLongitude();
double tileWidth = matrixWidthMeters / matrixWidth;
tileId = (long) ((longitude - minX) / tileWidth);
}
return tileId;
} | class class_name[name] begin[{]
method[getTileColumn, return_type[type[long]], modifier[public static], parameter[totalBox, matrixWidth, longitude]] begin[{]
local_variable[type[double], minX]
local_variable[type[double], maxX]
local_variable[type[long], tileId]
if[binary_operation[member[.longitude], <, member[.minX]]] begin[{]
assign[member[.tileId], literal[1]]
else begin[{]
if[binary_operation[member[.longitude], >=, member[.maxX]]] begin[{]
assign[member[.tileId], member[.matrixWidth]]
else begin[{]
local_variable[type[double], matrixWidthMeters]
local_variable[type[double], tileWidth]
assign[member[.tileId], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=longitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=tileWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), type=BasicType(dimensions=[], name=long))]
end[}]
end[}]
return[member[.tileId]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[getTileColumn] operator[SEP] identifier[BoundingBox] identifier[totalBox] , Keyword[long] identifier[matrixWidth] , Keyword[double] identifier[longitude] operator[SEP] {
Keyword[double] identifier[minX] operator[=] identifier[totalBox] operator[SEP] identifier[getMinLongitude] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[maxX] operator[=] identifier[totalBox] operator[SEP] identifier[getMaxLongitude] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[tileId] operator[SEP] Keyword[if] operator[SEP] identifier[longitude] operator[<] identifier[minX] operator[SEP] {
identifier[tileId] operator[=] operator[-] Other[1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[longitude] operator[>=] identifier[maxX] operator[SEP] {
identifier[tileId] operator[=] identifier[matrixWidth] operator[SEP]
}
Keyword[else] {
Keyword[double] identifier[matrixWidthMeters] operator[=] identifier[totalBox] operator[SEP] identifier[getMaxLongitude] operator[SEP] operator[SEP] operator[-] identifier[totalBox] operator[SEP] identifier[getMinLongitude] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[tileWidth] operator[=] identifier[matrixWidthMeters] operator[/] identifier[matrixWidth] operator[SEP] identifier[tileId] operator[=] operator[SEP] Keyword[long] operator[SEP] operator[SEP] operator[SEP] identifier[longitude] operator[-] identifier[minX] operator[SEP] operator[/] identifier[tileWidth] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tileId] operator[SEP]
}
|
public static DictionaryMaker combine(String pathA, String pathB)
{
DictionaryMaker dictionaryMaker = new DictionaryMaker();
dictionaryMaker.addAll(DictionaryMaker.loadAsItemList(pathA));
dictionaryMaker.addAll(DictionaryMaker.loadAsItemList(pathB));
return dictionaryMaker;
} | class class_name[name] begin[{]
method[combine, return_type[type[DictionaryMaker]], modifier[public static], parameter[pathA, pathB]] begin[{]
local_variable[type[DictionaryMaker], dictionaryMaker]
call[dictionaryMaker.addAll, parameter[call[DictionaryMaker.loadAsItemList, parameter[member[.pathA]]]]]
call[dictionaryMaker.addAll, parameter[call[DictionaryMaker.loadAsItemList, parameter[member[.pathB]]]]]
return[member[.dictionaryMaker]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DictionaryMaker] identifier[combine] operator[SEP] identifier[String] identifier[pathA] , identifier[String] identifier[pathB] operator[SEP] {
identifier[DictionaryMaker] identifier[dictionaryMaker] operator[=] Keyword[new] identifier[DictionaryMaker] operator[SEP] operator[SEP] operator[SEP] identifier[dictionaryMaker] operator[SEP] identifier[addAll] operator[SEP] identifier[DictionaryMaker] operator[SEP] identifier[loadAsItemList] operator[SEP] identifier[pathA] operator[SEP] operator[SEP] operator[SEP] identifier[dictionaryMaker] operator[SEP] identifier[addAll] operator[SEP] identifier[DictionaryMaker] operator[SEP] identifier[loadAsItemList] operator[SEP] identifier[pathB] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[dictionaryMaker] operator[SEP]
}
|
@Nonnull
public static String getURIWithContext (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final String sHRef)
{
ValueEnforcer.notNull (aRequestScope, "RequestScope");
ValueEnforcer.notNull (sHRef, "HRef");
// If known protocol, keep it
if (hasKnownProtocol (sHRef))
return sHRef;
final String sContextPath = aRequestScope.getContextPath ();
return aRequestScope.encodeURL (_getURIWithContext (sContextPath, sHRef));
} | class class_name[name] begin[{]
method[getURIWithContext, return_type[type[String]], modifier[public static], parameter[aRequestScope, sHRef]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aRequestScope], literal["RequestScope"]]]
call[ValueEnforcer.notNull, parameter[member[.sHRef], literal["HRef"]]]
if[call[.hasKnownProtocol, parameter[member[.sHRef]]]] begin[{]
return[member[.sHRef]]
else begin[{]
None
end[}]
local_variable[type[String], sContextPath]
return[call[aRequestScope.encodeURL, parameter[call[._getURIWithContext, parameter[member[.sContextPath], member[.sHRef]]]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[String] identifier[getURIWithContext] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[IRequestWebScopeWithoutResponse] identifier[aRequestScope] , annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[sHRef] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aRequestScope] , literal[String] operator[SEP] operator[SEP] identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[sHRef] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasKnownProtocol] operator[SEP] identifier[sHRef] operator[SEP] operator[SEP] Keyword[return] identifier[sHRef] operator[SEP] Keyword[final] identifier[String] identifier[sContextPath] operator[=] identifier[aRequestScope] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[aRequestScope] operator[SEP] identifier[encodeURL] operator[SEP] identifier[_getURIWithContext] operator[SEP] identifier[sContextPath] , identifier[sHRef] operator[SEP] operator[SEP] operator[SEP]
}
|
private int getNumBlocks(R delta) {
ByteBuffer content = getValue(delta);
int numBlocks = 0;
// build numBlocks by adding together each hex digit
for (int i = 0; i < _prefixLength; i++) {
byte b = content.get(i);
numBlocks = numBlocks << 4 | (b <= '9' ? b - '0' : b - 'A' + 10);
}
return numBlocks;
} | class class_name[name] begin[{]
method[getNumBlocks, return_type[type[int]], modifier[private], parameter[delta]] begin[{]
local_variable[type[ByteBuffer], content]
local_variable[type[int], numBlocks]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=numBlocks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=numBlocks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=<<), operandr=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), if_false=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='A'), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=+), if_true=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-)), operator=|)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=_prefixLength, 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[.numBlocks]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[getNumBlocks] operator[SEP] identifier[R] identifier[delta] operator[SEP] {
identifier[ByteBuffer] identifier[content] operator[=] identifier[getValue] operator[SEP] identifier[delta] operator[SEP] operator[SEP] Keyword[int] identifier[numBlocks] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[_prefixLength] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[byte] identifier[b] operator[=] identifier[content] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[numBlocks] operator[=] identifier[numBlocks] operator[<<] Other[4] operator[|] operator[SEP] identifier[b] operator[<=] literal[String] operator[?] identifier[b] operator[-] literal[String] operator[:] identifier[b] operator[-] literal[String] operator[+] Other[10] operator[SEP] operator[SEP]
}
Keyword[return] identifier[numBlocks] operator[SEP]
}
|
public static CPInstance fetchByC_ERC(long companyId,
String externalReferenceCode, boolean retrieveFromCache) {
return getPersistence()
.fetchByC_ERC(companyId, externalReferenceCode,
retrieveFromCache);
} | class class_name[name] begin[{]
method[fetchByC_ERC, return_type[type[CPInstance]], modifier[public static], parameter[companyId, externalReferenceCode, retrieveFromCache]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CPInstance] identifier[fetchByC_ERC] operator[SEP] Keyword[long] identifier[companyId] , identifier[String] identifier[externalReferenceCode] , Keyword[boolean] identifier[retrieveFromCache] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[fetchByC_ERC] operator[SEP] identifier[companyId] , identifier[externalReferenceCode] , identifier[retrieveFromCache] operator[SEP] operator[SEP]
}
|
public List<Task> executeAndJumpTask(String taskId, String operator, Map<String, Object> args, String nodeName) {
Execution execution = execute(taskId, operator, args);
if(execution == null) return Collections.emptyList();
ProcessModel model = execution.getProcess().getModel();
AssertHelper.notNull(model, "当前任务未找到流程定义模型");
if(StringHelper.isEmpty(nodeName)) {
Task newTask = task().rejectTask(model, execution.getTask());
execution.addTask(newTask);
} else {
NodeModel nodeModel = model.getNode(nodeName);
AssertHelper.notNull(nodeModel, "根据节点名称[" + nodeName + "]无法找到节点模型");
//动态创建转移对象,由转移对象执行execution实例
TransitionModel tm = new TransitionModel();
tm.setTarget(nodeModel);
tm.setEnabled(true);
tm.execute(execution);
}
return execution.getTasks();
} | class class_name[name] begin[{]
method[executeAndJumpTask, return_type[type[List]], modifier[public], parameter[taskId, operator, args, nodeName]] begin[{]
local_variable[type[Execution], execution]
if[binary_operation[member[.execution], ==, literal[null]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[ProcessModel], model]
call[AssertHelper.notNull, parameter[member[.model], literal["当前任务未找到流程定义模型"]]]
if[call[StringHelper.isEmpty, parameter[member[.nodeName]]]] begin[{]
local_variable[type[Task], newTask]
call[execution.addTask, parameter[member[.newTask]]]
else begin[{]
local_variable[type[NodeModel], nodeModel]
call[AssertHelper.notNull, parameter[member[.nodeModel], binary_operation[binary_operation[literal["根据节点名称["], +, member[.nodeName]], +, literal["]无法找到节点模型"]]]]
local_variable[type[TransitionModel], tm]
call[tm.setTarget, parameter[member[.nodeModel]]]
call[tm.setEnabled, parameter[literal[true]]]
call[tm.execute, parameter[member[.execution]]]
end[}]
return[call[execution.getTasks, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Task] operator[>] identifier[executeAndJumpTask] operator[SEP] identifier[String] identifier[taskId] , identifier[String] identifier[operator] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[args] , identifier[String] identifier[nodeName] operator[SEP] {
identifier[Execution] identifier[execution] operator[=] identifier[execute] operator[SEP] identifier[taskId] , identifier[operator] , identifier[args] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[execution] operator[==] Other[null] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] identifier[ProcessModel] identifier[model] operator[=] identifier[execution] operator[SEP] identifier[getProcess] operator[SEP] operator[SEP] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[AssertHelper] operator[SEP] identifier[notNull] operator[SEP] identifier[model] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[isEmpty] operator[SEP] identifier[nodeName] operator[SEP] operator[SEP] {
identifier[Task] identifier[newTask] operator[=] identifier[task] operator[SEP] operator[SEP] operator[SEP] identifier[rejectTask] operator[SEP] identifier[model] , identifier[execution] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[execution] operator[SEP] identifier[addTask] operator[SEP] identifier[newTask] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[NodeModel] identifier[nodeModel] operator[=] identifier[model] operator[SEP] identifier[getNode] operator[SEP] identifier[nodeName] operator[SEP] operator[SEP] identifier[AssertHelper] operator[SEP] identifier[notNull] operator[SEP] identifier[nodeModel] , literal[String] operator[+] identifier[nodeName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[TransitionModel] identifier[tm] operator[=] Keyword[new] identifier[TransitionModel] operator[SEP] operator[SEP] operator[SEP] identifier[tm] operator[SEP] identifier[setTarget] operator[SEP] identifier[nodeModel] operator[SEP] operator[SEP] identifier[tm] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[tm] operator[SEP] identifier[execute] operator[SEP] identifier[execution] operator[SEP] operator[SEP]
}
Keyword[return] identifier[execution] operator[SEP] identifier[getTasks] operator[SEP] operator[SEP] operator[SEP]
}
|
public static short CONST_SHORT(final int v) throws IllegalArgumentException {
if (v < Short.MIN_VALUE || v > Short.MAX_VALUE) {
throw new IllegalArgumentException("Supplied value must be a valid byte literal between -32768 and 32767: [" + v + "]");
}
return (short) v;
} | class class_name[name] begin[{]
method[CONST_SHORT, return_type[type[short]], modifier[public static], parameter[v]] begin[{]
if[binary_operation[binary_operation[member[.v], <, member[Short.MIN_VALUE]], ||, binary_operation[member[.v], >, member[Short.MAX_VALUE]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Supplied value must be a valid byte literal between -32768 and 32767: ["), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=short))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[short] identifier[CONST_SHORT] operator[SEP] Keyword[final] Keyword[int] identifier[v] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] identifier[v] operator[<] identifier[Short] operator[SEP] identifier[MIN_VALUE] operator[||] identifier[v] operator[>] identifier[Short] operator[SEP] identifier[MAX_VALUE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[v] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] Keyword[short] operator[SEP] identifier[v] operator[SEP]
}
|
public JellyContext createContext() {
JellyContext context = new CustomJellyContext(ROOT_CONTEXT);
context.setClassLoader(owner.loader);
context.setExportLibraries(false);
return context;
} | class class_name[name] begin[{]
method[createContext, return_type[type[JellyContext]], modifier[public], parameter[]] begin[{]
local_variable[type[JellyContext], context]
call[context.setClassLoader, parameter[member[owner.loader]]]
call[context.setExportLibraries, parameter[literal[false]]]
return[member[.context]]
end[}]
END[}] | Keyword[public] identifier[JellyContext] identifier[createContext] operator[SEP] operator[SEP] {
identifier[JellyContext] identifier[context] operator[=] Keyword[new] identifier[CustomJellyContext] operator[SEP] identifier[ROOT_CONTEXT] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[setClassLoader] operator[SEP] identifier[owner] operator[SEP] identifier[loader] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[setExportLibraries] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[context] operator[SEP]
}
|
private void initComponents()
{
java.awt.GridBagConstraints gridBagConstraints;
mainMap = new org.jxmapviewer.JXMapViewer();
miniMap = new org.jxmapviewer.JXMapViewer();
jPanel1 = new javax.swing.JPanel();
zoomInButton = new javax.swing.JButton();
zoomOutButton = new javax.swing.JButton();
zoomSlider = new javax.swing.JSlider();
setLayout(new java.awt.GridBagLayout());
mainMap.setLayout(new java.awt.GridBagLayout());
miniMap.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
miniMap.setMinimumSize(new java.awt.Dimension(100, 100));
miniMap.setPreferredSize(new java.awt.Dimension(100, 100));
miniMap.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
mainMap.add(miniMap, gridBagConstraints);
jPanel1.setOpaque(false);
jPanel1.setLayout(new java.awt.GridBagLayout());
zoomInButton.setAction(getZoomOutAction());
zoomInButton.setIcon(new ImageIcon(JXMapKit.class.getResource("/images/plus.png")));
zoomInButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
zoomInButton.setMaximumSize(new java.awt.Dimension(20, 20));
zoomInButton.setMinimumSize(new java.awt.Dimension(20, 20));
zoomInButton.setOpaque(false);
zoomInButton.setPreferredSize(new java.awt.Dimension(20, 20));
zoomInButton.addActionListener(new java.awt.event.ActionListener()
{
@Override
public void actionPerformed(java.awt.event.ActionEvent evt)
{
zoomInButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
jPanel1.add(zoomInButton, gridBagConstraints);
zoomOutButton.setAction(getZoomInAction());
zoomOutButton.setIcon(new ImageIcon(JXMapKit.class.getResource("/images/minus.png")));
zoomOutButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
zoomOutButton.setMaximumSize(new java.awt.Dimension(20, 20));
zoomOutButton.setMinimumSize(new java.awt.Dimension(20, 20));
zoomOutButton.setOpaque(false);
zoomOutButton.setPreferredSize(new java.awt.Dimension(20, 20));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weighty = 1.0;
jPanel1.add(zoomOutButton, gridBagConstraints);
zoomSlider.setMajorTickSpacing(1);
zoomSlider.setMaximum(15);
zoomSlider.setMinimum(10);
zoomSlider.setMinorTickSpacing(1);
zoomSlider.setOrientation(SwingConstants.VERTICAL);
zoomSlider.setPaintTicks(true);
zoomSlider.setSnapToTicks(true);
zoomSlider.setMinimumSize(new java.awt.Dimension(35, 100));
zoomSlider.setPreferredSize(new java.awt.Dimension(35, 190));
zoomSlider.addChangeListener(new javax.swing.event.ChangeListener()
{
@Override
public void stateChanged(javax.swing.event.ChangeEvent evt)
{
zoomSliderStateChanged(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
jPanel1.add(zoomSlider, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
mainMap.add(jPanel1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(mainMap, gridBagConstraints);
} | class class_name[name] begin[{]
method[initComponents, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[java], gridBagConstraints]
assign[member[.mainMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=jxmapviewer, sub_type=ReferenceType(arguments=None, dimensions=None, name=JXMapViewer, sub_type=None))))]
assign[member[.miniMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=jxmapviewer, sub_type=ReferenceType(arguments=None, dimensions=None, name=JXMapViewer, sub_type=None))))]
assign[member[.jPanel1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JPanel, sub_type=None))))]
assign[member[.zoomInButton], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JButton, sub_type=None))))]
assign[member[.zoomOutButton], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JButton, sub_type=None))))]
assign[member[.zoomSlider], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JSlider, sub_type=None))))]
call[.setLayout, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagLayout, sub_type=None))))]]
call[mainMap.setLayout, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagLayout, sub_type=None))))]]
call[miniMap.setBorder, parameter[call[javax.swing.BorderFactory.createLineBorder, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Color, sub_type=None))))]]]]
call[miniMap.setMinimumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[miniMap.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[miniMap.setLayout, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagLayout, sub_type=None))))]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.gridx], literal[1]]
assign[member[gridBagConstraints.gridy], literal[0]]
assign[member[gridBagConstraints.anchor], member[java.awt.GridBagConstraints.SOUTHEAST]]
assign[member[gridBagConstraints.weightx], literal[1.0]]
assign[member[gridBagConstraints.weighty], literal[1.0]]
call[mainMap.add, parameter[member[.miniMap], member[.gridBagConstraints]]]
call[jPanel1.setOpaque, parameter[literal[false]]]
call[jPanel1.setLayout, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagLayout, sub_type=None))))]]
call[zoomInButton.setAction, parameter[call[.getZoomOutAction, parameter[]]]]
call[zoomInButton.setIcon, parameter[ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/images/plus.png")], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JXMapKit, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ImageIcon, sub_type=None))]]
call[zoomInButton.setMargin, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Insets, sub_type=None))))]]
call[zoomInButton.setMaximumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomInButton.setMinimumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomInButton.setOpaque, parameter[literal[false]]]
call[zoomInButton.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomInButton.addActionListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=zoomInButtonActionPerformed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=actionPerformed, parameters=[FormalParameter(annotations=[], modifiers=set(), name=evt, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=ActionEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=ActionListener, sub_type=None)))))]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.gridx], literal[1]]
assign[member[gridBagConstraints.gridy], literal[1]]
assign[member[gridBagConstraints.anchor], member[java.awt.GridBagConstraints.NORTHEAST]]
assign[member[gridBagConstraints.weightx], literal[1.0]]
assign[member[gridBagConstraints.weighty], literal[1.0]]
call[jPanel1.add, parameter[member[.zoomInButton], member[.gridBagConstraints]]]
call[zoomOutButton.setAction, parameter[call[.getZoomInAction, parameter[]]]]
call[zoomOutButton.setIcon, parameter[ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/images/minus.png")], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JXMapKit, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ImageIcon, sub_type=None))]]
call[zoomOutButton.setMargin, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Insets, sub_type=None))))]]
call[zoomOutButton.setMaximumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomOutButton.setMinimumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomOutButton.setOpaque, parameter[literal[false]]]
call[zoomOutButton.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.gridx], literal[0]]
assign[member[gridBagConstraints.gridy], literal[1]]
assign[member[gridBagConstraints.anchor], member[java.awt.GridBagConstraints.NORTHWEST]]
assign[member[gridBagConstraints.weighty], literal[1.0]]
call[jPanel1.add, parameter[member[.zoomOutButton], member[.gridBagConstraints]]]
call[zoomSlider.setMajorTickSpacing, parameter[literal[1]]]
call[zoomSlider.setMaximum, parameter[literal[15]]]
call[zoomSlider.setMinimum, parameter[literal[10]]]
call[zoomSlider.setMinorTickSpacing, parameter[literal[1]]]
call[zoomSlider.setOrientation, parameter[member[SwingConstants.VERTICAL]]]
call[zoomSlider.setPaintTicks, parameter[literal[true]]]
call[zoomSlider.setSnapToTicks, parameter[literal[true]]]
call[zoomSlider.setMinimumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=35), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomSlider.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=35), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=190)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))))]]
call[zoomSlider.addChangeListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=zoomSliderStateChanged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=stateChanged, parameters=[FormalParameter(annotations=[], modifiers=set(), name=evt, type=ReferenceType(arguments=None, dimensions=[], name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=ChangeEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=ChangeListener, sub_type=None)))))]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.gridx], literal[0]]
assign[member[gridBagConstraints.gridy], literal[0]]
assign[member[gridBagConstraints.gridwidth], literal[2]]
assign[member[gridBagConstraints.fill], member[java.awt.GridBagConstraints.VERTICAL]]
assign[member[gridBagConstraints.anchor], member[java.awt.GridBagConstraints.NORTH]]
call[jPanel1.add, parameter[member[.zoomSlider], member[.gridBagConstraints]]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.gridx], literal[0]]
assign[member[gridBagConstraints.gridy], literal[0]]
assign[member[gridBagConstraints.anchor], member[java.awt.GridBagConstraints.SOUTHWEST]]
assign[member[gridBagConstraints.weightx], literal[1.0]]
assign[member[gridBagConstraints.weighty], literal[1.0]]
assign[member[gridBagConstraints.insets], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=Insets, sub_type=None))))]
call[mainMap.add, parameter[member[.jPanel1], member[.gridBagConstraints]]]
assign[member[.gridBagConstraints], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=GridBagConstraints, sub_type=None))))]
assign[member[gridBagConstraints.fill], member[java.awt.GridBagConstraints.BOTH]]
assign[member[gridBagConstraints.weightx], literal[1.0]]
assign[member[gridBagConstraints.weighty], literal[1.0]]
call[.add, parameter[member[.mainMap], member[.gridBagConstraints]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initComponents] operator[SEP] operator[SEP] {
identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] identifier[gridBagConstraints] operator[SEP] identifier[mainMap] operator[=] Keyword[new] identifier[org] operator[SEP] identifier[jxmapviewer] operator[SEP] identifier[JXMapViewer] operator[SEP] operator[SEP] operator[SEP] identifier[miniMap] operator[=] Keyword[new] identifier[org] operator[SEP] identifier[jxmapviewer] operator[SEP] identifier[JXMapViewer] operator[SEP] operator[SEP] operator[SEP] identifier[jPanel1] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JPanel] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JButton] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JButton] operator[SEP] operator[SEP] operator[SEP] identifier[zoomSlider] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JSlider] operator[SEP] operator[SEP] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagLayout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mainMap] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagLayout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[miniMap] operator[SEP] identifier[setBorder] operator[SEP] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[BorderFactory] operator[SEP] identifier[createLineBorder] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Color] operator[SEP] Other[0] , Other[0] , Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[miniMap] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[100] , Other[100] operator[SEP] operator[SEP] operator[SEP] identifier[miniMap] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[100] , Other[100] operator[SEP] operator[SEP] operator[SEP] identifier[miniMap] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagLayout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridx] operator[=] Other[1] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridy] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[anchor] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[SOUTHEAST] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weightx] operator[=] literal[Float] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weighty] operator[=] literal[Float] operator[SEP] identifier[mainMap] operator[SEP] identifier[add] operator[SEP] identifier[miniMap] , identifier[gridBagConstraints] operator[SEP] operator[SEP] identifier[jPanel1] operator[SEP] identifier[setOpaque] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[jPanel1] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagLayout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setAction] operator[SEP] identifier[getZoomOutAction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setIcon] operator[SEP] Keyword[new] identifier[ImageIcon] operator[SEP] identifier[JXMapKit] operator[SEP] Keyword[class] operator[SEP] identifier[getResource] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setMargin] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Insets] operator[SEP] Other[2] , Other[2] , Other[2] , Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setMaximumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setOpaque] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[zoomInButton] operator[SEP] identifier[addActionListener] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[actionPerformed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
identifier[zoomInButtonActionPerformed] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridx] operator[=] Other[1] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridy] operator[=] Other[1] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[anchor] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[NORTHEAST] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weightx] operator[=] literal[Float] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weighty] operator[=] literal[Float] operator[SEP] identifier[jPanel1] operator[SEP] identifier[add] operator[SEP] identifier[zoomInButton] , identifier[gridBagConstraints] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setAction] operator[SEP] identifier[getZoomInAction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setIcon] operator[SEP] Keyword[new] identifier[ImageIcon] operator[SEP] identifier[JXMapKit] operator[SEP] Keyword[class] operator[SEP] identifier[getResource] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setMargin] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Insets] operator[SEP] Other[2] , Other[2] , Other[2] , Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setMaximumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setOpaque] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[zoomOutButton] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[20] , Other[20] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridx] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridy] operator[=] Other[1] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[anchor] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[NORTHWEST] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weighty] operator[=] literal[Float] operator[SEP] identifier[jPanel1] operator[SEP] identifier[add] operator[SEP] identifier[zoomOutButton] , identifier[gridBagConstraints] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setMajorTickSpacing] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setMaximum] operator[SEP] Other[15] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setMinimum] operator[SEP] Other[10] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setMinorTickSpacing] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setOrientation] operator[SEP] identifier[SwingConstants] operator[SEP] identifier[VERTICAL] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setPaintTicks] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setSnapToTicks] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[35] , Other[100] operator[SEP] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Dimension] operator[SEP] Other[35] , Other[190] operator[SEP] operator[SEP] operator[SEP] identifier[zoomSlider] operator[SEP] identifier[addChangeListener] operator[SEP] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[event] operator[SEP] identifier[ChangeListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[stateChanged] operator[SEP] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[event] operator[SEP] identifier[ChangeEvent] identifier[evt] operator[SEP] {
identifier[zoomSliderStateChanged] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridx] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridy] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridwidth] operator[=] Other[2] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[fill] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[VERTICAL] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[anchor] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[NORTH] operator[SEP] identifier[jPanel1] operator[SEP] identifier[add] operator[SEP] identifier[zoomSlider] , identifier[gridBagConstraints] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridx] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[gridy] operator[=] Other[0] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[anchor] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[SOUTHWEST] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weightx] operator[=] literal[Float] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weighty] operator[=] literal[Float] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[insets] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Insets] operator[SEP] Other[4] , Other[4] , Other[4] , Other[4] operator[SEP] operator[SEP] identifier[mainMap] operator[SEP] identifier[add] operator[SEP] identifier[jPanel1] , identifier[gridBagConstraints] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[fill] operator[=] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[GridBagConstraints] operator[SEP] identifier[BOTH] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weightx] operator[=] literal[Float] operator[SEP] identifier[gridBagConstraints] operator[SEP] identifier[weighty] operator[=] literal[Float] operator[SEP] identifier[add] operator[SEP] identifier[mainMap] , identifier[gridBagConstraints] operator[SEP] operator[SEP]
}
|
public RelatedTags getRelated(String tag) throws JinxException {
JinxUtils.validateParams(tag);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getRelated");
params.put("tag", tag);
return jinx.flickrGet(params, RelatedTags.class);
} | class class_name[name] begin[{]
method[getRelated, return_type[type[RelatedTags]], modifier[public], parameter[tag]] begin[{]
call[JinxUtils.validateParams, parameter[member[.tag]]]
local_variable[type[Map], params]
call[params.put, parameter[literal["method"], literal["flickr.tags.getRelated"]]]
call[params.put, parameter[literal["tag"], member[.tag]]]
return[call[jinx.flickrGet, parameter[member[.params], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RelatedTags, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[RelatedTags] identifier[getRelated] operator[SEP] identifier[String] identifier[tag] operator[SEP] Keyword[throws] identifier[JinxException] {
identifier[JinxUtils] operator[SEP] identifier[validateParams] operator[SEP] identifier[tag] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[tag] operator[SEP] operator[SEP] Keyword[return] identifier[jinx] operator[SEP] identifier[flickrGet] operator[SEP] identifier[params] , identifier[RelatedTags] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
@Override
public double getCirumscribedRadius() {
return 0.5* Math.sqrt(width*width + height*height + length*length);
} | class class_name[name] begin[{]
method[getCirumscribedRadius, return_type[type[double]], modifier[public], parameter[]] begin[{]
return[binary_operation[literal[0.5], *, call[Math.sqrt, parameter[binary_operation[binary_operation[binary_operation[member[.width], *, member[.width]], +, binary_operation[member[.height], *, member[.height]]], +, binary_operation[member[.length], *, member[.length]]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[getCirumscribedRadius] operator[SEP] operator[SEP] {
Keyword[return] literal[Float] operator[*] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[width] operator[*] identifier[width] operator[+] identifier[height] operator[*] identifier[height] operator[+] identifier[length] operator[*] identifier[length] operator[SEP] operator[SEP]
}
|
public void addOrder(String columnName, boolean ascending) {
if (columnName == null) {
return;
}
for (int i = 0; i < columns.size(); i++) {
if (!columnName.equals(columns.get(i).getData())) {
continue;
}
order.add(new Order(i, ascending ? "asc" : "desc"));
}
} | class class_name[name] begin[{]
method[addOrder, return_type[void], modifier[public], parameter[columnName, ascending]] begin[{]
if[binary_operation[member[.columnName], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=columns, selectors=[MethodInvocation(arguments=[], member=getData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=columnName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=MemberReference(member=ascending, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="desc"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="asc"))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Order, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=order, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=columns, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addOrder] operator[SEP] identifier[String] identifier[columnName] , Keyword[boolean] identifier[ascending] operator[SEP] {
Keyword[if] operator[SEP] identifier[columnName] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[columns] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[columnName] operator[SEP] identifier[equals] operator[SEP] identifier[columns] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[order] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Order] operator[SEP] identifier[i] , identifier[ascending] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException {
javaClassObject = new MemoryJavaClassObject(className, kind);
return javaClassObject;
} | class class_name[name] begin[{]
method[getJavaFileForOutput, return_type[type[JavaFileObject]], modifier[public], parameter[location, className, kind, sibling]] begin[{]
assign[member[.javaClassObject], ClassCreator(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=kind, 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=MemoryJavaClassObject, sub_type=None))]
return[member[.javaClassObject]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[JavaFileObject] identifier[getJavaFileForOutput] operator[SEP] identifier[Location] identifier[location] , identifier[String] identifier[className] , identifier[JavaFileObject] operator[SEP] identifier[Kind] identifier[kind] , identifier[FileObject] identifier[sibling] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[javaClassObject] operator[=] Keyword[new] identifier[MemoryJavaClassObject] operator[SEP] identifier[className] , identifier[kind] operator[SEP] operator[SEP] Keyword[return] identifier[javaClassObject] operator[SEP]
}
|
public final void writeTo(String fmt, OutputStream out) throws IOException {
if (fmt.equalsIgnoreCase(SVG_FMT)) {
out.write(toSvgStr().getBytes(Charsets.UTF_8));
} else if (fmt.equalsIgnoreCase(PS_FMT)) {
out.write(toEpsStr().getBytes(Charsets.UTF_8));
} else if (fmt.equalsIgnoreCase(PDF_FMT)) {
out.write(toPdfStr().getBytes(Charsets.UTF_8));
} else {
ImageIO.write(toImg(), fmt, out);
}
} | class class_name[name] begin[{]
method[writeTo, return_type[void], modifier[final public], parameter[fmt, out]] begin[{]
if[call[fmt.equalsIgnoreCase, parameter[member[.SVG_FMT]]]] begin[{]
call[out.write, parameter[call[.toSvgStr, parameter[]]]]
else begin[{]
if[call[fmt.equalsIgnoreCase, parameter[member[.PS_FMT]]]] begin[{]
call[out.write, parameter[call[.toEpsStr, parameter[]]]]
else begin[{]
if[call[fmt.equalsIgnoreCase, parameter[member[.PDF_FMT]]]] begin[{]
call[out.write, parameter[call[.toPdfStr, parameter[]]]]
else begin[{]
call[ImageIO.write, parameter[call[.toImg, parameter[]], member[.fmt], member[.out]]]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[writeTo] operator[SEP] identifier[String] identifier[fmt] , identifier[OutputStream] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[fmt] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[SVG_FMT] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[toSvgStr] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fmt] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[PS_FMT] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[toEpsStr] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fmt] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[PDF_FMT] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[toPdfStr] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ImageIO] operator[SEP] identifier[write] operator[SEP] identifier[toImg] operator[SEP] operator[SEP] , identifier[fmt] , identifier[out] operator[SEP] operator[SEP]
}
}
|
public double[] getRow(int row) {
checkIndices(row, 0);
double[] rowArr = new double[cols];
int index = getIndex(row, 0);
for (int i = 0; i < cols; ++i)
rowArr[i] = matrix[index++];
return rowArr;
} | class class_name[name] begin[{]
method[getRow, return_type[type[double]], modifier[public], parameter[row]] begin[{]
call[.checkIndices, parameter[member[.row], literal[0]]]
local_variable[type[double], rowArr]
local_variable[type[int], index]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=matrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))])), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cols, 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[.rowArr]]
end[}]
END[}] | Keyword[public] Keyword[double] operator[SEP] operator[SEP] identifier[getRow] operator[SEP] Keyword[int] identifier[row] operator[SEP] {
identifier[checkIndices] operator[SEP] identifier[row] , Other[0] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[rowArr] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[cols] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[getIndex] operator[SEP] identifier[row] , Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[cols] operator[SEP] operator[++] identifier[i] operator[SEP] identifier[rowArr] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[matrix] operator[SEP] identifier[index] operator[++] operator[SEP] operator[SEP] Keyword[return] identifier[rowArr] operator[SEP]
}
|
public CloseableReference<Bitmap> createBitmap(
Bitmap source,
int x,
int y,
int width,
int height,
@Nullable Object callerContext) {
return createBitmap(source, x, y, width, height, null, false, callerContext);
} | class class_name[name] begin[{]
method[createBitmap, return_type[type[CloseableReference]], modifier[public], parameter[source, x, y, width, height, callerContext]] begin[{]
return[call[.createBitmap, parameter[member[.source], member[.x], member[.y], member[.width], member[.height], literal[null], literal[false], member[.callerContext]]]]
end[}]
END[}] | Keyword[public] identifier[CloseableReference] operator[<] identifier[Bitmap] operator[>] identifier[createBitmap] operator[SEP] identifier[Bitmap] identifier[source] , Keyword[int] identifier[x] , Keyword[int] identifier[y] , Keyword[int] identifier[width] , Keyword[int] identifier[height] , annotation[@] identifier[Nullable] identifier[Object] identifier[callerContext] operator[SEP] {
Keyword[return] identifier[createBitmap] operator[SEP] identifier[source] , identifier[x] , identifier[y] , identifier[width] , identifier[height] , Other[null] , literal[boolean] , identifier[callerContext] operator[SEP] operator[SEP]
}
|
public void setParamWithProperty(int param, boolean hasProperty) {
if (param < 0 || param > 31) {
return;
}
if (hasProperty) {
bits |= (1 << param);
} else {
bits &= ~(1 << param);
}
} | class class_name[name] begin[{]
method[setParamWithProperty, return_type[void], modifier[public], parameter[param, hasProperty]] begin[{]
if[binary_operation[binary_operation[member[.param], <, literal[0]], ||, binary_operation[member[.param], >, literal[31]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[member[.hasProperty]] begin[{]
assign[member[.bits], binary_operation[literal[1], <<, member[.param]]]
else begin[{]
assign[member[.bits], binary_operation[literal[1], <<, member[.param]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setParamWithProperty] operator[SEP] Keyword[int] identifier[param] , Keyword[boolean] identifier[hasProperty] operator[SEP] {
Keyword[if] operator[SEP] identifier[param] operator[<] Other[0] operator[||] identifier[param] operator[>] Other[31] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hasProperty] operator[SEP] {
identifier[bits] operator[|=] operator[SEP] Other[1] operator[<<] identifier[param] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bits] operator[&=] operator[~] operator[SEP] Other[1] operator[<<] identifier[param] operator[SEP] operator[SEP]
}
}
|
public static long getResultDisplayDurationInMsOrDefaultValue(Intent intent) {
if (intent == null) return DEFAULT_INTENT_RESULT_DURATION_MS;
return intent.getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
DEFAULT_INTENT_RESULT_DURATION_MS);
} | class class_name[name] begin[{]
method[getResultDisplayDurationInMsOrDefaultValue, return_type[type[long]], modifier[public static], parameter[intent]] begin[{]
if[binary_operation[member[.intent], ==, literal[null]]] begin[{]
return[member[.DEFAULT_INTENT_RESULT_DURATION_MS]]
else begin[{]
None
end[}]
return[call[intent.getLongExtra, parameter[member[Intents.Scan.RESULT_DISPLAY_DURATION_MS], member[.DEFAULT_INTENT_RESULT_DURATION_MS]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[getResultDisplayDurationInMsOrDefaultValue] operator[SEP] identifier[Intent] identifier[intent] operator[SEP] {
Keyword[if] operator[SEP] identifier[intent] operator[==] Other[null] operator[SEP] Keyword[return] identifier[DEFAULT_INTENT_RESULT_DURATION_MS] operator[SEP] Keyword[return] identifier[intent] operator[SEP] identifier[getLongExtra] operator[SEP] identifier[Intents] operator[SEP] identifier[Scan] operator[SEP] identifier[RESULT_DISPLAY_DURATION_MS] , identifier[DEFAULT_INTENT_RESULT_DURATION_MS] operator[SEP] operator[SEP]
}
|
@GwtIncompatible // propagateIfInstanceOf
public static <X1 extends Throwable, X2 extends Throwable> void propagateIfPossible(
@Nullable Throwable throwable, Class<X1> declaredType1, Class<X2> declaredType2)
throws X1, X2 {
checkNotNull(declaredType2);
propagateIfInstanceOf(throwable, declaredType1);
propagateIfPossible(throwable, declaredType2);
} | class class_name[name] begin[{]
method[propagateIfPossible, return_type[void], modifier[public static], parameter[throwable, declaredType1, declaredType2]] begin[{]
call[.checkNotNull, parameter[member[.declaredType2]]]
call[.propagateIfInstanceOf, parameter[member[.throwable], member[.declaredType1]]]
call[.propagateIfPossible, parameter[member[.throwable], member[.declaredType2]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] Keyword[public] Keyword[static] operator[<] identifier[X1] Keyword[extends] identifier[Throwable] , identifier[X2] Keyword[extends] identifier[Throwable] operator[>] Keyword[void] identifier[propagateIfPossible] operator[SEP] annotation[@] identifier[Nullable] identifier[Throwable] identifier[throwable] , identifier[Class] operator[<] identifier[X1] operator[>] identifier[declaredType1] , identifier[Class] operator[<] identifier[X2] operator[>] identifier[declaredType2] operator[SEP] Keyword[throws] identifier[X1] , identifier[X2] {
identifier[checkNotNull] operator[SEP] identifier[declaredType2] operator[SEP] operator[SEP] identifier[propagateIfInstanceOf] operator[SEP] identifier[throwable] , identifier[declaredType1] operator[SEP] operator[SEP] identifier[propagateIfPossible] operator[SEP] identifier[throwable] , identifier[declaredType2] operator[SEP] operator[SEP]
}
|
public void removeSubject(String subject) {
String prefix = normalizePrefix(subject);
for (String suffix : getSuffixes(prefix).keySet()) {
setItem(prefix + suffix, null);
}
} | class class_name[name] begin[{]
method[removeSubject, return_type[void], modifier[public], parameter[subject]] begin[{]
local_variable[type[String], prefix]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSuffixes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=keySet, 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=suffix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeSubject] operator[SEP] identifier[String] identifier[subject] operator[SEP] {
identifier[String] identifier[prefix] operator[=] identifier[normalizePrefix] operator[SEP] identifier[subject] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[suffix] operator[:] identifier[getSuffixes] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[setItem] operator[SEP] identifier[prefix] operator[+] identifier[suffix] , Other[null] operator[SEP] operator[SEP]
}
}
|
public Type getType(DocumentResolver definitionDocumentResolver) {
Type type;
if (property instanceof RefProperty) {
RefProperty refProperty = (RefProperty) property;
if (refProperty.getRefFormat() == RefFormat.RELATIVE)
type = new ObjectType(refProperty.getTitle(), null); // FIXME : Workaround for https://github.com/swagger-api/swagger-parser/issues/177
else
type = new RefType(definitionDocumentResolver.apply(refProperty.getSimpleRef()), new ObjectType(refProperty.getSimpleRef(), null /* FIXME, not used for now */));
} else if (property instanceof ArrayProperty) {
ArrayProperty arrayProperty = (ArrayProperty) property;
Property items = arrayProperty.getItems();
if (items == null)
type = new ArrayType(arrayProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
else {
Type arrayType = new PropertyAdapter(items).getType(definitionDocumentResolver);
if (arrayType == null)
type = new ArrayType(arrayProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
else
type = new ArrayType(arrayProperty.getTitle(), new PropertyAdapter(items).getType(definitionDocumentResolver));
}
} else if (property instanceof MapProperty) {
MapProperty mapProperty = (MapProperty) property;
Property additionalProperties = mapProperty.getAdditionalProperties();
if (additionalProperties == null)
type = new MapType(mapProperty.getTitle(), new ObjectType(null, null)); // FIXME : Workaround for Swagger parser issue with composed models (https://github.com/Swagger2Markup/swagger2markup/issues/150)
else
type = new MapType(mapProperty.getTitle(), new PropertyAdapter(additionalProperties).getType(definitionDocumentResolver));
} else if (property instanceof StringProperty) {
StringProperty stringProperty = (StringProperty) property;
List<String> enums = stringProperty.getEnum();
if (CollectionUtils.isNotEmpty(enums)) {
type = new EnumType(stringProperty.getTitle(), enums);
} else if (isNotBlank(stringProperty.getFormat())) {
type = new BasicType(stringProperty.getType(), stringProperty.getTitle(), stringProperty.getFormat());
} else {
type = new BasicType(stringProperty.getType(), stringProperty.getTitle());
}
} else if (property instanceof ObjectProperty) {
type = new ObjectType(property.getTitle(), ((ObjectProperty) property).getProperties());
} else if (property instanceof IntegerProperty) {
IntegerProperty integerProperty = (IntegerProperty) property;
List<Integer> enums = integerProperty.getEnum();
if (CollectionUtils.isNotEmpty(enums)) {
// first, convert integer enum values to strings
List<String> enumValuesAsString = enums.stream().map(String::valueOf).collect(Collectors.toList());
type = new EnumType(integerProperty.getTitle(), enumValuesAsString);
} else if (isNotBlank(integerProperty.getFormat())) {
type = new BasicType(integerProperty.getType(), integerProperty.getTitle(), integerProperty.getFormat());
} else {
type = new BasicType(property.getType(), property.getTitle());
}
} else {
if (property.getType() == null) {
return null;
} else if (isNotBlank(property.getFormat())) {
type = new BasicType(property.getType(), property.getTitle(), property.getFormat());
} else {
type = new BasicType(property.getType(), property.getTitle());
}
}
return type;
} | class class_name[name] begin[{]
method[getType, return_type[type[Type]], modifier[public], parameter[definitionDocumentResolver]] begin[{]
local_variable[type[Type], type]
if[binary_operation[member[.property], instanceof, type[RefProperty]]] begin[{]
local_variable[type[RefProperty], refProperty]
if[binary_operation[call[refProperty.getRefFormat, parameter[]], ==, member[RefFormat.RELATIVE]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=refProperty, selectors=[], type_arguments=None), 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=ObjectType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSimpleRef, postfix_operators=[], prefix_operators=[], qualifier=refProperty, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=definitionDocumentResolver, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSimpleRef, postfix_operators=[], prefix_operators=[], qualifier=refProperty, selectors=[], type_arguments=None), 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=ObjectType, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RefType, sub_type=None))]
end[}]
else begin[{]
if[binary_operation[member[.property], instanceof, type[ArrayProperty]]] begin[{]
local_variable[type[ArrayProperty], arrayProperty]
local_variable[type[Property], items]
if[binary_operation[member[.items], ==, literal[null]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=arrayProperty, selectors=[], type_arguments=None), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectType, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayType, sub_type=None))]
else begin[{]
local_variable[type[Type], arrayType]
if[binary_operation[member[.arrayType], ==, literal[null]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=arrayProperty, selectors=[], type_arguments=None), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectType, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=arrayProperty, selectors=[], type_arguments=None), ClassCreator(arguments=[MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=definitionDocumentResolver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PropertyAdapter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayType, sub_type=None))]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.property], instanceof, type[MapProperty]]] begin[{]
local_variable[type[MapProperty], mapProperty]
local_variable[type[Property], additionalProperties]
if[binary_operation[member[.additionalProperties], ==, literal[null]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=mapProperty, selectors=[], type_arguments=None), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectType, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MapType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=mapProperty, selectors=[], type_arguments=None), ClassCreator(arguments=[MemberReference(member=additionalProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=definitionDocumentResolver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PropertyAdapter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MapType, sub_type=None))]
end[}]
else begin[{]
if[binary_operation[member[.property], instanceof, type[StringProperty]]] begin[{]
local_variable[type[StringProperty], stringProperty]
local_variable[type[List], enums]
if[call[CollectionUtils.isNotEmpty, parameter[member[.enums]]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None), MemberReference(member=enums, 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=EnumType, sub_type=None))]
else begin[{]
if[call[.isNotBlank, parameter[call[stringProperty.getFormat, parameter[]]]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFormat, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=stringProperty, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.property], instanceof, type[ObjectProperty]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), Cast(expression=MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ObjectProperty, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectType, sub_type=None))]
else begin[{]
if[binary_operation[member[.property], instanceof, type[IntegerProperty]]] begin[{]
local_variable[type[IntegerProperty], integerProperty]
local_variable[type[List], enums]
if[call[CollectionUtils.isNotEmpty, parameter[member[.enums]]]] begin[{]
local_variable[type[List], enumValuesAsString]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=integerProperty, selectors=[], type_arguments=None), MemberReference(member=enumValuesAsString, 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=EnumType, sub_type=None))]
else begin[{]
if[call[.isNotBlank, parameter[call[integerProperty.getFormat, parameter[]]]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=integerProperty, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=integerProperty, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFormat, postfix_operators=[], prefix_operators=[], qualifier=integerProperty, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
end[}]
end[}]
else begin[{]
if[binary_operation[call[property.getType, parameter[]], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
if[call[.isNotBlank, parameter[call[property.getFormat, parameter[]]]]] begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFormat, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
else begin[{]
assign[member[.type], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTitle, postfix_operators=[], prefix_operators=[], qualifier=property, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicType, sub_type=None))]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
return[member[.type]]
end[}]
END[}] | Keyword[public] identifier[Type] identifier[getType] operator[SEP] identifier[DocumentResolver] identifier[definitionDocumentResolver] operator[SEP] {
identifier[Type] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[RefProperty] operator[SEP] {
identifier[RefProperty] identifier[refProperty] operator[=] operator[SEP] identifier[RefProperty] operator[SEP] identifier[property] operator[SEP] Keyword[if] operator[SEP] identifier[refProperty] operator[SEP] identifier[getRefFormat] operator[SEP] operator[SEP] operator[==] identifier[RefFormat] operator[SEP] identifier[RELATIVE] operator[SEP] identifier[type] operator[=] Keyword[new] identifier[ObjectType] operator[SEP] identifier[refProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[else] identifier[type] operator[=] Keyword[new] identifier[RefType] operator[SEP] identifier[definitionDocumentResolver] operator[SEP] identifier[apply] operator[SEP] identifier[refProperty] operator[SEP] identifier[getSimpleRef] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[ObjectType] operator[SEP] identifier[refProperty] operator[SEP] identifier[getSimpleRef] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[ArrayProperty] operator[SEP] {
identifier[ArrayProperty] identifier[arrayProperty] operator[=] operator[SEP] identifier[ArrayProperty] operator[SEP] identifier[property] operator[SEP] identifier[Property] identifier[items] operator[=] identifier[arrayProperty] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] identifier[type] operator[=] Keyword[new] identifier[ArrayType] operator[SEP] identifier[arrayProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Keyword[new] identifier[ObjectType] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] Keyword[else] {
identifier[Type] identifier[arrayType] operator[=] Keyword[new] identifier[PropertyAdapter] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[getType] operator[SEP] identifier[definitionDocumentResolver] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[arrayType] operator[==] Other[null] operator[SEP] identifier[type] operator[=] Keyword[new] identifier[ArrayType] operator[SEP] identifier[arrayProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Keyword[new] identifier[ObjectType] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[type] operator[=] Keyword[new] identifier[ArrayType] operator[SEP] identifier[arrayProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Keyword[new] identifier[PropertyAdapter] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[getType] operator[SEP] identifier[definitionDocumentResolver] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[MapProperty] operator[SEP] {
identifier[MapProperty] identifier[mapProperty] operator[=] operator[SEP] identifier[MapProperty] operator[SEP] identifier[property] operator[SEP] identifier[Property] identifier[additionalProperties] operator[=] identifier[mapProperty] operator[SEP] identifier[getAdditionalProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[additionalProperties] operator[==] Other[null] operator[SEP] identifier[type] operator[=] Keyword[new] identifier[MapType] operator[SEP] identifier[mapProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Keyword[new] identifier[ObjectType] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[type] operator[=] Keyword[new] identifier[MapType] operator[SEP] identifier[mapProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , Keyword[new] identifier[PropertyAdapter] operator[SEP] identifier[additionalProperties] operator[SEP] operator[SEP] identifier[getType] operator[SEP] identifier[definitionDocumentResolver] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[StringProperty] operator[SEP] {
identifier[StringProperty] identifier[stringProperty] operator[=] operator[SEP] identifier[StringProperty] operator[SEP] identifier[property] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[enums] operator[=] identifier[stringProperty] operator[SEP] identifier[getEnum] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[enums] operator[SEP] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[EnumType] operator[SEP] identifier[stringProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[enums] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[stringProperty] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[stringProperty] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[stringProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[stringProperty] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[stringProperty] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[stringProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[ObjectProperty] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[ObjectType] operator[SEP] identifier[property] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , operator[SEP] operator[SEP] identifier[ObjectProperty] operator[SEP] identifier[property] operator[SEP] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[property] Keyword[instanceof] identifier[IntegerProperty] operator[SEP] {
identifier[IntegerProperty] identifier[integerProperty] operator[=] operator[SEP] identifier[IntegerProperty] operator[SEP] identifier[property] operator[SEP] identifier[List] operator[<] identifier[Integer] operator[>] identifier[enums] operator[=] identifier[integerProperty] operator[SEP] identifier[getEnum] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[enums] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[enumValuesAsString] operator[=] identifier[enums] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[String] operator[::] identifier[valueOf] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[type] operator[=] Keyword[new] identifier[EnumType] operator[SEP] identifier[integerProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[enumValuesAsString] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[integerProperty] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[integerProperty] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[integerProperty] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[integerProperty] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[property] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[type] operator[=] Keyword[new] identifier[BasicType] operator[SEP] identifier[property] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[property] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[type] operator[SEP]
}
|
public static Polygon circle(@NonNull Point center, double radius, @IntRange(from = 1) int steps,
@TurfConstants.TurfUnitCriteria String units) {
List<Point> coordinates = new ArrayList<>();
for (int i = 0; i < steps; i++) {
coordinates.add(TurfMeasurement.destination(center, radius, i * 360d / steps, units));
}
if (coordinates.size() > 0) {
coordinates.add(coordinates.get(0));
}
List<List<Point>> coordinate = new ArrayList<>();
coordinate.add(coordinates);
return Polygon.fromLngLats(coordinate);
} | class class_name[name] begin[{]
method[circle, return_type[type[Polygon]], modifier[public static], parameter[center, radius, steps, units]] begin[{]
local_variable[type[List], coordinates]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=center, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=radius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=360d), operator=*), operandr=MemberReference(member=steps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), MemberReference(member=units, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=destination, postfix_operators=[], prefix_operators=[], qualifier=TurfMeasurement, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=coordinates, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=steps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[call[coordinates.size, parameter[]], >, literal[0]]] begin[{]
call[coordinates.add, parameter[call[coordinates.get, parameter[literal[0]]]]]
else begin[{]
None
end[}]
local_variable[type[List], coordinate]
call[coordinate.add, parameter[member[.coordinates]]]
return[call[Polygon.fromLngLats, parameter[member[.coordinate]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Polygon] identifier[circle] operator[SEP] annotation[@] identifier[NonNull] identifier[Point] identifier[center] , Keyword[double] identifier[radius] , annotation[@] identifier[IntRange] operator[SEP] identifier[from] operator[=] Other[1] operator[SEP] Keyword[int] identifier[steps] , annotation[@] identifier[TurfConstants] operator[SEP] identifier[TurfUnitCriteria] identifier[String] identifier[units] operator[SEP] {
identifier[List] operator[<] identifier[Point] operator[>] identifier[coordinates] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[steps] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[coordinates] operator[SEP] identifier[add] operator[SEP] identifier[TurfMeasurement] operator[SEP] identifier[destination] operator[SEP] identifier[center] , identifier[radius] , identifier[i] operator[*] literal[Float] operator[/] identifier[steps] , identifier[units] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[coordinates] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[coordinates] operator[SEP] identifier[add] operator[SEP] identifier[coordinates] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[List] operator[<] identifier[Point] operator[>] operator[>] identifier[coordinate] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[coordinate] operator[SEP] identifier[add] operator[SEP] identifier[coordinates] operator[SEP] operator[SEP] Keyword[return] identifier[Polygon] operator[SEP] identifier[fromLngLats] operator[SEP] identifier[coordinate] operator[SEP] operator[SEP]
}
|
public static Set<Annotation> getAllAnnotations(final Class<?> cls) {
List<Class<?>> allTypes = ClassUtil.getAllSuperclasses(cls);
allTypes.addAll(ClassUtil.getAllInterfaces(cls));
allTypes.add(cls);
Set<Annotation> anns = new HashSet<Annotation>();
for (Class<?> type : allTypes) {
anns.addAll(Arrays.asList(type.getDeclaredAnnotations()));
}
Set<Annotation> superAnnotations = new HashSet<Annotation>();
for (Annotation ann : anns) {
getSuperAnnotations(ann.annotationType(), superAnnotations);
}
anns.addAll(superAnnotations);
return anns;
} | class class_name[name] begin[{]
method[getAllAnnotations, return_type[type[Set]], modifier[public static], parameter[cls]] begin[{]
local_variable[type[List], allTypes]
call[allTypes.addAll, parameter[call[ClassUtil.getAllInterfaces, parameter[member[.cls]]]]]
call[allTypes.add, parameter[member[.cls]]]
local_variable[type[Set], anns]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDeclaredAnnotations, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=anns, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=allTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
local_variable[type[Set], superAnnotations]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=annotationType, postfix_operators=[], prefix_operators=[], qualifier=ann, selectors=[], type_arguments=None), MemberReference(member=superAnnotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSuperAnnotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=anns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ann)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Annotation, sub_type=None))), label=None)
call[anns.addAll, parameter[member[.superAnnotations]]]
return[member[.anns]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[Annotation] operator[>] identifier[getAllAnnotations] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[cls] operator[SEP] {
identifier[List] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[allTypes] operator[=] identifier[ClassUtil] operator[SEP] identifier[getAllSuperclasses] operator[SEP] identifier[cls] operator[SEP] operator[SEP] identifier[allTypes] operator[SEP] identifier[addAll] operator[SEP] identifier[ClassUtil] operator[SEP] identifier[getAllInterfaces] operator[SEP] identifier[cls] operator[SEP] operator[SEP] operator[SEP] identifier[allTypes] operator[SEP] identifier[add] operator[SEP] identifier[cls] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Annotation] operator[>] identifier[anns] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Annotation] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[:] identifier[allTypes] operator[SEP] {
identifier[anns] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[type] operator[SEP] identifier[getDeclaredAnnotations] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[Annotation] operator[>] identifier[superAnnotations] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Annotation] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Annotation] identifier[ann] operator[:] identifier[anns] operator[SEP] {
identifier[getSuperAnnotations] operator[SEP] identifier[ann] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] , identifier[superAnnotations] operator[SEP] operator[SEP]
}
identifier[anns] operator[SEP] identifier[addAll] operator[SEP] identifier[superAnnotations] operator[SEP] operator[SEP] Keyword[return] identifier[anns] operator[SEP]
}
|
public void marshall(Configuration configuration, ProtocolMarshaller protocolMarshaller) {
if (configuration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configuration.getClassification(), CLASSIFICATION_BINDING);
protocolMarshaller.marshall(configuration.getConfigurations(), CONFIGURATIONS_BINDING);
protocolMarshaller.marshall(configuration.getProperties(), PROPERTIES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[configuration, protocolMarshaller]] begin[{]
if[binary_operation[member[.configuration], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassification, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), MemberReference(member=CLASSIFICATION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConfigurations, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), MemberReference(member=CONFIGURATIONS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProperties, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), MemberReference(member=PROPERTIES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[Configuration] identifier[configuration] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[configuration] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[configuration] operator[SEP] identifier[getClassification] operator[SEP] operator[SEP] , identifier[CLASSIFICATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[configuration] operator[SEP] identifier[getConfigurations] operator[SEP] operator[SEP] , identifier[CONFIGURATIONS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[configuration] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] , identifier[PROPERTIES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Factory
public static <T extends Throwable> Matcher<T> isThrowable(Class<?> type) {
final Matcher<T> typeMatcher = instanceOf(type);
return new IsThrowable<>(typeMatcher);
} | class class_name[name] begin[{]
method[isThrowable, return_type[type[Matcher]], modifier[public static], parameter[type]] begin[{]
local_variable[type[Matcher], typeMatcher]
return[ClassCreator(arguments=[MemberReference(member=typeMatcher, 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=IsThrowable, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Factory] Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Throwable] operator[>] identifier[Matcher] operator[<] identifier[T] operator[>] identifier[isThrowable] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
Keyword[final] identifier[Matcher] operator[<] identifier[T] operator[>] identifier[typeMatcher] operator[=] identifier[instanceOf] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[IsThrowable] operator[<] operator[>] operator[SEP] identifier[typeMatcher] operator[SEP] operator[SEP]
}
|
public static int subtractExact(int a, int b) {
long result = (long) a - b;
checkNoOverflow(result == (int) result);
return (int) result;
} | class class_name[name] begin[{]
method[subtractExact, return_type[type[int]], modifier[public static], parameter[a, b]] begin[{]
local_variable[type[long], result]
call[.checkNoOverflow, parameter[binary_operation[member[.result], ==, Cast(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]]
return[Cast(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[subtractExact] operator[SEP] Keyword[int] identifier[a] , Keyword[int] identifier[b] operator[SEP] {
Keyword[long] identifier[result] operator[=] operator[SEP] Keyword[long] operator[SEP] identifier[a] operator[-] identifier[b] operator[SEP] identifier[checkNoOverflow] operator[SEP] identifier[result] operator[==] operator[SEP] Keyword[int] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[result] operator[SEP]
}
|
@Override
public long write(final InputStream _in,
final long _size,
final String _fileName)
throws EFapsException
{
long size = 0;
ConnectionResource res = null;
try {
res = Context.getThreadContext().getConnectionResource();
final AbstractDatabase<?> db = Context.getDbType();
final StringBuilder cmd = new StringBuilder().append(db.getSQLPart(SQLPart.UPDATE)).append(" ")
.append(db.getTableQuote()).append(JDBCStoreResource.TABLENAME_STORE)
.append(db.getTableQuote())
.append(" ").append(db.getSQLPart(SQLPart.SET)).append(" ")
.append(db.getColumnQuote())
.append(JDBCStoreResource.COLNAME_FILECONTENT)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.WHERE)).append(" ")
.append(db.getColumnQuote()).append("ID").append(db.getColumnQuote())
.append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID());
final PreparedStatement stmt = res.prepareStatement(cmd.toString());
try {
stmt.setBinaryStream(1, _in, ((Long) _size).intValue());
stmt.execute();
} finally {
stmt.close();
}
size = _size;
} catch (final EFapsException e) {
throw e;
} catch (final SQLException e) {
JDBCStoreResource.LOG.error("write of content failed", e);
throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e);
}
setFileInfo(_fileName, size);
return size;
} | class class_name[name] begin[{]
method[write, return_type[type[long]], modifier[public], parameter[_in, _size, _fileName]] begin[{]
local_variable[type[long], size]
local_variable[type[ConnectionResource], res]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getThreadContext, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[MethodInvocation(arguments=[], member=getConnectionResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDbType, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[], type_arguments=None), name=db)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=AbstractDatabase, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=UPDATE, postfix_operators=[], prefix_operators=[], qualifier=SQLPart, selectors=[])], member=getSQLPart, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=TABLENAME_STORE, postfix_operators=[], prefix_operators=[], qualifier=JDBCStoreResource, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=SQLPart, selectors=[])], member=getSQLPart, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=COLNAME_FILECONTENT, postfix_operators=[], prefix_operators=[], qualifier=JDBCStoreResource, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=EQUAL, postfix_operators=[], prefix_operators=[], qualifier=SQLPart, selectors=[])], member=getSQLPart, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="? ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=WHERE, postfix_operators=[], prefix_operators=[], qualifier=SQLPart, selectors=[])], member=getSQLPart, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ID")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getColumnQuote, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=EQUAL, postfix_operators=[], prefix_operators=[], qualifier=SQLPart, selectors=[])], member=getSQLPart, postfix_operators=[], prefix_operators=[], qualifier=db, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGeneralID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=cmd)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None)], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), name=stmt)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=PreparedStatement, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=_in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], member=setBinaryStream, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None)], label=None, resources=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=_size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EFapsException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="write of content failed"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=JDBCStoreResource.LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JDBCStoreResource, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="write.SQLException"), 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=EFapsException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
call[.setFileInfo, parameter[member[._fileName], member[.size]]]
return[member[.size]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[write] operator[SEP] Keyword[final] identifier[InputStream] identifier[_in] , Keyword[final] Keyword[long] identifier[_size] , Keyword[final] identifier[String] identifier[_fileName] operator[SEP] Keyword[throws] identifier[EFapsException] {
Keyword[long] identifier[size] operator[=] Other[0] operator[SEP] identifier[ConnectionResource] identifier[res] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[res] operator[=] identifier[Context] operator[SEP] identifier[getThreadContext] operator[SEP] operator[SEP] operator[SEP] identifier[getConnectionResource] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[AbstractDatabase] operator[<] operator[?] operator[>] identifier[db] operator[=] identifier[Context] operator[SEP] identifier[getDbType] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[cmd] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getSQLPart] operator[SEP] identifier[SQLPart] operator[SEP] identifier[UPDATE] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getTableQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[JDBCStoreResource] operator[SEP] identifier[TABLENAME_STORE] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getTableQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getSQLPart] operator[SEP] identifier[SQLPart] operator[SEP] identifier[SET] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getColumnQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[JDBCStoreResource] operator[SEP] identifier[COLNAME_FILECONTENT] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getColumnQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getSQLPart] operator[SEP] identifier[SQLPart] operator[SEP] identifier[EQUAL] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getSQLPart] operator[SEP] identifier[SQLPart] operator[SEP] identifier[WHERE] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getColumnQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getColumnQuote] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[db] operator[SEP] identifier[getSQLPart] operator[SEP] identifier[SQLPart] operator[SEP] identifier[EQUAL] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[getGeneralID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PreparedStatement] identifier[stmt] operator[=] identifier[res] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[cmd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[stmt] operator[SEP] identifier[setBinaryStream] operator[SEP] Other[1] , identifier[_in] , operator[SEP] operator[SEP] identifier[Long] operator[SEP] identifier[_size] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[stmt] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[size] operator[=] identifier[_size] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[EFapsException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SQLException] identifier[e] operator[SEP] {
identifier[JDBCStoreResource] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[EFapsException] operator[SEP] identifier[JDBCStoreResource] operator[SEP] Keyword[class] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[setFileInfo] operator[SEP] identifier[_fileName] , identifier[size] operator[SEP] operator[SEP] Keyword[return] identifier[size] operator[SEP]
}
|
public double response( double[] sample ) {
if( sample.length != A.numCols )
throw new IllegalArgumentException("Expected input vector to be in sample space");
DMatrixRMaj dots = new DMatrixRMaj(numComponents,1);
DMatrixRMaj s = DMatrixRMaj.wrap(A.numCols,1,sample);
CommonOps_DDRM.mult(V_t,s,dots);
return NormOps_DDRM.normF(dots);
} | class class_name[name] begin[{]
method[response, return_type[type[double]], modifier[public], parameter[sample]] begin[{]
if[binary_operation[member[sample.length], !=, member[A.numCols]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected input vector to be in sample space")], 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[DMatrixRMaj], dots]
local_variable[type[DMatrixRMaj], s]
call[CommonOps_DDRM.mult, parameter[member[.V_t], member[.s], member[.dots]]]
return[call[NormOps_DDRM.normF, parameter[member[.dots]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[response] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[sample] operator[SEP] {
Keyword[if] operator[SEP] identifier[sample] operator[SEP] identifier[length] operator[!=] identifier[A] operator[SEP] identifier[numCols] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[dots] operator[=] Keyword[new] identifier[DMatrixRMaj] operator[SEP] identifier[numComponents] , Other[1] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[s] operator[=] identifier[DMatrixRMaj] operator[SEP] identifier[wrap] operator[SEP] identifier[A] operator[SEP] identifier[numCols] , Other[1] , identifier[sample] operator[SEP] operator[SEP] identifier[CommonOps_DDRM] operator[SEP] identifier[mult] operator[SEP] identifier[V_t] , identifier[s] , identifier[dots] operator[SEP] operator[SEP] Keyword[return] identifier[NormOps_DDRM] operator[SEP] identifier[normF] operator[SEP] identifier[dots] operator[SEP] operator[SEP]
}
|
@NotNull
public static LongStream iterate(
final long seed,
@NotNull final LongPredicate predicate,
@NotNull final LongUnaryOperator op) {
Objects.requireNonNull(predicate);
return iterate(seed, op).takeWhile(predicate);
} | class class_name[name] begin[{]
method[iterate, return_type[type[LongStream]], modifier[public static], parameter[seed, predicate, op]] begin[{]
call[Objects.requireNonNull, parameter[member[.predicate]]]
return[call[.iterate, parameter[member[.seed], member[.op]]]]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] Keyword[static] identifier[LongStream] identifier[iterate] operator[SEP] Keyword[final] Keyword[long] identifier[seed] , annotation[@] identifier[NotNull] Keyword[final] identifier[LongPredicate] identifier[predicate] , annotation[@] identifier[NotNull] Keyword[final] identifier[LongUnaryOperator] identifier[op] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[predicate] operator[SEP] operator[SEP] Keyword[return] identifier[iterate] operator[SEP] identifier[seed] , identifier[op] operator[SEP] operator[SEP] identifier[takeWhile] operator[SEP] identifier[predicate] operator[SEP] operator[SEP]
}
|
public static String deobfuscate(String s)
{
if (s.startsWith("OBF:"))
s=s.substring(4);
byte[] b=new byte[s.length()/2];
int l=0;
for (int i=0;i<s.length();i+=4)
{
String x=s.substring(i,i+4);
int i0 = Integer.parseInt(x,36);
int i1=(i0/256);
int i2=(i0%256);
b[l++]=(byte)((i1+i2-254)/2);
}
return new String(b,0,l);
} | class class_name[name] begin[{]
method[deobfuscate, return_type[type[String]], modifier[public static], parameter[s]] begin[{]
if[call[s.startsWith, parameter[literal["OBF:"]]]] begin[{]
assign[member[.s], call[s.substring, parameter[literal[4]]]]
else begin[{]
None
end[}]
local_variable[type[byte], b]
local_variable[type[int], l]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=x)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=36)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=i0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=256), operator=/), name=i1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=256), operator=%), name=i2)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=l, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=254), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), type=BasicType(dimensions=[], name=byte))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4))]), label=None)
return[ClassCreator(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=l, 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=String, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[deobfuscate] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[s] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[l] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[+=] Other[4] operator[SEP] {
identifier[String] identifier[x] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] identifier[i] , identifier[i] operator[+] Other[4] operator[SEP] operator[SEP] Keyword[int] identifier[i0] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[x] , Other[36] operator[SEP] operator[SEP] Keyword[int] identifier[i1] operator[=] operator[SEP] identifier[i0] operator[/] Other[256] operator[SEP] operator[SEP] Keyword[int] identifier[i2] operator[=] operator[SEP] identifier[i0] operator[%] Other[256] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[l] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[i1] operator[+] identifier[i2] operator[-] Other[254] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[b] , Other[0] , identifier[l] operator[SEP] operator[SEP]
}
|
private IConfigurationElement getParserWithHeighestPriority(
String natureId, IConfigurationElement[] config)
{
IConfigurationElement selectedParser = null;
int selectedParserPriority = 0;
for (IConfigurationElement e : config)
{
if (e.getAttribute("nature").equals(natureId))
{
if (selectedParser == null)
{
selectedParser = e;
String selectedParserPriorityString = selectedParser
.getAttribute("priority");
if (selectedParserPriorityString != null)
selectedParserPriority = Integer
.parseInt(selectedParserPriorityString);
} else
{
String parserPriorityString = selectedParser
.getAttribute("priority");
if (parserPriorityString != null)
{
int parserPriority = Integer
.parseInt(parserPriorityString);
if (parserPriority > selectedParserPriority)
{
selectedParser = e;
selectedParserPriority = parserPriority;
}
}
}
}
}
return selectedParser;
} | class class_name[name] begin[{]
method[getParserWithHeighestPriority, return_type[type[IConfigurationElement]], modifier[private], parameter[natureId, config]] begin[{]
local_variable[type[IConfigurationElement], selectedParser]
local_variable[type[int], selectedParserPriority]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="nature")], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MethodInvocation(arguments=[MemberReference(member=natureId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=selectedParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="priority")], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=selectedParser, selectors=[], type_arguments=None), name=parserPriorityString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=parserPriorityString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=parserPriorityString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=parserPriority)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=parserPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=selectedParserPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=selectedParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=selectedParserPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=parserPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=selectedParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="priority")], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=selectedParser, selectors=[], type_arguments=None), name=selectedParserPriorityString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=selectedParserPriorityString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=selectedParserPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=selectedParserPriorityString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IConfigurationElement, sub_type=None))), label=None)
return[member[.selectedParser]]
end[}]
END[}] | Keyword[private] identifier[IConfigurationElement] identifier[getParserWithHeighestPriority] operator[SEP] identifier[String] identifier[natureId] , identifier[IConfigurationElement] operator[SEP] operator[SEP] identifier[config] operator[SEP] {
identifier[IConfigurationElement] identifier[selectedParser] operator[=] Other[null] operator[SEP] Keyword[int] identifier[selectedParserPriority] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[IConfigurationElement] identifier[e] operator[:] identifier[config] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[natureId] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[selectedParser] operator[==] Other[null] operator[SEP] {
identifier[selectedParser] operator[=] identifier[e] operator[SEP] identifier[String] identifier[selectedParserPriorityString] operator[=] identifier[selectedParser] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[selectedParserPriorityString] operator[!=] Other[null] operator[SEP] identifier[selectedParserPriority] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[selectedParserPriorityString] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[parserPriorityString] operator[=] identifier[selectedParser] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parserPriorityString] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[parserPriority] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[parserPriorityString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parserPriority] operator[>] identifier[selectedParserPriority] operator[SEP] {
identifier[selectedParser] operator[=] identifier[e] operator[SEP] identifier[selectedParserPriority] operator[=] identifier[parserPriority] operator[SEP]
}
}
}
}
}
Keyword[return] identifier[selectedParser] operator[SEP]
}
|
@Nonnull
public JSDefinedClass _class (@Nonnull @Nonempty final String sName) throws JSNameAlreadyExistsException
{
final JSDefinedClass aDefinedClass = new JSDefinedClass (sName);
return addDeclaration (aDefinedClass);
} | class class_name[name] begin[{]
method[_class, return_type[type[JSDefinedClass]], modifier[public], parameter[sName]] begin[{]
local_variable[type[JSDefinedClass], aDefinedClass]
return[call[.addDeclaration, parameter[member[.aDefinedClass]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[JSDefinedClass] identifier[_class] operator[SEP] annotation[@] identifier[Nonnull] annotation[@] identifier[Nonempty] Keyword[final] identifier[String] identifier[sName] operator[SEP] Keyword[throws] identifier[JSNameAlreadyExistsException] {
Keyword[final] identifier[JSDefinedClass] identifier[aDefinedClass] operator[=] Keyword[new] identifier[JSDefinedClass] operator[SEP] identifier[sName] operator[SEP] operator[SEP] Keyword[return] identifier[addDeclaration] operator[SEP] identifier[aDefinedClass] operator[SEP] operator[SEP]
}
|
byte[] toNewByteArray()
{
int length = myBuffer.length - myOffset;
byte[] bytes = new byte[length];
System.arraycopy(myBuffer, myOffset, bytes, 0, length);
return bytes;
} | class class_name[name] begin[{]
method[toNewByteArray, return_type[type[byte]], modifier[default], parameter[]] begin[{]
local_variable[type[int], length]
local_variable[type[byte], bytes]
call[System.arraycopy, parameter[member[.myBuffer], member[.myOffset], member[.bytes], literal[0], member[.length]]]
return[member[.bytes]]
end[}]
END[}] | Keyword[byte] operator[SEP] operator[SEP] identifier[toNewByteArray] operator[SEP] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[myBuffer] operator[SEP] identifier[length] operator[-] identifier[myOffset] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[myBuffer] , identifier[myOffset] , identifier[bytes] , Other[0] , identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[bytes] operator[SEP]
}
|
public Period multipliedBy(int scalar) {
if (this == ZERO || scalar == 1) {
return this;
}
int[] values = getValues(); // cloned
for (int i = 0; i < values.length; i++) {
values[i] = FieldUtils.safeMultiply(values[i], scalar);
}
return new Period(values, getPeriodType());
} | class class_name[name] begin[{]
method[multipliedBy, return_type[type[Period]], modifier[public], parameter[scalar]] begin[{]
if[binary_operation[binary_operation[THIS[], ==, member[.ZERO]], ||, binary_operation[member[.scalar], ==, literal[1]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[int], values]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=scalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=FieldUtils, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=values, 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[ClassCreator(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPeriodType, 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=Period, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Period] identifier[multipliedBy] operator[SEP] Keyword[int] identifier[scalar] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[==] identifier[ZERO] operator[||] identifier[scalar] operator[==] Other[1] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[values] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[values] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[FieldUtils] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[values] operator[SEP] identifier[i] operator[SEP] , identifier[scalar] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Period] operator[SEP] identifier[values] , identifier[getPeriodType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void notifyComponentEvent(Event event, ComponentDescriptor<?> descriptor,
ComponentManager componentManager)
{
if (this.shouldStack) {
synchronized (this) {
this.events.push(new ComponentEventEntry(event, descriptor, componentManager));
}
} else {
sendEvent(event, descriptor, componentManager);
}
} | class class_name[name] begin[{]
method[notifyComponentEvent, return_type[void], modifier[private], parameter[event, descriptor, componentManager]] begin[{]
if[THIS[member[None.shouldStack]]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
THIS[member[None.events]call[None.push, parameter[ClassCreator(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=descriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=componentManager, 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=ComponentEventEntry, sub_type=None))]]]
END[}]
else begin[{]
call[.sendEvent, parameter[member[.event], member[.descriptor], member[.componentManager]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[notifyComponentEvent] operator[SEP] identifier[Event] identifier[event] , identifier[ComponentDescriptor] operator[<] operator[?] operator[>] identifier[descriptor] , identifier[ComponentManager] identifier[componentManager] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[shouldStack] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[this] operator[SEP] identifier[events] operator[SEP] identifier[push] operator[SEP] Keyword[new] identifier[ComponentEventEntry] operator[SEP] identifier[event] , identifier[descriptor] , identifier[componentManager] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[sendEvent] operator[SEP] identifier[event] , identifier[descriptor] , identifier[componentManager] operator[SEP] operator[SEP]
}
}
|
public static String getUserAgent() {
if (USER_AGENT == null) {
USER_AGENT = String.format(Locale.ENGLISH, "%s/%s (%s/%s)",
PRODUCT_NAME,
Version.SYNC_PROTOCOL_VERSION,
Version.getVersionName(),
Version.getCommitHash());
}
return USER_AGENT;
} | class class_name[name] begin[{]
method[getUserAgent, return_type[type[String]], modifier[public static], parameter[]] begin[{]
if[binary_operation[member[.USER_AGENT], ==, literal[null]]] begin[{]
assign[member[.USER_AGENT], call[String.format, parameter[member[Locale.ENGLISH], literal["%s/%s (%s/%s)"], member[.PRODUCT_NAME], member[Version.SYNC_PROTOCOL_VERSION], call[Version.getVersionName, parameter[]], call[Version.getCommitHash, parameter[]]]]]
else begin[{]
None
end[}]
return[member[.USER_AGENT]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getUserAgent] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[USER_AGENT] operator[==] Other[null] operator[SEP] {
identifier[USER_AGENT] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] , literal[String] , identifier[PRODUCT_NAME] , identifier[Version] operator[SEP] identifier[SYNC_PROTOCOL_VERSION] , identifier[Version] operator[SEP] identifier[getVersionName] operator[SEP] operator[SEP] , identifier[Version] operator[SEP] identifier[getCommitHash] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[USER_AGENT] operator[SEP]
}
|
public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler){
return () -> resultHandler.apply(callable.call());
} | class class_name[name] begin[{]
method[andThen, return_type[type[Callable]], modifier[public static], parameter[callable, resultHandler]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=call, postfix_operators=[], prefix_operators=[], qualifier=callable, selectors=[], type_arguments=None)], member=apply, postfix_operators=[], prefix_operators=[], qualifier=resultHandler, selectors=[], type_arguments=None), parameters=[])]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[R] operator[>] identifier[Callable] operator[<] identifier[R] operator[>] identifier[andThen] operator[SEP] identifier[Callable] operator[<] identifier[T] operator[>] identifier[callable] , identifier[Function] operator[<] identifier[T] , identifier[R] operator[>] identifier[resultHandler] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] operator[->] identifier[resultHandler] operator[SEP] identifier[apply] operator[SEP] identifier[callable] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static byte[] getStopRowForTransaction(byte[] queueRowPrefix, Transaction transaction) {
return Bytes.add(queueRowPrefix, Bytes.toBytes(transaction.getReadPointer() + 1));
} | class class_name[name] begin[{]
method[getStopRowForTransaction, return_type[type[byte]], modifier[public static], parameter[queueRowPrefix, transaction]] begin[{]
return[call[Bytes.add, parameter[member[.queueRowPrefix], call[Bytes.toBytes, parameter[binary_operation[call[transaction.getReadPointer, parameter[]], +, literal[1]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[getStopRowForTransaction] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[queueRowPrefix] , identifier[Transaction] identifier[transaction] operator[SEP] {
Keyword[return] identifier[Bytes] operator[SEP] identifier[add] operator[SEP] identifier[queueRowPrefix] , identifier[Bytes] operator[SEP] identifier[toBytes] operator[SEP] identifier[transaction] operator[SEP] identifier[getReadPointer] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(DescribeInputSecurityGroupRequest describeInputSecurityGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (describeInputSecurityGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeInputSecurityGroupRequest.getInputSecurityGroupId(), INPUTSECURITYGROUPID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[describeInputSecurityGroupRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeInputSecurityGroupRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInputSecurityGroupId, postfix_operators=[], prefix_operators=[], qualifier=describeInputSecurityGroupRequest, selectors=[], type_arguments=None), MemberReference(member=INPUTSECURITYGROUPID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DescribeInputSecurityGroupRequest] identifier[describeInputSecurityGroupRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeInputSecurityGroupRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeInputSecurityGroupRequest] operator[SEP] identifier[getInputSecurityGroupId] operator[SEP] operator[SEP] , identifier[INPUTSECURITYGROUPID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public NutMap postPay(String url, String key, Map<String, Object> params, File file, String password) {
params.remove("sign");
String sign = WxPaySign.createSign(key, params);
params.put("sign", sign);
Request req = Request.create(url, METHOD.POST);
req.setData(Xmls.mapToXml(params));
Sender sender = Sender.create(req);
SSLSocketFactory sslSocketFactory;
try {
sslSocketFactory = WxPaySSL.buildSSL(file, password);
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
sender.setSSLSocketFactory(sslSocketFactory);
Response resp = sender.send();
if (!resp.isOK())
throw new IllegalStateException("postPay with SSL, resp code=" + resp.getStatus());
return Xmls.xmlToMap(resp.getContent("UTF-8"));
} | class class_name[name] begin[{]
method[postPay, return_type[type[NutMap]], modifier[public], parameter[url, key, params, file, password]] begin[{]
call[params.remove, parameter[literal["sign"]]]
local_variable[type[String], sign]
call[params.put, parameter[literal["sign"], member[.sign]]]
local_variable[type[Request], req]
call[req.setData, parameter[call[Xmls.mapToXml, parameter[member[.params]]]]]
local_variable[type[Sender], sender]
local_variable[type[SSLSocketFactory], sslSocketFactory]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sslSocketFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildSSL, postfix_operators=[], prefix_operators=[], qualifier=WxPaySSL, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrapThrow, postfix_operators=[], prefix_operators=[], qualifier=Lang, 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)
call[sender.setSSLSocketFactory, parameter[member[.sslSocketFactory]]]
local_variable[type[Response], resp]
if[call[resp.isOK, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="postPay with SSL, resp code="), operandr=MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=resp, 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[}]
return[call[Xmls.xmlToMap, parameter[call[resp.getContent, parameter[literal["UTF-8"]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[NutMap] identifier[postPay] operator[SEP] identifier[String] identifier[url] , identifier[String] identifier[key] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] , identifier[File] identifier[file] , identifier[String] identifier[password] operator[SEP] {
identifier[params] operator[SEP] identifier[remove] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[sign] operator[=] identifier[WxPaySign] operator[SEP] identifier[createSign] operator[SEP] identifier[key] , identifier[params] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[sign] operator[SEP] operator[SEP] identifier[Request] identifier[req] operator[=] identifier[Request] operator[SEP] identifier[create] operator[SEP] identifier[url] , identifier[METHOD] operator[SEP] identifier[POST] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setData] operator[SEP] identifier[Xmls] operator[SEP] identifier[mapToXml] operator[SEP] identifier[params] operator[SEP] operator[SEP] operator[SEP] identifier[Sender] identifier[sender] operator[=] identifier[Sender] operator[SEP] identifier[create] operator[SEP] identifier[req] operator[SEP] operator[SEP] identifier[SSLSocketFactory] identifier[sslSocketFactory] operator[SEP] Keyword[try] {
identifier[sslSocketFactory] operator[=] identifier[WxPaySSL] operator[SEP] identifier[buildSSL] operator[SEP] identifier[file] , identifier[password] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] identifier[Lang] operator[SEP] identifier[wrapThrow] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[sender] operator[SEP] identifier[setSSLSocketFactory] operator[SEP] identifier[sslSocketFactory] operator[SEP] operator[SEP] identifier[Response] identifier[resp] operator[=] identifier[sender] operator[SEP] identifier[send] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[resp] operator[SEP] identifier[isOK] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[resp] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Xmls] operator[SEP] identifier[xmlToMap] operator[SEP] identifier[resp] operator[SEP] identifier[getContent] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public PagedList<JobPreparationAndReleaseTaskExecutionInformation> listPreparationAndReleaseTaskStatus(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) {
ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions).toBlocking().single();
return new PagedList<JobPreparationAndReleaseTaskExecutionInformation>(response.body()) {
@Override
public Page<JobPreparationAndReleaseTaskExecutionInformation> nextPage(String nextPageLink) {
JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null;
if (jobListPreparationAndReleaseTaskStatusOptions != null) {
jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions();
jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate());
}
return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body();
}
};
} | class class_name[name] begin[{]
method[listPreparationAndReleaseTaskStatus, return_type[type[PagedList]], modifier[public], parameter[jobId, jobListPreparationAndReleaseTaskStatusOptions]] begin[{]
local_variable[type[ServiceResponseWithHeaders], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=jobListPreparationAndReleaseTaskStatusNextOptions)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JobListPreparationAndReleaseTaskStatusNextOptions, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jobListPreparationAndReleaseTaskStatusOptions, 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=jobListPreparationAndReleaseTaskStatusNextOptions, 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=JobListPreparationAndReleaseTaskStatusNextOptions, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=clientRequestId, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusOptions, selectors=[], type_arguments=None)], member=withClientRequestId, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusNextOptions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=returnClientRequestId, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusOptions, selectors=[], type_arguments=None)], member=withReturnClientRequestId, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusNextOptions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=ocpDate, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusOptions, selectors=[], type_arguments=None)], member=withOcpDate, postfix_operators=[], prefix_operators=[], qualifier=jobListPreparationAndReleaseTaskStatusNextOptions, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jobListPreparationAndReleaseTaskStatusNextOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listPreparationAndReleaseTaskStatusNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toBlocking, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=single, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextPage, parameters=[FormalParameter(annotations=[], modifiers=set(), name=nextPageLink, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JobPreparationAndReleaseTaskExecutionInformation, sub_type=None))], dimensions=[], name=Page, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JobPreparationAndReleaseTaskExecutionInformation, sub_type=None))], dimensions=None, name=PagedList, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[PagedList] operator[<] identifier[JobPreparationAndReleaseTaskExecutionInformation] operator[>] identifier[listPreparationAndReleaseTaskStatus] operator[SEP] Keyword[final] identifier[String] identifier[jobId] , Keyword[final] identifier[JobListPreparationAndReleaseTaskStatusOptions] identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[SEP] {
identifier[ServiceResponseWithHeaders] operator[<] identifier[Page] operator[<] identifier[JobPreparationAndReleaseTaskExecutionInformation] operator[>] , identifier[JobListPreparationAndReleaseTaskStatusHeaders] operator[>] identifier[response] operator[=] identifier[listPreparationAndReleaseTaskStatusSinglePageAsync] operator[SEP] identifier[jobId] , identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PagedList] operator[<] identifier[JobPreparationAndReleaseTaskExecutionInformation] operator[>] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[JobPreparationAndReleaseTaskExecutionInformation] operator[>] identifier[nextPage] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
identifier[JobListPreparationAndReleaseTaskStatusNextOptions] identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[!=] Other[null] operator[SEP] {
identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[=] Keyword[new] identifier[JobListPreparationAndReleaseTaskStatusNextOptions] operator[SEP] operator[SEP] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[SEP] identifier[withClientRequestId] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[SEP] identifier[clientRequestId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[SEP] identifier[withReturnClientRequestId] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[SEP] identifier[returnClientRequestId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[SEP] identifier[withOcpDate] operator[SEP] identifier[jobListPreparationAndReleaseTaskStatusOptions] operator[SEP] identifier[ocpDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[listPreparationAndReleaseTaskStatusNextSinglePageAsync] operator[SEP] identifier[nextPageLink] , identifier[jobListPreparationAndReleaseTaskStatusNextOptions] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public final EObject entryRuleConjunction() throws RecognitionException {
EObject current = null;
EObject iv_ruleConjunction = null;
try {
// InternalXtext.g:1817:52: (iv_ruleConjunction= ruleConjunction EOF )
// InternalXtext.g:1818:2: iv_ruleConjunction= ruleConjunction EOF
{
newCompositeNode(grammarAccess.getConjunctionRule());
pushFollow(FollowSets000.FOLLOW_1);
iv_ruleConjunction=ruleConjunction();
state._fsp--;
current =iv_ruleConjunction;
match(input,EOF,FollowSets000.FOLLOW_2);
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} | class class_name[name] begin[{]
method[entryRuleConjunction, return_type[type[EObject]], modifier[final public], parameter[]] begin[{]
local_variable[type[EObject], current]
local_variable[type[EObject], iv_ruleConjunction]
TryStatement(block=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConjunctionRule, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_1, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=iv_ruleConjunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleConjunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=iv_ruleConjunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EOF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=appendSkippedTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.current]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[EObject] identifier[entryRuleConjunction] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[EObject] identifier[current] operator[=] Other[null] operator[SEP] identifier[EObject] identifier[iv_ruleConjunction] operator[=] Other[null] operator[SEP] Keyword[try] {
{
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getConjunctionRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FollowSets000] operator[SEP] identifier[FOLLOW_1] operator[SEP] operator[SEP] identifier[iv_ruleConjunction] operator[=] identifier[ruleConjunction] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] identifier[current] operator[=] identifier[iv_ruleConjunction] operator[SEP] identifier[match] operator[SEP] identifier[input] , identifier[EOF] , identifier[FollowSets000] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[appendSkippedTokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[current] operator[SEP]
}
|
private void txtClassUriTemplateFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtClassUriTemplateFocusLost
String uriTemplate = txtClassUriTemplate.getText();
if (predicateSubjectMap == null) {
predicateSubjectMap = createPredicateSubjectMap();
}
predicateSubjectMap.setTargetMapping(uriTemplate);
validateClassUri();
} | class class_name[name] begin[{]
method[txtClassUriTemplateFocusLost, return_type[void], modifier[private], parameter[evt]] begin[{]
local_variable[type[String], uriTemplate]
if[binary_operation[member[.predicateSubjectMap], ==, literal[null]]] begin[{]
assign[member[.predicateSubjectMap], call[.createPredicateSubjectMap, parameter[]]]
else begin[{]
None
end[}]
call[predicateSubjectMap.setTargetMapping, parameter[member[.uriTemplate]]]
call[.validateClassUri, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[txtClassUriTemplateFocusLost] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[FocusEvent] identifier[evt] operator[SEP] {
identifier[String] identifier[uriTemplate] operator[=] identifier[txtClassUriTemplate] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[predicateSubjectMap] operator[==] Other[null] operator[SEP] {
identifier[predicateSubjectMap] operator[=] identifier[createPredicateSubjectMap] operator[SEP] operator[SEP] operator[SEP]
}
identifier[predicateSubjectMap] operator[SEP] identifier[setTargetMapping] operator[SEP] identifier[uriTemplate] operator[SEP] operator[SEP] identifier[validateClassUri] operator[SEP] operator[SEP] operator[SEP]
}
|
public static double romb(Function1D f, double a, double b, int max)
{
// see http://en.wikipedia.org/wiki/Romberg's_method
max+=1;
double[] s = new double[max];//first index will not be used
double var = 0;//var is used to hold the value R(n-1,m-1), from the previous row so that 2 arrays are not needed
double lastVal = Double.NEGATIVE_INFINITY;
for(int k = 1; k < max; k++)
{
for(int i = 1; i <= k; i++)
{
if(i == 1)
{
var = s[i];
s[i] = Trapezoidal.trapz(f, a, b, (int)pow(2, k-1));
}
else
{
s[k]= ( pow(4 , i-1)*s[i-1]-var )/(pow(4, i-1) - 1);
var = s[i];
s[i]= s[k];
}
}
if( abs(lastVal - s[k]) < 1e-15 )//there is only approximatly 15.955 accurate decimal digits in a double, this is as close as we will get
return s[k];
else lastVal = s[k];
}
return s[max-1];
} | class class_name[name] begin[{]
method[romb, return_type[type[double]], modifier[public static], parameter[f, a, b, max]] begin[{]
assign[member[.max], literal[1]]
local_variable[type[double], s]
local_variable[type[double], var]
local_variable[type[double], lastVal]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=*), operandr=MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=/)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=var, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))], member=trapz, postfix_operators=[], prefix_operators=[], qualifier=Trapezoidal, selectors=[], type_arguments=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=lastVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1e-15), operator=<), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), label=None, then_statement=ReturnStatement(expression=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=k)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.s]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[romb] operator[SEP] identifier[Function1D] identifier[f] , Keyword[double] identifier[a] , Keyword[double] identifier[b] , Keyword[int] identifier[max] operator[SEP] {
identifier[max] operator[+=] Other[1] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[s] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[max] operator[SEP] operator[SEP] Keyword[double] identifier[var] operator[=] Other[0] operator[SEP] Keyword[double] identifier[lastVal] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[k] operator[=] Other[1] operator[SEP] identifier[k] operator[<] identifier[max] operator[SEP] identifier[k] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[k] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] Other[1] operator[SEP] {
identifier[var] operator[=] identifier[s] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[Trapezoidal] operator[SEP] identifier[trapz] operator[SEP] identifier[f] , identifier[a] , identifier[b] , operator[SEP] Keyword[int] operator[SEP] identifier[pow] operator[SEP] Other[2] , identifier[k] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[s] operator[SEP] identifier[k] operator[SEP] operator[=] operator[SEP] identifier[pow] operator[SEP] Other[4] , identifier[i] operator[-] Other[1] operator[SEP] operator[*] identifier[s] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[-] identifier[var] operator[SEP] operator[/] operator[SEP] identifier[pow] operator[SEP] Other[4] , identifier[i] operator[-] Other[1] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[var] operator[=] identifier[s] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[s] operator[SEP] identifier[k] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[abs] operator[SEP] identifier[lastVal] operator[-] identifier[s] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[<] literal[Float] operator[SEP] Keyword[return] identifier[s] operator[SEP] identifier[k] operator[SEP] operator[SEP] Keyword[else] identifier[lastVal] operator[=] identifier[s] operator[SEP] identifier[k] operator[SEP] operator[SEP]
}
Keyword[return] identifier[s] operator[SEP] identifier[max] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public CommandLine setExecutionExceptionHandler(IExecutionExceptionHandler executionExceptionHandler) {
this.executionExceptionHandler = Assert.notNull(executionExceptionHandler, "executionExceptionHandler");
for (CommandLine sub : getSubcommands().values()) { sub.setExecutionExceptionHandler(executionExceptionHandler); }
return this;
} | class class_name[name] begin[{]
method[setExecutionExceptionHandler, return_type[type[CommandLine]], modifier[public], parameter[executionExceptionHandler]] begin[{]
assign[THIS[member[None.executionExceptionHandler]], call[Assert.notNull, parameter[member[.executionExceptionHandler], literal["executionExceptionHandler"]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=executionExceptionHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setExecutionExceptionHandler, postfix_operators=[], prefix_operators=[], qualifier=sub, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSubcommands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=values, 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=sub)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CommandLine, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CommandLine] identifier[setExecutionExceptionHandler] operator[SEP] identifier[IExecutionExceptionHandler] identifier[executionExceptionHandler] operator[SEP] {
Keyword[this] operator[SEP] identifier[executionExceptionHandler] operator[=] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[executionExceptionHandler] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CommandLine] identifier[sub] operator[:] identifier[getSubcommands] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[sub] operator[SEP] identifier[setExecutionExceptionHandler] operator[SEP] identifier[executionExceptionHandler] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
protected void initializeIntent(Intent intent) {
intent.putExtra(UploadService.PARAM_TASK_PARAMETERS, params);
Class taskClass = getTaskClass();
if (taskClass == null)
throw new RuntimeException("The request must specify a task class!");
intent.putExtra(UploadService.PARAM_TASK_CLASS, taskClass.getName());
} | class class_name[name] begin[{]
method[initializeIntent, return_type[void], modifier[protected], parameter[intent]] begin[{]
call[intent.putExtra, parameter[member[UploadService.PARAM_TASK_PARAMETERS], member[.params]]]
local_variable[type[Class], taskClass]
if[binary_operation[member[.taskClass], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The request must specify a task class!")], 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[intent.putExtra, parameter[member[UploadService.PARAM_TASK_CLASS], call[taskClass.getName, parameter[]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[initializeIntent] operator[SEP] identifier[Intent] identifier[intent] operator[SEP] {
identifier[intent] operator[SEP] identifier[putExtra] operator[SEP] identifier[UploadService] operator[SEP] identifier[PARAM_TASK_PARAMETERS] , identifier[params] operator[SEP] operator[SEP] identifier[Class] identifier[taskClass] operator[=] identifier[getTaskClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[taskClass] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[intent] operator[SEP] identifier[putExtra] operator[SEP] identifier[UploadService] operator[SEP] identifier[PARAM_TASK_CLASS] , identifier[taskClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setCookie(String name, String value, String path, Date expirationDate, boolean secure, boolean httpOnly) {
if (remote == null)
throw new IllegalStateException("Cannot setCookie since remote == null");
if (path == null || path.length() == 0)
path = remote.getPath();
Cookie.Builder builder = new Cookie.Builder();
builder.name(name).value(value).domain(remote.getHost()).path(path);
if (expirationDate != null)
builder.expiresAt(expirationDate.getTime());
List<Cookie> cookies = Collections.singletonList(builder.build());
this.clientFactory.addCookies(cookies);
} | class class_name[name] begin[{]
method[setCookie, return_type[void], modifier[public], parameter[name, value, path, expirationDate, secure, httpOnly]] begin[{]
if[binary_operation[member[.remote], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot setCookie since remote == null")], 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[}]
if[binary_operation[binary_operation[member[.path], ==, literal[null]], ||, binary_operation[call[path.length, parameter[]], ==, literal[0]]]] begin[{]
assign[member[.path], call[remote.getPath, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Cookie], builder]
call[builder.name, parameter[member[.name]]]
if[binary_operation[member[.expirationDate], !=, literal[null]]] begin[{]
call[builder.expiresAt, parameter[call[expirationDate.getTime, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[List], cookies]
THIS[member[None.clientFactory]call[None.addCookies, parameter[member[.cookies]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCookie] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] , identifier[String] identifier[path] , identifier[Date] identifier[expirationDate] , Keyword[boolean] identifier[secure] , Keyword[boolean] identifier[httpOnly] operator[SEP] {
Keyword[if] operator[SEP] identifier[remote] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[==] Other[null] operator[||] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[path] operator[=] identifier[remote] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[Cookie] operator[SEP] identifier[Builder] identifier[builder] operator[=] Keyword[new] identifier[Cookie] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[domain] operator[SEP] identifier[remote] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expirationDate] operator[!=] Other[null] operator[SEP] identifier[builder] operator[SEP] identifier[expiresAt] operator[SEP] identifier[expirationDate] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Cookie] operator[>] identifier[cookies] operator[=] identifier[Collections] operator[SEP] identifier[singletonList] operator[SEP] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[clientFactory] operator[SEP] identifier[addCookies] operator[SEP] identifier[cookies] operator[SEP] operator[SEP]
}
|
private void developLongDigits(int decExponent, long lvalue,
long insignificant) {
char digits[];
int ndigits;
int digitno;
int c;
//
// Discard non-significant low-order bits, while rounding,
// up to insignificant value.
int i;
for (i = 0; insignificant >= 10L; i++)
insignificant /= 10L;
if (i != 0) {
long pow10 = long5pow[i] << i; // 10^i == 5^i * 2^i;
long residue = lvalue % pow10;
lvalue /= pow10;
decExponent += i;
if (residue >= (pow10 >> 1)) {
// round up based on the low-order bits we're discarding
lvalue++;
}
}
if (lvalue <= Integer.MAX_VALUE) {
assert lvalue > 0L : lvalue; // lvalue <= 0
// even easier subcase!
// can do int arithmetic rather than long!
int ivalue = (int) lvalue;
ndigits = 10;
digits = (char[]) (perThreadBuffer.get());
digitno = ndigits - 1;
c = ivalue % 10;
ivalue /= 10;
while (c == 0) {
decExponent++;
c = ivalue % 10;
ivalue /= 10;
}
while (ivalue != 0) {
digits[digitno--] = (char) (c + '0');
decExponent++;
c = ivalue % 10;
ivalue /= 10;
}
digits[digitno] = (char) (c + '0');
} else {
// same algorithm as above (same bugs, too )
// but using long arithmetic.
ndigits = 20;
digits = (char[]) (perThreadBuffer.get());
digitno = ndigits - 1;
c = (int) (lvalue % 10L);
lvalue /= 10L;
while (c == 0) {
decExponent++;
c = (int) (lvalue % 10L);
lvalue /= 10L;
}
while (lvalue != 0L) {
digits[digitno--] = (char) (c + '0');
decExponent++;
c = (int) (lvalue % 10L);
lvalue /= 10;
}
digits[digitno] = (char) (c + '0');
}
byte result[];
ndigits -= digitno;
result = new byte[ndigits];
System.arraycopy(digits, digitno, result, 0, ndigits);
this.digits = result;
this.decExponent = decExponent + 1;
this.nDigits = ndigits;
} | class class_name[name] begin[{]
method[developLongDigits, return_type[void], modifier[private], parameter[decExponent, lvalue, insignificant]] begin[{]
local_variable[type[char], digits]
local_variable[type[int], ndigits]
local_variable[type[int], digitno]
local_variable[type[int], c]
local_variable[type[int], i]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=insignificant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=/=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10L)), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=insignificant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10L), operator=>=), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.i], !=, literal[0]]] begin[{]
local_variable[type[long], pow10]
local_variable[type[long], residue]
assign[member[.lvalue], member[.pow10]]
assign[member[.decExponent], member[.i]]
if[binary_operation[member[.residue], >=, binary_operation[member[.pow10], >>, literal[1]]]] begin[{]
member[.lvalue]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.lvalue], <=, member[Integer.MAX_VALUE]]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=lvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), operator=>), label=None, value=MemberReference(member=lvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))
local_variable[type[int], ivalue]
assign[member[.ndigits], literal[10]]
assign[member[.digits], Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=perThreadBuffer, selectors=[], type_arguments=None), type=BasicType(dimensions=[None], name=char))]
assign[member[.digitno], binary_operation[member[.ndigits], -, literal[1]]]
assign[member[.c], binary_operation[member[.ivalue], %, literal[10]]]
assign[member[.ivalue], literal[10]]
while[binary_operation[member[.c], ==, literal[0]]] begin[{]
member[.decExponent]
assign[member[.c], binary_operation[member[.ivalue], %, literal[10]]]
assign[member[.ivalue], literal[10]]
end[}]
while[binary_operation[member[.ivalue], !=, literal[0]]] begin[{]
assign[member[.digits], Cast(expression=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=+), type=BasicType(dimensions=[], name=char))]
member[.decExponent]
assign[member[.c], binary_operation[member[.ivalue], %, literal[10]]]
assign[member[.ivalue], literal[10]]
end[}]
assign[member[.digits], Cast(expression=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=+), type=BasicType(dimensions=[], name=char))]
else begin[{]
assign[member[.ndigits], literal[20]]
assign[member[.digits], Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=perThreadBuffer, selectors=[], type_arguments=None), type=BasicType(dimensions=[None], name=char))]
assign[member[.digitno], binary_operation[member[.ndigits], -, literal[1]]]
assign[member[.c], Cast(expression=BinaryOperation(operandl=MemberReference(member=lvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10L), operator=%), type=BasicType(dimensions=[], name=int))]
assign[member[.lvalue], literal[10L]]
while[binary_operation[member[.c], ==, literal[0]]] begin[{]
member[.decExponent]
assign[member[.c], Cast(expression=BinaryOperation(operandl=MemberReference(member=lvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10L), operator=%), type=BasicType(dimensions=[], name=int))]
assign[member[.lvalue], literal[10L]]
end[}]
while[binary_operation[member[.lvalue], !=, literal[0L]]] begin[{]
assign[member[.digits], Cast(expression=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=+), type=BasicType(dimensions=[], name=char))]
member[.decExponent]
assign[member[.c], Cast(expression=BinaryOperation(operandl=MemberReference(member=lvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10L), operator=%), type=BasicType(dimensions=[], name=int))]
assign[member[.lvalue], literal[10]]
end[}]
assign[member[.digits], Cast(expression=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=+), type=BasicType(dimensions=[], name=char))]
end[}]
local_variable[type[byte], result]
assign[member[.ndigits], member[.digitno]]
assign[member[.result], ArrayCreator(dimensions=[MemberReference(member=ndigits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
call[System.arraycopy, parameter[member[.digits], member[.digitno], member[.result], literal[0], member[.ndigits]]]
assign[THIS[member[None.digits]], member[.result]]
assign[THIS[member[None.decExponent]], binary_operation[member[.decExponent], +, literal[1]]]
assign[THIS[member[None.nDigits]], member[.ndigits]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[developLongDigits] operator[SEP] Keyword[int] identifier[decExponent] , Keyword[long] identifier[lvalue] , Keyword[long] identifier[insignificant] operator[SEP] {
Keyword[char] identifier[digits] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[ndigits] operator[SEP] Keyword[int] identifier[digitno] operator[SEP] Keyword[int] identifier[c] operator[SEP] Keyword[int] identifier[i] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[insignificant] operator[>=] Other[10L] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[insignificant] operator[/=] Other[10L] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[!=] Other[0] operator[SEP] {
Keyword[long] identifier[pow10] operator[=] identifier[long5pow] operator[SEP] identifier[i] operator[SEP] operator[<<] identifier[i] operator[SEP] Keyword[long] identifier[residue] operator[=] identifier[lvalue] operator[%] identifier[pow10] operator[SEP] identifier[lvalue] operator[/=] identifier[pow10] operator[SEP] identifier[decExponent] operator[+=] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[residue] operator[>=] operator[SEP] identifier[pow10] operator[>] operator[>] Other[1] operator[SEP] operator[SEP] {
identifier[lvalue] operator[++] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[lvalue] operator[<=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] {
Keyword[assert] identifier[lvalue] operator[>] Other[0L] operator[:] identifier[lvalue] operator[SEP] Keyword[int] identifier[ivalue] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[lvalue] operator[SEP] identifier[ndigits] operator[=] Other[10] operator[SEP] identifier[digits] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[perThreadBuffer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[digitno] operator[=] identifier[ndigits] operator[-] Other[1] operator[SEP] identifier[c] operator[=] identifier[ivalue] operator[%] Other[10] operator[SEP] identifier[ivalue] operator[/=] Other[10] operator[SEP] Keyword[while] operator[SEP] identifier[c] operator[==] Other[0] operator[SEP] {
identifier[decExponent] operator[++] operator[SEP] identifier[c] operator[=] identifier[ivalue] operator[%] Other[10] operator[SEP] identifier[ivalue] operator[/=] Other[10] operator[SEP]
}
Keyword[while] operator[SEP] identifier[ivalue] operator[!=] Other[0] operator[SEP] {
identifier[digits] operator[SEP] identifier[digitno] operator[--] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP] identifier[decExponent] operator[++] operator[SEP] identifier[c] operator[=] identifier[ivalue] operator[%] Other[10] operator[SEP] identifier[ivalue] operator[/=] Other[10] operator[SEP]
}
identifier[digits] operator[SEP] identifier[digitno] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ndigits] operator[=] Other[20] operator[SEP] identifier[digits] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[perThreadBuffer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[digitno] operator[=] identifier[ndigits] operator[-] Other[1] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[lvalue] operator[%] Other[10L] operator[SEP] operator[SEP] identifier[lvalue] operator[/=] Other[10L] operator[SEP] Keyword[while] operator[SEP] identifier[c] operator[==] Other[0] operator[SEP] {
identifier[decExponent] operator[++] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[lvalue] operator[%] Other[10L] operator[SEP] operator[SEP] identifier[lvalue] operator[/=] Other[10L] operator[SEP]
}
Keyword[while] operator[SEP] identifier[lvalue] operator[!=] Other[0L] operator[SEP] {
identifier[digits] operator[SEP] identifier[digitno] operator[--] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP] identifier[decExponent] operator[++] operator[SEP] identifier[c] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[lvalue] operator[%] Other[10L] operator[SEP] operator[SEP] identifier[lvalue] operator[/=] Other[10] operator[SEP]
}
identifier[digits] operator[SEP] identifier[digitno] operator[SEP] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[byte] identifier[result] operator[SEP] operator[SEP] operator[SEP] identifier[ndigits] operator[-=] identifier[digitno] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[ndigits] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[digits] , identifier[digitno] , identifier[result] , Other[0] , identifier[ndigits] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[digits] operator[=] identifier[result] operator[SEP] Keyword[this] operator[SEP] identifier[decExponent] operator[=] identifier[decExponent] operator[+] Other[1] operator[SEP] Keyword[this] operator[SEP] identifier[nDigits] operator[=] identifier[ndigits] operator[SEP]
}
|
private void doWakeUpWorker() {
if (idleWorkers.get() == 0) {
synchronized (workers) {
if (workers.size() >= getMaximumPoolSize()) {
return;
}
if (workers.isEmpty() || (idleWorkers.get() == 0)) {
addWorkerUnsafe();
}
}
}
} | class class_name[name] begin[{]
method[doWakeUpWorker, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[call[idleWorkers.get, parameter[]], ==, literal[0]]] begin[{]
SYNCHRONIZED[member[.workers]] BEGIN[{]
if[binary_operation[call[workers.size, parameter[]], >=, call[.getMaximumPoolSize, parameter[]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[workers.isEmpty, parameter[]], ||, binary_operation[call[idleWorkers.get, parameter[]], ==, literal[0]]]] begin[{]
call[.addWorkerUnsafe, parameter[]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[doWakeUpWorker] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[idleWorkers] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[workers] operator[SEP] {
Keyword[if] operator[SEP] identifier[workers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] identifier[getMaximumPoolSize] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[workers] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[idleWorkers] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] {
identifier[addWorkerUnsafe] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public boolean isContaintSensitiveWord(String txt,MatchType matchType){
boolean flag = false;
for(int i = 0 ; i < txt.length() ; i++){
int matchFlag = checkSensitiveWord(txt, i, matchType); //判断是否包含敏感字符
if(matchFlag > 0){ //大于0存在,返回true
flag = true;
}
}
return flag;
} | class class_name[name] begin[{]
method[isContaintSensitiveWord, return_type[type[boolean]], modifier[public], parameter[txt, matchType]] begin[{]
local_variable[type[boolean], flag]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=txt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matchType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkSensitiveWord, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=matchFlag)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=matchFlag, 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=flag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=txt, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.flag]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isContaintSensitiveWord] operator[SEP] identifier[String] identifier[txt] , identifier[MatchType] identifier[matchType] operator[SEP] {
Keyword[boolean] identifier[flag] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[txt] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[matchFlag] operator[=] identifier[checkSensitiveWord] operator[SEP] identifier[txt] , identifier[i] , identifier[matchType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matchFlag] operator[>] Other[0] operator[SEP] {
identifier[flag] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[flag] operator[SEP]
}
|
@SuppressWarnings("PMD.EmptyIfStmt")
@Nullable V remap(K key, Object keyRef,
BiFunction<? super K, ? super V, ? extends V> remappingFunction,
long[/* 1 */] now, boolean computeIfAbsent) {
@SuppressWarnings("unchecked")
K[] nodeKey = (K[]) new Object[1];
@SuppressWarnings("unchecked")
V[] oldValue = (V[]) new Object[1];
@SuppressWarnings("unchecked")
V[] newValue = (V[]) new Object[1];
@SuppressWarnings({"unchecked", "rawtypes"})
Node<K, V>[] removed = new Node[1];
int[] weight = new int[2]; // old, new
RemovalCause[] cause = new RemovalCause[1];
Node<K, V> node = data.compute(keyRef, (kr, n) -> {
if (n == null) {
if (!computeIfAbsent) {
return null;
}
newValue[0] = remappingFunction.apply(key, null);
if (newValue[0] == null) {
return null;
}
now[0] = expirationTicker().read();
weight[1] = weigher.weigh(key, newValue[0]);
n = nodeFactory.newNode(keyRef, newValue[0],
valueReferenceQueue(), weight[1], now[0]);
setVariableTime(n, expireAfterCreate(key, newValue[0], expiry(), now[0]));
return n;
}
synchronized (n) {
nodeKey[0] = n.getKey();
oldValue[0] = n.getValue();
if ((nodeKey[0] == null) || (oldValue[0] == null)) {
cause[0] = RemovalCause.COLLECTED;
} else if (hasExpired(n, now[0])) {
cause[0] = RemovalCause.EXPIRED;
}
if (cause[0] != null) {
writer.delete(nodeKey[0], oldValue[0], cause[0]);
if (!computeIfAbsent) {
removed[0] = n;
n.retire();
return null;
}
}
newValue[0] = remappingFunction.apply(nodeKey[0],
(cause[0] == null) ? oldValue[0] : null);
if (newValue[0] == null) {
if (cause[0] == null) {
cause[0] = RemovalCause.EXPLICIT;
}
removed[0] = n;
n.retire();
return null;
}
weight[0] = n.getWeight();
weight[1] = weigher.weigh(key, newValue[0]);
now[0] = expirationTicker().read();
if (cause[0] == null) {
if (newValue[0] != oldValue[0]) {
cause[0] = RemovalCause.REPLACED;
}
setVariableTime(n, expireAfterUpdate(n, key, newValue[0], expiry(), now[0]));
} else {
setVariableTime(n, expireAfterCreate(key, newValue[0], expiry(), now[0]));
}
n.setValue(newValue[0], valueReferenceQueue());
n.setWeight(weight[1]);
setAccessTime(n, now[0]);
setWriteTime(n, now[0]);
return n;
}
});
if (cause[0] != null) {
if (cause[0].wasEvicted()) {
statsCounter().recordEviction(weight[0], cause[0]);
}
if (hasRemovalListener()) {
notifyRemoval(nodeKey[0], oldValue[0], cause[0]);
}
}
if (removed[0] != null) {
afterWrite(new RemovalTask(removed[0]));
} else if (node == null) {
// absent and not computable
} else if ((oldValue[0] == null) && (cause[0] == null)) {
afterWrite(new AddTask(node, weight[1]));
} else {
int weightedDifference = weight[1] - weight[0];
if (expiresAfterWrite() || (weightedDifference != 0)) {
afterWrite(new UpdateTask(node, weightedDifference));
} else {
if (cause[0] == null) {
if (!isComputingAsync(node)) {
tryExpireAfterRead(node, key, newValue[0], expiry(), now[0]);
setAccessTime(node, now[0]);
}
} else if (cause[0] == RemovalCause.COLLECTED) {
scheduleDrainBuffers();
}
afterRead(node, now[0], /* recordHit */ false);
}
}
return newValue[0];
} | class class_name[name] begin[{]
method[remap, return_type[type[V]], modifier[default], parameter[key, keyRef, remappingFunction, now, computeIfAbsent]] begin[{]
local_variable[type[K], nodeKey]
local_variable[type[V], oldValue]
local_variable[type[V], newValue]
local_variable[type[Node], removed]
local_variable[type[int], weight]
local_variable[type[RemovalCause], cause]
local_variable[type[Node], node]
if[binary_operation[member[.cause], !=, literal[null]]] begin[{]
if[member[.cause]] begin[{]
call[.statsCounter, parameter[]]
else begin[{]
None
end[}]
if[call[.hasRemovalListener, parameter[]]] begin[{]
call[.notifyRemoval, parameter[member[.nodeKey], member[.oldValue], member[.cause]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.removed], !=, literal[null]]] begin[{]
call[.afterWrite, parameter[ClassCreator(arguments=[MemberReference(member=removed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RemovalTask, sub_type=None))]]
else begin[{]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
else begin[{]
if[binary_operation[binary_operation[member[.oldValue], ==, literal[null]], &&, binary_operation[member[.cause], ==, literal[null]]]] begin[{]
call[.afterWrite, parameter[ClassCreator(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=weight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AddTask, sub_type=None))]]
else begin[{]
local_variable[type[int], weightedDifference]
if[binary_operation[call[.expiresAfterWrite, parameter[]], ||, binary_operation[member[.weightedDifference], !=, literal[0]]]] begin[{]
call[.afterWrite, parameter[ClassCreator(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=weightedDifference, 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=UpdateTask, sub_type=None))]]
else begin[{]
if[binary_operation[member[.cause], ==, literal[null]]] begin[{]
if[call[.isComputingAsync, parameter[member[.node]]]] begin[{]
call[.tryExpireAfterRead, parameter[member[.node], member[.key], member[.newValue], call[.expiry, parameter[]], member[.now]]]
call[.setAccessTime, parameter[member[.node], member[.now]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.cause], ==, member[RemovalCause.COLLECTED]]] begin[{]
call[.scheduleDrainBuffers, parameter[]]
else begin[{]
None
end[}]
end[}]
call[.afterRead, parameter[member[.node], member[.now], literal[false]]]
end[}]
end[}]
end[}]
end[}]
return[member[.newValue]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Nullable] identifier[V] identifier[remap] operator[SEP] identifier[K] identifier[key] , identifier[Object] identifier[keyRef] , identifier[BiFunction] operator[<] operator[?] Keyword[super] identifier[K] , operator[?] Keyword[super] identifier[V] , operator[?] Keyword[extends] identifier[V] operator[>] identifier[remappingFunction] , Keyword[long] operator[SEP] operator[SEP] identifier[now] , Keyword[boolean] identifier[computeIfAbsent] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[K] operator[SEP] operator[SEP] identifier[nodeKey] operator[=] operator[SEP] identifier[K] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] Other[1] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[V] operator[SEP] operator[SEP] identifier[oldValue] operator[=] operator[SEP] identifier[V] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] Other[1] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[V] operator[SEP] operator[SEP] identifier[newValue] operator[=] operator[SEP] identifier[V] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Object] operator[SEP] Other[1] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] operator[SEP] identifier[removed] operator[=] Keyword[new] identifier[Node] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[weight] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[RemovalCause] operator[SEP] operator[SEP] identifier[cause] operator[=] Keyword[new] identifier[RemovalCause] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[node] operator[=] identifier[data] operator[SEP] identifier[compute] operator[SEP] identifier[keyRef] , operator[SEP] identifier[kr] , identifier[n] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[n] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[computeIfAbsent] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[=] identifier[remappingFunction] operator[SEP] identifier[apply] operator[SEP] identifier[key] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[now] operator[SEP] Other[0] operator[SEP] operator[=] identifier[expirationTicker] operator[SEP] operator[SEP] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] identifier[weight] operator[SEP] Other[1] operator[SEP] operator[=] identifier[weigher] operator[SEP] identifier[weigh] operator[SEP] identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[=] identifier[nodeFactory] operator[SEP] identifier[newNode] operator[SEP] identifier[keyRef] , identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[valueReferenceQueue] operator[SEP] operator[SEP] , identifier[weight] operator[SEP] Other[1] operator[SEP] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[setVariableTime] operator[SEP] identifier[n] , identifier[expireAfterCreate] operator[SEP] identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[expiry] operator[SEP] operator[SEP] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[n] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[n] operator[SEP] {
identifier[nodeKey] operator[SEP] Other[0] operator[SEP] operator[=] identifier[n] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[oldValue] operator[SEP] Other[0] operator[SEP] operator[=] identifier[n] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[nodeKey] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[oldValue] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
identifier[cause] operator[SEP] Other[0] operator[SEP] operator[=] identifier[RemovalCause] operator[SEP] identifier[COLLECTED] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[hasExpired] operator[SEP] identifier[n] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] {
identifier[cause] operator[SEP] Other[0] operator[SEP] operator[=] identifier[RemovalCause] operator[SEP] identifier[EXPIRED] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[delete] operator[SEP] identifier[nodeKey] operator[SEP] Other[0] operator[SEP] , identifier[oldValue] operator[SEP] Other[0] operator[SEP] , identifier[cause] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[computeIfAbsent] operator[SEP] {
identifier[removed] operator[SEP] Other[0] operator[SEP] operator[=] identifier[n] operator[SEP] identifier[n] operator[SEP] identifier[retire] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[=] identifier[remappingFunction] operator[SEP] identifier[apply] operator[SEP] identifier[nodeKey] operator[SEP] Other[0] operator[SEP] , operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[?] identifier[oldValue] operator[SEP] Other[0] operator[SEP] operator[:] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[cause] operator[SEP] Other[0] operator[SEP] operator[=] identifier[RemovalCause] operator[SEP] identifier[EXPLICIT] operator[SEP]
}
identifier[removed] operator[SEP] Other[0] operator[SEP] operator[=] identifier[n] operator[SEP] identifier[n] operator[SEP] identifier[retire] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[weight] operator[SEP] Other[0] operator[SEP] operator[=] identifier[n] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] operator[SEP] identifier[weight] operator[SEP] Other[1] operator[SEP] operator[=] identifier[weigher] operator[SEP] identifier[weigh] operator[SEP] identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[now] operator[SEP] Other[0] operator[SEP] operator[=] identifier[expirationTicker] operator[SEP] operator[SEP] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[!=] identifier[oldValue] operator[SEP] Other[0] operator[SEP] operator[SEP] {
identifier[cause] operator[SEP] Other[0] operator[SEP] operator[=] identifier[RemovalCause] operator[SEP] identifier[REPLACED] operator[SEP]
}
identifier[setVariableTime] operator[SEP] identifier[n] , identifier[expireAfterUpdate] operator[SEP] identifier[n] , identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[expiry] operator[SEP] operator[SEP] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setVariableTime] operator[SEP] identifier[n] , identifier[expireAfterCreate] operator[SEP] identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[expiry] operator[SEP] operator[SEP] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[n] operator[SEP] identifier[setValue] operator[SEP] identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[valueReferenceQueue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[SEP] identifier[setWeight] operator[SEP] identifier[weight] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[setAccessTime] operator[SEP] identifier[n] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[setWriteTime] operator[SEP] identifier[n] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[n] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[wasEvicted] operator[SEP] operator[SEP] operator[SEP] {
identifier[statsCounter] operator[SEP] operator[SEP] operator[SEP] identifier[recordEviction] operator[SEP] identifier[weight] operator[SEP] Other[0] operator[SEP] , identifier[cause] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hasRemovalListener] operator[SEP] operator[SEP] operator[SEP] {
identifier[notifyRemoval] operator[SEP] identifier[nodeKey] operator[SEP] Other[0] operator[SEP] , identifier[oldValue] operator[SEP] Other[0] operator[SEP] , identifier[cause] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[removed] operator[SEP] Other[0] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[afterWrite] operator[SEP] Keyword[new] identifier[RemovalTask] operator[SEP] identifier[removed] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] {
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[oldValue] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
identifier[afterWrite] operator[SEP] Keyword[new] identifier[AddTask] operator[SEP] identifier[node] , identifier[weight] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[weightedDifference] operator[=] identifier[weight] operator[SEP] Other[1] operator[SEP] operator[-] identifier[weight] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expiresAfterWrite] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[weightedDifference] operator[!=] Other[0] operator[SEP] operator[SEP] {
identifier[afterWrite] operator[SEP] Keyword[new] identifier[UpdateTask] operator[SEP] identifier[node] , identifier[weightedDifference] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isComputingAsync] operator[SEP] identifier[node] operator[SEP] operator[SEP] {
identifier[tryExpireAfterRead] operator[SEP] identifier[node] , identifier[key] , identifier[newValue] operator[SEP] Other[0] operator[SEP] , identifier[expiry] operator[SEP] operator[SEP] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[setAccessTime] operator[SEP] identifier[node] , identifier[now] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[cause] operator[SEP] Other[0] operator[SEP] operator[==] identifier[RemovalCause] operator[SEP] identifier[COLLECTED] operator[SEP] {
identifier[scheduleDrainBuffers] operator[SEP] operator[SEP] operator[SEP]
}
identifier[afterRead] operator[SEP] identifier[node] , identifier[now] operator[SEP] Other[0] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[newValue] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public CacheManagerBuilder<T> withDefaultSizeOfMaxObjectGraph(long size) {
DefaultSizeOfEngineProviderConfiguration configuration = configBuilder.findServiceByClass(DefaultSizeOfEngineProviderConfiguration.class);
if (configuration == null) {
return new CacheManagerBuilder<>(this, configBuilder.addService(new DefaultSizeOfEngineProviderConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size)));
} else {
ConfigurationBuilder builder = configBuilder.removeService(configuration);
return new CacheManagerBuilder<>(this, builder.addService(new DefaultSizeOfEngineProviderConfiguration(configuration
.getMaxObjectSize(), configuration.getUnit(), size)));
}
} | class class_name[name] begin[{]
method[withDefaultSizeOfMaxObjectGraph, return_type[type[CacheManagerBuilder]], modifier[public], parameter[size]] begin[{]
local_variable[type[DefaultSizeOfEngineProviderConfiguration], configuration]
if[binary_operation[member[.configuration], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=DEFAULT_MAX_OBJECT_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DEFAULT_UNIT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=size, 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=DefaultSizeOfEngineProviderConfiguration, sub_type=None))], member=addService, postfix_operators=[], prefix_operators=[], qualifier=configBuilder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=CacheManagerBuilder, sub_type=None))]
else begin[{]
local_variable[type[ConfigurationBuilder], builder]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMaxObjectSize, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUnit, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), MemberReference(member=size, 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=DefaultSizeOfEngineProviderConfiguration, sub_type=None))], member=addService, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=CacheManagerBuilder, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[public] identifier[CacheManagerBuilder] operator[<] identifier[T] operator[>] identifier[withDefaultSizeOfMaxObjectGraph] operator[SEP] Keyword[long] identifier[size] operator[SEP] {
identifier[DefaultSizeOfEngineProviderConfiguration] identifier[configuration] operator[=] identifier[configBuilder] operator[SEP] identifier[findServiceByClass] operator[SEP] identifier[DefaultSizeOfEngineProviderConfiguration] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[configuration] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[CacheManagerBuilder] operator[<] operator[>] operator[SEP] Keyword[this] , identifier[configBuilder] operator[SEP] identifier[addService] operator[SEP] Keyword[new] identifier[DefaultSizeOfEngineProviderConfiguration] operator[SEP] identifier[DEFAULT_MAX_OBJECT_SIZE] , identifier[DEFAULT_UNIT] , identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ConfigurationBuilder] identifier[builder] operator[=] identifier[configBuilder] operator[SEP] identifier[removeService] operator[SEP] identifier[configuration] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CacheManagerBuilder] operator[<] operator[>] operator[SEP] Keyword[this] , identifier[builder] operator[SEP] identifier[addService] operator[SEP] Keyword[new] identifier[DefaultSizeOfEngineProviderConfiguration] operator[SEP] identifier[configuration] operator[SEP] identifier[getMaxObjectSize] operator[SEP] operator[SEP] , identifier[configuration] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] , identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
static public Date getDate(String str, TimeZone tz, SFSession session) throws SFException
{
try
{
long milliSecsSinceEpoch = Long.valueOf(str) * 86400000;
SFTimestamp tsInUTC = SFTimestamp.fromDate(new Date(milliSecsSinceEpoch),
0, TimeZone.getTimeZone("UTC"));
SFTimestamp tsInClientTZ = tsInUTC.moveToTimeZone(tz);
if (logger.isDebugEnabled())
{
logger.debug("getDate: tz offset={}",
tsInClientTZ.getTimeZone().getOffset(tsInClientTZ.getTime()));
}
// return the date adjusted to the JVM default time zone
Date preDate = new Date(tsInClientTZ.getTime());
// if date is on or before 1582-10-04, apply the difference
// by (H-H/4-2) where H is the hundreds digit of the year according to:
// http://en.wikipedia.org/wiki/Gregorian_calendar
Date newDate = adjustDate(preDate);
if (logger.isDebugEnabled())
{
logger.debug("Adjust date from {} to {}",
preDate.toString(), newDate.toString());
}
return newDate;
}
catch (NumberFormatException ex)
{
throw (SFException) IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.INTERNAL_ERROR,
"Invalid date value: " + str),
null,
null);
}
} | class class_name[name] begin[{]
method[getDate, return_type[type[Date]], modifier[public static], parameter[str, tz, session]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=86400000), operator=*), name=milliSecsSinceEpoch)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=milliSecsSinceEpoch, 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=Date, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTC")], member=getTimeZone, postfix_operators=[], prefix_operators=[], qualifier=TimeZone, selectors=[], type_arguments=None)], member=fromDate, postfix_operators=[], prefix_operators=[], qualifier=SFTimestamp, selectors=[], type_arguments=None), name=tsInUTC)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SFTimestamp, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=moveToTimeZone, postfix_operators=[], prefix_operators=[], qualifier=tsInUTC, selectors=[], type_arguments=None), name=tsInClientTZ)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SFTimestamp, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getDate: tz offset={}"), MethodInvocation(arguments=[], member=getTimeZone, postfix_operators=[], prefix_operators=[], qualifier=tsInClientTZ, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTime, postfix_operators=[], prefix_operators=[], qualifier=tsInClientTZ, selectors=[], type_arguments=None)], member=getOffset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTime, postfix_operators=[], prefix_operators=[], qualifier=tsInClientTZ, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None)), name=preDate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=preDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=adjustDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=newDate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Adjust date from {} to {}"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=preDate, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=newDate, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=newDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid date value: "), operandr=MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFException, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=generateIncidentV2WithException, postfix_operators=[], prefix_operators=[], qualifier=IncidentUtil, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SFException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[static] Keyword[public] identifier[Date] identifier[getDate] operator[SEP] identifier[String] identifier[str] , identifier[TimeZone] identifier[tz] , identifier[SFSession] identifier[session] operator[SEP] Keyword[throws] identifier[SFException] {
Keyword[try] {
Keyword[long] identifier[milliSecsSinceEpoch] operator[=] identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[str] operator[SEP] operator[*] Other[86400000] operator[SEP] identifier[SFTimestamp] identifier[tsInUTC] operator[=] identifier[SFTimestamp] operator[SEP] identifier[fromDate] operator[SEP] Keyword[new] identifier[Date] operator[SEP] identifier[milliSecsSinceEpoch] operator[SEP] , Other[0] , identifier[TimeZone] operator[SEP] identifier[getTimeZone] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[SFTimestamp] identifier[tsInClientTZ] operator[=] identifier[tsInUTC] operator[SEP] identifier[moveToTimeZone] operator[SEP] identifier[tz] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[tsInClientTZ] operator[SEP] identifier[getTimeZone] operator[SEP] operator[SEP] operator[SEP] identifier[getOffset] operator[SEP] identifier[tsInClientTZ] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Date] identifier[preDate] operator[=] Keyword[new] identifier[Date] operator[SEP] identifier[tsInClientTZ] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Date] identifier[newDate] operator[=] identifier[adjustDate] operator[SEP] identifier[preDate] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[preDate] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[newDate] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newDate] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[ex] operator[SEP] {
Keyword[throw] operator[SEP] identifier[SFException] operator[SEP] identifier[IncidentUtil] operator[SEP] identifier[generateIncidentV2WithException] operator[SEP] identifier[session] , Keyword[new] identifier[SFException] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[INTERNAL_ERROR] , literal[String] operator[+] identifier[str] operator[SEP] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
}
|
public void setUser(User user) {
this.user = user;
if (httpSender != null) {
httpSender.setUser(user);
}
} | class class_name[name] begin[{]
method[setUser, return_type[void], modifier[public], parameter[user]] begin[{]
assign[THIS[member[None.user]], member[.user]]
if[binary_operation[member[.httpSender], !=, literal[null]]] begin[{]
call[httpSender.setUser, parameter[member[.user]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setUser] operator[SEP] identifier[User] identifier[user] operator[SEP] {
Keyword[this] operator[SEP] identifier[user] operator[=] identifier[user] operator[SEP] Keyword[if] operator[SEP] identifier[httpSender] operator[!=] Other[null] operator[SEP] {
identifier[httpSender] operator[SEP] identifier[setUser] operator[SEP] identifier[user] operator[SEP] operator[SEP]
}
}
|
public void add(String name,String value)
throws IllegalArgumentException
{
if (value==null)
throw new IllegalArgumentException("null value");
FieldInfo info=getFieldInfo(name);
Field field=getField(info,false);
Field last=null;
if (field!=null)
{
while(field!=null && field._version==_version)
{
last=field;
field=field._next;
}
}
if (field!=null)
field.reset(value,_version);
else
{
// create the field
field=new Field(info,value,_version);
// look for chain to add too
if(last!=null)
{
field._prev=last;
last._next=field;
}
else if (info.hashCode()<_index.length)
_index[info.hashCode()]=_fields.size();
_fields.add(field);
}
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[name, value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null value")], 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[FieldInfo], info]
local_variable[type[Field], field]
local_variable[type[Field], last]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
while[binary_operation[binary_operation[member[.field], !=, literal[null]], &&, binary_operation[member[field._version], ==, member[._version]]]] begin[{]
assign[member[.last], member[.field]]
assign[member[.field], member[field._next]]
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
call[field.reset, parameter[member[.value], member[._version]]]
else begin[{]
assign[member[.field], ClassCreator(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_version, 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=Field, sub_type=None))]
if[binary_operation[member[.last], !=, literal[null]]] begin[{]
assign[member[field._prev], member[.last]]
assign[member[last._next], member[.field]]
else begin[{]
if[binary_operation[call[info.hashCode, parameter[]], <, member[_index.length]]] begin[{]
assign[member[._index], call[_fields.size, parameter[]]]
else begin[{]
None
end[}]
end[}]
call[_fields.add, parameter[member[.field]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[FieldInfo] identifier[info] operator[=] identifier[getFieldInfo] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[Field] identifier[field] operator[=] identifier[getField] operator[SEP] identifier[info] , literal[boolean] operator[SEP] operator[SEP] identifier[Field] identifier[last] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
Keyword[while] operator[SEP] identifier[field] operator[!=] Other[null] operator[&&] identifier[field] operator[SEP] identifier[_version] operator[==] identifier[_version] operator[SEP] {
identifier[last] operator[=] identifier[field] operator[SEP] identifier[field] operator[=] identifier[field] operator[SEP] identifier[_next] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] identifier[field] operator[SEP] identifier[reset] operator[SEP] identifier[value] , identifier[_version] operator[SEP] operator[SEP] Keyword[else] {
identifier[field] operator[=] Keyword[new] identifier[Field] operator[SEP] identifier[info] , identifier[value] , identifier[_version] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[last] operator[!=] Other[null] operator[SEP] {
identifier[field] operator[SEP] identifier[_prev] operator[=] identifier[last] operator[SEP] identifier[last] operator[SEP] identifier[_next] operator[=] identifier[field] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[info] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[<] identifier[_index] operator[SEP] identifier[length] operator[SEP] identifier[_index] operator[SEP] identifier[info] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] operator[=] identifier[_fields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[_fields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
}
|
public static String getRepeatedFieldSetterName(Field field) {
if (field.isRepeated()) {
return SETTER_PREFIX + Formatter.toPascalCase(field.getName());
}
throw new IllegalArgumentException(field.toString());
} | class class_name[name] begin[{]
method[getRepeatedFieldSetterName, return_type[type[String]], modifier[public static], parameter[field]] begin[{]
if[call[field.isRepeated, parameter[]]] begin[{]
return[binary_operation[member[.SETTER_PREFIX], +, call[Formatter.toPascalCase, parameter[call[field.getName, parameter[]]]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], 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)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getRepeatedFieldSetterName] operator[SEP] identifier[Field] identifier[field] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[SEP] identifier[isRepeated] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[SETTER_PREFIX] operator[+] identifier[Formatter] operator[SEP] identifier[toPascalCase] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[field] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@RequestMapping(value = "/api/todolist/{index}",
method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<?> getTodoItem(@PathVariable("index") int index) {
if (index > todoList.size() - 1) {
return new ResponseEntity<>(new TodoItem(-1, "index out of range", null), HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(todoList.get(index), HttpStatus.OK);
} | class class_name[name] begin[{]
method[getTodoItem, return_type[type[ResponseEntity]], modifier[public], parameter[index]] begin[{]
if[binary_operation[member[.index], >, binary_operation[call[todoList.size, parameter[]], -, literal[1]]]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="index out of range"), 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=TodoItem, sub_type=None)), MemberReference(member=NOT_FOUND, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ResponseEntity, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=todoList, selectors=[], type_arguments=None), MemberReference(member=OK, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ResponseEntity, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[GET] , identifier[produces] operator[=] {
identifier[MediaType] operator[SEP] identifier[APPLICATION_JSON_VALUE]
} operator[SEP] Keyword[public] identifier[ResponseEntity] operator[<] operator[?] operator[>] identifier[getTodoItem] operator[SEP] annotation[@] identifier[PathVariable] operator[SEP] literal[String] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[>] identifier[todoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
Keyword[return] Keyword[new] identifier[ResponseEntity] operator[<] operator[>] operator[SEP] Keyword[new] identifier[TodoItem] operator[SEP] operator[-] Other[1] , literal[String] , Other[null] operator[SEP] , identifier[HttpStatus] operator[SEP] identifier[NOT_FOUND] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ResponseEntity] operator[<] operator[>] operator[SEP] identifier[todoList] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] , identifier[HttpStatus] operator[SEP] identifier[OK] operator[SEP] operator[SEP]
}
|
private static void internalArrayEquals(String message, Object expecteds,
Object actuals) throws ArrayComparisonFailure {
new ExactComparisonCriteria().arrayEquals(message, expecteds, actuals);
} | class class_name[name] begin[{]
method[internalArrayEquals, return_type[void], modifier[private static], parameter[message, expecteds, actuals]] begin[{]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expecteds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=actuals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arrayEquals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ExactComparisonCriteria, sub_type=None))
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[internalArrayEquals] operator[SEP] identifier[String] identifier[message] , identifier[Object] identifier[expecteds] , identifier[Object] identifier[actuals] operator[SEP] Keyword[throws] identifier[ArrayComparisonFailure] {
Keyword[new] identifier[ExactComparisonCriteria] operator[SEP] operator[SEP] operator[SEP] identifier[arrayEquals] operator[SEP] identifier[message] , identifier[expecteds] , identifier[actuals] operator[SEP] operator[SEP]
}
|
public void getWorldPositions(float[] dest)
{
if (dest.length != mBones.length * 3)
{
throw new IllegalArgumentException("Destination array is the wrong size");
}
sync();
for (int i = 0; i < mBones.length; ++i)
{
int t = i * 3;
dest[t] = mBones[i].WorldMatrix.m30();
dest[t + 1] = mBones[i].WorldMatrix.m31();
dest[t + 2] = mBones[i].WorldMatrix.m32();
}
} | class class_name[name] begin[{]
method[getWorldPositions, return_type[void], modifier[public], parameter[dest]] begin[{]
if[binary_operation[member[dest.length], !=, binary_operation[member[mBones.length], *, literal[3]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Destination array is the wrong size")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.sync, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=*), name=t)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=mBones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=WorldMatrix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=m30, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), type==, value=MemberReference(member=mBones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=WorldMatrix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=m31, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+))]), type==, value=MemberReference(member=mBones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=WorldMatrix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=m32, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=mBones, 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[getWorldPositions] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[dest] operator[SEP] {
Keyword[if] operator[SEP] identifier[dest] operator[SEP] identifier[length] operator[!=] identifier[mBones] operator[SEP] identifier[length] operator[*] Other[3] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sync] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[mBones] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[int] identifier[t] operator[=] identifier[i] operator[*] Other[3] operator[SEP] identifier[dest] operator[SEP] identifier[t] operator[SEP] operator[=] identifier[mBones] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[WorldMatrix] operator[SEP] identifier[m30] operator[SEP] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[t] operator[+] Other[1] operator[SEP] operator[=] identifier[mBones] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[WorldMatrix] operator[SEP] identifier[m31] operator[SEP] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[t] operator[+] Other[2] operator[SEP] operator[=] identifier[mBones] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[WorldMatrix] operator[SEP] identifier[m32] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void processAttachments(FedoraClient fedora, DigitalObject object,
String vitalPid) throws Exception {
ByteArrayOutputStream out = null;
ByteArrayInputStream in = null;
SolrResult result;
// Search for attachments to this object
String oid = object.getId();
SearchRequest req = new SearchRequest("attached_to:\"" + oid + "\"");
req.setParam("rows", "1000");
// Get our search results
try {
out = new ByteArrayOutputStream();
indexer.search(req, out);
in = new ByteArrayInputStream(out.toByteArray());
result = new SolrResult(in);
} catch (Exception ex) {
throw new Exception("Error searching for attachments : ", ex);
} finally {
close(out);
close(in);
}
// Make sure there were even results
if (result.getNumFound() == 0) {
log.info("No attachments found for '{}'", oid);
return;
}
// Do a *first* pre-pass establishing which IDs to use
Map<String, Map<String, String>> idMap = new HashMap<String,
Map<String, String>>();
List<String> usedIds = new ArrayList<String>();
for (SolrDoc item : result.getResults()) {
// Has it been to VITAL before?
String aOid = item.getFirst("id");
DigitalObject attachment = storage.getObject(aOid);
Properties metadata = attachment.getMetadata();
String vitalDsId = metadata.getProperty(Strings.PROP_VITAL_DSID);
String vitalOrder = metadata.getProperty(Strings.PROP_VITAL_ORDER);
// Record what we know
Map<String, String> map = new HashMap<String, String>();
if (vitalDsId != null) {
map.put("hasId", "true");
map.put(Strings.PROP_VITAL_DSID, vitalDsId);
map.put(Strings.PROP_VITAL_ORDER, vitalOrder);
usedIds.add(vitalDsId);
} else {
map.put("hasId", "false");
}
idMap.put(aOid, map);
}
// Another pass, now that we know all the used IDs
int dsIdSuffix = 1;
for (SolrDoc item : result.getResults()) {
String aOid = item.getFirst("id");
boolean hasId = Boolean.parseBoolean(idMap.get(aOid).get("hasId"));
// This record needs a new ID
if (!hasId) {
String newId = String.format(attachDs, dsIdSuffix);
// Make sure it's not in use already either by us
while (usedIds.contains(newId) || // or by VITAL
datastreamExists(fedora, vitalPid, newId)) {
dsIdSuffix++;
newId = String.format(attachDs, dsIdSuffix);
}
// 'Use' it
idMap.get(aOid).put(Strings.PROP_VITAL_DSID, newId);
idMap.get(aOid).put(Strings.PROP_VITAL_ORDER,
String.valueOf(dsIdSuffix));
usedIds.add(newId);
dsIdSuffix++;
}
}
// Now, the real work. Loop through each attachment
for (SolrDoc item : result.getResults()) {
String aOid = item.getFirst("id");
log.info("Processing Attachment: '{}'", aOid);
// Get the object from storage
DigitalObject attachment = storage.getObject(aOid);
// Find our workflow/form data
Payload wfPayload = attachment.getPayload("workflow.metadata");
JsonSimple workflow = null;
try {
workflow = new JsonSimple(wfPayload.open());
} catch (Exception ex) {
throw ex;
} finally {
wfPayload.close();
}
// Find our payload
String pid = workflow.getString(attachment.getSourceId(),
Strings.NODE_FORMDATA, "filename");
log.info(" === Attachment PID: '{}'", pid);
Payload payload = attachment.getPayload(pid);
// MIME Type - Default to binary data
String mimeType = payload.getContentType();
if (mimeType == null) {
mimeType = "application/octet-stream";
}
// Get our VITAL config
String dsId = idMap.get(aOid).get(Strings.PROP_VITAL_DSID);
String vitalOrder = idMap.get(aOid).get(Strings.PROP_VITAL_ORDER);
String label = dsId; // Default
String labelData = workflow.getString(null,
Strings.NODE_FORMDATA, attachLabelField);
if (attachLabels.containsKey(labelData)) {
// We found a real value
label = attachLabels.get(labelData);
}
String status = "A"; // Default
String statusData = workflow.getString(null,
Strings.NODE_FORMDATA, attachStatusField);
if (attachStatuses.containsKey(statusData)) {
// We found a real value
status = attachStatuses.get(statusData);
}
// Check for Alt IDs that already exist... if configured to
String[] altIds = {};
if (attachRetainIds && datastreamExists(fedora, vitalPid, dsId)) {
altIds = getAltIds(fedora, vitalPid, dsId);
for (String altId : altIds) {
log.debug("Retaining alt ID: '{}' => {}'", dsId, altId);
}
}
altIds = resolveAltIds(altIds, mimeType,
Integer.valueOf(vitalOrder));
try {
sendToVital(fedora, attachment, pid, vitalPid, dsId, altIds,
label, mimeType, attachControlGroup, status,
attachVersionable);
} catch (Exception ex) {
// Throw error
throw new Exception("Error uploading attachment '" + aOid
+ "' : ", ex);
}
// The submission was successful, store the dsId if not already
boolean hasId = Boolean.parseBoolean(idMap.get(aOid).get("hasId"));
if (!hasId) {
Properties metadata = attachment.getMetadata();
metadata.setProperty(Strings.PROP_VITAL_DSID, dsId);
metadata.setProperty(Strings.PROP_VITAL_ORDER, vitalOrder);
attachment.close();
}
} // End for loop
} | class class_name[name] begin[{]
method[processAttachments, return_type[void], modifier[private], parameter[fedora, object, vitalPid]] begin[{]
local_variable[type[ByteArrayOutputStream], out]
local_variable[type[ByteArrayInputStream], in]
local_variable[type[SolrResult], result]
local_variable[type[String], oid]
local_variable[type[SearchRequest], req]
call[req.setParam, parameter[literal["rows"], literal["1000"]]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=out, 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=ByteArrayOutputStream, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=search, postfix_operators=[], prefix_operators=[], qualifier=indexer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=in, 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=SolrResult, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error searching for attachments : "), MemberReference(member=ex, 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=Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
if[binary_operation[call[result.getNumFound, parameter[]], ==, literal[0]]] begin[{]
call[log.info, parameter[literal["No attachments found for '{}'"], member[.oid]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[Map], idMap]
local_variable[type[List], usedIds]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id")], member=getFirst, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=aOid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[], type_arguments=None), name=attachment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DigitalObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetadata, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), name=metadata)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Properties, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_DSID, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), name=vitalDsId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_ORDER, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), name=vitalOrder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=map)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=vitalDsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hasId"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="false")], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hasId"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="true")], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_DSID, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=vitalDsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_ORDER, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=vitalOrder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=vitalDsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=usedIds, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=map, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResults, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SolrDoc, sub_type=None))), label=None)
local_variable[type[int], dsIdSuffix]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id")], member=getFirst, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=aOid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hasId")], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=parseBoolean, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), name=hasId)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=hasId, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=attachDs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dsIdSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), name=newId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=dsIdSuffix, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=attachDs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dsIdSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=newId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=usedIds, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=fedora, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vitalPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=datastreamExists, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=||), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_DSID, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=newId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_ORDER, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MethodInvocation(arguments=[MemberReference(member=dsIdSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=usedIds, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=dsIdSuffix, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResults, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SolrDoc, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id")], member=getFirst, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=aOid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Processing Attachment: '{}'"), MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[], type_arguments=None), name=attachment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DigitalObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="workflow.metadata")], member=getPayload, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), name=wfPayload)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Payload, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=workflow)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonSimple, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=workflow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=wfPayload, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonSimple, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=wfPayload, selectors=[], type_arguments=None), label=None)], label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceId, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), MemberReference(member=NODE_FORMDATA, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filename")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=workflow, selectors=[], type_arguments=None), name=pid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" === Attachment PID: '{}'"), MemberReference(member=pid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPayload, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), name=payload)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Payload, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentType, postfix_operators=[], prefix_operators=[], qualifier=payload, selectors=[], type_arguments=None), name=mimeType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mimeType, 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=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/octet-stream")), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_DSID, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=dsId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_ORDER, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=vitalOrder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=label)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=NODE_FORMDATA, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=attachLabelField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=workflow, selectors=[], type_arguments=None), name=labelData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=labelData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=attachLabels, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=labelData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=attachLabels, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A"), name=status)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=NODE_FORMDATA, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=attachStatusField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=workflow, selectors=[], type_arguments=None), name=statusData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=statusData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=attachStatuses, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=statusData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=attachStatuses, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayInitializer(initializers=[]), name=altIds)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=attachRetainIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=fedora, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vitalPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=datastreamExists, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=altIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=fedora, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vitalPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAltIds, postfix_operators=[], prefix_operators=[], qualifier=, 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="Retaining alt ID: '{}' => {}'"), MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=altId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=altIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=altId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=altIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=altIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=vitalOrder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)], member=resolveAltIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fedora, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attachment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vitalPid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=altIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mimeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attachControlGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attachVersionable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendToVital, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error uploading attachment '"), operandr=MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' : "), operator=+), MemberReference(member=ex, 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=Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=aOid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=idMap, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hasId")], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=parseBoolean, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), name=hasId)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=hasId, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetadata, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), name=metadata)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Properties, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_DSID, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=dsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROP_VITAL_ORDER, postfix_operators=[], prefix_operators=[], qualifier=Strings, selectors=[]), MemberReference(member=vitalOrder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=attachment, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResults, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SolrDoc, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processAttachments] operator[SEP] identifier[FedoraClient] identifier[fedora] , identifier[DigitalObject] identifier[object] , identifier[String] identifier[vitalPid] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ByteArrayOutputStream] identifier[out] operator[=] Other[null] operator[SEP] identifier[ByteArrayInputStream] identifier[in] operator[=] Other[null] operator[SEP] identifier[SolrResult] identifier[result] operator[SEP] identifier[String] identifier[oid] operator[=] identifier[object] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[SearchRequest] identifier[req] operator[=] Keyword[new] identifier[SearchRequest] operator[SEP] literal[String] operator[+] identifier[oid] operator[+] literal[String] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setParam] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[out] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[indexer] operator[SEP] identifier[search] operator[SEP] identifier[req] , identifier[out] operator[SEP] operator[SEP] identifier[in] operator[=] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[out] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[SolrResult] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[close] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[close] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[getNumFound] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[oid] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[idMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[usedIds] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[SolrDoc] identifier[item] operator[:] identifier[result] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[aOid] operator[=] identifier[item] operator[SEP] identifier[getFirst] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[DigitalObject] identifier[attachment] operator[=] identifier[storage] operator[SEP] identifier[getObject] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[Properties] identifier[metadata] operator[=] identifier[attachment] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[vitalDsId] operator[=] identifier[metadata] operator[SEP] identifier[getProperty] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_DSID] operator[SEP] operator[SEP] identifier[String] identifier[vitalOrder] operator[=] identifier[metadata] operator[SEP] identifier[getProperty] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_ORDER] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[map] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vitalDsId] operator[!=] Other[null] operator[SEP] {
identifier[map] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_DSID] , identifier[vitalDsId] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_ORDER] , identifier[vitalOrder] operator[SEP] operator[SEP] identifier[usedIds] operator[SEP] identifier[add] operator[SEP] identifier[vitalDsId] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[map] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
identifier[idMap] operator[SEP] identifier[put] operator[SEP] identifier[aOid] , identifier[map] operator[SEP] operator[SEP]
}
Keyword[int] identifier[dsIdSuffix] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[SolrDoc] identifier[item] operator[:] identifier[result] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[aOid] operator[=] identifier[item] operator[SEP] identifier[getFirst] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[hasId] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[hasId] operator[SEP] {
identifier[String] identifier[newId] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[attachDs] , identifier[dsIdSuffix] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[usedIds] operator[SEP] identifier[contains] operator[SEP] identifier[newId] operator[SEP] operator[||] identifier[datastreamExists] operator[SEP] identifier[fedora] , identifier[vitalPid] , identifier[newId] operator[SEP] operator[SEP] {
identifier[dsIdSuffix] operator[++] operator[SEP] identifier[newId] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[attachDs] , identifier[dsIdSuffix] operator[SEP] operator[SEP]
}
identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_DSID] , identifier[newId] operator[SEP] operator[SEP] identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_ORDER] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[dsIdSuffix] operator[SEP] operator[SEP] operator[SEP] identifier[usedIds] operator[SEP] identifier[add] operator[SEP] identifier[newId] operator[SEP] operator[SEP] identifier[dsIdSuffix] operator[++] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[SolrDoc] identifier[item] operator[:] identifier[result] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[aOid] operator[=] identifier[item] operator[SEP] identifier[getFirst] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[aOid] operator[SEP] operator[SEP] identifier[DigitalObject] identifier[attachment] operator[=] identifier[storage] operator[SEP] identifier[getObject] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[Payload] identifier[wfPayload] operator[=] identifier[attachment] operator[SEP] identifier[getPayload] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[JsonSimple] identifier[workflow] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[workflow] operator[=] Keyword[new] identifier[JsonSimple] operator[SEP] identifier[wfPayload] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
Keyword[finally] {
identifier[wfPayload] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[pid] operator[=] identifier[workflow] operator[SEP] identifier[getString] operator[SEP] identifier[attachment] operator[SEP] identifier[getSourceId] operator[SEP] operator[SEP] , identifier[Strings] operator[SEP] identifier[NODE_FORMDATA] , literal[String] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[pid] operator[SEP] operator[SEP] identifier[Payload] identifier[payload] operator[=] identifier[attachment] operator[SEP] identifier[getPayload] operator[SEP] identifier[pid] operator[SEP] operator[SEP] identifier[String] identifier[mimeType] operator[=] identifier[payload] operator[SEP] identifier[getContentType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mimeType] operator[==] Other[null] operator[SEP] {
identifier[mimeType] operator[=] literal[String] operator[SEP]
}
identifier[String] identifier[dsId] operator[=] identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_DSID] operator[SEP] operator[SEP] identifier[String] identifier[vitalOrder] operator[=] identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_ORDER] operator[SEP] operator[SEP] identifier[String] identifier[label] operator[=] identifier[dsId] operator[SEP] identifier[String] identifier[labelData] operator[=] identifier[workflow] operator[SEP] identifier[getString] operator[SEP] Other[null] , identifier[Strings] operator[SEP] identifier[NODE_FORMDATA] , identifier[attachLabelField] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attachLabels] operator[SEP] identifier[containsKey] operator[SEP] identifier[labelData] operator[SEP] operator[SEP] {
identifier[label] operator[=] identifier[attachLabels] operator[SEP] identifier[get] operator[SEP] identifier[labelData] operator[SEP] operator[SEP]
}
identifier[String] identifier[status] operator[=] literal[String] operator[SEP] identifier[String] identifier[statusData] operator[=] identifier[workflow] operator[SEP] identifier[getString] operator[SEP] Other[null] , identifier[Strings] operator[SEP] identifier[NODE_FORMDATA] , identifier[attachStatusField] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attachStatuses] operator[SEP] identifier[containsKey] operator[SEP] identifier[statusData] operator[SEP] operator[SEP] {
identifier[status] operator[=] identifier[attachStatuses] operator[SEP] identifier[get] operator[SEP] identifier[statusData] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[altIds] operator[=] {
} operator[SEP] Keyword[if] operator[SEP] identifier[attachRetainIds] operator[&&] identifier[datastreamExists] operator[SEP] identifier[fedora] , identifier[vitalPid] , identifier[dsId] operator[SEP] operator[SEP] {
identifier[altIds] operator[=] identifier[getAltIds] operator[SEP] identifier[fedora] , identifier[vitalPid] , identifier[dsId] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[altId] operator[:] identifier[altIds] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[dsId] , identifier[altId] operator[SEP] operator[SEP]
}
}
identifier[altIds] operator[=] identifier[resolveAltIds] operator[SEP] identifier[altIds] , identifier[mimeType] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[vitalOrder] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[sendToVital] operator[SEP] identifier[fedora] , identifier[attachment] , identifier[pid] , identifier[vitalPid] , identifier[dsId] , identifier[altIds] , identifier[label] , identifier[mimeType] , identifier[attachControlGroup] , identifier[status] , identifier[attachVersionable] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[+] identifier[aOid] operator[+] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[hasId] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[idMap] operator[SEP] identifier[get] operator[SEP] identifier[aOid] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[hasId] operator[SEP] {
identifier[Properties] identifier[metadata] operator[=] identifier[attachment] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[metadata] operator[SEP] identifier[setProperty] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_DSID] , identifier[dsId] operator[SEP] operator[SEP] identifier[metadata] operator[SEP] identifier[setProperty] operator[SEP] identifier[Strings] operator[SEP] identifier[PROP_VITAL_ORDER] , identifier[vitalOrder] operator[SEP] operator[SEP] identifier[attachment] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
void triggerSessionRequested(Jingle initJin) {
JingleSessionRequestListener[] jingleSessionRequestListeners;
// Make a synchronized copy of the listenerJingles
synchronized (this.jingleSessionRequestListeners) {
jingleSessionRequestListeners = new JingleSessionRequestListener[this.jingleSessionRequestListeners.size()];
this.jingleSessionRequestListeners.toArray(jingleSessionRequestListeners);
}
// ... and let them know of the event
JingleSessionRequest request = new JingleSessionRequest(this, initJin);
for (int i = 0; i < jingleSessionRequestListeners.length; i++) {
jingleSessionRequestListeners[i].sessionRequested(request);
}
} | class class_name[name] begin[{]
method[triggerSessionRequested, return_type[void], modifier[default], parameter[initJin]] begin[{]
local_variable[type[JingleSessionRequestListener], jingleSessionRequestListeners]
SYNCHRONIZED[THIS[member[None.jingleSessionRequestListeners]]] BEGIN[{]
assign[member[.jingleSessionRequestListeners], ArrayCreator(dimensions=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=jingleSessionRequestListeners, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JingleSessionRequestListener, sub_type=None))]
THIS[member[None.jingleSessionRequestListeners]call[None.toArray, parameter[member[.jingleSessionRequestListeners]]]]
END[}]
local_variable[type[JingleSessionRequest], request]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=jingleSessionRequestListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sessionRequested, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=jingleSessionRequestListeners, 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[void] identifier[triggerSessionRequested] operator[SEP] identifier[Jingle] identifier[initJin] operator[SEP] {
identifier[JingleSessionRequestListener] operator[SEP] operator[SEP] identifier[jingleSessionRequestListeners] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[jingleSessionRequestListeners] operator[SEP] {
identifier[jingleSessionRequestListeners] operator[=] Keyword[new] identifier[JingleSessionRequestListener] operator[SEP] Keyword[this] operator[SEP] identifier[jingleSessionRequestListeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[jingleSessionRequestListeners] operator[SEP] identifier[toArray] operator[SEP] identifier[jingleSessionRequestListeners] operator[SEP] operator[SEP]
}
identifier[JingleSessionRequest] identifier[request] operator[=] Keyword[new] identifier[JingleSessionRequest] operator[SEP] Keyword[this] , identifier[initJin] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[jingleSessionRequestListeners] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[jingleSessionRequestListeners] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sessionRequested] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
}
|
@Pure
public static <K, V> Pair<K, V> of(K k, V v) {
return new Pair<K, V>(k, v);
} | class class_name[name] begin[{]
method[of, return_type[type[Pair]], modifier[public static], parameter[k, v]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Pair, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Pair] operator[<] identifier[K] , identifier[V] operator[>] identifier[of] operator[SEP] identifier[K] identifier[k] , identifier[V] identifier[v] operator[SEP] {
Keyword[return] Keyword[new] identifier[Pair] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[k] , identifier[v] operator[SEP] operator[SEP]
}
|
public <E> Concatenator LTE(E value) {
getBooleanOp().setOperator(Operator.LTE);
return this.operateOn(value);
} | class class_name[name] begin[{]
method[LTE, return_type[type[Concatenator]], modifier[public], parameter[value]] begin[{]
call[.getBooleanOp, parameter[]]
return[THIS[call[None.operateOn, parameter[member[.value]]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[E] operator[>] identifier[Concatenator] identifier[LTE] operator[SEP] identifier[E] identifier[value] operator[SEP] {
identifier[getBooleanOp] operator[SEP] operator[SEP] operator[SEP] identifier[setOperator] operator[SEP] identifier[Operator] operator[SEP] identifier[LTE] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[operateOn] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public RealMatrix outerProduct(RealVector v) {
final int m = this.getDimension();
final int n = v.getDimension();
final RealMatrix product;
if(m > 1000000) { //use only in big values
product = new MapRealMatrix(m, n);
}
else {
product = new OpenMapRealMatrix(m, n);
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
product.setEntry(i, j, this.getEntry(i) * v.getEntry(j));
}
}
return product;
} | class class_name[name] begin[{]
method[outerProduct, return_type[type[RealMatrix]], modifier[public], parameter[v]] begin[{]
local_variable[type[int], m]
local_variable[type[int], n]
local_variable[type[RealMatrix], product]
if[binary_operation[member[.m], >, literal[1000000]]] begin[{]
assign[member[.product], ClassCreator(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=n, 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=MapRealMatrix, sub_type=None))]
else begin[{]
assign[member[.product], ClassCreator(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=n, 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=OpenMapRealMatrix, sub_type=None))]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntry, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntry, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), operator=*)], member=setEntry, postfix_operators=[], prefix_operators=[], qualifier=product, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, 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)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m, 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[.product]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RealMatrix] identifier[outerProduct] operator[SEP] identifier[RealVector] identifier[v] operator[SEP] {
Keyword[final] Keyword[int] identifier[m] operator[=] Keyword[this] operator[SEP] identifier[getDimension] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[n] operator[=] identifier[v] operator[SEP] identifier[getDimension] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[RealMatrix] identifier[product] operator[SEP] Keyword[if] operator[SEP] identifier[m] operator[>] Other[1000000] operator[SEP] {
identifier[product] operator[=] Keyword[new] identifier[MapRealMatrix] operator[SEP] identifier[m] , identifier[n] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[product] operator[=] Keyword[new] identifier[OpenMapRealMatrix] operator[SEP] identifier[m] , identifier[n] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[m] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[n] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[product] operator[SEP] identifier[setEntry] operator[SEP] identifier[i] , identifier[j] , Keyword[this] operator[SEP] identifier[getEntry] operator[SEP] identifier[i] operator[SEP] operator[*] identifier[v] operator[SEP] identifier[getEntry] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[product] operator[SEP]
}
|
@Override
public AsyncAuditOutputStream write(AuditEvent event) {
if (event instanceof AnnotationAuditEvent) {
annotationStream.write((AnnotationAuditEvent) event);
} else {
deferred.accept(event);
b.await();
}
return this;
} | class class_name[name] begin[{]
method[write, return_type[type[AsyncAuditOutputStream]], modifier[public], parameter[event]] begin[{]
if[binary_operation[member[.event], instanceof, type[AnnotationAuditEvent]]] begin[{]
call[annotationStream.write, parameter[Cast(expression=MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AnnotationAuditEvent, sub_type=None))]]
else begin[{]
call[deferred.accept, parameter[member[.event]]]
call[b.await, parameter[]]
end[}]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[AsyncAuditOutputStream] identifier[write] operator[SEP] identifier[AuditEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[event] Keyword[instanceof] identifier[AnnotationAuditEvent] operator[SEP] {
identifier[annotationStream] operator[SEP] identifier[write] operator[SEP] operator[SEP] identifier[AnnotationAuditEvent] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[deferred] operator[SEP] identifier[accept] operator[SEP] identifier[event] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[await] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Map<String, Object> getSelectorProperties()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getSelectorProperties");
SibTr.exit(tc, "getSelectorProperties", selectorProperties);
}
return selectorProperties;
} | class class_name[name] begin[{]
method[getSelectorProperties, return_type[type[Map]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getSelectorProperties"]]]
call[SibTr.exit, parameter[member[.tc], literal["getSelectorProperties"], member[.selectorProperties]]]
else begin[{]
None
end[}]
return[member[.selectorProperties]]
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getSelectorProperties] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[selectorProperties] operator[SEP] operator[SEP]
}
Keyword[return] identifier[selectorProperties] operator[SEP]
}
|
public void hookCommandLineListener(CommandLine cmdLine) throws Exception {
List<CommandLineArgument[]> allCommandLineList = new ArrayList<>();
Map<String, CommandLineListener> extMap = new HashMap<>();
for (Map.Entry<Extension, ExtensionHook> entry : extensionHooks.entrySet()) {
ExtensionHook hook = entry.getValue();
CommandLineArgument[] arg = hook.getCommandLineArgument();
if (arg.length > 0) {
allCommandLineList.add(arg);
}
Extension extension = entry.getKey();
if (extension instanceof CommandLineListener) {
CommandLineListener cli = (CommandLineListener) extension;
List<String> exts = cli.getHandledExtensions();
if (exts != null) {
for (String ext : exts) {
extMap.put(ext, cli);
}
}
}
}
cmdLine.parse(allCommandLineList, extMap);
} | class class_name[name] begin[{]
method[hookCommandLineListener, return_type[void], modifier[public], parameter[cmdLine]] begin[{]
local_variable[type[List], allCommandLineList]
local_variable[type[Map], extMap]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=hook)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionHook, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getCommandLineArgument, postfix_operators=[], prefix_operators=[], qualifier=hook, selectors=[], type_arguments=None), name=arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=CommandLineArgument, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=arg, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=allCommandLineList, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=extension)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Extension, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CommandLineListener, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CommandLineListener, sub_type=None)), name=cli)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CommandLineListener, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHandledExtensions, postfix_operators=[], prefix_operators=[], qualifier=cli, selectors=[], type_arguments=None), name=exts)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=exts, 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=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cli, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=extMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=exts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=extensionHooks, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Extension, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ExtensionHook, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[cmdLine.parse, parameter[member[.allCommandLineList], member[.extMap]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[hookCommandLineListener] operator[SEP] identifier[CommandLine] identifier[cmdLine] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[List] operator[<] identifier[CommandLineArgument] operator[SEP] operator[SEP] operator[>] identifier[allCommandLineList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[CommandLineListener] operator[>] identifier[extMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Extension] , identifier[ExtensionHook] operator[>] identifier[entry] operator[:] identifier[extensionHooks] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[ExtensionHook] identifier[hook] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[CommandLineArgument] operator[SEP] operator[SEP] identifier[arg] operator[=] identifier[hook] operator[SEP] identifier[getCommandLineArgument] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[arg] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[allCommandLineList] operator[SEP] identifier[add] operator[SEP] identifier[arg] operator[SEP] operator[SEP]
}
identifier[Extension] identifier[extension] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extension] Keyword[instanceof] identifier[CommandLineListener] operator[SEP] {
identifier[CommandLineListener] identifier[cli] operator[=] operator[SEP] identifier[CommandLineListener] operator[SEP] identifier[extension] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[exts] operator[=] identifier[cli] operator[SEP] identifier[getHandledExtensions] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[exts] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[ext] operator[:] identifier[exts] operator[SEP] {
identifier[extMap] operator[SEP] identifier[put] operator[SEP] identifier[ext] , identifier[cli] operator[SEP] operator[SEP]
}
}
}
}
identifier[cmdLine] operator[SEP] identifier[parse] operator[SEP] identifier[allCommandLineList] , identifier[extMap] operator[SEP] operator[SEP]
}
|
public double getDouble(int index) {
byte val = storage[index];
return (double) (isUnsigned() ? DataType.unsignedByteToShort(val) : val);
} | class class_name[name] begin[{]
method[getDouble, return_type[type[double]], modifier[public], parameter[index]] begin[{]
local_variable[type[byte], val]
return[Cast(expression=TernaryExpression(condition=MethodInvocation(arguments=[], member=isUnsigned, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unsignedByteToShort, postfix_operators=[], prefix_operators=[], qualifier=DataType, selectors=[], type_arguments=None)), type=BasicType(dimensions=[], name=double))]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[getDouble] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[byte] identifier[val] operator[=] identifier[storage] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[isUnsigned] operator[SEP] operator[SEP] operator[?] identifier[DataType] operator[SEP] identifier[unsignedByteToShort] operator[SEP] identifier[val] operator[SEP] operator[:] identifier[val] operator[SEP] operator[SEP]
}
|
public synchronized TreeEntry<K, V> lowerEntry(final K key) {
// Retorna la clave mas cercana menor a la clave indicada
return getRoundEntry(key, false, false);
} | class class_name[name] begin[{]
method[lowerEntry, return_type[type[TreeEntry]], modifier[synchronized public], parameter[key]] begin[{]
return[call[.getRoundEntry, parameter[member[.key], literal[false], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[TreeEntry] operator[<] identifier[K] , identifier[V] operator[>] identifier[lowerEntry] operator[SEP] Keyword[final] identifier[K] identifier[key] operator[SEP] {
Keyword[return] identifier[getRoundEntry] operator[SEP] identifier[key] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
private static Method resolveMethod(Class<? extends Handler> handler_class, String handler_method) {
for (Method method : handler_class.getMethods())
if (method.getName().equals(handler_method)) {
Class[] pt = method.getParameterTypes();
if (pt != null && pt.length == 2 && pt[0] == Integer.TYPE && Schema.class.isAssignableFrom(pt[1]))
return method;
}
throw H2O.fail("Failed to find handler method: " + handler_method + " in class: " + handler_class.getSimpleName());
} | class class_name[name] begin[{]
method[resolveMethod, return_type[type[Method]], modifier[private static], parameter[handler_class, handler_method]] begin[{]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MemberReference(member=handler_method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), name=pt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pt, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=pt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=TYPE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator===), operator=&&), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=pt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Schema, sub_type=None)), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))])), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=handler_class, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to find handler method: "), operandr=MemberReference(member=handler_method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in class: "), operator=+), operandr=MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=handler_class, selectors=[], type_arguments=None), operator=+)], member=fail, postfix_operators=[], prefix_operators=[], qualifier=H2O, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Method] identifier[resolveMethod] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Handler] operator[>] identifier[handler_class] , identifier[String] identifier[handler_method] operator[SEP] {
Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[handler_class] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[handler_method] operator[SEP] operator[SEP] {
identifier[Class] operator[SEP] operator[SEP] identifier[pt] operator[=] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pt] operator[!=] Other[null] operator[&&] identifier[pt] operator[SEP] identifier[length] operator[==] Other[2] operator[&&] identifier[pt] operator[SEP] Other[0] operator[SEP] operator[==] identifier[Integer] operator[SEP] identifier[TYPE] operator[&&] identifier[Schema] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[pt] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[method] operator[SEP]
}
Keyword[throw] identifier[H2O] operator[SEP] identifier[fail] operator[SEP] literal[String] operator[+] identifier[handler_method] operator[+] literal[String] operator[+] identifier[handler_class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static <E> ImmutableSortedSet<E> unsafeDelegateSortedSet(
SortedSet<E> delegate, boolean isSubset) {
return delegate.isEmpty()
? emptySet(delegate.comparator())
: new RegularImmutableSortedSet<E>(delegate, isSubset);
} | class class_name[name] begin[{]
method[unsafeDelegateSortedSet, return_type[type[ImmutableSortedSet]], modifier[static], parameter[delegate, isSubset]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), if_false=ClassCreator(arguments=[MemberReference(member=delegate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isSubset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=None, name=RegularImmutableSortedSet, sub_type=None)), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=comparator, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None)], member=emptySet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[static] operator[<] identifier[E] operator[>] identifier[ImmutableSortedSet] operator[<] identifier[E] operator[>] identifier[unsafeDelegateSortedSet] operator[SEP] identifier[SortedSet] operator[<] identifier[E] operator[>] identifier[delegate] , Keyword[boolean] identifier[isSubset] operator[SEP] {
Keyword[return] identifier[delegate] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] identifier[emptySet] operator[SEP] identifier[delegate] operator[SEP] identifier[comparator] operator[SEP] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[RegularImmutableSortedSet] operator[<] identifier[E] operator[>] operator[SEP] identifier[delegate] , identifier[isSubset] operator[SEP] operator[SEP]
}
|
public Box<Object> out(Object key, int type, String struct,
Converter decoder) {
Parameter parameter = new Parameter();
parameter.setOutput(new Box<Object>());
parameter.setType(type);
parameter.setStruct(struct);
parameter.setDecoder(decoder);
return merge(key, parameter).getOutput();
} | class class_name[name] begin[{]
method[out, return_type[type[Box]], modifier[public], parameter[key, type, struct, decoder]] begin[{]
local_variable[type[Parameter], parameter]
call[parameter.setOutput, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Box, sub_type=None))]]
call[parameter.setType, parameter[member[.type]]]
call[parameter.setStruct, parameter[member[.struct]]]
call[parameter.setDecoder, parameter[member[.decoder]]]
return[call[.merge, parameter[member[.key], member[.parameter]]]]
end[}]
END[}] | Keyword[public] identifier[Box] operator[<] identifier[Object] operator[>] identifier[out] operator[SEP] identifier[Object] identifier[key] , Keyword[int] identifier[type] , identifier[String] identifier[struct] , identifier[Converter] identifier[decoder] operator[SEP] {
identifier[Parameter] identifier[parameter] operator[=] Keyword[new] identifier[Parameter] operator[SEP] operator[SEP] operator[SEP] identifier[parameter] operator[SEP] identifier[setOutput] operator[SEP] Keyword[new] identifier[Box] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[parameter] operator[SEP] identifier[setType] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[parameter] operator[SEP] identifier[setStruct] operator[SEP] identifier[struct] operator[SEP] operator[SEP] identifier[parameter] operator[SEP] identifier[setDecoder] operator[SEP] identifier[decoder] operator[SEP] operator[SEP] Keyword[return] identifier[merge] operator[SEP] identifier[key] , identifier[parameter] operator[SEP] operator[SEP] identifier[getOutput] operator[SEP] operator[SEP] operator[SEP]
}
|
static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
long dBits = Double.doubleToRawLongBits(d);
boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
int binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
// Discover obvious special cases of NaN and Infinity.
if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
if ( fractBits == 0L ){
return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY;
} else {
return B2AC_NOT_A_NUMBER;
}
}
// Finish unpacking
// Normalize denormalized numbers.
// Insert assumed high-order bit for normalized numbers.
// Subtract exponent bias.
int nSignificantBits;
if ( binExp == 0 ){
if ( fractBits == 0L ){
// not a denorm, just a 0!
return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO;
}
int leadingZeros = Long.numberOfLeadingZeros(fractBits);
int shift = leadingZeros-(63-EXP_SHIFT);
fractBits <<= shift;
binExp = 1 - shift;
nSignificantBits = 64-leadingZeros; // recall binExp is - shift count.
} else {
fractBits |= FRACT_HOB;
nSignificantBits = EXP_SHIFT+1;
}
binExp -= DoubleConsts.EXP_BIAS;
BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
buf.setSign(isNegative);
// call the routine that actually does all the hard work.
buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
return buf;
} | class class_name[name] begin[{]
method[getBinaryToASCIIConverter, return_type[type[BinaryToASCIIConverter]], modifier[static], parameter[d, isCompatibleFormat]] begin[{]
local_variable[type[long], dBits]
local_variable[type[boolean], isNegative]
local_variable[type[long], fractBits]
local_variable[type[int], binExp]
if[binary_operation[member[.binExp], ==, Cast(expression=BinaryOperation(operandl=MemberReference(member=EXP_BIT_MASK, postfix_operators=[], prefix_operators=[], qualifier=DoubleConsts, selectors=[]), operandr=MemberReference(member=EXP_SHIFT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>), type=BasicType(dimensions=[], name=int))]] begin[{]
if[binary_operation[member[.fractBits], ==, literal[0L]]] begin[{]
return[TernaryExpression(condition=MemberReference(member=isNegative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=B2AC_POSITIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=B2AC_NEGATIVE_INFINITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
return[member[.B2AC_NOT_A_NUMBER]]
end[}]
else begin[{]
None
end[}]
local_variable[type[int], nSignificantBits]
if[binary_operation[member[.binExp], ==, literal[0]]] begin[{]
if[binary_operation[member[.fractBits], ==, literal[0L]]] begin[{]
return[TernaryExpression(condition=MemberReference(member=isNegative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=B2AC_POSITIVE_ZERO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=B2AC_NEGATIVE_ZERO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
None
end[}]
local_variable[type[int], leadingZeros]
local_variable[type[int], shift]
assign[member[.fractBits], member[.shift]]
assign[member[.binExp], binary_operation[literal[1], -, member[.shift]]]
assign[member[.nSignificantBits], binary_operation[literal[64], -, member[.leadingZeros]]]
else begin[{]
assign[member[.fractBits], member[.FRACT_HOB]]
assign[member[.nSignificantBits], binary_operation[member[.EXP_SHIFT], +, literal[1]]]
end[}]
assign[member[.binExp], member[DoubleConsts.EXP_BIAS]]
local_variable[type[BinaryToASCIIBuffer], buf]
call[buf.setSign, parameter[member[.isNegative]]]
call[buf.dtoa, parameter[member[.binExp], member[.fractBits], member[.nSignificantBits], member[.isCompatibleFormat]]]
return[member[.buf]]
end[}]
END[}] | Keyword[static] identifier[BinaryToASCIIConverter] identifier[getBinaryToASCIIConverter] operator[SEP] Keyword[double] identifier[d] , Keyword[boolean] identifier[isCompatibleFormat] operator[SEP] {
Keyword[long] identifier[dBits] operator[=] identifier[Double] operator[SEP] identifier[doubleToRawLongBits] operator[SEP] identifier[d] operator[SEP] operator[SEP] Keyword[boolean] identifier[isNegative] operator[=] operator[SEP] identifier[dBits] operator[&] identifier[DoubleConsts] operator[SEP] identifier[SIGN_BIT_MASK] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[long] identifier[fractBits] operator[=] identifier[dBits] operator[&] identifier[DoubleConsts] operator[SEP] identifier[SIGNIF_BIT_MASK] operator[SEP] Keyword[int] identifier[binExp] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[dBits] operator[&] identifier[DoubleConsts] operator[SEP] identifier[EXP_BIT_MASK] operator[SEP] operator[>] operator[>] identifier[EXP_SHIFT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binExp] operator[==] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[DoubleConsts] operator[SEP] identifier[EXP_BIT_MASK] operator[>] operator[>] identifier[EXP_SHIFT] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fractBits] operator[==] Other[0L] operator[SEP] {
Keyword[return] identifier[isNegative] operator[?] identifier[B2AC_NEGATIVE_INFINITY] operator[:] identifier[B2AC_POSITIVE_INFINITY] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[B2AC_NOT_A_NUMBER] operator[SEP]
}
}
Keyword[int] identifier[nSignificantBits] operator[SEP] Keyword[if] operator[SEP] identifier[binExp] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[fractBits] operator[==] Other[0L] operator[SEP] {
Keyword[return] identifier[isNegative] operator[?] identifier[B2AC_NEGATIVE_ZERO] operator[:] identifier[B2AC_POSITIVE_ZERO] operator[SEP]
}
Keyword[int] identifier[leadingZeros] operator[=] identifier[Long] operator[SEP] identifier[numberOfLeadingZeros] operator[SEP] identifier[fractBits] operator[SEP] operator[SEP] Keyword[int] identifier[shift] operator[=] identifier[leadingZeros] operator[-] operator[SEP] Other[63] operator[-] identifier[EXP_SHIFT] operator[SEP] operator[SEP] identifier[fractBits] operator[<<=] identifier[shift] operator[SEP] identifier[binExp] operator[=] Other[1] operator[-] identifier[shift] operator[SEP] identifier[nSignificantBits] operator[=] Other[64] operator[-] identifier[leadingZeros] operator[SEP]
}
Keyword[else] {
identifier[fractBits] operator[|=] identifier[FRACT_HOB] operator[SEP] identifier[nSignificantBits] operator[=] identifier[EXP_SHIFT] operator[+] Other[1] operator[SEP]
}
identifier[binExp] operator[-=] identifier[DoubleConsts] operator[SEP] identifier[EXP_BIAS] operator[SEP] identifier[BinaryToASCIIBuffer] identifier[buf] operator[=] identifier[getBinaryToASCIIBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[setSign] operator[SEP] identifier[isNegative] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[dtoa] operator[SEP] identifier[binExp] , identifier[fractBits] , identifier[nSignificantBits] , identifier[isCompatibleFormat] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP]
}
|
public void applyToSourceUnits(SourceUnitOperation body) throws CompilationFailedException {
for (String name : names) {
SourceUnit source = sources.get(name);
if ((source.phase < phase) || (source.phase == phase && !source.phaseComplete)) {
try {
body.call(source);
} catch (CompilationFailedException e) {
throw e;
} catch (Exception e) {
GroovyBugError gbe = new GroovyBugError(e);
changeBugText(gbe, source);
throw gbe;
} catch (GroovyBugError e) {
changeBugText(e, source);
throw e;
}
}
}
getErrorCollector().failIfErrors();
} | class class_name[name] begin[{]
method[applyToSourceUnits, return_type[void], modifier[public], parameter[body]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sources, selectors=[], type_arguments=None), name=source)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SourceUnit, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=source, selectors=[]), operandr=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=source, selectors=[]), operandr=MemberReference(member=phase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=MemberReference(member=phaseComplete, postfix_operators=[], prefix_operators=['!'], qualifier=source, selectors=[]), operator=&&), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=call, postfix_operators=[], prefix_operators=[], qualifier=body, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CompilationFailedException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=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=GroovyBugError, sub_type=None)), name=gbe)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GroovyBugError, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gbe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=changeBugText, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=gbe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=changeBugText, postfix_operators=[], prefix_operators=[], qualifier=, 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=['GroovyBugError']))], finally_block=None, label=None, resources=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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)
call[.getErrorCollector, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[applyToSourceUnits] operator[SEP] identifier[SourceUnitOperation] identifier[body] operator[SEP] Keyword[throws] identifier[CompilationFailedException] {
Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[names] operator[SEP] {
identifier[SourceUnit] identifier[source] operator[=] identifier[sources] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[source] operator[SEP] identifier[phase] operator[<] identifier[phase] operator[SEP] operator[||] operator[SEP] identifier[source] operator[SEP] identifier[phase] operator[==] identifier[phase] operator[&&] operator[!] identifier[source] operator[SEP] identifier[phaseComplete] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[body] operator[SEP] identifier[call] operator[SEP] identifier[source] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CompilationFailedException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[GroovyBugError] identifier[gbe] operator[=] Keyword[new] identifier[GroovyBugError] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[changeBugText] operator[SEP] identifier[gbe] , identifier[source] operator[SEP] operator[SEP] Keyword[throw] identifier[gbe] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[GroovyBugError] identifier[e] operator[SEP] {
identifier[changeBugText] operator[SEP] identifier[e] , identifier[source] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
}
identifier[getErrorCollector] operator[SEP] operator[SEP] operator[SEP] identifier[failIfErrors] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<Void> promoteAsync(String resourceGroupName, String clusterName, String scriptExecutionId) {
return promoteWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[promoteAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, clusterName, scriptExecutionId]] begin[{]
return[call[.promoteWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.clusterName], member[.scriptExecutionId]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Void] operator[>] identifier[promoteAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[clusterName] , identifier[String] identifier[scriptExecutionId] operator[SEP] {
Keyword[return] identifier[promoteWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[clusterName] , identifier[scriptExecutionId] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] , identifier[Void] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public String replaceObjectNameParameters (String pattern, MBeanLocationParameterSource parameterSource) {
Matcher matcher = replaceParamPattern.matcher(pattern);
StringBuffer result = new StringBuffer();
while ( matcher.find() ) {
String name = matcher.group("paramName");
String value = parameterSource.getParameter(name);
if ( value != null ) {
matcher.appendReplacement(result, value);
} else {
matcher.appendReplacement(result, Matcher.quoteReplacement(matcher.group()));
}
}
matcher.appendTail(result);
return result.toString();
} | class class_name[name] begin[{]
method[replaceObjectNameParameters, return_type[type[String]], modifier[public], parameter[pattern, parameterSource]] begin[{]
local_variable[type[Matcher], matcher]
local_variable[type[StringBuffer], result]
while[call[matcher.find, parameter[]]] begin[{]
local_variable[type[String], name]
local_variable[type[String], value]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
call[matcher.appendReplacement, parameter[member[.result], member[.value]]]
else begin[{]
call[matcher.appendReplacement, parameter[member[.result], call[Matcher.quoteReplacement, parameter[call[matcher.group, parameter[]]]]]]
end[}]
end[}]
call[matcher.appendTail, parameter[member[.result]]]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[replaceObjectNameParameters] operator[SEP] identifier[String] identifier[pattern] , identifier[MBeanLocationParameterSource] identifier[parameterSource] operator[SEP] {
identifier[Matcher] identifier[matcher] operator[=] identifier[replaceParamPattern] operator[SEP] identifier[matcher] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[result] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[parameterSource] operator[SEP] identifier[getParameter] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[matcher] operator[SEP] identifier[appendReplacement] operator[SEP] identifier[result] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[matcher] operator[SEP] identifier[appendReplacement] operator[SEP] identifier[result] , identifier[Matcher] operator[SEP] identifier[quoteReplacement] operator[SEP] identifier[matcher] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[matcher] operator[SEP] identifier[appendTail] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static RequestParameter exists(final String name)
{
return new RequestParameter(name, "{" + RequestParameter.class.getName() + "_" + name + "_value}") {
@Override
public String toString()
{
return "RequestParameter.exists(\"" + name + "\")";
}
};
} | class class_name[name] begin[{]
method[exists, return_type[type[RequestParameter]], modifier[public static], parameter[name]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="{"), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=RequestParameter, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_"), operator=+), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_value}"), operator=+)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RequestParameter.exists(\""), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\")"), operator=+), label=None)], documentation=None, modifiers={'public'}, name=toString, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, 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=RequestParameter, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RequestParameter] identifier[exists] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[return] Keyword[new] identifier[RequestParameter] operator[SEP] identifier[name] , literal[String] operator[+] identifier[RequestParameter] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[toString] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP]
}
} operator[SEP]
}
|
private boolean ignoreCompoundWithIgnoredWord(String word) throws IOException {
if (!StringTools.startsWithUppercase(word) && !StringUtils.startsWithAny(word, "nord", "west", "ost", "süd")) {
// otherwise stuff like "rumfangreichen" gets accepted
return false;
}
String[] words = word.split("-");
if (words.length < 2) {
// non-hyphenated compound (e.g., "Feynmandiagramm"):
// only search for compounds that start(!) with a word from spelling.txt
int end = super.startsWithIgnoredWord(word, true);
if (end < 3) {
// support for geographical adjectives - although "süd/ost/west/nord" are not in spelling.txt
// to accept sentences such as
// "Der westperuanische Ferienort, das ostargentinische Städtchen, das südukrainische Brauchtum, der nordägyptische Staudamm."
if (word.startsWith("ost") || word.startsWith("süd")) {
end = 3;
} else if (word.startsWith("west") || word.startsWith("nord")) {
end = 4;
} else {
return false;
}
}
String ignoredWord = word.substring(0, end);
String partialWord = word.substring(end);
boolean isCandidateForNonHyphenatedCompound = !StringUtils.isAllUpperCase(ignoredWord) && (StringUtils.isAllLowerCase(partialWord) || ignoredWord.endsWith("-"));
boolean needFugenS = isNeedingFugenS(ignoredWord);
if (isCandidateForNonHyphenatedCompound && !needFugenS && partialWord.length() > 2) {
return !hunspellDict.misspelled(partialWord) || !hunspellDict.misspelled(StringUtils.capitalize(partialWord));
} else if (isCandidateForNonHyphenatedCompound && needFugenS && partialWord.length() > 2) {
partialWord = partialWord.startsWith("s") ? partialWord.substring(1) : partialWord;
return !hunspellDict.misspelled(partialWord) || !hunspellDict.misspelled(StringUtils.capitalize(partialWord));
}
return false;
}
// hyphenated compound (e.g., "Feynman-Diagramm"):
boolean hasIgnoredWord = false;
List<String> toSpellCheck = new ArrayList<>(3);
String stripFirst = word.substring(words[0].length()+1); // everything after the first "-"
String stripLast = word.substring(0, word.length()-words[words.length-1].length()-1); // everything up to the last "-"
if (super.ignoreWord(stripFirst) || wordsToBeIgnoredInCompounds.contains(stripFirst)) { // e.g., "Senioren-Au-pair"
hasIgnoredWord = true;
if (!super.ignoreWord(words[0])) {
toSpellCheck.add(words[0]);
}
} else if (super.ignoreWord(stripLast) || wordsToBeIgnoredInCompounds.contains(stripLast)) { // e.g., "Au-pair-Agentur"
hasIgnoredWord = true;
if (!super.ignoreWord(words[words.length-1])){
toSpellCheck.add(words[words.length-1]);
}
} else {
for (String word1 : words) {
if (super.ignoreWord(word1) || wordsToBeIgnoredInCompounds.contains(word1)) {
hasIgnoredWord = true;
} else {
toSpellCheck.add(word1);
}
}
}
if (hasIgnoredWord) {
for (String w : toSpellCheck) {
if (hunspellDict.misspelled(w)) {
return false;
}
}
}
return hasIgnoredWord;
} | class class_name[name] begin[{]
method[ignoreCompoundWithIgnoredWord, return_type[type[boolean]], modifier[private], parameter[word]] begin[{]
if[binary_operation[call[StringTools.startsWithUppercase, parameter[member[.word]]], &&, call[StringUtils.startsWithAny, parameter[member[.word], literal["nord"], literal["west"], literal["ost"], literal["süd"]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], words]
if[binary_operation[member[words.length], <, literal[2]]] begin[{]
local_variable[type[int], end]
if[binary_operation[member[.end], <, literal[3]]] begin[{]
if[binary_operation[call[word.startsWith, parameter[literal["ost"]]], ||, call[word.startsWith, parameter[literal["süd"]]]]] begin[{]
assign[member[.end], literal[3]]
else begin[{]
if[binary_operation[call[word.startsWith, parameter[literal["west"]]], ||, call[word.startsWith, parameter[literal["nord"]]]]] begin[{]
assign[member[.end], literal[4]]
else begin[{]
return[literal[false]]
end[}]
end[}]
else begin[{]
None
end[}]
local_variable[type[String], ignoredWord]
local_variable[type[String], partialWord]
local_variable[type[boolean], isCandidateForNonHyphenatedCompound]
local_variable[type[boolean], needFugenS]
if[binary_operation[binary_operation[member[.isCandidateForNonHyphenatedCompound], &&, member[.needFugenS]], &&, binary_operation[call[partialWord.length, parameter[]], >, literal[2]]]] begin[{]
return[binary_operation[call[hunspellDict.misspelled, parameter[member[.partialWord]]], ||, call[hunspellDict.misspelled, parameter[call[StringUtils.capitalize, parameter[member[.partialWord]]]]]]]
else begin[{]
if[binary_operation[binary_operation[member[.isCandidateForNonHyphenatedCompound], &&, member[.needFugenS]], &&, binary_operation[call[partialWord.length, parameter[]], >, literal[2]]]] begin[{]
assign[member[.partialWord], TernaryExpression(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="s")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=partialWord, selectors=[], type_arguments=None), if_false=MemberReference(member=partialWord, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=partialWord, selectors=[], type_arguments=None))]
return[binary_operation[call[hunspellDict.misspelled, parameter[member[.partialWord]]], ||, call[hunspellDict.misspelled, parameter[call[StringUtils.capitalize, parameter[member[.partialWord]]]]]]]
else begin[{]
None
end[}]
end[}]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], hasIgnoredWord]
local_variable[type[List], toSpellCheck]
local_variable[type[String], stripFirst]
local_variable[type[String], stripLast]
if[binary_operation[SuperMethodInvocation(arguments=[MemberReference(member=stripFirst, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ignoreWord, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), ||, call[wordsToBeIgnoredInCompounds.contains, parameter[member[.stripFirst]]]]] begin[{]
assign[member[.hasIgnoredWord], literal[true]]
if[SuperMethodInvocation(arguments=[MemberReference(member=words, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=ignoreWord, postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[], type_arguments=None)] begin[{]
call[toSpellCheck.add, parameter[member[.words]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[SuperMethodInvocation(arguments=[MemberReference(member=stripLast, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ignoreWord, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), ||, call[wordsToBeIgnoredInCompounds.contains, parameter[member[.stripLast]]]]] begin[{]
assign[member[.hasIgnoredWord], literal[true]]
if[SuperMethodInvocation(arguments=[MemberReference(member=words, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=words, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))])], member=ignoreWord, postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[], type_arguments=None)] begin[{]
call[toSpellCheck.add, parameter[member[.words]]]
else begin[{]
None
end[}]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=SuperMethodInvocation(arguments=[MemberReference(member=word1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ignoreWord, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=word1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=wordsToBeIgnoredInCompounds, selectors=[], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=word1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=toSpellCheck, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasIgnoredWord, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=words, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=word1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
end[}]
if[member[.hasIgnoredWord]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=misspelled, postfix_operators=[], prefix_operators=[], qualifier=hunspellDict, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=toSpellCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=w)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.hasIgnoredWord]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[ignoreCompoundWithIgnoredWord] operator[SEP] identifier[String] identifier[word] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[StringTools] operator[SEP] identifier[startsWithUppercase] operator[SEP] identifier[word] operator[SEP] operator[&&] operator[!] identifier[StringUtils] operator[SEP] identifier[startsWithAny] operator[SEP] identifier[word] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[words] operator[=] identifier[word] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[words] operator[SEP] identifier[length] operator[<] Other[2] operator[SEP] {
Keyword[int] identifier[end] operator[=] Keyword[super] operator[SEP] identifier[startsWithIgnoredWord] operator[SEP] identifier[word] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[end] operator[<] Other[3] operator[SEP] {
Keyword[if] operator[SEP] identifier[word] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[word] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[end] operator[=] Other[3] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[word] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[word] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[end] operator[=] Other[4] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
identifier[String] identifier[ignoredWord] operator[=] identifier[word] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[end] operator[SEP] operator[SEP] identifier[String] identifier[partialWord] operator[=] identifier[word] operator[SEP] identifier[substring] operator[SEP] identifier[end] operator[SEP] operator[SEP] Keyword[boolean] identifier[isCandidateForNonHyphenatedCompound] operator[=] operator[!] identifier[StringUtils] operator[SEP] identifier[isAllUpperCase] operator[SEP] identifier[ignoredWord] operator[SEP] operator[&&] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isAllLowerCase] operator[SEP] identifier[partialWord] operator[SEP] operator[||] identifier[ignoredWord] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[needFugenS] operator[=] identifier[isNeedingFugenS] operator[SEP] identifier[ignoredWord] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isCandidateForNonHyphenatedCompound] operator[&&] operator[!] identifier[needFugenS] operator[&&] identifier[partialWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
Keyword[return] operator[!] identifier[hunspellDict] operator[SEP] identifier[misspelled] operator[SEP] identifier[partialWord] operator[SEP] operator[||] operator[!] identifier[hunspellDict] operator[SEP] identifier[misspelled] operator[SEP] identifier[StringUtils] operator[SEP] identifier[capitalize] operator[SEP] identifier[partialWord] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isCandidateForNonHyphenatedCompound] operator[&&] identifier[needFugenS] operator[&&] identifier[partialWord] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] {
identifier[partialWord] operator[=] identifier[partialWord] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[?] identifier[partialWord] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[:] identifier[partialWord] operator[SEP] Keyword[return] operator[!] identifier[hunspellDict] operator[SEP] identifier[misspelled] operator[SEP] identifier[partialWord] operator[SEP] operator[||] operator[!] identifier[hunspellDict] operator[SEP] identifier[misspelled] operator[SEP] identifier[StringUtils] operator[SEP] identifier[capitalize] operator[SEP] identifier[partialWord] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[boolean] identifier[hasIgnoredWord] operator[=] literal[boolean] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[toSpellCheck] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[String] identifier[stripFirst] operator[=] identifier[word] operator[SEP] identifier[substring] operator[SEP] identifier[words] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[stripLast] operator[=] identifier[word] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[word] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[words] operator[SEP] identifier[words] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[super] operator[SEP] identifier[ignoreWord] operator[SEP] identifier[stripFirst] operator[SEP] operator[||] identifier[wordsToBeIgnoredInCompounds] operator[SEP] identifier[contains] operator[SEP] identifier[stripFirst] operator[SEP] operator[SEP] {
identifier[hasIgnoredWord] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[super] operator[SEP] identifier[ignoreWord] operator[SEP] identifier[words] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] {
identifier[toSpellCheck] operator[SEP] identifier[add] operator[SEP] identifier[words] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] Keyword[super] operator[SEP] identifier[ignoreWord] operator[SEP] identifier[stripLast] operator[SEP] operator[||] identifier[wordsToBeIgnoredInCompounds] operator[SEP] identifier[contains] operator[SEP] identifier[stripLast] operator[SEP] operator[SEP] {
identifier[hasIgnoredWord] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[super] operator[SEP] identifier[ignoreWord] operator[SEP] identifier[words] operator[SEP] identifier[words] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[toSpellCheck] operator[SEP] identifier[add] operator[SEP] identifier[words] operator[SEP] identifier[words] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[String] identifier[word1] operator[:] identifier[words] operator[SEP] {
Keyword[if] operator[SEP] Keyword[super] operator[SEP] identifier[ignoreWord] operator[SEP] identifier[word1] operator[SEP] operator[||] identifier[wordsToBeIgnoredInCompounds] operator[SEP] identifier[contains] operator[SEP] identifier[word1] operator[SEP] operator[SEP] {
identifier[hasIgnoredWord] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[toSpellCheck] operator[SEP] identifier[add] operator[SEP] identifier[word1] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[hasIgnoredWord] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[w] operator[:] identifier[toSpellCheck] operator[SEP] {
Keyword[if] operator[SEP] identifier[hunspellDict] operator[SEP] identifier[misspelled] operator[SEP] identifier[w] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] identifier[hasIgnoredWord] operator[SEP]
}
|
public Observable<ServiceResponse<List<EntityRole>>> getHierarchicalEntityRolesWithServiceResponseAsync(UUID appId, String versionId, UUID hEntityId) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (hEntityId == null) {
throw new IllegalArgumentException("Parameter hEntityId is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.getHierarchicalEntityRoles(appId, versionId, hEntityId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<EntityRole>>>>() {
@Override
public Observable<ServiceResponse<List<EntityRole>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<EntityRole>> clientResponse = getHierarchicalEntityRolesDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[getHierarchicalEntityRolesWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[appId, versionId, hEntityId]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.endpoint, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.endpoint() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.appId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter appId is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.versionId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter versionId is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.hEntityId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter hEntityId is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], parameterizedHost]
return[call[service.getHierarchicalEntityRoles, parameter[member[.appId], member[.versionId], member[.hEntityId], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], member[.parameterizedHost], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[EntityRole] operator[>] operator[>] operator[>] identifier[getHierarchicalEntityRolesWithServiceResponseAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[UUID] identifier[hEntityId] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[endpoint] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[appId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[versionId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[hEntityId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[parameterizedHost] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[endpoint] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[getHierarchicalEntityRoles] operator[SEP] identifier[appId] , identifier[versionId] , identifier[hEntityId] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , identifier[parameterizedHost] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[EntityRole] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[EntityRole] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[EntityRole] operator[>] operator[>] identifier[clientResponse] operator[=] identifier[getHierarchicalEntityRolesDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public void setContentView(int resId) {
if (mCurrentLayoutId != resId) {
View view = inflate(mContext, resId, null);
if (mDefaultContentView == null &&
resId == mCallback.getContentViewDefaultLayoutId(this)) {
mDefaultContentView = view;
mDefaultLayoutId = resId;
}
mCurrentLayoutId = resId;
setContentView(view);
}
} | class class_name[name] begin[{]
method[setContentView, return_type[void], modifier[public], parameter[resId]] begin[{]
if[binary_operation[member[.mCurrentLayoutId], !=, member[.resId]]] begin[{]
local_variable[type[View], view]
if[binary_operation[binary_operation[member[.mDefaultContentView], ==, literal[null]], &&, binary_operation[member[.resId], ==, call[mCallback.getContentViewDefaultLayoutId, parameter[THIS[]]]]]] begin[{]
assign[member[.mDefaultContentView], member[.view]]
assign[member[.mDefaultLayoutId], member[.resId]]
else begin[{]
None
end[}]
assign[member[.mCurrentLayoutId], member[.resId]]
call[.setContentView, parameter[member[.view]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setContentView] operator[SEP] Keyword[int] identifier[resId] operator[SEP] {
Keyword[if] operator[SEP] identifier[mCurrentLayoutId] operator[!=] identifier[resId] operator[SEP] {
identifier[View] identifier[view] operator[=] identifier[inflate] operator[SEP] identifier[mContext] , identifier[resId] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mDefaultContentView] operator[==] Other[null] operator[&&] identifier[resId] operator[==] identifier[mCallback] operator[SEP] identifier[getContentViewDefaultLayoutId] operator[SEP] Keyword[this] operator[SEP] operator[SEP] {
identifier[mDefaultContentView] operator[=] identifier[view] operator[SEP] identifier[mDefaultLayoutId] operator[=] identifier[resId] operator[SEP]
}
identifier[mCurrentLayoutId] operator[=] identifier[resId] operator[SEP] identifier[setContentView] operator[SEP] identifier[view] operator[SEP] operator[SEP]
}
}
|
public static Money parse(CharSequence text, MonetaryAmountFormat formatter) {
return from(formatter.parse(text));
} | class class_name[name] begin[{]
method[parse, return_type[type[Money]], modifier[public static], parameter[text, formatter]] begin[{]
return[call[.from, parameter[call[formatter.parse, parameter[member[.text]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Money] identifier[parse] operator[SEP] identifier[CharSequence] identifier[text] , identifier[MonetaryAmountFormat] identifier[formatter] operator[SEP] {
Keyword[return] identifier[from] operator[SEP] identifier[formatter] operator[SEP] identifier[parse] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void unregisterAttributeListener(String attributeName, AttributeListener attributeListener) {
List<AttributeListener> listeners = attributeListeners.get(attributeName);
if (listeners == null) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(attributeListener);
if (!success) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
}
} | class class_name[name] begin[{]
method[unregisterAttributeListener, return_type[void], modifier[public], parameter[attributeName, attributeListener]] begin[{]
local_variable[type[List], listeners]
if[binary_operation[member[.listeners], ==, literal[null]]] begin[{]
call[LOG.error, parameter[binary_operation[binary_operation[literal["trying to unregister an attribute listener for attribute \""], +, member[.attributeName]], +, literal["\" that was never registered"]]]]
return[None]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.listeners]] BEGIN[{]
local_variable[type[boolean], success]
if[member[.success]] begin[{]
call[LOG.error, parameter[binary_operation[binary_operation[literal["trying to unregister an attribute listener for attribute \""], +, member[.attributeName]], +, literal["\" that was never registered"]]]]
return[None]
else begin[{]
None
end[}]
END[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[unregisterAttributeListener] operator[SEP] identifier[String] identifier[attributeName] , identifier[AttributeListener] identifier[attributeListener] operator[SEP] {
identifier[List] operator[<] identifier[AttributeListener] operator[>] identifier[listeners] operator[=] identifier[attributeListeners] operator[SEP] identifier[get] operator[SEP] identifier[attributeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listeners] operator[==] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[attributeName] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[listeners] operator[SEP] {
Keyword[boolean] identifier[success] operator[=] identifier[listeners] operator[SEP] identifier[remove] operator[SEP] identifier[attributeListener] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[success] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[attributeName] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
}
|
public ScriptEngine getScriptEngine(String language, boolean resolveFromCache) {
ScriptEngine scriptEngine = null;
if (resolveFromCache) {
scriptEngine = cachedEngines.get(language);
if(scriptEngine == null) {
scriptEngine = scriptEngineManager.getEngineByName(language);
if(scriptEngine != null) {
if(ScriptingEngines.GROOVY_SCRIPTING_LANGUAGE.equals(language)) {
configureGroovyScriptEngine(scriptEngine);
}
if(isCachable(scriptEngine)) {
cachedEngines.put(language, scriptEngine);
}
}
}
} else {
scriptEngine = scriptEngineManager.getEngineByName(language);
}
return scriptEngine;
} | class class_name[name] begin[{]
method[getScriptEngine, return_type[type[ScriptEngine]], modifier[public], parameter[language, resolveFromCache]] begin[{]
local_variable[type[ScriptEngine], scriptEngine]
if[member[.resolveFromCache]] begin[{]
assign[member[.scriptEngine], call[cachedEngines.get, parameter[member[.language]]]]
if[binary_operation[member[.scriptEngine], ==, literal[null]]] begin[{]
assign[member[.scriptEngine], call[scriptEngineManager.getEngineByName, parameter[member[.language]]]]
if[binary_operation[member[.scriptEngine], !=, literal[null]]] begin[{]
if[call[ScriptingEngines.GROOVY_SCRIPTING_LANGUAGE.equals, parameter[member[.language]]]] begin[{]
call[.configureGroovyScriptEngine, parameter[member[.scriptEngine]]]
else begin[{]
None
end[}]
if[call[.isCachable, parameter[member[.scriptEngine]]]] begin[{]
call[cachedEngines.put, parameter[member[.language], member[.scriptEngine]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
assign[member[.scriptEngine], call[scriptEngineManager.getEngineByName, parameter[member[.language]]]]
end[}]
return[member[.scriptEngine]]
end[}]
END[}] | Keyword[public] identifier[ScriptEngine] identifier[getScriptEngine] operator[SEP] identifier[String] identifier[language] , Keyword[boolean] identifier[resolveFromCache] operator[SEP] {
identifier[ScriptEngine] identifier[scriptEngine] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resolveFromCache] operator[SEP] {
identifier[scriptEngine] operator[=] identifier[cachedEngines] operator[SEP] identifier[get] operator[SEP] identifier[language] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scriptEngine] operator[==] Other[null] operator[SEP] {
identifier[scriptEngine] operator[=] identifier[scriptEngineManager] operator[SEP] identifier[getEngineByName] operator[SEP] identifier[language] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scriptEngine] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[ScriptingEngines] operator[SEP] identifier[GROOVY_SCRIPTING_LANGUAGE] operator[SEP] identifier[equals] operator[SEP] identifier[language] operator[SEP] operator[SEP] {
identifier[configureGroovyScriptEngine] operator[SEP] identifier[scriptEngine] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isCachable] operator[SEP] identifier[scriptEngine] operator[SEP] operator[SEP] {
identifier[cachedEngines] operator[SEP] identifier[put] operator[SEP] identifier[language] , identifier[scriptEngine] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[scriptEngine] operator[=] identifier[scriptEngineManager] operator[SEP] identifier[getEngineByName] operator[SEP] identifier[language] operator[SEP] operator[SEP]
}
Keyword[return] identifier[scriptEngine] operator[SEP]
}
|
private static StackTraceElement normalizeClassName(final StackTraceElement element) {
String className = element.getClassName();
int dollarIndex = className.indexOf("$");
if (dollarIndex == -1) {
return element;
} else {
className = stripAnonymousPart(className);
return new StackTraceElement(className, element.getMethodName(), element.getFileName(), element.getLineNumber());
}
} | class class_name[name] begin[{]
method[normalizeClassName, return_type[type[StackTraceElement]], modifier[private static], parameter[element]] begin[{]
local_variable[type[String], className]
local_variable[type[int], dollarIndex]
if[binary_operation[member[.dollarIndex], ==, literal[1]]] begin[{]
return[member[.element]]
else begin[{]
assign[member[.className], call[.stripAnonymousPart, parameter[member[.className]]]]
return[ClassCreator(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMethodName, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFileName, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getLineNumber, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StackTraceElement, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[StackTraceElement] identifier[normalizeClassName] operator[SEP] Keyword[final] identifier[StackTraceElement] identifier[element] operator[SEP] {
identifier[String] identifier[className] operator[=] identifier[element] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[dollarIndex] operator[=] identifier[className] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dollarIndex] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[element] operator[SEP]
}
Keyword[else] {
identifier[className] operator[=] identifier[stripAnonymousPart] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[StackTraceElement] operator[SEP] identifier[className] , identifier[element] operator[SEP] identifier[getMethodName] operator[SEP] operator[SEP] , identifier[element] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] , identifier[element] operator[SEP] identifier[getLineNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public ServiceFuture<List<ExplicitListItem>> getExplicitListAsync(UUID appId, String versionId, UUID entityId, final ServiceCallback<List<ExplicitListItem>> serviceCallback) {
return ServiceFuture.fromResponse(getExplicitListWithServiceResponseAsync(appId, versionId, entityId), serviceCallback);
} | class class_name[name] begin[{]
method[getExplicitListAsync, return_type[type[ServiceFuture]], modifier[public], parameter[appId, versionId, entityId, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.getExplicitListWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.entityId]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[ExplicitListItem] operator[>] operator[>] identifier[getExplicitListAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[UUID] identifier[entityId] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[List] operator[<] identifier[ExplicitListItem] operator[>] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[getExplicitListWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[entityId] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public URI toURI() throws URISyntaxException {
if (m_isStrict && m_errorFree) {
// we have already verified that the URI contains no errors
return new URI(m_uri);
}
// create a new URI from the components
// using this constructor the input will be escaped if required
return new URI(null, m_prefix + (m_query != null ? "?" + m_query : ""), m_anchor);
} | class class_name[name] begin[{]
method[toURI, return_type[type[URI]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_isStrict], &&, member[.m_errorFree]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=m_uri, 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=URI, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), BinaryOperation(operandl=MemberReference(member=m_prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=m_query, 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=""), if_true=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="?"), operandr=MemberReference(member=m_query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), operator=+), MemberReference(member=m_anchor, 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=URI, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[URI] identifier[toURI] operator[SEP] operator[SEP] Keyword[throws] identifier[URISyntaxException] {
Keyword[if] operator[SEP] identifier[m_isStrict] operator[&&] identifier[m_errorFree] operator[SEP] {
Keyword[return] Keyword[new] identifier[URI] operator[SEP] identifier[m_uri] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[URI] operator[SEP] Other[null] , identifier[m_prefix] operator[+] operator[SEP] identifier[m_query] operator[!=] Other[null] operator[?] literal[String] operator[+] identifier[m_query] operator[:] literal[String] operator[SEP] , identifier[m_anchor] operator[SEP] operator[SEP]
}
|
public static String convertMethodSignature(XMethod xmethod) {
@DottedClassName
String className = xmethod.getClassName();
assert className.indexOf('/') == -1;
return convertMethodSignature(className, xmethod.getName(), xmethod.getSignature());
} | class class_name[name] begin[{]
method[convertMethodSignature, return_type[type[String]], modifier[public static], parameter[xmethod]] begin[{]
local_variable[type[String], className]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), label=None, value=None)
return[call[.convertMethodSignature, parameter[member[.className], call[xmethod.getName, parameter[]], call[xmethod.getSignature, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[convertMethodSignature] operator[SEP] identifier[XMethod] identifier[xmethod] operator[SEP] {
annotation[@] identifier[DottedClassName] identifier[String] identifier[className] operator[=] identifier[xmethod] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[className] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] identifier[convertMethodSignature] operator[SEP] identifier[className] , identifier[xmethod] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[xmethod] operator[SEP] identifier[getSignature] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean handleClassWithIndexForSortOnly(OSelectExecutionPlan plan, OIdentifier queryTarget, Set<String> filterClusters,
QueryPlanningInfo info, OCommandContext ctx, boolean profilingEnabled) {
OSchema schema = getSchemaFromContext(ctx);
OClass clazz = schema.getClass(queryTarget.getStringValue());
if (clazz == null) {
clazz = schema.getView(queryTarget.getStringValue());
if (clazz == null) {
throw new OCommandExecutionException("Class not found: " + queryTarget);
}
}
for (OIndex idx : clazz.getIndexes().stream().filter(i -> i.supportsOrderedIterations()).filter(i -> i.getDefinition() != null)
.collect(Collectors.toList())) {
List<String> indexFields = idx.getDefinition().getFields();
if (indexFields.size() < info.orderBy.getItems().size()) {
continue;
}
boolean indexFound = true;
String orderType = null;
for (int i = 0; i < info.orderBy.getItems().size(); i++) {
OOrderByItem orderItem = info.orderBy.getItems().get(i);
if (orderItem.getCollate() != null) {
return false;
}
String indexField = indexFields.get(i);
if (i == 0) {
orderType = orderItem.getType();
} else {
if (orderType == null || !orderType.equals(orderItem.getType())) {
indexFound = false;
break;//ASC/DESC interleaved, cannot be used with index.
}
}
if (!(indexField.equals(orderItem.getAlias()) || isInOriginalProjection(indexField, orderItem.getAlias()))) {
indexFound = false;
break;
}
}
if (indexFound && orderType != null) {
plan.chain(new FetchFromIndexValuesStep(idx, orderType.equals(OOrderByItem.ASC), ctx, profilingEnabled));
int[] filterClusterIds = null;
if (filterClusters != null) {
filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i)
.toArray();
}
plan.chain(new GetValueFromIndexEntryStep(ctx, filterClusterIds, profilingEnabled));
if (info.serverToClusters.size() == 1) {
info.orderApplied = true;
}
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[handleClassWithIndexForSortOnly, return_type[type[boolean]], modifier[private], parameter[plan, queryTarget, filterClusters, info, ctx, profilingEnabled]] begin[{]
local_variable[type[OSchema], schema]
local_variable[type[OClass], clazz]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
assign[member[.clazz], call[schema.getView, parameter[call[queryTarget.getStringValue, parameter[]]]]]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Class not found: "), operandr=MemberReference(member=queryTarget, 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=OCommandExecutionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDefinition, postfix_operators=[], prefix_operators=[], qualifier=idx, selectors=[MethodInvocation(arguments=[], member=getFields, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=indexFields)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=indexFields, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getItems, postfix_operators=[], prefix_operators=[], qualifier=info.orderBy, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=indexFound)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=orderType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getItems, postfix_operators=[], prefix_operators=[], qualifier=info.orderBy, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=orderItem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OOrderByItem, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCollate, postfix_operators=[], prefix_operators=[], qualifier=orderItem, 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=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=indexFields, selectors=[], type_arguments=None), name=indexField)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=orderType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=orderItem, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=orderType, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=indexFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=orderType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=orderItem, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=orderItem, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=indexField, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=indexField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=orderItem, selectors=[], type_arguments=None)], member=isInOriginalProjection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=indexFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getItems, postfix_operators=[], prefix_operators=[], qualifier=info.orderBy, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=indexFound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=orderType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=ASC, postfix_operators=[], prefix_operators=[], qualifier=OOrderByItem, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=orderType, selectors=[], type_arguments=None), MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=profilingEnabled, 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=FetchFromIndexValuesStep, sub_type=None))], member=chain, postfix_operators=[], prefix_operators=[], qualifier=plan, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=filterClusterIds)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=filterClusters, 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=filterClusterIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=filterClusters, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[], member=getDatabase, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getClusterIdByName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=map, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), parameters=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=mapToInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filterClusterIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=profilingEnabled, 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=GetValueFromIndexEntryStep, sub_type=None))], member=chain, postfix_operators=[], prefix_operators=[], qualifier=plan, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=info.serverToClusters, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=orderApplied, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getIndexes, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[MethodInvocation(arguments=[], member=stream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[], member=supportsOrderedIterations, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), parameters=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=filter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDefinition, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), parameters=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=filter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toList, postfix_operators=[], prefix_operators=[], qualifier=Collectors, selectors=[], type_arguments=None)], member=collect, 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=idx)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OIndex, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[handleClassWithIndexForSortOnly] operator[SEP] identifier[OSelectExecutionPlan] identifier[plan] , identifier[OIdentifier] identifier[queryTarget] , identifier[Set] operator[<] identifier[String] operator[>] identifier[filterClusters] , identifier[QueryPlanningInfo] identifier[info] , identifier[OCommandContext] identifier[ctx] , Keyword[boolean] identifier[profilingEnabled] operator[SEP] {
identifier[OSchema] identifier[schema] operator[=] identifier[getSchemaFromContext] operator[SEP] identifier[ctx] operator[SEP] operator[SEP] identifier[OClass] identifier[clazz] operator[=] identifier[schema] operator[SEP] identifier[getClass] operator[SEP] identifier[queryTarget] operator[SEP] identifier[getStringValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] {
identifier[clazz] operator[=] identifier[schema] operator[SEP] identifier[getView] operator[SEP] identifier[queryTarget] operator[SEP] identifier[getStringValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OCommandExecutionException] operator[SEP] literal[String] operator[+] identifier[queryTarget] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[OIndex] identifier[idx] operator[:] identifier[clazz] operator[SEP] identifier[getIndexes] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[i] operator[->] identifier[i] operator[SEP] identifier[supportsOrderedIterations] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[i] operator[->] identifier[i] operator[SEP] identifier[getDefinition] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[indexFields] operator[=] identifier[idx] operator[SEP] identifier[getDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[getFields] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexFields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[info] operator[SEP] identifier[orderBy] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[boolean] identifier[indexFound] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[orderType] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[info] operator[SEP] identifier[orderBy] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[OOrderByItem] identifier[orderItem] operator[=] identifier[info] operator[SEP] identifier[orderBy] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[orderItem] operator[SEP] identifier[getCollate] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[indexField] operator[=] identifier[indexFields] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[==] Other[0] operator[SEP] {
identifier[orderType] operator[=] identifier[orderItem] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[orderType] operator[==] Other[null] operator[||] operator[!] identifier[orderType] operator[SEP] identifier[equals] operator[SEP] identifier[orderItem] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[indexFound] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[indexField] operator[SEP] identifier[equals] operator[SEP] identifier[orderItem] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[isInOriginalProjection] operator[SEP] identifier[indexField] , identifier[orderItem] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[indexFound] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[indexFound] operator[&&] identifier[orderType] operator[!=] Other[null] operator[SEP] {
identifier[plan] operator[SEP] identifier[chain] operator[SEP] Keyword[new] identifier[FetchFromIndexValuesStep] operator[SEP] identifier[idx] , identifier[orderType] operator[SEP] identifier[equals] operator[SEP] identifier[OOrderByItem] operator[SEP] identifier[ASC] operator[SEP] , identifier[ctx] , identifier[profilingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[filterClusterIds] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[filterClusters] operator[!=] Other[null] operator[SEP] {
identifier[filterClusterIds] operator[=] identifier[filterClusters] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[name] operator[->] identifier[ctx] operator[SEP] identifier[getDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[getClusterIdByName] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[mapToInt] operator[SEP] identifier[i] operator[->] identifier[i] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP]
}
identifier[plan] operator[SEP] identifier[chain] operator[SEP] Keyword[new] identifier[GetValueFromIndexEntryStep] operator[SEP] identifier[ctx] , identifier[filterClusterIds] , identifier[profilingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[info] operator[SEP] identifier[serverToClusters] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[info] operator[SEP] identifier[orderApplied] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public BooleanColumn set(Selection rowSelection, boolean newValue) {
for (int row : rowSelection) {
set(row, newValue);
}
return this;
} | class class_name[name] begin[{]
method[set, return_type[type[BooleanColumn]], modifier[public], parameter[rowSelection, newValue]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rowSelection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=row)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[BooleanColumn] identifier[set] operator[SEP] identifier[Selection] identifier[rowSelection] , Keyword[boolean] identifier[newValue] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[row] operator[:] identifier[rowSelection] operator[SEP] {
identifier[set] operator[SEP] identifier[row] , identifier[newValue] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static void usage(Object command, PrintStream out) {
toCommandLine(command, new DefaultFactory()).usage(out);
} | class class_name[name] begin[{]
method[usage, return_type[void], modifier[public static], parameter[command, out]] begin[{]
call[.toCommandLine, parameter[member[.command], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultFactory, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[usage] operator[SEP] identifier[Object] identifier[command] , identifier[PrintStream] identifier[out] operator[SEP] {
identifier[toCommandLine] operator[SEP] identifier[command] , Keyword[new] identifier[DefaultFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[usage] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
|
public UpdatePullRequestParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString()));
}
return this;
} | class class_name[name] begin[{]
method[notifiedUserIds, return_type[type[UpdatePullRequestParams]], modifier[public], parameter[notifiedUserIds]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="notifiedUserId[]"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=notifiedUserId, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NameValuePair, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=notifiedUserIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=notifiedUserId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[UpdatePullRequestParams] identifier[notifiedUserIds] operator[SEP] identifier[List] operator[<] identifier[Long] operator[>] identifier[notifiedUserIds] operator[SEP] {
Keyword[for] operator[SEP] identifier[Long] identifier[notifiedUserId] operator[:] identifier[notifiedUserIds] operator[SEP] {
identifier[parameters] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[NameValuePair] operator[SEP] literal[String] , identifier[notifiedUserId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public Datastream getDatastream(Context context,
String pid,
String datastreamID,
Date asOfDateTime) throws ServerException {
return mgmt.getDatastream(context, pid, datastreamID, asOfDateTime);
} | class class_name[name] begin[{]
method[getDatastream, return_type[type[Datastream]], modifier[public], parameter[context, pid, datastreamID, asOfDateTime]] begin[{]
return[call[mgmt.getDatastream, parameter[member[.context], member[.pid], member[.datastreamID], member[.asOfDateTime]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Datastream] identifier[getDatastream] operator[SEP] identifier[Context] identifier[context] , identifier[String] identifier[pid] , identifier[String] identifier[datastreamID] , identifier[Date] identifier[asOfDateTime] operator[SEP] Keyword[throws] identifier[ServerException] {
Keyword[return] identifier[mgmt] operator[SEP] identifier[getDatastream] operator[SEP] identifier[context] , identifier[pid] , identifier[datastreamID] , identifier[asOfDateTime] operator[SEP] operator[SEP]
}
|
public static Method getSingleSetter(String fieldName, Class<?> clazz) {
String setterName = buildSetterName(fieldName);
try {
// Using getMathods(), getMathod(...) expects exact parameter type
// matching and ignores inheritance-tree.
Method[] methods = clazz.getMethods();
List<Method> candidates = new ArrayList<Method>();
Set<Class<?>> parameterTypes = new HashSet<Class<?>>();
for(Method method : methods) {
if(method.getName().equals(setterName)) {
Class<?>[] paramTypes = method.getParameterTypes();
if(paramTypes != null && paramTypes.length == 1) {
candidates.add(method);
parameterTypes.add(paramTypes[0]);
}
}
}
if (parameterTypes.size() > 1) {
throw LOG.ambiguousSetterMethod(setterName, clazz.getName());
}
if (candidates.size() >= 1) {
return candidates.get(0);
}
return null;
}
catch (SecurityException e) {
throw LOG.unableToAccessMethod(setterName, clazz.getName());
}
} | class class_name[name] begin[{]
method[getSingleSetter, return_type[type[Method]], modifier[public static], parameter[fieldName, clazz]] begin[{]
local_variable[type[String], setterName]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), name=methods)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Method, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=candidates)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=None, name=HashSet, sub_type=None)), name=parameterTypes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MemberReference(member=setterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), name=paramTypes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[None], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=paramTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=paramTypes, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=paramTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=add, postfix_operators=[], prefix_operators=[], qualifier=parameterTypes, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=parameterTypes, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=setterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)], member=ambiguousSetterMethod, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=setterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)], member=unableToAccessMethod, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Method] identifier[getSingleSetter] operator[SEP] identifier[String] identifier[fieldName] , identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
identifier[String] identifier[setterName] operator[=] identifier[buildSetterName] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] Keyword[try] {
identifier[Method] operator[SEP] operator[SEP] identifier[methods] operator[=] identifier[clazz] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Method] operator[>] identifier[candidates] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Method] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[parameterTypes] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[setterName] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[paramTypes] operator[=] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[paramTypes] operator[!=] Other[null] operator[&&] identifier[paramTypes] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
identifier[candidates] operator[SEP] identifier[add] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[parameterTypes] operator[SEP] identifier[add] operator[SEP] identifier[paramTypes] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[parameterTypes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[throw] identifier[LOG] operator[SEP] identifier[ambiguousSetterMethod] operator[SEP] identifier[setterName] , identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[candidates] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[1] operator[SEP] {
Keyword[return] identifier[candidates] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] identifier[LOG] operator[SEP] identifier[unableToAccessMethod] operator[SEP] identifier[setterName] , identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@CanIgnoreReturnValue
@NonNullDecl
public static <T extends Object> T checkNotNull(
@NonNullDecl T reference,
@NullableDecl String errorMessageTemplate,
@NullableDecl Object... errorMessageArgs) {
if (reference == null) {
throw new NullPointerException(lenientFormat(errorMessageTemplate, errorMessageArgs));
}
return reference;
} | class class_name[name] begin[{]
method[checkNotNull, return_type[type[T]], modifier[public static], parameter[reference, errorMessageTemplate, errorMessageArgs]] begin[{]
if[binary_operation[member[.reference], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=errorMessageTemplate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=errorMessageArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lenientFormat, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.reference]]
end[}]
END[}] | annotation[@] identifier[CanIgnoreReturnValue] annotation[@] identifier[NonNullDecl] Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Object] operator[>] identifier[T] identifier[checkNotNull] operator[SEP] annotation[@] identifier[NonNullDecl] identifier[T] identifier[reference] , annotation[@] identifier[NullableDecl] identifier[String] identifier[errorMessageTemplate] , annotation[@] identifier[NullableDecl] identifier[Object] operator[...] identifier[errorMessageArgs] operator[SEP] {
Keyword[if] operator[SEP] identifier[reference] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] identifier[lenientFormat] operator[SEP] identifier[errorMessageTemplate] , identifier[errorMessageArgs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[reference] operator[SEP]
}
|
@Override
public CPOptionValue findByUuid_C_First(String uuid, long companyId,
OrderByComparator<CPOptionValue> orderByComparator)
throws NoSuchCPOptionValueException {
CPOptionValue cpOptionValue = fetchByUuid_C_First(uuid, companyId,
orderByComparator);
if (cpOptionValue != null) {
return cpOptionValue;
}
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", companyId=");
msg.append(companyId);
msg.append("}");
throw new NoSuchCPOptionValueException(msg.toString());
} | class class_name[name] begin[{]
method[findByUuid_C_First, return_type[type[CPOptionValue]], modifier[public], parameter[uuid, companyId, orderByComparator]] begin[{]
local_variable[type[CPOptionValue], cpOptionValue]
if[binary_operation[member[.cpOptionValue], !=, literal[null]]] begin[{]
return[member[.cpOptionValue]]
else begin[{]
None
end[}]
local_variable[type[StringBundler], msg]
call[msg.append, parameter[member[._NO_SUCH_ENTITY_WITH_KEY]]]
call[msg.append, parameter[literal["uuid="]]]
call[msg.append, parameter[member[.uuid]]]
call[msg.append, parameter[literal[", companyId="]]]
call[msg.append, parameter[member[.companyId]]]
call[msg.append, parameter[literal["}"]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchCPOptionValueException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CPOptionValue] identifier[findByUuid_C_First] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[companyId] , identifier[OrderByComparator] operator[<] identifier[CPOptionValue] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[NoSuchCPOptionValueException] {
identifier[CPOptionValue] identifier[cpOptionValue] operator[=] identifier[fetchByUuid_C_First] operator[SEP] identifier[uuid] , identifier[companyId] , identifier[orderByComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cpOptionValue] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[cpOptionValue] operator[SEP]
}
identifier[StringBundler] identifier[msg] operator[=] Keyword[new] identifier[StringBundler] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[_NO_SUCH_ENTITY_WITH_KEY] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[companyId] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NoSuchCPOptionValueException] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.