code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static int nvgraphSetGraphStructure(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
Object topologyData,
int TType)
{
return checkResult(nvgraphSetGraphStructureNative(handle, descrG, topologyData, TType));
} | class class_name[name] begin[{]
method[nvgraphSetGraphStructure, return_type[type[int]], modifier[public static], parameter[handle, descrG, topologyData, TType]] begin[{]
return[call[.checkResult, parameter[call[.nvgraphSetGraphStructureNative, parameter[member[.handle], member[.descrG], member[.topologyData], member[.TType]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[nvgraphSetGraphStructure] operator[SEP] identifier[nvgraphHandle] identifier[handle] , identifier[nvgraphGraphDescr] identifier[descrG] , identifier[Object] identifier[topologyData] , Keyword[int] identifier[TType] operator[SEP] {
Keyword[return] identifier[checkResult] operator[SEP] identifier[nvgraphSetGraphStructureNative] operator[SEP] identifier[handle] , identifier[descrG] , identifier[topologyData] , identifier[TType] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String extractSubstring(
String str,
String open,
String close,
char escape)
{
return extractSubstring(str, open, close, escape, true);
} | class class_name[name] begin[{]
method[extractSubstring, return_type[type[String]], modifier[public static], parameter[str, open, close, escape]] begin[{]
return[call[.extractSubstring, parameter[member[.str], member[.open], member[.close], member[.escape], literal[true]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[extractSubstring] operator[SEP] identifier[String] identifier[str] , identifier[String] identifier[open] , identifier[String] identifier[close] , Keyword[char] identifier[escape] operator[SEP] {
Keyword[return] identifier[extractSubstring] operator[SEP] identifier[str] , identifier[open] , identifier[close] , identifier[escape] , literal[boolean] operator[SEP] operator[SEP]
}
|
private void removeBuffers() {
IntBuffer buffer = BufferUtils.createIntBuffer(1);
int queued = AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED);
while (queued > 0)
{
AL10.alSourceUnqueueBuffers(source, buffer);
queued--;
}
} | class class_name[name] begin[{]
method[removeBuffers, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[IntBuffer], buffer]
local_variable[type[int], queued]
while[binary_operation[member[.queued], >, literal[0]]] begin[{]
call[AL10.alSourceUnqueueBuffers, parameter[member[.source], member[.buffer]]]
member[.queued]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[removeBuffers] operator[SEP] operator[SEP] {
identifier[IntBuffer] identifier[buffer] operator[=] identifier[BufferUtils] operator[SEP] identifier[createIntBuffer] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[queued] operator[=] identifier[AL10] operator[SEP] identifier[alGetSourcei] operator[SEP] identifier[source] , identifier[AL10] operator[SEP] identifier[AL_BUFFERS_QUEUED] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[queued] operator[>] Other[0] operator[SEP] {
identifier[AL10] operator[SEP] identifier[alSourceUnqueueBuffers] operator[SEP] identifier[source] , identifier[buffer] operator[SEP] operator[SEP] identifier[queued] operator[--] operator[SEP]
}
}
|
public Boolean isTopmostElement(By by) {
if (!isTopmostElementCheckApplicable(by)) {
return null;
}
WebElement topmostElement = findTopmostElement(by);
WebElement element = findElement(by);
return element.equals(topmostElement);
} | class class_name[name] begin[{]
method[isTopmostElement, return_type[type[Boolean]], modifier[public], parameter[by]] begin[{]
if[call[.isTopmostElementCheckApplicable, parameter[member[.by]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[WebElement], topmostElement]
local_variable[type[WebElement], element]
return[call[element.equals, parameter[member[.topmostElement]]]]
end[}]
END[}] | Keyword[public] identifier[Boolean] identifier[isTopmostElement] operator[SEP] identifier[By] identifier[by] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isTopmostElementCheckApplicable] operator[SEP] identifier[by] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[WebElement] identifier[topmostElement] operator[=] identifier[findTopmostElement] operator[SEP] identifier[by] operator[SEP] operator[SEP] identifier[WebElement] identifier[element] operator[=] identifier[findElement] operator[SEP] identifier[by] operator[SEP] operator[SEP] Keyword[return] identifier[element] operator[SEP] identifier[equals] operator[SEP] identifier[topmostElement] operator[SEP] operator[SEP]
}
|
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BasePackage.AFP__STRUCTURED_FIELDS:
return ((InternalEList<?>)getStructuredFields()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
} | class class_name[name] begin[{]
method[eInverseRemove, return_type[type[NotificationChain]], modifier[public], parameter[otherEnd, featureID, msgs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=AFP__STRUCTURED_FIELDS, postfix_operators=[], prefix_operators=[], qualifier=BasePackage, selectors=[])], statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getStructuredFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=InternalEList, sub_type=None)), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eInverseRemove, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[NotificationChain] identifier[eInverseRemove] operator[SEP] identifier[InternalEObject] identifier[otherEnd] , Keyword[int] identifier[featureID] , identifier[NotificationChain] identifier[msgs] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[BasePackage] operator[SEP] identifier[AFP__STRUCTURED_FIELDS] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[InternalEList] operator[<] operator[?] operator[>] operator[SEP] identifier[getStructuredFields] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[basicRemove] operator[SEP] identifier[otherEnd] , identifier[msgs] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eInverseRemove] operator[SEP] identifier[otherEnd] , identifier[featureID] , identifier[msgs] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public BridgeFactory getBridgeFactory(Class<?> farType) {
if (!farToNearType.containsKey(farType)) {
throw new IllegalStateException("Far type not registered: " + (farType == null ? "null" : farType.getSimpleName()));
}
return farTypeToFactory.get(farType);
} | class class_name[name] begin[{]
method[getBridgeFactory, return_type[type[BridgeFactory]], modifier[public], parameter[farType]] begin[{]
if[call[farToNearType.containsKey, parameter[member[.farType]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Far type not registered: "), operandr=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=farType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=farType, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="null")), 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[farTypeToFactory.get, parameter[member[.farType]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[BridgeFactory] identifier[getBridgeFactory] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[farType] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[farToNearType] operator[SEP] identifier[containsKey] operator[SEP] identifier[farType] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] operator[SEP] identifier[farType] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[farType] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[farTypeToFactory] operator[SEP] identifier[get] operator[SEP] identifier[farType] operator[SEP] operator[SEP]
}
|
public String writeToString() throws IOException {
final Reader reader = getReader();
try {
return CharStreams.toString(reader);
} finally {
reader.close();
}
} | class class_name[name] begin[{]
method[writeToString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[Reader], reader]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=CharStreams, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[writeToString] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[Reader] identifier[reader] operator[=] identifier[getReader] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[CharStreams] operator[SEP] identifier[toString] operator[SEP] identifier[reader] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[reader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Handler
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void onClose(Close event) throws IOException, InterruptedException {
boolean subOnly = true;
for (Channel channel : event.channels()) {
if (channel instanceof TcpChannelImpl) {
if (channels.contains(channel)) {
((TcpChannelImpl) channel).close();
}
} else {
subOnly = false;
}
}
if (subOnly || !serverSocketChannel.isOpen()) {
// Closed already
fire(new Closed());
return;
}
synchronized (channels) {
closing = true;
// Copy to avoid concurrent modification exception
Set<TcpChannelImpl> conns = new HashSet<>(channels);
for (TcpChannelImpl conn : conns) {
conn.close();
}
while (!channels.isEmpty()) {
channels.wait();
}
}
serverSocketChannel.close();
purger.interrupt();
closing = false;
fire(new Closed());
} | class class_name[name] begin[{]
method[onClose, return_type[void], modifier[public], parameter[event]] begin[{]
local_variable[type[boolean], subOnly]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=TcpChannelImpl, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=subOnly, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=channels, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TcpChannelImpl, sub_type=None)), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=channels, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=channel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None))), label=None)
if[binary_operation[member[.subOnly], ||, call[serverSocketChannel.isOpen, parameter[]]]] begin[{]
call[.fire, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Closed, sub_type=None))]]
return[None]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.channels]] BEGIN[{]
assign[member[.closing], literal[true]]
local_variable[type[Set], conns]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=conns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=conn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TcpChannelImpl, sub_type=None))), label=None)
while[call[channels.isEmpty, parameter[]]] begin[{]
call[channels.wait, parameter[]]
end[}]
END[}]
call[serverSocketChannel.close, parameter[]]
call[purger.interrupt, parameter[]]
assign[member[.closing], literal[false]]
call[.fire, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Closed, sub_type=None))]]
end[}]
END[}] | annotation[@] identifier[Handler] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[onClose] operator[SEP] identifier[Close] identifier[event] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
Keyword[boolean] identifier[subOnly] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Channel] identifier[channel] operator[:] identifier[event] operator[SEP] identifier[channels] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[channel] Keyword[instanceof] identifier[TcpChannelImpl] operator[SEP] {
Keyword[if] operator[SEP] identifier[channels] operator[SEP] identifier[contains] operator[SEP] identifier[channel] operator[SEP] operator[SEP] {
operator[SEP] operator[SEP] identifier[TcpChannelImpl] operator[SEP] identifier[channel] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[subOnly] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[subOnly] operator[||] operator[!] identifier[serverSocketChannel] operator[SEP] identifier[isOpen] operator[SEP] operator[SEP] operator[SEP] {
identifier[fire] operator[SEP] Keyword[new] identifier[Closed] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[channels] operator[SEP] {
identifier[closing] operator[=] literal[boolean] operator[SEP] identifier[Set] operator[<] identifier[TcpChannelImpl] operator[>] identifier[conns] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[channels] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TcpChannelImpl] identifier[conn] operator[:] identifier[conns] operator[SEP] {
identifier[conn] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[!] identifier[channels] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[channels] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[serverSocketChannel] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[purger] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] identifier[closing] operator[=] literal[boolean] operator[SEP] identifier[fire] operator[SEP] Keyword[new] identifier[Closed] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public OvhIPLoadbalancing project_serviceName_ipLoadbalancing_id_GET(String serviceName, String id) throws IOException {
String qPath = "/cloud/project/{serviceName}/ipLoadbalancing/{id}";
StringBuilder sb = path(qPath, serviceName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhIPLoadbalancing.class);
} | class class_name[name] begin[{]
method[project_serviceName_ipLoadbalancing_id_GET, return_type[type[OvhIPLoadbalancing]], modifier[public], parameter[serviceName, id]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhIPLoadbalancing, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhIPLoadbalancing] identifier[project_serviceName_ipLoadbalancing_id_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[id] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhIPLoadbalancing] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static TickRange newValueTick(
long tick,
Object value,
long itemStreamIndex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry( tc, "newValueTick", new Object[] { Long.valueOf(tick),
value,
Long.valueOf(itemStreamIndex)});
TickRange r = new TickRange(TickRange.Value, tick, tick);
r.itemStreamIndex = itemStreamIndex;
r.value = value;
r.valuestamp = tick;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit( tc, "newValueTick", r);
return r;
} | class class_name[name] begin[{]
method[newValueTick, return_type[type[TickRange]], modifier[public static], parameter[tick, value, itemStreamIndex]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["newValueTick"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=tick, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=itemStreamIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[TickRange], r]
assign[member[r.itemStreamIndex], member[.itemStreamIndex]]
assign[member[r.value], member[.value]]
assign[member[r.valuestamp], member[.tick]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["newValueTick"], member[.r]]]
else begin[{]
None
end[}]
return[member[.r]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TickRange] identifier[newValueTick] operator[SEP] Keyword[long] identifier[tick] , identifier[Object] identifier[value] , Keyword[long] identifier[itemStreamIndex] 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] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[tick] operator[SEP] , identifier[value] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[itemStreamIndex] operator[SEP]
} operator[SEP] operator[SEP] identifier[TickRange] identifier[r] operator[=] Keyword[new] identifier[TickRange] operator[SEP] identifier[TickRange] operator[SEP] identifier[Value] , identifier[tick] , identifier[tick] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[itemStreamIndex] operator[=] identifier[itemStreamIndex] operator[SEP] identifier[r] operator[SEP] identifier[value] operator[=] identifier[value] operator[SEP] identifier[r] operator[SEP] identifier[valuestamp] operator[=] identifier[tick] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[r] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
|
protected void loadInterpolationValues() {
// System properties may be accessed using ${name} or @{name}
for (String propertyName : System.getProperties().stringPropertyNames()) {
String value = System.getProperty(propertyName);
if (!StringUtils.isNullOrEmpty(value)) {
addInterpolationValue(propertyName, value);
}
}
// Environment variables may be accessed using ${env.NAME} or @{env.NAME}
for (String variableName : System.getenv().keySet()) {
String value = System.getenv(variableName);
if (!StringUtils.isNullOrEmpty(value)) {
addInterpolationValue("env." + variableName, value);
}
}
} | class class_name[name] begin[{]
method[loadInterpolationValues, return_type[void], modifier[protected], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNullOrEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addInterpolationValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getProperties, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[MethodInvocation(arguments=[], member=stringPropertyNames, 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=propertyName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=variableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getenv, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNullOrEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="env."), operandr=MemberReference(member=variableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addInterpolationValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getenv, postfix_operators=[], prefix_operators=[], qualifier=System, 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=variableName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[loadInterpolationValues] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[propertyName] operator[:] identifier[System] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[stringPropertyNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[addInterpolationValue] operator[SEP] identifier[propertyName] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[String] identifier[variableName] operator[:] identifier[System] operator[SEP] identifier[getenv] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[variableName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[addInterpolationValue] operator[SEP] literal[String] operator[+] identifier[variableName] , identifier[value] operator[SEP] operator[SEP]
}
}
}
|
private Context translateFail(WyilFile.Stmt.Fail stmt, Context context) {
Expr condition = new Expr.Constant(new Value.Bool(false));
//
VerificationCondition verificationCondition = new VerificationCondition("possible panic", context.assumptions,
condition, stmt.getParent(WyilFile.Attribute.Span.class));
context.emit(verificationCondition);
//
return null;
} | class class_name[name] begin[{]
method[translateFail, return_type[type[Context]], modifier[private], parameter[stmt, context]] begin[{]
local_variable[type[Expr], condition]
local_variable[type[VerificationCondition], verificationCondition]
call[context.emit, parameter[member[.verificationCondition]]]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[Context] identifier[translateFail] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Stmt] operator[SEP] identifier[Fail] identifier[stmt] , identifier[Context] identifier[context] operator[SEP] {
identifier[Expr] identifier[condition] operator[=] Keyword[new] identifier[Expr] operator[SEP] identifier[Constant] operator[SEP] Keyword[new] identifier[Value] operator[SEP] identifier[Bool] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[VerificationCondition] identifier[verificationCondition] operator[=] Keyword[new] identifier[VerificationCondition] operator[SEP] literal[String] , identifier[context] operator[SEP] identifier[assumptions] , identifier[condition] , identifier[stmt] operator[SEP] identifier[getParent] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Attribute] operator[SEP] identifier[Span] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[emit] operator[SEP] identifier[verificationCondition] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public ChromeOptions addEncodedExtensions(List<String> encoded) {
for (String extension : encoded) {
checkNotNull(extension);
}
extensions.addAll(encoded);
return this;
} | class class_name[name] begin[{]
method[addEncodedExtensions, return_type[type[ChromeOptions]], modifier[public], parameter[encoded]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=encoded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extension)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[extensions.addAll, parameter[member[.encoded]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ChromeOptions] identifier[addEncodedExtensions] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[encoded] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[extension] operator[:] identifier[encoded] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[extension] operator[SEP] operator[SEP]
}
identifier[extensions] operator[SEP] identifier[addAll] operator[SEP] identifier[encoded] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
protected boolean isForAction(Method actionMethod, Class<?> controllerClazz) {
for (Class<?> paramType : actionMethod.getParameterTypes()) {
if (paramType == Portal.class) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[isForAction, return_type[type[boolean]], modifier[protected], parameter[actionMethod, controllerClazz]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=paramType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Portal, sub_type=None)), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=actionMethod, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=paramType)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[boolean] identifier[isForAction] operator[SEP] identifier[Method] identifier[actionMethod] , identifier[Class] operator[<] operator[?] operator[>] identifier[controllerClazz] operator[SEP] {
Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[paramType] operator[:] identifier[actionMethod] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[paramType] operator[==] identifier[Portal] operator[SEP] Keyword[class] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorListener = listener;
} | class class_name[name] begin[{]
method[setErrorListener, return_type[void], modifier[public], parameter[listener]] begin[{]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ER_NULL_ERROR_HANDLER, postfix_operators=[], prefix_operators=[], qualifier=XPATHErrorResources, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=createXPATHMessage, postfix_operators=[], prefix_operators=[], qualifier=XSLMessages, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.m_errorListener], member[.listener]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setErrorListener] operator[SEP] identifier[ErrorListener] identifier[listener] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[XSLMessages] operator[SEP] identifier[createXPATHMessage] operator[SEP] identifier[XPATHErrorResources] operator[SEP] identifier[ER_NULL_ERROR_HANDLER] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[m_errorListener] operator[=] identifier[listener] operator[SEP]
}
|
public String toSyslogMessage(MessageFormat messageFormat) {
switch (messageFormat) {
case RFC_3164:
return toRfc3164SyslogMessage();
case RFC_5424:
return toRfc5424SyslogMessage();
case RFC_5425:
return toRfc5425SyslogMessage();
default:
throw new IllegalStateException("Unsupported message format '" + messageFormat + "'");
}
} | class class_name[name] begin[{]
method[toSyslogMessage, return_type[type[String]], modifier[public], parameter[messageFormat]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['RFC_3164'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=toRfc3164SyslogMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['RFC_5424'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=toRfc5424SyslogMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['RFC_5425'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=toRfc5425SyslogMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported message format '"), operandr=MemberReference(member=messageFormat, 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=IllegalStateException, sub_type=None)), label=None)])], expression=MemberReference(member=messageFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[toSyslogMessage] operator[SEP] identifier[MessageFormat] identifier[messageFormat] operator[SEP] {
Keyword[switch] operator[SEP] identifier[messageFormat] operator[SEP] {
Keyword[case] identifier[RFC_3164] operator[:] Keyword[return] identifier[toRfc3164SyslogMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[RFC_5424] operator[:] Keyword[return] identifier[toRfc5424SyslogMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[RFC_5425] operator[:] Keyword[return] identifier[toRfc5425SyslogMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[messageFormat] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public void removeClientNotification(RESTRequest request, ObjectName objectName, int clientID) {
//Get the client area
ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null);
//Remove the corresponding listener (will also remove from MBeanServer)
clientArea.removeClientNotificationListener(request, objectName);
} | class class_name[name] begin[{]
method[removeClientNotification, return_type[void], modifier[public], parameter[request, objectName, clientID]] begin[{]
local_variable[type[ClientNotificationArea], clientArea]
call[clientArea.removeClientNotificationListener, parameter[member[.request], member[.objectName]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeClientNotification] operator[SEP] identifier[RESTRequest] identifier[request] , identifier[ObjectName] identifier[objectName] , Keyword[int] identifier[clientID] operator[SEP] {
identifier[ClientNotificationArea] identifier[clientArea] operator[=] identifier[getInboxIfAvailable] operator[SEP] identifier[clientID] , Other[null] operator[SEP] operator[SEP] identifier[clientArea] operator[SEP] identifier[removeClientNotificationListener] operator[SEP] identifier[request] , identifier[objectName] operator[SEP] operator[SEP]
}
|
private void sawLoad(int seen, int pc) {
int reg = RegisterUtils.getLoadReg(this, seen);
if (!ignoreRegs.get(reg)) {
ScopeBlock sb = findScopeBlock(rootScopeBlock, pc);
if (sb != null) {
sb.addLoad(reg, pc);
} else {
ignoreRegs.set(reg);
}
}
} | class class_name[name] begin[{]
method[sawLoad, return_type[void], modifier[private], parameter[seen, pc]] begin[{]
local_variable[type[int], reg]
if[call[ignoreRegs.get, parameter[member[.reg]]]] begin[{]
local_variable[type[ScopeBlock], sb]
if[binary_operation[member[.sb], !=, literal[null]]] begin[{]
call[sb.addLoad, parameter[member[.reg], member[.pc]]]
else begin[{]
call[ignoreRegs.set, parameter[member[.reg]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[sawLoad] operator[SEP] Keyword[int] identifier[seen] , Keyword[int] identifier[pc] operator[SEP] {
Keyword[int] identifier[reg] operator[=] identifier[RegisterUtils] operator[SEP] identifier[getLoadReg] operator[SEP] Keyword[this] , identifier[seen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ignoreRegs] operator[SEP] identifier[get] operator[SEP] identifier[reg] operator[SEP] operator[SEP] {
identifier[ScopeBlock] identifier[sb] operator[=] identifier[findScopeBlock] operator[SEP] identifier[rootScopeBlock] , identifier[pc] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sb] operator[!=] Other[null] operator[SEP] {
identifier[sb] operator[SEP] identifier[addLoad] operator[SEP] identifier[reg] , identifier[pc] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ignoreRegs] operator[SEP] identifier[set] operator[SEP] identifier[reg] operator[SEP] operator[SEP]
}
}
}
|
@Deprecated
public LargeObject open(int oid, int mode) throws SQLException {
return open((long) oid, mode, false);
} | class class_name[name] begin[{]
method[open, return_type[type[LargeObject]], modifier[public], parameter[oid, mode]] begin[{]
return[call[.open, parameter[Cast(expression=MemberReference(member=oid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long)), member[.mode], literal[false]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] identifier[LargeObject] identifier[open] operator[SEP] Keyword[int] identifier[oid] , Keyword[int] identifier[mode] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[return] identifier[open] operator[SEP] operator[SEP] Keyword[long] operator[SEP] identifier[oid] , identifier[mode] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static KbServerSideException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage()))
? (KbServerSideException) cause
: new KbServerSideException(message, cause);
} | class class_name[name] begin[{]
method[fromThrowable, return_type[type[KbServerSideException]], modifier[public static], parameter[message, cause]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=KbServerSideException, sub_type=None), operator=instanceof), operandr=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=cause, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), operator=&&), if_false=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cause, 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=KbServerSideException, sub_type=None)), if_true=Cast(expression=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=KbServerSideException, sub_type=None)))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[KbServerSideException] identifier[fromThrowable] operator[SEP] identifier[String] identifier[message] , identifier[Throwable] identifier[cause] operator[SEP] {
Keyword[return] operator[SEP] identifier[cause] Keyword[instanceof] identifier[KbServerSideException] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[message] , identifier[cause] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[?] operator[SEP] identifier[KbServerSideException] operator[SEP] identifier[cause] operator[:] Keyword[new] identifier[KbServerSideException] operator[SEP] identifier[message] , identifier[cause] operator[SEP] operator[SEP]
}
|
public static void setInstance(Cache cache) throws GuildWars2Exception {
if (instance != null)
throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized");
instance = new GuildWars2(cache);
} | class class_name[name] begin[{]
method[setInstance, return_type[void], modifier[public static], parameter[cache]] begin[{]
if[binary_operation[member[.instance], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=Other, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Instance already initialized")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GuildWars2Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.instance], ClassCreator(arguments=[MemberReference(member=cache, 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=GuildWars2, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setInstance] operator[SEP] identifier[Cache] identifier[cache] operator[SEP] Keyword[throws] identifier[GuildWars2Exception] {
Keyword[if] operator[SEP] identifier[instance] operator[!=] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[GuildWars2Exception] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[Other] , literal[String] operator[SEP] operator[SEP] identifier[instance] operator[=] Keyword[new] identifier[GuildWars2] operator[SEP] identifier[cache] operator[SEP] operator[SEP]
}
|
public void schedule(@NonNull Node<K, V> node) {
Node<K, V> sentinel = findBucket(node.getVariableTime());
link(sentinel, node);
} | class class_name[name] begin[{]
method[schedule, return_type[void], modifier[public], parameter[node]] begin[{]
local_variable[type[Node], sentinel]
call[.link, parameter[member[.sentinel], member[.node]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[schedule] operator[SEP] annotation[@] identifier[NonNull] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[node] operator[SEP] {
identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[sentinel] operator[=] identifier[findBucket] operator[SEP] identifier[node] operator[SEP] identifier[getVariableTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[link] operator[SEP] identifier[sentinel] , identifier[node] operator[SEP] operator[SEP]
}
|
private boolean readRawData( QrCode qr) {
QrCode.VersionInfo info = QrCode.VERSION_INFO[qr.version];
qr.rawbits = new byte[info.codewords];
// predeclare memory
bits.resize(info.codewords*8);
// read bits from memory
List<Point2D_I32> locationBits = QrCode.LOCATION_BITS[qr.version];
// end at bits.size instead of locationBits.size because location might point to useless bits
for (int i = 0; i < bits.size; i++ ) {
Point2D_I32 b = locationBits.get(i);
readDataMatrix(i,b.y,b.x, qr.mask);
}
// System.out.println("Version "+qr.version);
// System.out.println("bits8.size "+bits8.size+" locationBits "+locationBits.size());
// bits8.print();
// copy over the results
System.arraycopy(bits.data,0,qr.rawbits,0,qr.rawbits.length);
return true;
} | class class_name[name] begin[{]
method[readRawData, return_type[type[boolean]], modifier[private], parameter[qr]] begin[{]
local_variable[type[QrCode], info]
assign[member[qr.rawbits], ArrayCreator(dimensions=[MemberReference(member=codewords, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
call[bits.resize, parameter[binary_operation[member[info.codewords], *, literal[8]]]]
local_variable[type[List], locationBits]
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=locationBits, selectors=[], type_arguments=None), name=b)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point2D_I32, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[]), MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[]), MemberReference(member=mask, postfix_operators=[], prefix_operators=[], qualifier=qr, selectors=[])], member=readDataMatrix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=bits, 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)
call[System.arraycopy, parameter[member[bits.data], literal[0], member[qr.rawbits], literal[0], member[qr.rawbits.length]]]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[readRawData] operator[SEP] identifier[QrCode] identifier[qr] operator[SEP] {
identifier[QrCode] operator[SEP] identifier[VersionInfo] identifier[info] operator[=] identifier[QrCode] operator[SEP] identifier[VERSION_INFO] operator[SEP] identifier[qr] operator[SEP] identifier[version] operator[SEP] operator[SEP] identifier[qr] operator[SEP] identifier[rawbits] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[info] operator[SEP] identifier[codewords] operator[SEP] operator[SEP] identifier[bits] operator[SEP] identifier[resize] operator[SEP] identifier[info] operator[SEP] identifier[codewords] operator[*] Other[8] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Point2D_I32] operator[>] identifier[locationBits] operator[=] identifier[QrCode] operator[SEP] identifier[LOCATION_BITS] operator[SEP] identifier[qr] operator[SEP] identifier[version] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[bits] operator[SEP] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Point2D_I32] identifier[b] operator[=] identifier[locationBits] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[readDataMatrix] operator[SEP] identifier[i] , identifier[b] operator[SEP] identifier[y] , identifier[b] operator[SEP] identifier[x] , identifier[qr] operator[SEP] identifier[mask] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[bits] operator[SEP] identifier[data] , Other[0] , identifier[qr] operator[SEP] identifier[rawbits] , Other[0] , identifier[qr] operator[SEP] identifier[rawbits] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, Fee fee ) {
return this.createWithTokenAndFee( token, amount, currency, null, fee );
} | class class_name[name] begin[{]
method[createWithTokenAndFee, return_type[type[Transaction]], modifier[public], parameter[token, amount, currency, fee]] begin[{]
return[THIS[call[None.createWithTokenAndFee, parameter[member[.token], member[.amount], member[.currency], literal[null], member[.fee]]]]]
end[}]
END[}] | Keyword[public] identifier[Transaction] identifier[createWithTokenAndFee] operator[SEP] identifier[String] identifier[token] , identifier[Integer] identifier[amount] , identifier[String] identifier[currency] , identifier[Fee] identifier[fee] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[createWithTokenAndFee] operator[SEP] identifier[token] , identifier[amount] , identifier[currency] , Other[null] , identifier[fee] operator[SEP] operator[SEP]
}
|
@Override
public void writeData(PrintWriter out) throws IOException {
// all lines have one rule per line
for (IntDependency dependency : argCounter.keySet()) {
if (dependency.head != wildTW && dependency.arg != wildTW &&
dependency.head.word != -1 && dependency.arg.word != -1) {
double count = argCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.println("BEGIN_STOP");
for (IntDependency dependency : stopCounter.keySet()) {
if (dependency.head.word != -1) {
double count = stopCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.flush();
} | class class_name[name] begin[{]
method[writeData, return_type[void], modifier[public], parameter[out]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=head, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[]), operandr=MemberReference(member=wildTW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[]), operandr=MemberReference(member=wildTW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=dependency.head, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=dependency.arg, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCount, postfix_operators=[], prefix_operators=[], qualifier=argCounter, selectors=[], type_arguments=None), name=count)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=wordIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tagIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=argCounter, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dependency)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntDependency, sub_type=None))), label=None)
call[out.println, parameter[literal["BEGIN_STOP"]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=dependency.head, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCount, postfix_operators=[], prefix_operators=[], qualifier=stopCounter, selectors=[], type_arguments=None), name=count)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=wordIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tagIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=stopCounter, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dependency)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntDependency, sub_type=None))), label=None)
call[out.flush, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[writeData] operator[SEP] identifier[PrintWriter] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[for] operator[SEP] identifier[IntDependency] identifier[dependency] operator[:] identifier[argCounter] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[dependency] operator[SEP] identifier[head] operator[!=] identifier[wildTW] operator[&&] identifier[dependency] operator[SEP] identifier[arg] operator[!=] identifier[wildTW] operator[&&] identifier[dependency] operator[SEP] identifier[head] operator[SEP] identifier[word] operator[!=] operator[-] Other[1] operator[&&] identifier[dependency] operator[SEP] identifier[arg] operator[SEP] identifier[word] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[double] identifier[count] operator[=] identifier[argCounter] operator[SEP] identifier[getCount] operator[SEP] identifier[dependency] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[dependency] operator[SEP] identifier[toString] operator[SEP] identifier[wordIndex] , identifier[tagIndex] operator[SEP] operator[+] literal[String] operator[+] identifier[count] operator[SEP] operator[SEP]
}
}
identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IntDependency] identifier[dependency] operator[:] identifier[stopCounter] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[dependency] operator[SEP] identifier[head] operator[SEP] identifier[word] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[double] identifier[count] operator[=] identifier[stopCounter] operator[SEP] identifier[getCount] operator[SEP] identifier[dependency] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[dependency] operator[SEP] identifier[toString] operator[SEP] identifier[wordIndex] , identifier[tagIndex] operator[SEP] operator[+] literal[String] operator[+] identifier[count] operator[SEP] operator[SEP]
}
}
identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
|
public LinearClassifier<L,F> trainSemiSupGE(GeneralDataset<L, F> labeledDataset, List<? extends Datum<L, F>> unlabeledDataList, List<F> GEFeatures, double convexComboCoeff) {
LogConditionalObjectiveFunction<L, F> objective = new LogConditionalObjectiveFunction<L, F>(labeledDataset, new LogPrior(LogPrior.LogPriorType.NULL));
GeneralizedExpectationObjectiveFunction<L,F> geObjective = new GeneralizedExpectationObjectiveFunction<L,F>(labeledDataset, unlabeledDataList, GEFeatures);
SemiSupervisedLogConditionalObjectiveFunction semiSupObjective = new SemiSupervisedLogConditionalObjectiveFunction(objective, geObjective, null,convexComboCoeff);
double[] initial = objective.initial();
double[] weights = minimizer.minimize(semiSupObjective, TOL, initial);
return new LinearClassifier<L, F>(objective.to2D(weights), labeledDataset.featureIndex(), labeledDataset.labelIndex());
} | class class_name[name] begin[{]
method[trainSemiSupGE, return_type[type[LinearClassifier]], modifier[public], parameter[labeledDataset, unlabeledDataList, GEFeatures, convexComboCoeff]] begin[{]
local_variable[type[LogConditionalObjectiveFunction], objective]
local_variable[type[GeneralizedExpectationObjectiveFunction], geObjective]
local_variable[type[SemiSupervisedLogConditionalObjectiveFunction], semiSupObjective]
local_variable[type[double], initial]
local_variable[type[double], weights]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=weights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=to2D, postfix_operators=[], prefix_operators=[], qualifier=objective, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=featureIndex, postfix_operators=[], prefix_operators=[], qualifier=labeledDataset, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=labelIndex, postfix_operators=[], prefix_operators=[], qualifier=labeledDataset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=L, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=F, sub_type=None))], dimensions=None, name=LinearClassifier, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[LinearClassifier] operator[<] identifier[L] , identifier[F] operator[>] identifier[trainSemiSupGE] operator[SEP] identifier[GeneralDataset] operator[<] identifier[L] , identifier[F] operator[>] identifier[labeledDataset] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[Datum] operator[<] identifier[L] , identifier[F] operator[>] operator[>] identifier[unlabeledDataList] , identifier[List] operator[<] identifier[F] operator[>] identifier[GEFeatures] , Keyword[double] identifier[convexComboCoeff] operator[SEP] {
identifier[LogConditionalObjectiveFunction] operator[<] identifier[L] , identifier[F] operator[>] identifier[objective] operator[=] Keyword[new] identifier[LogConditionalObjectiveFunction] operator[<] identifier[L] , identifier[F] operator[>] operator[SEP] identifier[labeledDataset] , Keyword[new] identifier[LogPrior] operator[SEP] identifier[LogPrior] operator[SEP] identifier[LogPriorType] operator[SEP] identifier[NULL] operator[SEP] operator[SEP] operator[SEP] identifier[GeneralizedExpectationObjectiveFunction] operator[<] identifier[L] , identifier[F] operator[>] identifier[geObjective] operator[=] Keyword[new] identifier[GeneralizedExpectationObjectiveFunction] operator[<] identifier[L] , identifier[F] operator[>] operator[SEP] identifier[labeledDataset] , identifier[unlabeledDataList] , identifier[GEFeatures] operator[SEP] operator[SEP] identifier[SemiSupervisedLogConditionalObjectiveFunction] identifier[semiSupObjective] operator[=] Keyword[new] identifier[SemiSupervisedLogConditionalObjectiveFunction] operator[SEP] identifier[objective] , identifier[geObjective] , Other[null] , identifier[convexComboCoeff] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[initial] operator[=] identifier[objective] operator[SEP] identifier[initial] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[weights] operator[=] identifier[minimizer] operator[SEP] identifier[minimize] operator[SEP] identifier[semiSupObjective] , identifier[TOL] , identifier[initial] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LinearClassifier] operator[<] identifier[L] , identifier[F] operator[>] operator[SEP] identifier[objective] operator[SEP] identifier[to2D] operator[SEP] identifier[weights] operator[SEP] , identifier[labeledDataset] operator[SEP] identifier[featureIndex] operator[SEP] operator[SEP] , identifier[labeledDataset] operator[SEP] identifier[labelIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> just(final T item) {
ObjectHelper.requireNonNull(item, "value is null");
return RxJavaPlugins.onAssembly(new SingleJust<T>(item));
} | class class_name[name] begin[{]
method[just, return_type[type[Single]], modifier[public static], parameter[item]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.item], literal["value is null"]]]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[MemberReference(member=item, 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=T, sub_type=None))], dimensions=None, name=SingleJust, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Single] operator[<] identifier[T] operator[>] identifier[just] operator[SEP] Keyword[final] identifier[T] identifier[item] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[item] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[SingleJust] operator[<] identifier[T] operator[>] operator[SEP] identifier[item] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) {
return create(new EstablishedConnection(connection, openHandler));
} | class class_name[name] begin[{]
method[create, return_type[type[ProtocolConnectionManager]], modifier[public static], parameter[connection, openHandler]] begin[{]
return[call[.create, parameter[ClassCreator(arguments=[MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=openHandler, 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=EstablishedConnection, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ProtocolConnectionManager] identifier[create] operator[SEP] Keyword[final] identifier[Connection] identifier[connection] , Keyword[final] identifier[ConnectionOpenHandler] identifier[openHandler] operator[SEP] {
Keyword[return] identifier[create] operator[SEP] Keyword[new] identifier[EstablishedConnection] operator[SEP] identifier[connection] , identifier[openHandler] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Record
fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
Record rec;
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
int length = st.getUInt16();
byte [] data = st.getHex();
if (data == null) {
data = new byte[0];
}
if (length != data.length)
throw st.exception("invalid unknown RR encoding: " +
"length mismatch");
DNSInput in = new DNSInput(data);
return newRecord(name, type, dclass, ttl, length, in);
}
st.unget();
rec = getEmptyRecord(name, type, dclass, ttl, true);
rec.rdataFromString(st, origin);
t = st.get();
if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
throw st.exception("unexpected tokens at end of record");
}
return rec;
} | class class_name[name] begin[{]
method[fromString, return_type[type[Record]], modifier[public static], parameter[name, type, dclass, ttl, st, origin]] begin[{]
local_variable[type[Record], rec]
if[call[name.isAbsolute, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=name, 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=RelativeNameException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Type.check, parameter[member[.type]]]
call[DClass.check, parameter[member[.dclass]]]
call[TTL.check, parameter[member[.ttl]]]
local_variable[type[Tokenizer], t]
if[binary_operation[binary_operation[member[t.type], ==, member[Tokenizer.IDENTIFIER]], &&, call[t.value.equals, parameter[literal["\\#"]]]]] begin[{]
local_variable[type[int], length]
local_variable[type[byte], data]
if[binary_operation[member[.data], ==, literal[null]]] begin[{]
assign[member[.data], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))]
else begin[{]
None
end[}]
if[binary_operation[member[.length], !=, member[data.length]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid unknown RR encoding: "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="length mismatch"), operator=+)], member=exception, postfix_operators=[], prefix_operators=[], qualifier=st, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[DNSInput], in]
return[call[.newRecord, parameter[member[.name], member[.type], member[.dclass], member[.ttl], member[.length], member[.in]]]]
else begin[{]
None
end[}]
call[st.unget, parameter[]]
assign[member[.rec], call[.getEmptyRecord, parameter[member[.name], member[.type], member[.dclass], member[.ttl], literal[true]]]]
call[rec.rdataFromString, parameter[member[.st], member[.origin]]]
assign[member[.t], call[st.get, parameter[]]]
if[binary_operation[binary_operation[member[t.type], !=, member[Tokenizer.EOL]], &&, binary_operation[member[t.type], !=, member[Tokenizer.EOF]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unexpected tokens at end of record")], member=exception, postfix_operators=[], prefix_operators=[], qualifier=st, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
return[member[.rec]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Record] identifier[fromString] operator[SEP] identifier[Name] identifier[name] , Keyword[int] identifier[type] , Keyword[int] identifier[dclass] , Keyword[long] identifier[ttl] , identifier[Tokenizer] identifier[st] , identifier[Name] identifier[origin] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Record] identifier[rec] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[name] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RelativeNameException] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[Type] operator[SEP] identifier[check] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[DClass] operator[SEP] identifier[check] operator[SEP] identifier[dclass] operator[SEP] operator[SEP] identifier[TTL] operator[SEP] identifier[check] operator[SEP] identifier[ttl] operator[SEP] operator[SEP] identifier[Tokenizer] operator[SEP] identifier[Token] identifier[t] operator[=] identifier[st] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[type] operator[==] identifier[Tokenizer] operator[SEP] identifier[IDENTIFIER] operator[&&] identifier[t] operator[SEP] identifier[value] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[st] operator[SEP] identifier[getUInt16] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[st] operator[SEP] identifier[getHex] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[==] Other[null] operator[SEP] {
identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[length] operator[!=] identifier[data] operator[SEP] identifier[length] operator[SEP] Keyword[throw] identifier[st] operator[SEP] identifier[exception] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[DNSInput] identifier[in] operator[=] Keyword[new] identifier[DNSInput] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[return] identifier[newRecord] operator[SEP] identifier[name] , identifier[type] , identifier[dclass] , identifier[ttl] , identifier[length] , identifier[in] operator[SEP] operator[SEP]
}
identifier[st] operator[SEP] identifier[unget] operator[SEP] operator[SEP] operator[SEP] identifier[rec] operator[=] identifier[getEmptyRecord] operator[SEP] identifier[name] , identifier[type] , identifier[dclass] , identifier[ttl] , literal[boolean] operator[SEP] operator[SEP] identifier[rec] operator[SEP] identifier[rdataFromString] operator[SEP] identifier[st] , identifier[origin] operator[SEP] operator[SEP] identifier[t] operator[=] identifier[st] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[type] operator[!=] identifier[Tokenizer] operator[SEP] identifier[EOL] operator[&&] identifier[t] operator[SEP] identifier[type] operator[!=] identifier[Tokenizer] operator[SEP] identifier[EOF] operator[SEP] {
Keyword[throw] identifier[st] operator[SEP] identifier[exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rec] operator[SEP]
}
|
@Override
protected void threadEnd() {
super.threadEnd();
boolean finalStatusSent = ((RuntimePartitionExecution) getRuntimeWorkUnitExecution()).isFinalStatusSent();
if (!finalStatusSent) {
try {
// We only need to send Failed FINAL_STATUS message here if there was an exception and the message was not sent previously
partitionReplyQueue.add(new PartitionReplyMsg(PartitionReplyMsgType.PARTITION_FINAL_STATUS).setBatchStatus(BatchStatus.FAILED).setExitStatus(BatchStatus.FAILED.toString()).setPartitionPlanConfig(partitionPlanConfig));
} catch (Exception e) {
//Just ffdc it.
} finally {
partitionReplyQueue.close();
}
}
} | class class_name[name] begin[{]
method[threadEnd, return_type[void], modifier[protected], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=threadEnd, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[boolean], finalStatusSent]
if[member[.finalStatusSent]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=PARTITION_FINAL_STATUS, postfix_operators=[], prefix_operators=[], qualifier=PartitionReplyMsgType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=FAILED, postfix_operators=[], prefix_operators=[], qualifier=BatchStatus, selectors=[])], member=setBatchStatus, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=BatchStatus.FAILED, selectors=[], type_arguments=None)], member=setExitStatus, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=partitionPlanConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPartitionPlanConfig, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PartitionReplyMsg, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=partitionReplyQueue, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=partitionReplyQueue, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[threadEnd] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[threadEnd] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[finalStatusSent] operator[=] operator[SEP] operator[SEP] identifier[RuntimePartitionExecution] operator[SEP] identifier[getRuntimeWorkUnitExecution] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isFinalStatusSent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[finalStatusSent] operator[SEP] {
Keyword[try] {
identifier[partitionReplyQueue] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[PartitionReplyMsg] operator[SEP] identifier[PartitionReplyMsgType] operator[SEP] identifier[PARTITION_FINAL_STATUS] operator[SEP] operator[SEP] identifier[setBatchStatus] operator[SEP] identifier[BatchStatus] operator[SEP] identifier[FAILED] operator[SEP] operator[SEP] identifier[setExitStatus] operator[SEP] identifier[BatchStatus] operator[SEP] identifier[FAILED] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setPartitionPlanConfig] operator[SEP] identifier[partitionPlanConfig] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
Keyword[finally] {
identifier[partitionReplyQueue] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static void setPropsInYamlFile(final String path, final File flowFile, final Props prop) {
final DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(FlowStyle.BLOCK);
final NodeBean nodeBean = FlowLoaderUtils.setPropsInNodeBean(path, flowFile, prop);
try (final BufferedWriter writer = Files
.newBufferedWriter(flowFile.toPath(), StandardCharsets.UTF_8)) {
new Yaml(options).dump(nodeBean, writer);
} catch (final IOException e) {
throw new ProjectManagerException(
"Failed to set properties in flow file " + flowFile.getName());
}
} | class class_name[name] begin[{]
method[setPropsInYamlFile, return_type[void], modifier[public static], parameter[path, flowFile, prop]] begin[{]
local_variable[type[DumperOptions], options]
call[options.setDefaultFlowStyle, parameter[member[FlowStyle.BLOCK]]]
local_variable[type[NodeBean], nodeBean]
TryStatement(block=[StatementExpression(expression=ClassCreator(arguments=[MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=nodeBean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=dump, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Yaml, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to set properties in flow file "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=flowFile, 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=ProjectManagerException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers={'final'}, name=writer, type=ReferenceType(arguments=None, dimensions=[], name=BufferedWriter, sub_type=None), value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toPath, postfix_operators=[], prefix_operators=[], qualifier=flowFile, selectors=[], type_arguments=None), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=newBufferedWriter, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setPropsInYamlFile] operator[SEP] Keyword[final] identifier[String] identifier[path] , Keyword[final] identifier[File] identifier[flowFile] , Keyword[final] identifier[Props] identifier[prop] operator[SEP] {
Keyword[final] identifier[DumperOptions] identifier[options] operator[=] Keyword[new] identifier[DumperOptions] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[setDefaultFlowStyle] operator[SEP] identifier[FlowStyle] operator[SEP] identifier[BLOCK] operator[SEP] operator[SEP] Keyword[final] identifier[NodeBean] identifier[nodeBean] operator[=] identifier[FlowLoaderUtils] operator[SEP] identifier[setPropsInNodeBean] operator[SEP] identifier[path] , identifier[flowFile] , identifier[prop] operator[SEP] operator[SEP] Keyword[try] operator[SEP] Keyword[final] identifier[BufferedWriter] identifier[writer] operator[=] identifier[Files] operator[SEP] identifier[newBufferedWriter] operator[SEP] identifier[flowFile] operator[SEP] identifier[toPath] operator[SEP] operator[SEP] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] {
Keyword[new] identifier[Yaml] operator[SEP] identifier[options] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[nodeBean] , identifier[writer] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ProjectManagerException] operator[SEP] literal[String] operator[+] identifier[flowFile] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Scriptable newArray(Scriptable scope, Object[] elements)
{
if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)
throw new IllegalArgumentException();
NativeArray result = new NativeArray(elements);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
} | class class_name[name] begin[{]
method[newArray, return_type[type[Scriptable]], modifier[public], parameter[scope, elements]] begin[{]
if[binary_operation[call[elements.getClass, parameter[]], !=, member[ScriptRuntime.ObjectClass]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[NativeArray], result]
call[ScriptRuntime.setBuiltinProtoAndParent, parameter[member[.result], member[.scope], member[TopLevel.Builtins.Array]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Scriptable] identifier[newArray] operator[SEP] identifier[Scriptable] identifier[scope] , identifier[Object] operator[SEP] operator[SEP] identifier[elements] operator[SEP] {
Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[!=] identifier[ScriptRuntime] operator[SEP] identifier[ObjectClass] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] identifier[NativeArray] identifier[result] operator[=] Keyword[new] identifier[NativeArray] operator[SEP] identifier[elements] operator[SEP] operator[SEP] identifier[ScriptRuntime] operator[SEP] identifier[setBuiltinProtoAndParent] operator[SEP] identifier[result] , identifier[scope] , identifier[TopLevel] operator[SEP] identifier[Builtins] operator[SEP] identifier[Array] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void initialize(String title) {
frame = new JFrame(title);
frame.setBounds(100, 100, 814, 669);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout(0, 0));
JToolBar toolBar = new JToolBar();
frame.getContentPane().add(toolBar, BorderLayout.NORTH);
UIAction newAction = new UIAction(ActionNames.NEW_GAME);
JButton btnNewGame = new JButton(newAction);
btnNewGame.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl N"),
ActionNames.NEW_GAME);
btnNewGame.getActionMap().put(ActionNames.NEW_GAME, newAction);
toolBar.add(btnNewGame);
reloadAction = new UIAction(ActionNames.RELOAD);
JButton btnReload = new JButton(reloadAction);
btnReload.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F5"), ActionNames.RELOAD);
btnReload.getActionMap().put(ActionNames.RELOAD, reloadAction);
toolBar.add(btnReload);
toolBar.addSeparator();
startAction = new UIAction(ActionNames.START);
JToggleButton tglbtnStart = new JToggleButton(startAction);
toolBar.add(tglbtnStart);
speedSlider = new JSlider();
speedSlider.setInverted(true);
speedSlider.setMinimum(MasterClock.MIN_PERIOD);
speedSlider.setMaximum(700);
speedSlider.setEnabled(false);
speedSlider.setMaximumSize(new Dimension(100, 16));
speedSlider.addChangeListener(controller);
toolBar.add(speedSlider);
stepAction = new UIAction(ActionNames.STEP);
JButton btnStep = new JButton(stepAction);
btnStep.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F10"), ActionNames.STEP);
btnStep.getActionMap().put(ActionNames.STEP, stepAction);
toolBar.add(btnStep);
JPanel mainPanel = new JPanel();
frame.getContentPane().add(mainPanel, BorderLayout.CENTER);
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
board = new BoardPanel(this);
mainPanel.add(board);
board.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 0), new BevelBorder(BevelBorder.RAISED, null,
null, null, null)));
JPanel rightPanel = new JPanel();
rightPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
rightPanel.setPreferredSize(new Dimension(196, 32767));
rightPanel.setMinimumSize(new Dimension(300, 300));
rightPanel.setMaximumSize(new Dimension(500, 32767));
mainPanel.add(rightPanel);
rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS));
JLabel lblTeams = new JLabel("Teams");
lblTeams.setAlignmentX(Component.CENTER_ALIGNMENT);
rightPanel.add(lblTeams);
table = new JTable();
teamsTableRenderer = new TeamsTableRenderer(this);
teamsTableRenderer.setDisableSelection(true);
table.setDefaultRenderer(Object.class, teamsTableRenderer);
tableModel = new DefaultTableModel(0, 2);
table.setModel(tableModel);
table.getColumnModel().getColumn(1).setMaxWidth(30);
table.setShowVerticalLines(false);
rightPanel.add(table);
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[private], parameter[title]] begin[{]
assign[member[.frame], ClassCreator(arguments=[MemberReference(member=title, 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=JFrame, sub_type=None))]
call[frame.setBounds, parameter[literal[100], literal[100], literal[814], literal[669]]]
call[frame.setDefaultCloseOperation, parameter[member[JFrame.EXIT_ON_CLOSE]]]
call[frame.getContentPane, parameter[]]
local_variable[type[JToolBar], toolBar]
call[frame.getContentPane, parameter[]]
local_variable[type[UIAction], newAction]
local_variable[type[JButton], btnNewGame]
call[btnNewGame.getInputMap, parameter[member[JComponent.WHEN_IN_FOCUSED_WINDOW]]]
call[btnNewGame.getActionMap, parameter[]]
call[toolBar.add, parameter[member[.btnNewGame]]]
assign[member[.reloadAction], ClassCreator(arguments=[MemberReference(member=RELOAD, postfix_operators=[], prefix_operators=[], qualifier=ActionNames, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UIAction, sub_type=None))]
local_variable[type[JButton], btnReload]
call[btnReload.getInputMap, parameter[member[JComponent.WHEN_IN_FOCUSED_WINDOW]]]
call[btnReload.getActionMap, parameter[]]
call[toolBar.add, parameter[member[.btnReload]]]
call[toolBar.addSeparator, parameter[]]
assign[member[.startAction], ClassCreator(arguments=[MemberReference(member=START, postfix_operators=[], prefix_operators=[], qualifier=ActionNames, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UIAction, sub_type=None))]
local_variable[type[JToggleButton], tglbtnStart]
call[toolBar.add, parameter[member[.tglbtnStart]]]
assign[member[.speedSlider], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSlider, sub_type=None))]
call[speedSlider.setInverted, parameter[literal[true]]]
call[speedSlider.setMinimum, parameter[member[MasterClock.MIN_PERIOD]]]
call[speedSlider.setMaximum, parameter[literal[700]]]
call[speedSlider.setEnabled, parameter[literal[false]]]
call[speedSlider.setMaximumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
call[speedSlider.addChangeListener, parameter[member[.controller]]]
call[toolBar.add, parameter[member[.speedSlider]]]
assign[member[.stepAction], ClassCreator(arguments=[MemberReference(member=STEP, postfix_operators=[], prefix_operators=[], qualifier=ActionNames, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UIAction, sub_type=None))]
local_variable[type[JButton], btnStep]
call[btnStep.getInputMap, parameter[member[JComponent.WHEN_IN_FOCUSED_WINDOW]]]
call[btnStep.getActionMap, parameter[]]
call[toolBar.add, parameter[member[.btnStep]]]
local_variable[type[JPanel], mainPanel]
call[frame.getContentPane, parameter[]]
call[mainPanel.setLayout, parameter[ClassCreator(arguments=[MemberReference(member=mainPanel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=X_AXIS, postfix_operators=[], prefix_operators=[], qualifier=BoxLayout, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BoxLayout, sub_type=None))]]
assign[member[.board], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BoardPanel, sub_type=None))]
call[mainPanel.add, parameter[member[.board]]]
call[board.setBorder, parameter[ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), 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=EmptyBorder, sub_type=None)), ClassCreator(arguments=[MemberReference(member=RAISED, postfix_operators=[], prefix_operators=[], qualifier=BevelBorder, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BevelBorder, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CompoundBorder, sub_type=None))]]
local_variable[type[JPanel], rightPanel]
call[rightPanel.setBorder, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EmptyBorder, sub_type=None))]]
call[rightPanel.setPreferredSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=196), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32767)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
call[rightPanel.setMinimumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=300), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=300)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
call[rightPanel.setMaximumSize, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32767)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
call[mainPanel.add, parameter[member[.rightPanel]]]
call[rightPanel.setLayout, parameter[ClassCreator(arguments=[MemberReference(member=rightPanel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PAGE_AXIS, postfix_operators=[], prefix_operators=[], qualifier=BoxLayout, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BoxLayout, sub_type=None))]]
local_variable[type[JLabel], lblTeams]
call[lblTeams.setAlignmentX, parameter[member[Component.CENTER_ALIGNMENT]]]
call[rightPanel.add, parameter[member[.lblTeams]]]
assign[member[.table], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JTable, sub_type=None))]
assign[member[.teamsTableRenderer], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TeamsTableRenderer, sub_type=None))]
call[teamsTableRenderer.setDisableSelection, parameter[literal[true]]]
call[table.setDefaultRenderer, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), member[.teamsTableRenderer]]]
assign[member[.tableModel], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), 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=DefaultTableModel, sub_type=None))]
call[table.setModel, parameter[member[.tableModel]]]
call[table.getColumnModel, parameter[]]
call[table.setShowVerticalLines, parameter[literal[false]]]
call[rightPanel.add, parameter[member[.table]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initialize] operator[SEP] identifier[String] identifier[title] operator[SEP] {
identifier[frame] operator[=] Keyword[new] identifier[JFrame] operator[SEP] identifier[title] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[setBounds] operator[SEP] Other[100] , Other[100] , Other[814] , Other[669] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[setDefaultCloseOperation] operator[SEP] identifier[JFrame] operator[SEP] identifier[EXIT_ON_CLOSE] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[getContentPane] operator[SEP] operator[SEP] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[BorderLayout] operator[SEP] Other[0] , Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[JToolBar] identifier[toolBar] operator[=] Keyword[new] identifier[JToolBar] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[getContentPane] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[toolBar] , identifier[BorderLayout] operator[SEP] identifier[NORTH] operator[SEP] operator[SEP] identifier[UIAction] identifier[newAction] operator[=] Keyword[new] identifier[UIAction] operator[SEP] identifier[ActionNames] operator[SEP] identifier[NEW_GAME] operator[SEP] operator[SEP] identifier[JButton] identifier[btnNewGame] operator[=] Keyword[new] identifier[JButton] operator[SEP] identifier[newAction] operator[SEP] operator[SEP] identifier[btnNewGame] operator[SEP] identifier[getInputMap] operator[SEP] identifier[JComponent] operator[SEP] identifier[WHEN_IN_FOCUSED_WINDOW] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[KeyStroke] operator[SEP] identifier[getKeyStroke] operator[SEP] literal[String] operator[SEP] , identifier[ActionNames] operator[SEP] identifier[NEW_GAME] operator[SEP] operator[SEP] identifier[btnNewGame] operator[SEP] identifier[getActionMap] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ActionNames] operator[SEP] identifier[NEW_GAME] , identifier[newAction] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[add] operator[SEP] identifier[btnNewGame] operator[SEP] operator[SEP] identifier[reloadAction] operator[=] Keyword[new] identifier[UIAction] operator[SEP] identifier[ActionNames] operator[SEP] identifier[RELOAD] operator[SEP] operator[SEP] identifier[JButton] identifier[btnReload] operator[=] Keyword[new] identifier[JButton] operator[SEP] identifier[reloadAction] operator[SEP] operator[SEP] identifier[btnReload] operator[SEP] identifier[getInputMap] operator[SEP] identifier[JComponent] operator[SEP] identifier[WHEN_IN_FOCUSED_WINDOW] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[KeyStroke] operator[SEP] identifier[getKeyStroke] operator[SEP] literal[String] operator[SEP] , identifier[ActionNames] operator[SEP] identifier[RELOAD] operator[SEP] operator[SEP] identifier[btnReload] operator[SEP] identifier[getActionMap] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ActionNames] operator[SEP] identifier[RELOAD] , identifier[reloadAction] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[add] operator[SEP] identifier[btnReload] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[addSeparator] operator[SEP] operator[SEP] operator[SEP] identifier[startAction] operator[=] Keyword[new] identifier[UIAction] operator[SEP] identifier[ActionNames] operator[SEP] identifier[START] operator[SEP] operator[SEP] identifier[JToggleButton] identifier[tglbtnStart] operator[=] Keyword[new] identifier[JToggleButton] operator[SEP] identifier[startAction] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[add] operator[SEP] identifier[tglbtnStart] operator[SEP] operator[SEP] identifier[speedSlider] operator[=] Keyword[new] identifier[JSlider] operator[SEP] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[setInverted] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[setMinimum] operator[SEP] identifier[MasterClock] operator[SEP] identifier[MIN_PERIOD] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[setMaximum] operator[SEP] Other[700] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[setMaximumSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] Other[100] , Other[16] operator[SEP] operator[SEP] operator[SEP] identifier[speedSlider] operator[SEP] identifier[addChangeListener] operator[SEP] identifier[controller] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[add] operator[SEP] identifier[speedSlider] operator[SEP] operator[SEP] identifier[stepAction] operator[=] Keyword[new] identifier[UIAction] operator[SEP] identifier[ActionNames] operator[SEP] identifier[STEP] operator[SEP] operator[SEP] identifier[JButton] identifier[btnStep] operator[=] Keyword[new] identifier[JButton] operator[SEP] identifier[stepAction] operator[SEP] operator[SEP] identifier[btnStep] operator[SEP] identifier[getInputMap] operator[SEP] identifier[JComponent] operator[SEP] identifier[WHEN_IN_FOCUSED_WINDOW] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[KeyStroke] operator[SEP] identifier[getKeyStroke] operator[SEP] literal[String] operator[SEP] , identifier[ActionNames] operator[SEP] identifier[STEP] operator[SEP] operator[SEP] identifier[btnStep] operator[SEP] identifier[getActionMap] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ActionNames] operator[SEP] identifier[STEP] , identifier[stepAction] operator[SEP] operator[SEP] identifier[toolBar] operator[SEP] identifier[add] operator[SEP] identifier[btnStep] operator[SEP] operator[SEP] identifier[JPanel] identifier[mainPanel] operator[=] Keyword[new] identifier[JPanel] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[getContentPane] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[mainPanel] , identifier[BorderLayout] operator[SEP] identifier[CENTER] operator[SEP] operator[SEP] identifier[mainPanel] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[BoxLayout] operator[SEP] identifier[mainPanel] , identifier[BoxLayout] operator[SEP] identifier[X_AXIS] operator[SEP] operator[SEP] operator[SEP] identifier[board] operator[=] Keyword[new] identifier[BoardPanel] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[mainPanel] operator[SEP] identifier[add] operator[SEP] identifier[board] operator[SEP] operator[SEP] identifier[board] operator[SEP] identifier[setBorder] operator[SEP] Keyword[new] identifier[CompoundBorder] operator[SEP] Keyword[new] identifier[EmptyBorder] operator[SEP] Other[10] , Other[10] , Other[10] , Other[0] operator[SEP] , Keyword[new] identifier[BevelBorder] operator[SEP] identifier[BevelBorder] operator[SEP] identifier[RAISED] , Other[null] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[JPanel] identifier[rightPanel] operator[=] Keyword[new] identifier[JPanel] operator[SEP] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[setBorder] operator[SEP] Keyword[new] identifier[EmptyBorder] operator[SEP] Other[5] , Other[5] , Other[5] , Other[5] operator[SEP] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] Other[196] , Other[32767] operator[SEP] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] Other[300] , Other[300] operator[SEP] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[setMaximumSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] Other[500] , Other[32767] operator[SEP] operator[SEP] operator[SEP] identifier[mainPanel] operator[SEP] identifier[add] operator[SEP] identifier[rightPanel] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[setLayout] operator[SEP] Keyword[new] identifier[BoxLayout] operator[SEP] identifier[rightPanel] , identifier[BoxLayout] operator[SEP] identifier[PAGE_AXIS] operator[SEP] operator[SEP] operator[SEP] identifier[JLabel] identifier[lblTeams] operator[=] Keyword[new] identifier[JLabel] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[lblTeams] operator[SEP] identifier[setAlignmentX] operator[SEP] identifier[Component] operator[SEP] identifier[CENTER_ALIGNMENT] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[add] operator[SEP] identifier[lblTeams] operator[SEP] operator[SEP] identifier[table] operator[=] Keyword[new] identifier[JTable] operator[SEP] operator[SEP] operator[SEP] identifier[teamsTableRenderer] operator[=] Keyword[new] identifier[TeamsTableRenderer] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[teamsTableRenderer] operator[SEP] identifier[setDisableSelection] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[setDefaultRenderer] operator[SEP] identifier[Object] operator[SEP] Keyword[class] , identifier[teamsTableRenderer] operator[SEP] operator[SEP] identifier[tableModel] operator[=] Keyword[new] identifier[DefaultTableModel] operator[SEP] Other[0] , Other[2] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[setModel] operator[SEP] identifier[tableModel] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[getColumnModel] operator[SEP] operator[SEP] operator[SEP] identifier[getColumn] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[setMaxWidth] operator[SEP] Other[30] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[setShowVerticalLines] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[rightPanel] operator[SEP] identifier[add] operator[SEP] identifier[table] operator[SEP] operator[SEP]
}
|
private static URL findBaseURI(final Element root) {
URL baseURI = null;
final List<Element> linksList = root.getChildren("link", OS_NS);
if (linksList != null) {
for (final Element element : linksList) {
final Element link = element;
if (!root.equals(link.getParent())) {
break;
}
String href = link.getAttribute("href").getValue();
if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
href = resolveURI(null, link, href);
try {
baseURI = new URL(href);
break;
} catch (final MalformedURLException e) {
System.err.println("Base URI is malformed: " + href);
}
}
}
}
return baseURI;
} | class class_name[name] begin[{]
method[findBaseURI, return_type[type[URL]], modifier[private static], parameter[root]] begin[{]
local_variable[type[URL], baseURI]
local_variable[type[List], linksList]
if[binary_operation[member[.linksList], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=link)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=link, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=root, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="href")], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=link, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=href)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="rel"), MemberReference(member=OS_NS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=link, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="rel"), MemberReference(member=OS_NS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAttribute, postfix_operators=[], prefix_operators=[], qualifier=link, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="alternate")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolveURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=baseURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None))), label=None), BreakStatement(goto=None, label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Base URI is malformed: "), operandr=MemberReference(member=href, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=linksList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.baseURI]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[URL] identifier[findBaseURI] operator[SEP] Keyword[final] identifier[Element] identifier[root] operator[SEP] {
identifier[URL] identifier[baseURI] operator[=] Other[null] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Element] operator[>] identifier[linksList] operator[=] identifier[root] operator[SEP] identifier[getChildren] operator[SEP] literal[String] , identifier[OS_NS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[linksList] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Element] identifier[element] operator[:] identifier[linksList] operator[SEP] {
Keyword[final] identifier[Element] identifier[link] operator[=] identifier[element] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[root] operator[SEP] identifier[equals] operator[SEP] identifier[link] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[String] identifier[href] operator[=] identifier[link] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[link] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] , identifier[OS_NS] operator[SEP] operator[==] Other[null] operator[||] identifier[link] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] , identifier[OS_NS] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[href] operator[=] identifier[resolveURI] operator[SEP] Other[null] , identifier[link] , identifier[href] operator[SEP] operator[SEP] Keyword[try] {
identifier[baseURI] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[href] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[MalformedURLException] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[href] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] identifier[baseURI] operator[SEP]
}
|
public static <E extends Number> AbstractGroupExpression<E, E> sum(Expression<E> expression) {
return new GSum<E>(expression);
} | class class_name[name] begin[{]
method[sum, return_type[type[AbstractGroupExpression]], modifier[public static], parameter[expression]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=expression, 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=GSum, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] Keyword[extends] identifier[Number] operator[>] identifier[AbstractGroupExpression] operator[<] identifier[E] , identifier[E] operator[>] identifier[sum] operator[SEP] identifier[Expression] operator[<] identifier[E] operator[>] identifier[expression] operator[SEP] {
Keyword[return] Keyword[new] identifier[GSum] operator[<] identifier[E] operator[>] operator[SEP] identifier[expression] operator[SEP] operator[SEP]
}
|
public Promise<V> in(int seconds) {
final Promise<V> smartFuture = new Promise<V>();
JobsPlugin.executor.schedule(getJobCallingCallable(smartFuture), seconds, TimeUnit.SECONDS);
return smartFuture;
} | class class_name[name] begin[{]
method[in, return_type[type[Promise]], modifier[public], parameter[seconds]] begin[{]
local_variable[type[Promise], smartFuture]
call[JobsPlugin.executor.schedule, parameter[call[.getJobCallingCallable, parameter[member[.smartFuture]]], member[.seconds], member[TimeUnit.SECONDS]]]
return[member[.smartFuture]]
end[}]
END[}] | Keyword[public] identifier[Promise] operator[<] identifier[V] operator[>] identifier[in] operator[SEP] Keyword[int] identifier[seconds] operator[SEP] {
Keyword[final] identifier[Promise] operator[<] identifier[V] operator[>] identifier[smartFuture] operator[=] Keyword[new] identifier[Promise] operator[<] identifier[V] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[JobsPlugin] operator[SEP] identifier[executor] operator[SEP] identifier[schedule] operator[SEP] identifier[getJobCallingCallable] operator[SEP] identifier[smartFuture] operator[SEP] , identifier[seconds] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP] Keyword[return] identifier[smartFuture] operator[SEP]
}
|
public static Optional<HivePartitionDataset> findDataset(String partitionName, List<HivePartitionDataset> datasets) {
for (HivePartitionDataset dataset : datasets) {
if (dataset.datasetURN().equalsIgnoreCase(partitionName)) {
return Optional.fromNullable(dataset);
}
}
log.warn("Unable to find dataset corresponding to " + partitionName);
return Optional.<HivePartitionDataset>absent();
} | class class_name[name] begin[{]
method[findDataset, return_type[type[Optional]], modifier[public static], parameter[partitionName, datasets]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=datasetURN, postfix_operators=[], prefix_operators=[], qualifier=dataset, selectors=[MethodInvocation(arguments=[MemberReference(member=partitionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=dataset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromNullable, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=datasets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=dataset)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HivePartitionDataset, sub_type=None))), label=None)
call[log.warn, parameter[binary_operation[literal["Unable to find dataset corresponding to "], +, member[.partitionName]]]]
return[call[.Optional, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Optional] operator[<] identifier[HivePartitionDataset] operator[>] identifier[findDataset] operator[SEP] identifier[String] identifier[partitionName] , identifier[List] operator[<] identifier[HivePartitionDataset] operator[>] identifier[datasets] operator[SEP] {
Keyword[for] operator[SEP] identifier[HivePartitionDataset] identifier[dataset] operator[:] identifier[datasets] operator[SEP] {
Keyword[if] operator[SEP] identifier[dataset] operator[SEP] identifier[datasetURN] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[partitionName] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[fromNullable] operator[SEP] identifier[dataset] operator[SEP] operator[SEP]
}
}
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[partitionName] operator[SEP] operator[SEP] Keyword[return] identifier[Optional] operator[SEP] operator[<] identifier[HivePartitionDataset] operator[>] identifier[absent] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
Object value = getAsObject(key);
return TypeConverter.toTypeWithDefault(type, value, defaultValue);
} | class class_name[name] begin[{]
method[getAsTypeWithDefault, return_type[type[T]], modifier[public], parameter[type, key, defaultValue]] begin[{]
local_variable[type[Object], value]
return[call[TypeConverter.toTypeWithDefault, parameter[member[.type], member[.value], member[.defaultValue]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getAsTypeWithDefault] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[String] identifier[key] , identifier[T] identifier[defaultValue] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[getAsObject] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[TypeConverter] operator[SEP] identifier[toTypeWithDefault] operator[SEP] identifier[type] , identifier[value] , identifier[defaultValue] operator[SEP] operator[SEP]
}
|
public static <T extends Offset<T>> Ordering<OffsetRange<T>> byEarlierStartEarlierEndOrdering() {
return Ordering.<T>natural().onResultOf(OffsetRange.<T>toStartInclusiveFunction())
.compound(Ordering.<T>natural().onResultOf(OffsetRange.<T>toEndInclusiveFunction()));
} | class class_name[name] begin[{]
method[byEarlierStartEarlierEndOrdering, return_type[type[Ordering]], modifier[public static], parameter[]] begin[{]
return[call[.Ordering, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Offset] operator[<] identifier[T] operator[>] operator[>] identifier[Ordering] operator[<] identifier[OffsetRange] operator[<] identifier[T] operator[>] operator[>] identifier[byEarlierStartEarlierEndOrdering] operator[SEP] operator[SEP] {
Keyword[return] identifier[Ordering] operator[SEP] operator[<] identifier[T] operator[>] identifier[natural] operator[SEP] operator[SEP] operator[SEP] identifier[onResultOf] operator[SEP] identifier[OffsetRange] operator[SEP] operator[<] identifier[T] operator[>] identifier[toStartInclusiveFunction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[compound] operator[SEP] identifier[Ordering] operator[SEP] operator[<] identifier[T] operator[>] identifier[natural] operator[SEP] operator[SEP] operator[SEP] identifier[onResultOf] operator[SEP] identifier[OffsetRange] operator[SEP] operator[<] identifier[T] operator[>] identifier[toEndInclusiveFunction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T fromJson(JsonNode json, Class<T> clazz) {
return fromJson(json, clazz, null);
} | class class_name[name] begin[{]
method[fromJson, return_type[type[T]], modifier[public static], parameter[json, clazz]] begin[{]
return[call[.fromJson, parameter[member[.json], member[.clazz], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[fromJson] operator[SEP] identifier[JsonNode] identifier[json] , identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
Keyword[return] identifier[fromJson] operator[SEP] identifier[json] , identifier[clazz] , Other[null] operator[SEP] operator[SEP]
}
|
public void execute(Runnable task) {
if (stats == null) {
executor.execute(task);
} else {
executor.execute(new MiscTaskStatsCollector(task));
}
} | class class_name[name] begin[{]
method[execute, return_type[void], modifier[public], parameter[task]] begin[{]
if[binary_operation[member[.stats], ==, literal[null]]] begin[{]
call[executor.execute, parameter[member[.task]]]
else begin[{]
call[executor.execute, parameter[ClassCreator(arguments=[MemberReference(member=task, 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=MiscTaskStatsCollector, sub_type=None))]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[execute] operator[SEP] identifier[Runnable] identifier[task] operator[SEP] {
Keyword[if] operator[SEP] identifier[stats] operator[==] Other[null] operator[SEP] {
identifier[executor] operator[SEP] identifier[execute] operator[SEP] identifier[task] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[executor] operator[SEP] identifier[execute] operator[SEP] Keyword[new] identifier[MiscTaskStatsCollector] operator[SEP] identifier[task] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@POST
public JSONObject post(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException {
throw new ServiceException(ServiceException.NOT_ALLOWED, "POST not implemented");
} | class class_name[name] begin[{]
method[post, return_type[type[JSONObject]], modifier[public], parameter[path, content, headers]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=NOT_ALLOWED, postfix_operators=[], prefix_operators=[], qualifier=ServiceException, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="POST not implemented")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[POST] Keyword[public] identifier[JSONObject] identifier[post] operator[SEP] identifier[String] identifier[path] , identifier[JSONObject] identifier[content] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[headers] operator[SEP] Keyword[throws] identifier[ServiceException] , identifier[JSONException] {
Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[ServiceException] operator[SEP] identifier[NOT_ALLOWED] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public boolean has(String name, Scriptable start)
{
return null != slotMap.query(name, 0);
} | class class_name[name] begin[{]
method[has, return_type[type[boolean]], modifier[public], parameter[name, start]] begin[{]
return[binary_operation[literal[null], !=, call[slotMap.query, parameter[member[.name], literal[0]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[has] operator[SEP] identifier[String] identifier[name] , identifier[Scriptable] identifier[start] operator[SEP] {
Keyword[return] Other[null] operator[!=] identifier[slotMap] operator[SEP] identifier[query] operator[SEP] identifier[name] , Other[0] operator[SEP] operator[SEP]
}
|
public java.util.List<String> getSupportedAddonList() {
if (supportedAddonList == null) {
supportedAddonList = new com.amazonaws.internal.SdkInternalList<String>();
}
return supportedAddonList;
} | class class_name[name] begin[{]
method[getSupportedAddonList, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.supportedAddonList], ==, literal[null]]] begin[{]
assign[member[.supportedAddonList], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.supportedAddonList]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[getSupportedAddonList] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[supportedAddonList] operator[==] Other[null] operator[SEP] {
identifier[supportedAddonList] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[supportedAddonList] operator[SEP]
}
|
private void registerEventHandler() {
clearEventHandler();
m_previewRegistration = Event.addNativePreviewHandler(new NativePreviewHandler() {
@SuppressWarnings("synthetic-access")
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (!(m_pointWidget.isAttached())) {
clearEventHandler();
return;
}
NativeEvent nativeEvent = event.getNativeEvent();
if (nativeEvent == null) {
return;
}
int eventType = event.getTypeInt();
switch (eventType) {
case Event.ONMOUSEUP:
clearEventHandler();
save();
break;
case Event.ONMOUSEMOVE:
handleMove(nativeEvent);
break;
default:
break;
}
}
});
} | class class_name[name] begin[{]
method[registerEventHandler, return_type[void], modifier[private], parameter[]] begin[{]
call[.clearEventHandler, parameter[]]
assign[member[.m_previewRegistration], call[Event.addNativePreviewHandler, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="synthetic-access"), name=SuppressWarnings)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isAttached, postfix_operators=[], prefix_operators=['!'], qualifier=m_pointWidget, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearEventHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNativeEvent, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), name=nativeEvent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NativeEvent, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=nativeEvent, 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=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTypeInt, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), name=eventType)], modifiers=set(), type=BasicType(dimensions=[], name=int)), SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=ONMOUSEUP, postfix_operators=[], prefix_operators=[], qualifier=Event, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearEventHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=save, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=ONMOUSEMOVE, postfix_operators=[], prefix_operators=[], qualifier=Event, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nativeEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleMove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MemberReference(member=eventType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=onPreviewNativeEvent, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=NativePreviewEvent, 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=NativePreviewHandler, sub_type=None))]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[registerEventHandler] operator[SEP] operator[SEP] {
identifier[clearEventHandler] operator[SEP] operator[SEP] operator[SEP] identifier[m_previewRegistration] operator[=] identifier[Event] operator[SEP] identifier[addNativePreviewHandler] operator[SEP] Keyword[new] identifier[NativePreviewHandler] operator[SEP] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[onPreviewNativeEvent] operator[SEP] identifier[NativePreviewEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[m_pointWidget] operator[SEP] identifier[isAttached] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[clearEventHandler] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[NativeEvent] identifier[nativeEvent] operator[=] identifier[event] operator[SEP] identifier[getNativeEvent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nativeEvent] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[int] identifier[eventType] operator[=] identifier[event] operator[SEP] identifier[getTypeInt] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[eventType] operator[SEP] {
Keyword[case] identifier[Event] operator[SEP] identifier[ONMOUSEUP] operator[:] identifier[clearEventHandler] operator[SEP] operator[SEP] operator[SEP] identifier[save] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[Event] operator[SEP] identifier[ONMOUSEMOVE] operator[:] identifier[handleMove] operator[SEP] identifier[nativeEvent] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public void marshall(DescribeEffectivePatchesForPatchBaselineRequest describeEffectivePatchesForPatchBaselineRequest, ProtocolMarshaller protocolMarshaller) {
if (describeEffectivePatchesForPatchBaselineRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeEffectivePatchesForPatchBaselineRequest.getBaselineId(), BASELINEID_BINDING);
protocolMarshaller.marshall(describeEffectivePatchesForPatchBaselineRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeEffectivePatchesForPatchBaselineRequest.getNextToken(), NEXTTOKEN_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[describeEffectivePatchesForPatchBaselineRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeEffectivePatchesForPatchBaselineRequest], ==, 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=getBaselineId, postfix_operators=[], prefix_operators=[], qualifier=describeEffectivePatchesForPatchBaselineRequest, selectors=[], type_arguments=None), MemberReference(member=BASELINEID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMaxResults, postfix_operators=[], prefix_operators=[], qualifier=describeEffectivePatchesForPatchBaselineRequest, selectors=[], type_arguments=None), MemberReference(member=MAXRESULTS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=describeEffectivePatchesForPatchBaselineRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], 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[DescribeEffectivePatchesForPatchBaselineRequest] identifier[describeEffectivePatchesForPatchBaselineRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeEffectivePatchesForPatchBaselineRequest] 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[describeEffectivePatchesForPatchBaselineRequest] operator[SEP] identifier[getBaselineId] operator[SEP] operator[SEP] , identifier[BASELINEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeEffectivePatchesForPatchBaselineRequest] operator[SEP] identifier[getMaxResults] operator[SEP] operator[SEP] , identifier[MAXRESULTS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeEffectivePatchesForPatchBaselineRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static byte[] convertVarIntByteBufferToByteArray(ByteBuffer byteBuffer) {
// get the size
byte originalVarIntSize=byteBuffer.get();
byte varIntSize=getVarIntSize(originalVarIntSize);
// reserveBuffer
byte[] varInt=new byte[varIntSize];
varInt[0]=originalVarIntSize;
byteBuffer.get(varInt,1,varIntSize-1);
return varInt;
} | class class_name[name] begin[{]
method[convertVarIntByteBufferToByteArray, return_type[type[byte]], modifier[public static], parameter[byteBuffer]] begin[{]
local_variable[type[byte], originalVarIntSize]
local_variable[type[byte], varIntSize]
local_variable[type[byte], varInt]
assign[member[.varInt], member[.originalVarIntSize]]
call[byteBuffer.get, parameter[member[.varInt], literal[1], binary_operation[member[.varIntSize], -, literal[1]]]]
return[member[.varInt]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[convertVarIntByteBufferToByteArray] operator[SEP] identifier[ByteBuffer] identifier[byteBuffer] operator[SEP] {
Keyword[byte] identifier[originalVarIntSize] operator[=] identifier[byteBuffer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] identifier[varIntSize] operator[=] identifier[getVarIntSize] operator[SEP] identifier[originalVarIntSize] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[varInt] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[varIntSize] operator[SEP] operator[SEP] identifier[varInt] operator[SEP] Other[0] operator[SEP] operator[=] identifier[originalVarIntSize] operator[SEP] identifier[byteBuffer] operator[SEP] identifier[get] operator[SEP] identifier[varInt] , Other[1] , identifier[varIntSize] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[varInt] operator[SEP]
}
|
public static void convert( ImageBase input , ImageBase output ) {
ImageType typeIn = input.getImageType();
ImageType typeOut = output.getImageType();
if( input instanceof ImageGray) {
ImageGray sb = (ImageGray)input;
if( output instanceof ImageGray) {
if (input.getClass() == output.getClass()) {
output.setTo(input);
} else {
try {
Method m = ConvertImage.class.getMethod("convert", input.getClass(), output.getClass());
m.invoke(null, input, output);
} catch (Exception e) {
throw new IllegalArgumentException("Unknown conversion. "+
input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
}
}
} else if( output instanceof Planar) {
Planar ms = (Planar)output;
for (int i = 0; i < ms.getNumBands(); i++) {
convert(input,ms.getBand(i));
}
} else if( output instanceof ImageInterleaved ) {
ImageInterleaved il = (ImageInterleaved)output;
for (int i = 0; i < il.getNumBands(); i++) {
GImageMiscOps.insertBand(sb, i, il);
}
}
} else if( input instanceof ImageInterleaved && output instanceof ImageInterleaved ) {
if( input.getClass() == output.getClass() ) {
output.setTo(input);
} else {
try {
Method m = ConvertImage.class.getMethod("convert", input.getClass(), output.getClass());
m.invoke(null, input, output);
} catch (Exception e) {
throw new IllegalArgumentException("Unknown conversion. "+
input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
}
}
} else if( input instanceof Planar && output instanceof ImageGray) {
Planar mi = (Planar)input;
ImageGray so = (ImageGray)output;
if( mi.getImageType().getDataType() != so.getDataType() ) {
int w = output.width;
int h = output.height;
ImageGray tmp = GeneralizedImageOps.createSingleBand(mi.getImageType().getDataType(),w,h);
average(mi,tmp);
convert(tmp,so);
} else {
average(mi,so);
}
} else if( input instanceof Planar && output instanceof ImageInterleaved ) {
String functionName;
if( typeIn.getDataType() == typeOut.getDataType()) {
functionName = "convert";
} else {
functionName = "convert"+typeIn.getDataType()+typeOut.getDataType();
}
try {
Method m = ConvertImage.class.getMethod(functionName, input.getClass(), output.getClass());
m.invoke(null, input, output);
} catch (Exception e) {
throw new IllegalArgumentException("Unknown conversion. " +
input.getClass().getSimpleName() + " to " + output.getClass().getSimpleName());
}
} else if( input instanceof Planar && output instanceof Planar) {
Planar mi = (Planar) input;
Planar mo = (Planar) output;
if (mi.getBandType() == mo.getBandType()) {
mo.setTo(mi);
} else {
for (int i = 0; i < mi.getNumBands(); i++) {
convert(mi.getBand(i), mo.getBand(i));
}
}
} else if( input instanceof ImageInterleaved && output instanceof Planar) {
String functionName;
if( typeIn.getDataType() == typeOut.getDataType()) {
functionName = "convert";
} else {
functionName = "convert"+typeIn.getDataType()+typeOut.getDataType();
}
try {
Method m = ConvertImage.class.getMethod(functionName, input.getClass(), output.getClass());
m.invoke(null, input, output);
} catch (Exception e) {
throw new IllegalArgumentException("Unknown conversion. "+
input.getClass().getSimpleName()+" to "+output.getClass().getSimpleName());
}
} else if( input instanceof ImageInterleaved && output instanceof ImageGray) {
ImageInterleaved mb = (ImageInterleaved)input;
ImageGray so = (ImageGray)output;
if( mb.getImageType().getDataType() != so.getDataType() ) {
int w = output.width;
int h = output.height;
ImageGray tmp = GeneralizedImageOps.createSingleBand(mb.getImageType().getDataType(),w,h);
average(mb,tmp);
convert(tmp,so);
} else {
average(mb,so);
}
} else {
String nameInput = input.getClass().getSimpleName();
String nameOutput = output.getClass().getSimpleName();
throw new IllegalArgumentException("Don't know how to convert between input types. "+nameInput+" "+nameOutput);
}
} | class class_name[name] begin[{]
method[convert, return_type[void], modifier[public static], parameter[input, output]] begin[{]
local_variable[type[ImageType], typeIn]
local_variable[type[ImageType], typeOut]
if[binary_operation[member[.input], instanceof, type[ImageGray]]] begin[{]
local_variable[type[ImageGray], sb]
if[binary_operation[member[.output], instanceof, type[ImageGray]]] begin[{]
if[binary_operation[call[input.getClass, parameter[]], ==, call[output.getClass, parameter[]]]] begin[{]
call[output.setTo, parameter[member[.input]]]
else begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="convert"), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConvertImage, sub_type=None)), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown conversion. "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
else begin[{]
if[binary_operation[member[.output], instanceof, type[Planar]]] begin[{]
local_variable[type[Planar], ms]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBand, postfix_operators=[], prefix_operators=[], qualifier=ms, selectors=[], type_arguments=None)], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumBands, postfix_operators=[], prefix_operators=[], qualifier=ms, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
if[binary_operation[member[.output], instanceof, type[ImageInterleaved]]] begin[{]
local_variable[type[ImageInterleaved], il]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=il, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insertBand, postfix_operators=[], prefix_operators=[], qualifier=GImageMiscOps, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumBands, postfix_operators=[], prefix_operators=[], qualifier=il, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[ImageInterleaved]], &&, binary_operation[member[.output], instanceof, type[ImageInterleaved]]]] begin[{]
if[binary_operation[call[input.getClass, parameter[]], ==, call[output.getClass, parameter[]]]] begin[{]
call[output.setTo, parameter[member[.input]]]
else begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="convert"), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConvertImage, sub_type=None)), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown conversion. "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[Planar]], &&, binary_operation[member[.output], instanceof, type[ImageGray]]]] begin[{]
local_variable[type[Planar], mi]
local_variable[type[ImageGray], so]
if[binary_operation[call[mi.getImageType, parameter[]], !=, call[so.getDataType, parameter[]]]] begin[{]
local_variable[type[int], w]
local_variable[type[int], h]
local_variable[type[ImageGray], tmp]
call[.average, parameter[member[.mi], member[.tmp]]]
call[.convert, parameter[member[.tmp], member[.so]]]
else begin[{]
call[.average, parameter[member[.mi], member[.so]]]
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[Planar]], &&, binary_operation[member[.output], instanceof, type[ImageInterleaved]]]] begin[{]
local_variable[type[String], functionName]
if[binary_operation[call[typeIn.getDataType, parameter[]], ==, call[typeOut.getDataType, parameter[]]]] begin[{]
assign[member[.functionName], literal["convert"]]
else begin[{]
assign[member[.functionName], binary_operation[binary_operation[literal["convert"], +, call[typeIn.getDataType, parameter[]]], +, call[typeOut.getDataType, parameter[]]]]
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=functionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConvertImage, sub_type=None)), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown conversion. "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[Planar]], &&, binary_operation[member[.output], instanceof, type[Planar]]]] begin[{]
local_variable[type[Planar], mi]
local_variable[type[Planar], mo]
if[binary_operation[call[mi.getBandType, parameter[]], ==, call[mo.getBandType, parameter[]]]] begin[{]
call[mo.setTo, parameter[member[.mi]]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBand, postfix_operators=[], prefix_operators=[], qualifier=mi, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBand, postfix_operators=[], prefix_operators=[], qualifier=mo, selectors=[], type_arguments=None)], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumBands, postfix_operators=[], prefix_operators=[], qualifier=mi, 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[}]
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[ImageInterleaved]], &&, binary_operation[member[.output], instanceof, type[Planar]]]] begin[{]
local_variable[type[String], functionName]
if[binary_operation[call[typeIn.getDataType, parameter[]], ==, call[typeOut.getDataType, parameter[]]]] begin[{]
assign[member[.functionName], literal["convert"]]
else begin[{]
assign[member[.functionName], binary_operation[binary_operation[literal["convert"], +, call[typeIn.getDataType, parameter[]]], +, call[typeOut.getDataType, parameter[]]]]
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=functionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConvertImage, sub_type=None)), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown conversion. "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[binary_operation[member[.input], instanceof, type[ImageInterleaved]], &&, binary_operation[member[.output], instanceof, type[ImageGray]]]] begin[{]
local_variable[type[ImageInterleaved], mb]
local_variable[type[ImageGray], so]
if[binary_operation[call[mb.getImageType, parameter[]], !=, call[so.getDataType, parameter[]]]] begin[{]
local_variable[type[int], w]
local_variable[type[int], h]
local_variable[type[ImageGray], tmp]
call[.average, parameter[member[.mb], member[.tmp]]]
call[.convert, parameter[member[.tmp], member[.so]]]
else begin[{]
call[.average, parameter[member[.mb], member[.so]]]
end[}]
else begin[{]
local_variable[type[String], nameInput]
local_variable[type[String], nameOutput]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Don't know how to convert between input types. "), operandr=MemberReference(member=nameInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), operandr=MemberReference(member=nameOutput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[convert] operator[SEP] identifier[ImageBase] identifier[input] , identifier[ImageBase] identifier[output] operator[SEP] {
identifier[ImageType] identifier[typeIn] operator[=] identifier[input] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] identifier[ImageType] identifier[typeOut] operator[=] identifier[output] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[ImageGray] operator[SEP] {
identifier[ImageGray] identifier[sb] operator[=] operator[SEP] identifier[ImageGray] operator[SEP] identifier[input] operator[SEP] Keyword[if] operator[SEP] identifier[output] Keyword[instanceof] identifier[ImageGray] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[==] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] {
identifier[output] operator[SEP] identifier[setTo] operator[SEP] identifier[input] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[Method] identifier[m] operator[=] identifier[ConvertImage] operator[SEP] Keyword[class] operator[SEP] identifier[getMethod] operator[SEP] literal[String] , identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[input] , identifier[output] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[output] Keyword[instanceof] identifier[Planar] operator[SEP] {
identifier[Planar] identifier[ms] operator[=] operator[SEP] identifier[Planar] operator[SEP] identifier[output] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ms] operator[SEP] identifier[getNumBands] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[convert] operator[SEP] identifier[input] , identifier[ms] operator[SEP] identifier[getBand] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[output] Keyword[instanceof] identifier[ImageInterleaved] operator[SEP] {
identifier[ImageInterleaved] identifier[il] operator[=] operator[SEP] identifier[ImageInterleaved] operator[SEP] identifier[output] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[il] operator[SEP] identifier[getNumBands] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[GImageMiscOps] operator[SEP] identifier[insertBand] operator[SEP] identifier[sb] , identifier[i] , identifier[il] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[ImageInterleaved] operator[&&] identifier[output] Keyword[instanceof] identifier[ImageInterleaved] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[==] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] {
identifier[output] operator[SEP] identifier[setTo] operator[SEP] identifier[input] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[Method] identifier[m] operator[=] identifier[ConvertImage] operator[SEP] Keyword[class] operator[SEP] identifier[getMethod] operator[SEP] literal[String] , identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[input] , identifier[output] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[Planar] operator[&&] identifier[output] Keyword[instanceof] identifier[ImageGray] operator[SEP] {
identifier[Planar] identifier[mi] operator[=] operator[SEP] identifier[Planar] operator[SEP] identifier[input] operator[SEP] identifier[ImageGray] identifier[so] operator[=] operator[SEP] identifier[ImageGray] operator[SEP] identifier[output] operator[SEP] Keyword[if] operator[SEP] identifier[mi] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[!=] identifier[so] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[w] operator[=] identifier[output] operator[SEP] identifier[width] operator[SEP] Keyword[int] identifier[h] operator[=] identifier[output] operator[SEP] identifier[height] operator[SEP] identifier[ImageGray] identifier[tmp] operator[=] identifier[GeneralizedImageOps] operator[SEP] identifier[createSingleBand] operator[SEP] identifier[mi] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] , identifier[w] , identifier[h] operator[SEP] operator[SEP] identifier[average] operator[SEP] identifier[mi] , identifier[tmp] operator[SEP] operator[SEP] identifier[convert] operator[SEP] identifier[tmp] , identifier[so] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[average] operator[SEP] identifier[mi] , identifier[so] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[Planar] operator[&&] identifier[output] Keyword[instanceof] identifier[ImageInterleaved] operator[SEP] {
identifier[String] identifier[functionName] operator[SEP] Keyword[if] operator[SEP] identifier[typeIn] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[==] identifier[typeOut] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] {
identifier[functionName] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[functionName] operator[=] literal[String] operator[+] identifier[typeIn] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[+] identifier[typeOut] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Method] identifier[m] operator[=] identifier[ConvertImage] operator[SEP] Keyword[class] operator[SEP] identifier[getMethod] operator[SEP] identifier[functionName] , identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[input] , identifier[output] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[Planar] operator[&&] identifier[output] Keyword[instanceof] identifier[Planar] operator[SEP] {
identifier[Planar] identifier[mi] operator[=] operator[SEP] identifier[Planar] operator[SEP] identifier[input] operator[SEP] identifier[Planar] identifier[mo] operator[=] operator[SEP] identifier[Planar] operator[SEP] identifier[output] operator[SEP] Keyword[if] operator[SEP] identifier[mi] operator[SEP] identifier[getBandType] operator[SEP] operator[SEP] operator[==] identifier[mo] operator[SEP] identifier[getBandType] operator[SEP] operator[SEP] operator[SEP] {
identifier[mo] operator[SEP] identifier[setTo] operator[SEP] identifier[mi] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[mi] operator[SEP] identifier[getNumBands] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[convert] operator[SEP] identifier[mi] operator[SEP] identifier[getBand] operator[SEP] identifier[i] operator[SEP] , identifier[mo] operator[SEP] identifier[getBand] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[ImageInterleaved] operator[&&] identifier[output] Keyword[instanceof] identifier[Planar] operator[SEP] {
identifier[String] identifier[functionName] operator[SEP] Keyword[if] operator[SEP] identifier[typeIn] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[==] identifier[typeOut] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] {
identifier[functionName] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[functionName] operator[=] literal[String] operator[+] identifier[typeIn] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[+] identifier[typeOut] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Method] identifier[m] operator[=] identifier[ConvertImage] operator[SEP] Keyword[class] operator[SEP] identifier[getMethod] operator[SEP] identifier[functionName] , identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[input] , identifier[output] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[ImageInterleaved] operator[&&] identifier[output] Keyword[instanceof] identifier[ImageGray] operator[SEP] {
identifier[ImageInterleaved] identifier[mb] operator[=] operator[SEP] identifier[ImageInterleaved] operator[SEP] identifier[input] operator[SEP] identifier[ImageGray] identifier[so] operator[=] operator[SEP] identifier[ImageGray] operator[SEP] identifier[output] operator[SEP] Keyword[if] operator[SEP] identifier[mb] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[!=] identifier[so] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[w] operator[=] identifier[output] operator[SEP] identifier[width] operator[SEP] Keyword[int] identifier[h] operator[=] identifier[output] operator[SEP] identifier[height] operator[SEP] identifier[ImageGray] identifier[tmp] operator[=] identifier[GeneralizedImageOps] operator[SEP] identifier[createSingleBand] operator[SEP] identifier[mb] operator[SEP] identifier[getImageType] operator[SEP] operator[SEP] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] , identifier[w] , identifier[h] operator[SEP] operator[SEP] identifier[average] operator[SEP] identifier[mb] , identifier[tmp] operator[SEP] operator[SEP] identifier[convert] operator[SEP] identifier[tmp] , identifier[so] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[average] operator[SEP] identifier[mb] , identifier[so] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[nameInput] operator[=] identifier[input] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[nameOutput] operator[=] identifier[output] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[nameInput] operator[+] literal[String] operator[+] identifier[nameOutput] operator[SEP] operator[SEP]
}
}
|
@Override
public JSONObject toJSON() throws JSONException {
JSONObject json = super.toJSON();
json.put(JSON_ID, this.mIdentifier);
if (this.mGeometry != null) {
json.put(JSON_GEOMETRY, this.mGeometry.toJSON());
} else {
json.put(JSON_GEOMETRY, JSONObject.NULL);
}
if (this.mProperties != null) {
json.put(JSON_PROPERTIES, this.mProperties);
} else {
json.put(JSON_PROPERTIES, JSONObject.NULL);
}
return json;
} | class class_name[name] begin[{]
method[toJSON, return_type[type[JSONObject]], modifier[public], parameter[]] begin[{]
local_variable[type[JSONObject], json]
call[json.put, parameter[member[.JSON_ID], THIS[member[None.mIdentifier]]]]
if[binary_operation[THIS[member[None.mGeometry]], !=, literal[null]]] begin[{]
call[json.put, parameter[member[.JSON_GEOMETRY], THIS[member[None.mGeometry]call[None.toJSON, parameter[]]]]]
else begin[{]
call[json.put, parameter[member[.JSON_GEOMETRY], member[JSONObject.NULL]]]
end[}]
if[binary_operation[THIS[member[None.mProperties]], !=, literal[null]]] begin[{]
call[json.put, parameter[member[.JSON_PROPERTIES], THIS[member[None.mProperties]]]]
else begin[{]
call[json.put, parameter[member[.JSON_PROPERTIES], member[JSONObject.NULL]]]
end[}]
return[member[.json]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[JSONObject] identifier[toJSON] operator[SEP] operator[SEP] Keyword[throws] identifier[JSONException] {
identifier[JSONObject] identifier[json] operator[=] Keyword[super] operator[SEP] identifier[toJSON] operator[SEP] operator[SEP] operator[SEP] identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[JSON_ID] , Keyword[this] operator[SEP] identifier[mIdentifier] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[mGeometry] operator[!=] Other[null] operator[SEP] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[JSON_GEOMETRY] , Keyword[this] operator[SEP] identifier[mGeometry] operator[SEP] identifier[toJSON] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[JSON_GEOMETRY] , identifier[JSONObject] operator[SEP] identifier[NULL] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[mProperties] operator[!=] Other[null] operator[SEP] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[JSON_PROPERTIES] , Keyword[this] operator[SEP] identifier[mProperties] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[json] operator[SEP] identifier[put] operator[SEP] identifier[JSON_PROPERTIES] , identifier[JSONObject] operator[SEP] identifier[NULL] operator[SEP] operator[SEP]
}
Keyword[return] identifier[json] operator[SEP]
}
|
public void write(final byte pBytes[], final int pOff, final int pLen) throws IOException {
out.write(pBytes, pOff, pLen);
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[pBytes, pOff, pLen]] begin[{]
call[out.write, parameter[member[.pBytes], member[.pOff], member[.pLen]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[write] operator[SEP] Keyword[final] Keyword[byte] identifier[pBytes] operator[SEP] operator[SEP] , Keyword[final] Keyword[int] identifier[pOff] , Keyword[final] Keyword[int] identifier[pLen] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[pBytes] , identifier[pOff] , identifier[pLen] operator[SEP] operator[SEP]
}
|
protected void doResponse(SipServletResponse response)
throws ServletException, IOException {
if(logger.isInfoEnabled()) {
logger.info("SimpleProxyServlet: Got response:\n" + response);
}
if(SipServletResponse.SC_OK == response.getStatus() && "BYE".equalsIgnoreCase(response.getMethod())) {
SipApplicationSession sipApplicationSession = response.getApplicationSession(false);
if(sipApplicationSession != null && sipApplicationSession.isValid()) {
sipApplicationSession.invalidate();
}
}
} | class class_name[name] begin[{]
method[doResponse, return_type[void], modifier[protected], parameter[response]] begin[{]
if[call[logger.isInfoEnabled, parameter[]]] begin[{]
call[logger.info, parameter[binary_operation[literal["SimpleProxyServlet: Got response:\n"], +, member[.response]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[SipServletResponse.SC_OK], ==, call[response.getStatus, parameter[]]], &&, literal["BYE"]]] begin[{]
local_variable[type[SipApplicationSession], sipApplicationSession]
if[binary_operation[binary_operation[member[.sipApplicationSession], !=, literal[null]], &&, call[sipApplicationSession.isValid, parameter[]]]] begin[{]
call[sipApplicationSession.invalidate, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[doResponse] operator[SEP] identifier[SipServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[response] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[SipServletResponse] operator[SEP] identifier[SC_OK] operator[==] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[&&] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[response] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[SipApplicationSession] identifier[sipApplicationSession] operator[=] identifier[response] operator[SEP] identifier[getApplicationSession] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sipApplicationSession] operator[!=] Other[null] operator[&&] identifier[sipApplicationSession] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
identifier[sipApplicationSession] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public String getResolvedValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException {
final String value = getOriginalValue(parsedLine, required);
return resolveValue(value, initialState);
} | class class_name[name] begin[{]
method[getResolvedValue, return_type[type[String]], modifier[public], parameter[parsedLine, required]] begin[{]
local_variable[type[String], value]
return[call[.resolveValue, parameter[member[.value], member[.initialState]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getResolvedValue] operator[SEP] identifier[ParsedCommandLine] identifier[parsedLine] , Keyword[boolean] identifier[required] operator[SEP] Keyword[throws] identifier[CommandFormatException] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[getOriginalValue] operator[SEP] identifier[parsedLine] , identifier[required] operator[SEP] operator[SEP] Keyword[return] identifier[resolveValue] operator[SEP] identifier[value] , identifier[initialState] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XtextPackage.PARSER_RULE__DEFINES_HIDDEN_TOKENS:
setDefinesHiddenTokens((Boolean)newValue);
return;
case XtextPackage.PARSER_RULE__HIDDEN_TOKENS:
getHiddenTokens().clear();
getHiddenTokens().addAll((Collection<? extends AbstractRule>)newValue);
return;
case XtextPackage.PARSER_RULE__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection<? extends Parameter>)newValue);
return;
case XtextPackage.PARSER_RULE__FRAGMENT:
setFragment((Boolean)newValue);
return;
case XtextPackage.PARSER_RULE__WILDCARD:
setWildcard((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=PARSER_RULE__DEFINES_HIDDEN_TOKENS, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], member=setDefinesHiddenTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=PARSER_RULE__HIDDEN_TOKENS, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getHiddenTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getHiddenTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=AbstractRule, sub_type=None))], dimensions=[], name=Collection, sub_type=None))], member=addAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=PARSER_RULE__PARAMETERS, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=Parameter, sub_type=None))], dimensions=[], name=Collection, sub_type=None))], member=addAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=PARSER_RULE__FRAGMENT, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], member=setFragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=PARSER_RULE__WILDCARD, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], member=setWildcard, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[XtextPackage] operator[SEP] identifier[PARSER_RULE__DEFINES_HIDDEN_TOKENS] operator[:] identifier[setDefinesHiddenTokens] operator[SEP] operator[SEP] identifier[Boolean] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[XtextPackage] operator[SEP] identifier[PARSER_RULE__HIDDEN_TOKENS] operator[:] identifier[getHiddenTokens] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[getHiddenTokens] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[AbstractRule] operator[>] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[XtextPackage] operator[SEP] identifier[PARSER_RULE__PARAMETERS] operator[:] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[Parameter] operator[>] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[XtextPackage] operator[SEP] identifier[PARSER_RULE__FRAGMENT] operator[:] identifier[setFragment] operator[SEP] operator[SEP] identifier[Boolean] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[XtextPackage] operator[SEP] identifier[PARSER_RULE__WILDCARD] operator[:] identifier[setWildcard] operator[SEP] operator[SEP] identifier[Boolean] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("rawtypes")
public static void populateArgumentsForCriteria(
PersistentEntity entity,
Query query,
Map argMap,
ConversionService conversionService,
boolean useDefaultMapping) {
Integer maxParam = null;
Integer offsetParam = null;
if (argMap.containsKey(DynamicFinder.ARGUMENT_MAX)) {
maxParam = conversionService.convert(argMap.get(DynamicFinder.ARGUMENT_MAX), Integer.class);
}
if (argMap.containsKey(DynamicFinder.ARGUMENT_OFFSET)) {
offsetParam = conversionService.convert(argMap.get(DynamicFinder.ARGUMENT_OFFSET), Integer.class);
}
if (argMap.containsKey(DynamicFinder.ARGUMENT_FETCH_SIZE)) {
query.setFetchSize(conversionService.convert(argMap.get(DynamicFinder.ARGUMENT_FETCH_SIZE), Integer.class));
}
if (argMap.containsKey(DynamicFinder.ARGUMENT_TIMEOUT)) {
query.setTimeout(conversionService.convert(argMap.get(DynamicFinder.ARGUMENT_TIMEOUT), Integer.class));
}
if (argMap.containsKey(DynamicFinder.ARGUMENT_FLUSH_MODE)) {
query.setHibernateFlushMode(convertFlushMode(argMap.get(DynamicFinder.ARGUMENT_FLUSH_MODE)));
}
if (argMap.containsKey(DynamicFinder.ARGUMENT_READ_ONLY)) {
query.setReadOnly(ClassUtils.getBooleanFromMap(DynamicFinder.ARGUMENT_READ_ONLY, argMap));
}
final int max = maxParam == null ? -1 : maxParam;
final int offset = offsetParam == null ? -1 : offsetParam;
if (max > -1) {
query.setMaxResults(max);
}
if (offset > -1) {
query.setFirstResult(offset);
}
if (ClassUtils.getBooleanFromMap(DynamicFinder.ARGUMENT_LOCK, argMap)) {
query.setLockMode(LockModeType.PESSIMISTIC_WRITE);
query.setCacheable(false);
} else {
if (argMap.containsKey(DynamicFinder.ARGUMENT_CACHE)) {
query.setCacheable(ClassUtils.getBooleanFromMap(DynamicFinder.ARGUMENT_CACHE, argMap));
} else {
cacheCriteriaByMapping(entity.getJavaClass(), query);
}
}
} | class class_name[name] begin[{]
method[populateArgumentsForCriteria, return_type[void], modifier[public static], parameter[entity, query, argMap, conversionService, useDefaultMapping]] begin[{]
local_variable[type[Integer], maxParam]
local_variable[type[Integer], offsetParam]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_MAX]]]] begin[{]
assign[member[.maxParam], call[conversionService.convert, parameter[call[argMap.get, parameter[member[DynamicFinder.ARGUMENT_MAX]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]]]
else begin[{]
None
end[}]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_OFFSET]]]] begin[{]
assign[member[.offsetParam], call[conversionService.convert, parameter[call[argMap.get, parameter[member[DynamicFinder.ARGUMENT_OFFSET]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]]]
else begin[{]
None
end[}]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_FETCH_SIZE]]]] begin[{]
call[query.setFetchSize, parameter[call[conversionService.convert, parameter[call[argMap.get, parameter[member[DynamicFinder.ARGUMENT_FETCH_SIZE]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]]]]
else begin[{]
None
end[}]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_TIMEOUT]]]] begin[{]
call[query.setTimeout, parameter[call[conversionService.convert, parameter[call[argMap.get, parameter[member[DynamicFinder.ARGUMENT_TIMEOUT]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]]]]
else begin[{]
None
end[}]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_FLUSH_MODE]]]] begin[{]
call[query.setHibernateFlushMode, parameter[call[.convertFlushMode, parameter[call[argMap.get, parameter[member[DynamicFinder.ARGUMENT_FLUSH_MODE]]]]]]]
else begin[{]
None
end[}]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_READ_ONLY]]]] begin[{]
call[query.setReadOnly, parameter[call[ClassUtils.getBooleanFromMap, parameter[member[DynamicFinder.ARGUMENT_READ_ONLY], member[.argMap]]]]]
else begin[{]
None
end[}]
local_variable[type[int], max]
local_variable[type[int], offset]
if[binary_operation[member[.max], >, literal[1]]] begin[{]
call[query.setMaxResults, parameter[member[.max]]]
else begin[{]
None
end[}]
if[binary_operation[member[.offset], >, literal[1]]] begin[{]
call[query.setFirstResult, parameter[member[.offset]]]
else begin[{]
None
end[}]
if[call[ClassUtils.getBooleanFromMap, parameter[member[DynamicFinder.ARGUMENT_LOCK], member[.argMap]]]] begin[{]
call[query.setLockMode, parameter[member[LockModeType.PESSIMISTIC_WRITE]]]
call[query.setCacheable, parameter[literal[false]]]
else begin[{]
if[call[argMap.containsKey, parameter[member[DynamicFinder.ARGUMENT_CACHE]]]] begin[{]
call[query.setCacheable, parameter[call[ClassUtils.getBooleanFromMap, parameter[member[DynamicFinder.ARGUMENT_CACHE], member[.argMap]]]]]
else begin[{]
call[.cacheCriteriaByMapping, parameter[call[entity.getJavaClass, parameter[]], member[.query]]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[populateArgumentsForCriteria] operator[SEP] identifier[PersistentEntity] identifier[entity] , identifier[Query] identifier[query] , identifier[Map] identifier[argMap] , identifier[ConversionService] identifier[conversionService] , Keyword[boolean] identifier[useDefaultMapping] operator[SEP] {
identifier[Integer] identifier[maxParam] operator[=] Other[null] operator[SEP] identifier[Integer] identifier[offsetParam] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_MAX] operator[SEP] operator[SEP] {
identifier[maxParam] operator[=] identifier[conversionService] operator[SEP] identifier[convert] operator[SEP] identifier[argMap] operator[SEP] identifier[get] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_MAX] operator[SEP] , identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_OFFSET] operator[SEP] operator[SEP] {
identifier[offsetParam] operator[=] identifier[conversionService] operator[SEP] identifier[convert] operator[SEP] identifier[argMap] operator[SEP] identifier[get] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_OFFSET] operator[SEP] , identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_FETCH_SIZE] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setFetchSize] operator[SEP] identifier[conversionService] operator[SEP] identifier[convert] operator[SEP] identifier[argMap] operator[SEP] identifier[get] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_FETCH_SIZE] operator[SEP] , identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_TIMEOUT] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setTimeout] operator[SEP] identifier[conversionService] operator[SEP] identifier[convert] operator[SEP] identifier[argMap] operator[SEP] identifier[get] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_TIMEOUT] operator[SEP] , identifier[Integer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_FLUSH_MODE] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setHibernateFlushMode] operator[SEP] identifier[convertFlushMode] operator[SEP] identifier[argMap] operator[SEP] identifier[get] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_FLUSH_MODE] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_READ_ONLY] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setReadOnly] operator[SEP] identifier[ClassUtils] operator[SEP] identifier[getBooleanFromMap] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_READ_ONLY] , identifier[argMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[max] operator[=] identifier[maxParam] operator[==] Other[null] operator[?] operator[-] Other[1] operator[:] identifier[maxParam] operator[SEP] Keyword[final] Keyword[int] identifier[offset] operator[=] identifier[offsetParam] operator[==] Other[null] operator[?] operator[-] Other[1] operator[:] identifier[offsetParam] operator[SEP] Keyword[if] operator[SEP] identifier[max] operator[>] operator[-] Other[1] operator[SEP] {
identifier[query] operator[SEP] identifier[setMaxResults] operator[SEP] identifier[max] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[offset] operator[>] operator[-] Other[1] operator[SEP] {
identifier[query] operator[SEP] identifier[setFirstResult] operator[SEP] identifier[offset] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ClassUtils] operator[SEP] identifier[getBooleanFromMap] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_LOCK] , identifier[argMap] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setLockMode] operator[SEP] identifier[LockModeType] operator[SEP] identifier[PESSIMISTIC_WRITE] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setCacheable] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[argMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_CACHE] operator[SEP] operator[SEP] {
identifier[query] operator[SEP] identifier[setCacheable] operator[SEP] identifier[ClassUtils] operator[SEP] identifier[getBooleanFromMap] operator[SEP] identifier[DynamicFinder] operator[SEP] identifier[ARGUMENT_CACHE] , identifier[argMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[cacheCriteriaByMapping] operator[SEP] identifier[entity] operator[SEP] identifier[getJavaClass] operator[SEP] operator[SEP] , identifier[query] operator[SEP] operator[SEP]
}
}
}
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
public static boolean hasUsbAccessoryFeature(PackageManager manager) {
return manager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY);
} | class class_name[name] begin[{]
method[hasUsbAccessoryFeature, return_type[type[boolean]], modifier[public static], parameter[manager]] begin[{]
return[call[manager.hasSystemFeature, parameter[member[PackageManager.FEATURE_USB_ACCESSORY]]]]
end[}]
END[}] | annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[HONEYCOMB_MR1] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[hasUsbAccessoryFeature] operator[SEP] identifier[PackageManager] identifier[manager] operator[SEP] {
Keyword[return] identifier[manager] operator[SEP] identifier[hasSystemFeature] operator[SEP] identifier[PackageManager] operator[SEP] identifier[FEATURE_USB_ACCESSORY] operator[SEP] operator[SEP]
}
|
public Result nextForCodePoint(int cp) {
return cp<=0xffff ?
next(cp) :
(next(UTF16.getLeadSurrogate(cp)).hasNext() ?
next(UTF16.getTrailSurrogate(cp)) :
Result.NO_MATCH);
} | class class_name[name] begin[{]
method[nextForCodePoint, return_type[type[Result]], modifier[public], parameter[cp]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xffff), operator=<=), if_false=TernaryExpression(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLeadSurrogate, postfix_operators=[], prefix_operators=[], qualifier=UTF16, selectors=[], type_arguments=None)], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=hasNext, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=MemberReference(member=NO_MATCH, postfix_operators=[], prefix_operators=[], qualifier=Result, selectors=[]), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTrailSurrogate, postfix_operators=[], prefix_operators=[], qualifier=UTF16, selectors=[], type_arguments=None)], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), if_true=MethodInvocation(arguments=[MemberReference(member=cp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[Result] identifier[nextForCodePoint] operator[SEP] Keyword[int] identifier[cp] operator[SEP] {
Keyword[return] identifier[cp] operator[<=] literal[Integer] operator[?] identifier[next] operator[SEP] identifier[cp] operator[SEP] operator[:] operator[SEP] identifier[next] operator[SEP] identifier[UTF16] operator[SEP] identifier[getLeadSurrogate] operator[SEP] identifier[cp] operator[SEP] operator[SEP] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[?] identifier[next] operator[SEP] identifier[UTF16] operator[SEP] identifier[getTrailSurrogate] operator[SEP] identifier[cp] operator[SEP] operator[SEP] operator[:] identifier[Result] operator[SEP] identifier[NO_MATCH] operator[SEP] operator[SEP]
}
|
public static java.util.List<com.liferay.commerce.price.list.model.CommercePriceListUserSegmentEntryRel> getCommercePriceListUserSegmentEntryRelsByUuidAndCompanyId(
String uuid, long companyId) {
return getService()
.getCommercePriceListUserSegmentEntryRelsByUuidAndCompanyId(uuid,
companyId);
} | class class_name[name] begin[{]
method[getCommercePriceListUserSegmentEntryRelsByUuidAndCompanyId, return_type[type[java]], modifier[public static], parameter[uuid, companyId]] begin[{]
return[call[.getService, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[price] operator[SEP] identifier[list] operator[SEP] identifier[model] operator[SEP] identifier[CommercePriceListUserSegmentEntryRel] operator[>] identifier[getCommercePriceListUserSegmentEntryRelsByUuidAndCompanyId] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[companyId] operator[SEP] {
Keyword[return] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[getCommercePriceListUserSegmentEntryRelsByUuidAndCompanyId] operator[SEP] identifier[uuid] , identifier[companyId] operator[SEP] operator[SEP]
}
|
public NodeDefinitionData[] readNodeDefinitions(NodeData nodeData) throws NodeTypeReadException, RepositoryException
{
InternalQName name = null;
List<NodeDefinitionData> nodeDefinitionDataList;
List<NodeData> childDefinitions = dataManager.getChildNodesData(nodeData);
if (childDefinitions.size() > 0)
name = readMandatoryName(nodeData, null, Constants.JCR_NODETYPENAME);
else
return new NodeDefinitionData[0];
nodeDefinitionDataList = new ArrayList<NodeDefinitionData>();
for (NodeData childDefinition : childDefinitions)
{
if (Constants.NT_CHILDNODEDEFINITION.equals(childDefinition.getPrimaryTypeName()))
{
nodeDefinitionDataList.add(nodeDefinitionAccessProvider.read(childDefinition, name));
}
}
return nodeDefinitionDataList.toArray(new NodeDefinitionData[nodeDefinitionDataList.size()]);
} | class class_name[name] begin[{]
method[readNodeDefinitions, return_type[type[NodeDefinitionData]], modifier[public], parameter[nodeData]] begin[{]
local_variable[type[InternalQName], name]
local_variable[type[List], nodeDefinitionDataList]
local_variable[type[List], childDefinitions]
if[binary_operation[call[childDefinitions.size, parameter[]], >, literal[0]]] begin[{]
assign[member[.name], call[.readMandatoryName, parameter[member[.nodeData], literal[null], member[Constants.JCR_NODETYPENAME]]]]
else begin[{]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NodeDefinitionData, sub_type=None))]
end[}]
assign[member[.nodeDefinitionDataList], 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=NodeDefinitionData, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPrimaryTypeName, postfix_operators=[], prefix_operators=[], qualifier=childDefinition, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Constants.NT_CHILDNODEDEFINITION, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=childDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=nodeDefinitionAccessProvider, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=nodeDefinitionDataList, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=childDefinitions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=childDefinition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeData, sub_type=None))), label=None)
return[call[nodeDefinitionDataList.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=nodeDefinitionDataList, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NodeDefinitionData, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[NodeDefinitionData] operator[SEP] operator[SEP] identifier[readNodeDefinitions] operator[SEP] identifier[NodeData] identifier[nodeData] operator[SEP] Keyword[throws] identifier[NodeTypeReadException] , identifier[RepositoryException] {
identifier[InternalQName] identifier[name] operator[=] Other[null] operator[SEP] identifier[List] operator[<] identifier[NodeDefinitionData] operator[>] identifier[nodeDefinitionDataList] operator[SEP] identifier[List] operator[<] identifier[NodeData] operator[>] identifier[childDefinitions] operator[=] identifier[dataManager] operator[SEP] identifier[getChildNodesData] operator[SEP] identifier[nodeData] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childDefinitions] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[name] operator[=] identifier[readMandatoryName] operator[SEP] identifier[nodeData] , Other[null] , identifier[Constants] operator[SEP] identifier[JCR_NODETYPENAME] operator[SEP] operator[SEP] Keyword[else] Keyword[return] Keyword[new] identifier[NodeDefinitionData] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[nodeDefinitionDataList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[NodeDefinitionData] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[NodeData] identifier[childDefinition] operator[:] identifier[childDefinitions] operator[SEP] {
Keyword[if] operator[SEP] identifier[Constants] operator[SEP] identifier[NT_CHILDNODEDEFINITION] operator[SEP] identifier[equals] operator[SEP] identifier[childDefinition] operator[SEP] identifier[getPrimaryTypeName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[nodeDefinitionDataList] operator[SEP] identifier[add] operator[SEP] identifier[nodeDefinitionAccessProvider] operator[SEP] identifier[read] operator[SEP] identifier[childDefinition] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[nodeDefinitionDataList] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[NodeDefinitionData] operator[SEP] identifier[nodeDefinitionDataList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static DMatrixRMaj inducedHomography13( TrifocalTensor tensor ,
Vector3D_F64 line2 ,
DMatrixRMaj output ) {
if( output == null )
output = new DMatrixRMaj(3,3);
DMatrixRMaj T = tensor.T1;
// H(:,0) = transpose(T1)*line
output.data[0] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z;
output.data[3] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z;
output.data[6] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z;
// H(:,1) = transpose(T2)*line
T = tensor.T2;
output.data[1] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z;
output.data[4] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z;
output.data[7] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z;
// H(:,2) = transpose(T3)*line
T = tensor.T3;
output.data[2] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z;
output.data[5] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z;
output.data[8] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z;
// Vector3D_F64 temp = new Vector3D_F64();
//
// for( int i = 0; i < 3; i++ ) {
// GeometryMath_F64.multTran(tensor.getT(i),line,temp);
// output.unsafe_set(0,i,temp.x);
// output.unsafe_set(1,i,temp.y);
// output.unsafe_set(2,i,temp.z);
// }
return output;
} | class class_name[name] begin[{]
method[inducedHomography13, return_type[type[DMatrixRMaj]], modifier[public static], parameter[tensor, line2, output]] begin[{]
if[binary_operation[member[.output], ==, literal[null]]] begin[{]
assign[member[.output], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DMatrixRMaj, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[DMatrixRMaj], T]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[.T], member[tensor.T2]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[.T], member[tensor.T3]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
assign[member[output.data], binary_operation[binary_operation[binary_operation[member[T.data], *, member[line2.x]], +, binary_operation[member[T.data], *, member[line2.y]]], +, binary_operation[member[T.data], *, member[line2.z]]]]
return[member[.output]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DMatrixRMaj] identifier[inducedHomography13] operator[SEP] identifier[TrifocalTensor] identifier[tensor] , identifier[Vector3D_F64] identifier[line2] , identifier[DMatrixRMaj] identifier[output] operator[SEP] {
Keyword[if] operator[SEP] identifier[output] operator[==] Other[null] operator[SEP] identifier[output] operator[=] Keyword[new] identifier[DMatrixRMaj] operator[SEP] Other[3] , Other[3] operator[SEP] operator[SEP] identifier[DMatrixRMaj] identifier[T] operator[=] identifier[tensor] operator[SEP] identifier[T1] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[0] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[0] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[3] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[6] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[3] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[1] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[4] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[7] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[6] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[2] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[5] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[8] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[T] operator[=] identifier[tensor] operator[SEP] identifier[T2] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[1] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[0] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[3] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[6] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[4] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[1] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[4] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[7] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[7] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[2] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[5] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[8] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[T] operator[=] identifier[tensor] operator[SEP] identifier[T3] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[2] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[0] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[3] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[6] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[5] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[1] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[4] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[7] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] identifier[output] operator[SEP] identifier[data] operator[SEP] Other[8] operator[SEP] operator[=] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[2] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[x] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[5] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[y] operator[+] identifier[T] operator[SEP] identifier[data] operator[SEP] Other[8] operator[SEP] operator[*] identifier[line2] operator[SEP] identifier[z] operator[SEP] Keyword[return] identifier[output] operator[SEP]
}
|
public String getCallBackUrl(ApiImplementor impl, String site) {
String url = site + CALL_BACK_URL + random.nextLong();
this.callBacks.put(url, impl);
logger.debug("Callback " + url + " registered for " + impl.getClass().getCanonicalName());
return url;
} | class class_name[name] begin[{]
method[getCallBackUrl, return_type[type[String]], modifier[public], parameter[impl, site]] begin[{]
local_variable[type[String], url]
THIS[member[None.callBacks]call[None.put, parameter[member[.url], member[.impl]]]]
call[logger.debug, parameter[binary_operation[binary_operation[binary_operation[literal["Callback "], +, member[.url]], +, literal[" registered for "]], +, call[impl.getClass, parameter[]]]]]
return[member[.url]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getCallBackUrl] operator[SEP] identifier[ApiImplementor] identifier[impl] , identifier[String] identifier[site] operator[SEP] {
identifier[String] identifier[url] operator[=] identifier[site] operator[+] identifier[CALL_BACK_URL] operator[+] identifier[random] operator[SEP] identifier[nextLong] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[callBacks] operator[SEP] identifier[put] operator[SEP] identifier[url] , identifier[impl] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[url] operator[+] literal[String] operator[+] identifier[impl] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[url] operator[SEP]
}
|
protected Properties getAdapterArchives() {
SortedProperties result = new SortedProperties();
List<Adapter> adapters = getAdapterServices();
String key;
for (Adapter adapter : adapters) {
String serviceKey = "adapter[" + adapter.getName() + "]";
/// "ServiceType" complexType
// enabled
key = serviceKey + "/enabled";
result.setProperty(key, adapter.isEnabled());
// bindings
result.putAll(getBindings(adapter));
// NVPairs
result.putAll(getNVPairs(adapter));
// failureCount
key = serviceKey + "/failureCount";
result.setProperty(key, adapter.getFailureCount());
// failureInterval
key = serviceKey + "/failureInterval";
result.setProperty(key, adapter.getFailureInterval());
// monitor
// plugins
// not supported (too complex)
}
return result;
} | class class_name[name] begin[{]
method[getAdapterArchives, return_type[type[Properties]], modifier[protected], parameter[]] begin[{]
local_variable[type[SortedProperties], result]
local_variable[type[List], adapters]
local_variable[type[String], key]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="adapter["), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+), name=serviceKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=serviceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/enabled"), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=isEnabled, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=adapter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBindings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=putAll, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=adapter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNVPairs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=putAll, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=serviceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/failureCount"), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFailureCount, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=serviceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/failureInterval"), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFailureInterval, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=adapters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=adapter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Adapter, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[protected] identifier[Properties] identifier[getAdapterArchives] operator[SEP] operator[SEP] {
identifier[SortedProperties] identifier[result] operator[=] Keyword[new] identifier[SortedProperties] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Adapter] operator[>] identifier[adapters] operator[=] identifier[getAdapterServices] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[key] operator[SEP] Keyword[for] operator[SEP] identifier[Adapter] identifier[adapter] operator[:] identifier[adapters] operator[SEP] {
identifier[String] identifier[serviceKey] operator[=] literal[String] operator[+] identifier[adapter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[key] operator[=] identifier[serviceKey] operator[+] literal[String] operator[SEP] identifier[result] operator[SEP] identifier[setProperty] operator[SEP] identifier[key] , identifier[adapter] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[putAll] operator[SEP] identifier[getBindings] operator[SEP] identifier[adapter] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[putAll] operator[SEP] identifier[getNVPairs] operator[SEP] identifier[adapter] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[=] identifier[serviceKey] operator[+] literal[String] operator[SEP] identifier[result] operator[SEP] identifier[setProperty] operator[SEP] identifier[key] , identifier[adapter] operator[SEP] identifier[getFailureCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[=] identifier[serviceKey] operator[+] literal[String] operator[SEP] identifier[result] operator[SEP] identifier[setProperty] operator[SEP] identifier[key] , identifier[adapter] operator[SEP] identifier[getFailureInterval] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public <T> T action(EntityTypeActionOperation<T> entityTypeActionOperation)
throws ServiceException {
try {
return service.action(entityTypeActionOperation);
} catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
} catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
} | class class_name[name] begin[{]
method[action, return_type[type[T]], modifier[public], parameter[entityTypeActionOperation]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=entityTypeActionOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=action, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[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=ServiceException, sub_type=None))], member=processCatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UniformInterfaceException'])), CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[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=ServiceException, sub_type=None))], member=processCatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClientHandlerException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[action] operator[SEP] identifier[EntityTypeActionOperation] operator[<] identifier[T] operator[>] identifier[entityTypeActionOperation] operator[SEP] Keyword[throws] identifier[ServiceException] {
Keyword[try] {
Keyword[return] identifier[service] operator[SEP] identifier[action] operator[SEP] identifier[entityTypeActionOperation] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UniformInterfaceException] identifier[e] operator[SEP] {
Keyword[throw] identifier[processCatch] operator[SEP] Keyword[new] identifier[ServiceException] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClientHandlerException] identifier[e] operator[SEP] {
Keyword[throw] identifier[processCatch] operator[SEP] Keyword[new] identifier[ServiceException] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected Map<String, Object> unsetUserRegistry(ServiceReference<UserRegistryService> ref) {
userRegistry.removeReference((String) ref.getProperty(KEY_ID), ref);
userRegistry.removeReference(String.valueOf(ref.getProperty(KEY_SERVICE_ID)), ref);
// determine a new user registry service
userRegistryService.set(null);
return getServiceProperties();
} | class class_name[name] begin[{]
method[unsetUserRegistry, return_type[type[Map]], modifier[protected], parameter[ref]] begin[{]
call[userRegistry.removeReference, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=KEY_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), member[.ref]]]
call[userRegistry.removeReference, parameter[call[String.valueOf, parameter[call[ref.getProperty, parameter[member[.KEY_SERVICE_ID]]]]], member[.ref]]]
call[userRegistryService.set, parameter[literal[null]]]
return[call[.getServiceProperties, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[unsetUserRegistry] operator[SEP] identifier[ServiceReference] operator[<] identifier[UserRegistryService] operator[>] identifier[ref] operator[SEP] {
identifier[userRegistry] operator[SEP] identifier[removeReference] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[ref] operator[SEP] identifier[getProperty] operator[SEP] identifier[KEY_ID] operator[SEP] , identifier[ref] operator[SEP] operator[SEP] identifier[userRegistry] operator[SEP] identifier[removeReference] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[ref] operator[SEP] identifier[getProperty] operator[SEP] identifier[KEY_SERVICE_ID] operator[SEP] operator[SEP] , identifier[ref] operator[SEP] operator[SEP] identifier[userRegistryService] operator[SEP] identifier[set] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[getServiceProperties] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> ObjLongConsumer<T> objLongConsumer(CheckedObjLongConsumer<T> consumer) {
return objLongConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION);
} | class class_name[name] begin[{]
method[objLongConsumer, return_type[type[ObjLongConsumer]], modifier[public static], parameter[consumer]] begin[{]
return[call[.objLongConsumer, parameter[member[.consumer], member[.THROWABLE_TO_RUNTIME_EXCEPTION]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[ObjLongConsumer] operator[<] identifier[T] operator[>] identifier[objLongConsumer] operator[SEP] identifier[CheckedObjLongConsumer] operator[<] identifier[T] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] identifier[objLongConsumer] operator[SEP] identifier[consumer] , identifier[THROWABLE_TO_RUNTIME_EXCEPTION] operator[SEP] operator[SEP]
}
|
protected static void removeViewer(Page page, IHelpViewer viewer, boolean close) {
if (viewer != null && viewer == page.getAttribute(VIEWER_ATTRIB)) {
removeViewer(page, close);
}
} | class class_name[name] begin[{]
method[removeViewer, return_type[void], modifier[static protected], parameter[page, viewer, close]] begin[{]
if[binary_operation[binary_operation[member[.viewer], !=, literal[null]], &&, binary_operation[member[.viewer], ==, call[page.getAttribute, parameter[member[.VIEWER_ATTRIB]]]]]] begin[{]
call[.removeViewer, parameter[member[.page], member[.close]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[void] identifier[removeViewer] operator[SEP] identifier[Page] identifier[page] , identifier[IHelpViewer] identifier[viewer] , Keyword[boolean] identifier[close] operator[SEP] {
Keyword[if] operator[SEP] identifier[viewer] operator[!=] Other[null] operator[&&] identifier[viewer] operator[==] identifier[page] operator[SEP] identifier[getAttribute] operator[SEP] identifier[VIEWER_ATTRIB] operator[SEP] operator[SEP] {
identifier[removeViewer] operator[SEP] identifier[page] , identifier[close] operator[SEP] operator[SEP]
}
}
|
public void marshall(UpdateSamplingRuleRequest updateSamplingRuleRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSamplingRuleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSamplingRuleRequest.getSamplingRuleUpdate(), SAMPLINGRULEUPDATE_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[updateSamplingRuleRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.updateSamplingRuleRequest], ==, 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=getSamplingRuleUpdate, postfix_operators=[], prefix_operators=[], qualifier=updateSamplingRuleRequest, selectors=[], type_arguments=None), MemberReference(member=SAMPLINGRULEUPDATE_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[UpdateSamplingRuleRequest] identifier[updateSamplingRuleRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[updateSamplingRuleRequest] 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[updateSamplingRuleRequest] operator[SEP] identifier[getSamplingRuleUpdate] operator[SEP] operator[SEP] , identifier[SAMPLINGRULEUPDATE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void setEnabled(boolean enabled) {
setEnabled(enabled, ENABLED_MASK);
if (enabled) {
Log parent;
if ((parent = mParent) != null) {
parent.setEnabled(true);
}
}
} | class class_name[name] begin[{]
method[setEnabled, return_type[void], modifier[public], parameter[enabled]] begin[{]
call[.setEnabled, parameter[member[.enabled], member[.ENABLED_MASK]]]
if[member[.enabled]] begin[{]
local_variable[type[Log], parent]
if[binary_operation[assign[member[.parent], member[.mParent]], !=, literal[null]]] begin[{]
call[parent.setEnabled, parameter[literal[true]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setEnabled] operator[SEP] Keyword[boolean] identifier[enabled] operator[SEP] {
identifier[setEnabled] operator[SEP] identifier[enabled] , identifier[ENABLED_MASK] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[enabled] operator[SEP] {
identifier[Log] identifier[parent] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[parent] operator[=] identifier[mParent] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[parent] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AfplibPackage.EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_TYPE:
setResType(RES_TYPE_EDEFAULT);
return;
case AfplibPackage.EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_LID:
setResLID(RES_LID_EDEFAULT);
return;
}
super.eUnset(featureID);
} | class class_name[name] begin[{]
method[eUnset, return_type[void], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_TYPE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=RES_TYPE_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setResType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_LID, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=RES_LID_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setResLID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eUnset, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eUnset] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_TYPE] operator[:] identifier[setResType] operator[SEP] identifier[RES_TYPE_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[EXTENDED_RESOURCE_LOCAL_IDENTIFIER__RES_LID] operator[:] identifier[setResLID] operator[SEP] identifier[RES_LID_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eUnset] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public PathImpl getWritePath()
{
ArrayList<PathImpl> pathList = getPathList();
if (pathList.size() == 0)
return new NotFoundPath(getSchemeMap(), _pathname);
else {
return pathList.get(0);
}
} | class class_name[name] begin[{]
method[getWritePath, return_type[type[PathImpl]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], pathList]
if[binary_operation[call[pathList.size, parameter[]], ==, literal[0]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSchemeMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=_pathname, 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=NotFoundPath, sub_type=None))]
else begin[{]
return[call[pathList.get, parameter[literal[0]]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[PathImpl] identifier[getWritePath] operator[SEP] operator[SEP] {
identifier[ArrayList] operator[<] identifier[PathImpl] operator[>] identifier[pathList] operator[=] identifier[getPathList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pathList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] Keyword[new] identifier[NotFoundPath] operator[SEP] identifier[getSchemeMap] operator[SEP] operator[SEP] , identifier[_pathname] operator[SEP] operator[SEP] Keyword[else] {
Keyword[return] identifier[pathList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
|
public void addStream(Stream stream) {
indexSets.add(stream.getIndexSet());
if (streams.add(stream)) {
sizeCounter.inc(8);
if (LOG.isTraceEnabled()) {
LOG.trace("[Message size update][{}] stream added: {}", getId(), sizeCounter.getCount());
}
}
} | class class_name[name] begin[{]
method[addStream, return_type[void], modifier[public], parameter[stream]] begin[{]
call[indexSets.add, parameter[call[stream.getIndexSet, parameter[]]]]
if[call[streams.add, parameter[member[.stream]]]] begin[{]
call[sizeCounter.inc, parameter[literal[8]]]
if[call[LOG.isTraceEnabled, parameter[]]] begin[{]
call[LOG.trace, parameter[literal["[Message size update][{}] stream added: {}"], call[.getId, parameter[]], call[sizeCounter.getCount, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addStream] operator[SEP] identifier[Stream] identifier[stream] operator[SEP] {
identifier[indexSets] operator[SEP] identifier[add] operator[SEP] identifier[stream] operator[SEP] identifier[getIndexSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[streams] operator[SEP] identifier[add] operator[SEP] identifier[stream] operator[SEP] operator[SEP] {
identifier[sizeCounter] operator[SEP] identifier[inc] operator[SEP] Other[8] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[getId] operator[SEP] operator[SEP] , identifier[sizeCounter] operator[SEP] identifier[getCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public @Nullable io.micronaut.inject.ast.Element visit(
Element element, AnnotationMetadata annotationMetadata) {
if (element instanceof VariableElement) {
final JavaFieldElement e = new JavaFieldElement(
(VariableElement) element,
annotationMetadata,
visitorContext);
visitor.visitField(
e,
visitorContext
);
return e;
} else if (element instanceof ExecutableElement) {
ExecutableElement executableElement = (ExecutableElement) element;
if (executableElement.getSimpleName().toString().equals("<init>")) {
final JavaConstructorElement e = new JavaConstructorElement(
executableElement,
annotationMetadata, visitorContext);
visitor.visitConstructor(
e,
visitorContext
);
return e;
} else {
final JavaMethodElement e = new JavaMethodElement(
executableElement,
annotationMetadata, visitorContext);
visitor.visitMethod(
e,
visitorContext
);
return e;
}
} else if (element instanceof TypeElement) {
TypeElement typeElement = (TypeElement) element;
boolean isEnum = JavaModelUtils.resolveKind(typeElement, ElementKind.ENUM).isPresent();
if (isEnum) {
final JavaEnumElement e = new JavaEnumElement(
typeElement,
annotationMetadata,
visitorContext,
Collections.emptyList());
visitor.visitClass(
e,
visitorContext
);
return e;
} else {
final JavaClassElement e = new JavaClassElement(
typeElement,
annotationMetadata,
visitorContext);
visitor.visitClass(
e,
visitorContext
);
return e;
}
}
return null;
} | class class_name[name] begin[{]
method[visit, return_type[type[io]], modifier[public], parameter[element, annotationMetadata]] begin[{]
if[binary_operation[member[.element], instanceof, type[VariableElement]]] begin[{]
local_variable[type[JavaFieldElement], e]
call[visitor.visitField, parameter[member[.e], member[.visitorContext]]]
return[member[.e]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[ExecutableElement]]] begin[{]
local_variable[type[ExecutableElement], executableElement]
if[call[executableElement.getSimpleName, parameter[]]] begin[{]
local_variable[type[JavaConstructorElement], e]
call[visitor.visitConstructor, parameter[member[.e], member[.visitorContext]]]
return[member[.e]]
else begin[{]
local_variable[type[JavaMethodElement], e]
call[visitor.visitMethod, parameter[member[.e], member[.visitorContext]]]
return[member[.e]]
end[}]
else begin[{]
if[binary_operation[member[.element], instanceof, type[TypeElement]]] begin[{]
local_variable[type[TypeElement], typeElement]
local_variable[type[boolean], isEnum]
if[member[.isEnum]] begin[{]
local_variable[type[JavaEnumElement], e]
call[visitor.visitClass, parameter[member[.e], member[.visitorContext]]]
return[member[.e]]
else begin[{]
local_variable[type[JavaClassElement], e]
call[visitor.visitClass, parameter[member[.e], member[.visitorContext]]]
return[member[.e]]
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] annotation[@] identifier[Nullable] identifier[io] operator[SEP] identifier[micronaut] operator[SEP] identifier[inject] operator[SEP] identifier[ast] operator[SEP] identifier[Element] identifier[visit] operator[SEP] identifier[Element] identifier[element] , identifier[AnnotationMetadata] identifier[annotationMetadata] operator[SEP] {
Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[VariableElement] operator[SEP] {
Keyword[final] identifier[JavaFieldElement] identifier[e] operator[=] Keyword[new] identifier[JavaFieldElement] operator[SEP] operator[SEP] identifier[VariableElement] operator[SEP] identifier[element] , identifier[annotationMetadata] , identifier[visitorContext] operator[SEP] operator[SEP] identifier[visitor] operator[SEP] identifier[visitField] operator[SEP] identifier[e] , identifier[visitorContext] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[ExecutableElement] operator[SEP] {
identifier[ExecutableElement] identifier[executableElement] operator[=] operator[SEP] identifier[ExecutableElement] operator[SEP] identifier[element] operator[SEP] Keyword[if] operator[SEP] identifier[executableElement] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[JavaConstructorElement] identifier[e] operator[=] Keyword[new] identifier[JavaConstructorElement] operator[SEP] identifier[executableElement] , identifier[annotationMetadata] , identifier[visitorContext] operator[SEP] operator[SEP] identifier[visitor] operator[SEP] identifier[visitConstructor] operator[SEP] identifier[e] , identifier[visitorContext] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[JavaMethodElement] identifier[e] operator[=] Keyword[new] identifier[JavaMethodElement] operator[SEP] identifier[executableElement] , identifier[annotationMetadata] , identifier[visitorContext] operator[SEP] operator[SEP] identifier[visitor] operator[SEP] identifier[visitMethod] operator[SEP] identifier[e] , identifier[visitorContext] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[TypeElement] operator[SEP] {
identifier[TypeElement] identifier[typeElement] operator[=] operator[SEP] identifier[TypeElement] operator[SEP] identifier[element] operator[SEP] Keyword[boolean] identifier[isEnum] operator[=] identifier[JavaModelUtils] operator[SEP] identifier[resolveKind] operator[SEP] identifier[typeElement] , identifier[ElementKind] operator[SEP] identifier[ENUM] operator[SEP] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isEnum] operator[SEP] {
Keyword[final] identifier[JavaEnumElement] identifier[e] operator[=] Keyword[new] identifier[JavaEnumElement] operator[SEP] identifier[typeElement] , identifier[annotationMetadata] , identifier[visitorContext] , identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[visitor] operator[SEP] identifier[visitClass] operator[SEP] identifier[e] , identifier[visitorContext] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[JavaClassElement] identifier[e] operator[=] Keyword[new] identifier[JavaClassElement] operator[SEP] identifier[typeElement] , identifier[annotationMetadata] , identifier[visitorContext] operator[SEP] operator[SEP] identifier[visitor] operator[SEP] identifier[visitClass] operator[SEP] identifier[e] , identifier[visitorContext] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
protected Object getCompareValue() {
// Date Compare (Use Date Formatted String - YYYY-MM-DD)
if (trigger instanceof WDateField) {
return value == null ? null : new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(value);
} else if (trigger instanceof WNumberField) { // Number Compare (Use Number Object)
return value;
} else if (trigger instanceof AbstractWSelectList) { // String Compare - List (Use the Option's Code)
final AbstractWSelectList listTrigger = (AbstractWSelectList) trigger;
final List<?> options = listTrigger.getOptions();
// No options, just return the compare value (so that a test against null works correctly)
if (options == null || options.isEmpty()) {
return value == null ? null : value.toString();
}
// Check if the value is a valid option allowing for "Legacy" matching
if (SelectListUtil.containsOptionWithMatching(options, value)) {
Object option = SelectListUtil.getOptionWithMatching(options, value);
String code = listTrigger.optionToCode(option);
return code;
}
// Return the value as a String - Treat empty the same as null
return (value == null || Util.empty(value.toString())) ? null : value.toString();
} else if (trigger instanceof RadioButtonGroup && value instanceof WRadioButton) {
// String Compare for RadioButtonGroup and value is WRadioButton (Use the button value)
// Note - This is only for backward compatibility where projects have used a radio button
// in the trigger. Projects should use the value expected, not the radio button.
// If the radio button passed into the compare is used in a repeater, then this compare will not work.
String data = ((WRadioButton) value).getValue();
// Treat empty the same as null
return Util.empty(data) ? null : data;
} else { // String Compare
// Treat empty the same as null
return (value == null || Util.empty(value.toString())) ? null : value.toString();
}
} | class class_name[name] begin[{]
method[getCompareValue, return_type[type[Object]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.trigger], instanceof, type[WDateField]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=INTERNAL_DATE_FORMAT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SimpleDateFormat, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
else begin[{]
if[binary_operation[member[.trigger], instanceof, type[WNumberField]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.trigger], instanceof, type[AbstractWSelectList]]] begin[{]
local_variable[type[AbstractWSelectList], listTrigger]
local_variable[type[List], options]
if[binary_operation[binary_operation[member[.options], ==, literal[null]], ||, call[options.isEmpty, parameter[]]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
else begin[{]
None
end[}]
if[call[SelectListUtil.containsOptionWithMatching, parameter[member[.options], member[.value]]]] begin[{]
local_variable[type[Object], option]
local_variable[type[String], code]
return[member[.code]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), operator=||), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
else begin[{]
if[binary_operation[binary_operation[member[.trigger], instanceof, type[RadioButtonGroup]], &&, binary_operation[member[.value], instanceof, type[WRadioButton]]]] begin[{]
local_variable[type[String], data]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), if_false=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
else begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), operator=||), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[getCompareValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[trigger] Keyword[instanceof] identifier[WDateField] operator[SEP] {
Keyword[return] identifier[value] operator[==] Other[null] operator[?] Other[null] operator[:] Keyword[new] identifier[SimpleDateFormat] operator[SEP] identifier[INTERNAL_DATE_FORMAT] operator[SEP] operator[SEP] identifier[format] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[trigger] Keyword[instanceof] identifier[WNumberField] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[trigger] Keyword[instanceof] identifier[AbstractWSelectList] operator[SEP] {
Keyword[final] identifier[AbstractWSelectList] identifier[listTrigger] operator[=] operator[SEP] identifier[AbstractWSelectList] operator[SEP] identifier[trigger] operator[SEP] Keyword[final] identifier[List] operator[<] operator[?] operator[>] identifier[options] operator[=] identifier[listTrigger] operator[SEP] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[==] Other[null] operator[||] identifier[options] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[SelectListUtil] operator[SEP] identifier[containsOptionWithMatching] operator[SEP] identifier[options] , identifier[value] operator[SEP] operator[SEP] {
identifier[Object] identifier[option] operator[=] identifier[SelectListUtil] operator[SEP] identifier[getOptionWithMatching] operator[SEP] identifier[options] , identifier[value] operator[SEP] operator[SEP] identifier[String] identifier[code] operator[=] identifier[listTrigger] operator[SEP] identifier[optionToCode] operator[SEP] identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[code] operator[SEP]
}
Keyword[return] operator[SEP] identifier[value] operator[==] Other[null] operator[||] identifier[Util] operator[SEP] identifier[empty] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[?] Other[null] operator[:] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[trigger] Keyword[instanceof] identifier[RadioButtonGroup] operator[&&] identifier[value] Keyword[instanceof] identifier[WRadioButton] operator[SEP] {
identifier[String] identifier[data] operator[=] operator[SEP] operator[SEP] identifier[WRadioButton] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Util] operator[SEP] identifier[empty] operator[SEP] identifier[data] operator[SEP] operator[?] Other[null] operator[:] identifier[data] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP] identifier[value] operator[==] Other[null] operator[||] identifier[Util] operator[SEP] identifier[empty] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[?] Other[null] operator[:] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
if (cache.isEnabled())
{
int childCount = cache.getChildNodesCount(parent);
if (childCount >= 0)
{
return childCount;
}
}
final DataRequest request = new DataRequest(parent.getIdentifier(), DataRequest.GET_NODES);
try
{
request.start();
if (cache.isEnabled())
{
// Try first to get the value from the cache since a
// request could have been launched just before
int childCount = cache.getChildNodesCount(parent);
if (childCount >= 0)
{
return childCount;
}
}
return executeAction(new PrivilegedExceptionAction<Integer>()
{
public Integer run() throws RepositoryException
{
int childCount = CacheableWorkspaceDataManager.super.getChildNodesCount(parent);
if (cache.isEnabled())
{
cache.addChildNodesCount(parent, childCount);
}
return childCount;
}
});
}
finally
{
request.done();
}
} | class class_name[name] begin[{]
method[getChildNodesCount, return_type[type[int]], modifier[public], parameter[parent]] begin[{]
if[call[cache.isEnabled, parameter[]]] begin[{]
local_variable[type[int], childCount]
if[binary_operation[member[.childCount], >=, literal[0]]] begin[{]
return[member[.childCount]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[DataRequest], request]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEnabled, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getChildNodesCount, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), name=childCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=childCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=childCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))])), ReturnStatement(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=CacheableWorkspaceDataManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getChildNodesCount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=childCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[], member=isEnabled, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=childCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChildNodesCount, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=childCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None), throws=['RepositoryException'], 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=Integer, sub_type=None))], dimensions=None, name=PrivilegedExceptionAction, sub_type=None))], member=executeAction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=done, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getChildNodesCount] operator[SEP] Keyword[final] identifier[NodeData] identifier[parent] operator[SEP] Keyword[throws] identifier[RepositoryException] {
Keyword[if] operator[SEP] identifier[cache] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[childCount] operator[=] identifier[cache] operator[SEP] identifier[getChildNodesCount] operator[SEP] identifier[parent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childCount] operator[>=] Other[0] operator[SEP] {
Keyword[return] identifier[childCount] operator[SEP]
}
}
Keyword[final] identifier[DataRequest] identifier[request] operator[=] Keyword[new] identifier[DataRequest] operator[SEP] identifier[parent] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[DataRequest] operator[SEP] identifier[GET_NODES] operator[SEP] operator[SEP] Keyword[try] {
identifier[request] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cache] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[childCount] operator[=] identifier[cache] operator[SEP] identifier[getChildNodesCount] operator[SEP] identifier[parent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childCount] operator[>=] Other[0] operator[SEP] {
Keyword[return] identifier[childCount] operator[SEP]
}
}
Keyword[return] identifier[executeAction] operator[SEP] Keyword[new] identifier[PrivilegedExceptionAction] operator[<] identifier[Integer] operator[>] operator[SEP] operator[SEP] {
Keyword[public] identifier[Integer] identifier[run] operator[SEP] operator[SEP] Keyword[throws] identifier[RepositoryException] {
Keyword[int] identifier[childCount] operator[=] identifier[CacheableWorkspaceDataManager] operator[SEP] Keyword[super] operator[SEP] identifier[getChildNodesCount] operator[SEP] identifier[parent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cache] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[cache] operator[SEP] identifier[addChildNodesCount] operator[SEP] identifier[parent] , identifier[childCount] operator[SEP] operator[SEP]
}
Keyword[return] identifier[childCount] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[request] operator[SEP] identifier[done] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Observable<Page<ControllerInner>> listNextAsync(final String nextPageLink) {
return listNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<ControllerInner>>, Page<ControllerInner>>() {
@Override
public Page<ControllerInner> call(ServiceResponse<Page<ControllerInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listNextAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
return[call[.listNextWithServiceResponseAsync, parameter[member[.nextPageLink]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[ControllerInner] operator[>] operator[>] identifier[listNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listNextWithServiceResponseAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ControllerInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[ControllerInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[ControllerInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ControllerInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static <T> void exclusiveBetween(final T start, final T end, final Comparable<T> value) {
// TODO when breaking BC, consider returning value
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
} | class class_name[name] begin[{]
method[exclusiveBetween, return_type[void], modifier[public static], parameter[start, end, value]] begin[{]
if[binary_operation[binary_operation[call[value.compareTo, parameter[member[.start]]], <=, literal[0]], ||, binary_operation[call[value.compareTo, parameter[member[.end]]], >=, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=simpleFormat, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, 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)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[exclusiveBetween] operator[SEP] Keyword[final] identifier[T] identifier[start] , Keyword[final] identifier[T] identifier[end] , Keyword[final] identifier[Comparable] operator[<] identifier[T] operator[>] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[compareTo] operator[SEP] identifier[start] operator[SEP] operator[<=] Other[0] operator[||] identifier[value] operator[SEP] identifier[compareTo] operator[SEP] identifier[end] operator[SEP] operator[>=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[StringUtils] operator[SEP] identifier[simpleFormat] operator[SEP] identifier[DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE] , identifier[value] , identifier[start] , identifier[end] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Blueprint fromDir(String programId, String description, File rootDir, File icon) {
return new Blueprint(programId, description, processDir(rootDir), processBlob(icon));
} | class class_name[name] begin[{]
method[fromDir, return_type[type[Blueprint]], modifier[public], parameter[programId, description, rootDir, icon]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=programId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=rootDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=icon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processBlob, 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=Blueprint, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Blueprint] identifier[fromDir] operator[SEP] identifier[String] identifier[programId] , identifier[String] identifier[description] , identifier[File] identifier[rootDir] , identifier[File] identifier[icon] operator[SEP] {
Keyword[return] Keyword[new] identifier[Blueprint] operator[SEP] identifier[programId] , identifier[description] , identifier[processDir] operator[SEP] identifier[rootDir] operator[SEP] , identifier[processBlob] operator[SEP] identifier[icon] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean configure(final FeatureContext context) {
final Configuration config = context.getConfiguration();
if (!config.isRegistered(NotFoundForward.class)) {
context.register(NotFoundForward.class);
}
if (!config.isRegistered(DataViewMessageBodyWriter.class)) {
context.register(ErrorTemplateExceptionMapper.class);
context.register(DataViewMessageBodyWriter.class, 1000);
context.register(new MvcBinder());
Map<String, String> tempConf = Maps.newHashMap();
for (String key : config.getPropertyNames()) {
if (key.startsWith(TemplateHelper.TPL_ENGINE_DIR_PR)) {//模板引擎默认路径
String engine = key.replaceFirst(Pattern.quote(
TemplateHelper.TPL_ENGINE_DIR_PR.substring(0, TemplateHelper.TPL_ENGINE_DIR_PR.length() - 1)
), "");
String confKey = TEMPLATE_BASE_PATH + engine;
append(config, engine, tempConf, key, confKey, context);
} else if (key.startsWith(TPL_MODULE_DIR_PR)) {//模块自定义模板路径
String confKey = key.replaceFirst(Pattern.quote(TPL_MODULE_DIR_PR), "");
int i = confKey.indexOf(".");
if (i != -1) {
String engine = confKey.substring(0, i);
confKey = TEMPLATE_BASE_PATH + "." + engine;
append(config, engine, tempConf, key, confKey, context);
}
} else if (key.startsWith(TPL_CACHE + ".")) {
tempConf.put(CACHE_TEMPLATES + key.replaceFirst(Pattern.quote(TPL_CACHE), ""),
(String) config.getProperty(key));
}
}
for (String key : tempConf.keySet()) {
context.property(key, tempConf.get(key));
}
context.property(TEMPLATE_BASE_PATH,
config.getProperty(TemplateHelper.TPL_DIR));
context.property(CACHE_TEMPLATES,
config.getProperty(TPL_CACHE));
}
return true;
} | class class_name[name] begin[{]
method[configure, return_type[type[boolean]], modifier[public], parameter[context]] begin[{]
local_variable[type[Configuration], config]
if[call[config.isRegistered, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFoundForward, sub_type=None))]]] begin[{]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFoundForward, sub_type=None))]]
else begin[{]
None
end[}]
if[call[config.isRegistered, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataViewMessageBodyWriter, sub_type=None))]]] begin[{]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ErrorTemplateExceptionMapper, sub_type=None))]]
call[context.register, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataViewMessageBodyWriter, sub_type=None)), literal[1000]]]
call[context.register, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MvcBinder, sub_type=None))]]
local_variable[type[Map], tempConf]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TPL_ENGINE_DIR_PR, postfix_operators=[], prefix_operators=[], qualifier=TemplateHelper, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=TPL_MODULE_DIR_PR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=TPL_CACHE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+)], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=CACHE_TEMPLATES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=TPL_CACHE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=quote, postfix_operators=[], prefix_operators=[], qualifier=Pattern, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replaceFirst, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), operator=+), Cast(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=tempConf, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=TPL_MODULE_DIR_PR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=quote, postfix_operators=[], prefix_operators=[], qualifier=Pattern, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replaceFirst, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), name=confKey)], 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=".")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=confKey, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), 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=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=confKey, selectors=[], type_arguments=None), name=engine)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=confKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=TEMPLATE_BASE_PATH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tempConf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=confKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=TemplateHelper.TPL_ENGINE_DIR_PR, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=TemplateHelper.TPL_ENGINE_DIR_PR, selectors=[], type_arguments=None)], member=quote, postfix_operators=[], prefix_operators=[], qualifier=Pattern, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replaceFirst, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), name=engine)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=TEMPLATE_BASE_PATH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=confKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tempConf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=confKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPropertyNames, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tempConf, selectors=[], type_arguments=None)], member=property, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=tempConf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[context.property, parameter[member[.TEMPLATE_BASE_PATH], call[config.getProperty, parameter[member[TemplateHelper.TPL_DIR]]]]]
call[context.property, parameter[member[.CACHE_TEMPLATES], call[config.getProperty, parameter[member[.TPL_CACHE]]]]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[configure] operator[SEP] Keyword[final] identifier[FeatureContext] identifier[context] operator[SEP] {
Keyword[final] identifier[Configuration] identifier[config] operator[=] identifier[context] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[config] operator[SEP] identifier[isRegistered] operator[SEP] identifier[NotFoundForward] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[NotFoundForward] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[config] operator[SEP] identifier[isRegistered] operator[SEP] identifier[DataViewMessageBodyWriter] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[ErrorTemplateExceptionMapper] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[register] operator[SEP] identifier[DataViewMessageBodyWriter] operator[SEP] Keyword[class] , Other[1000] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[register] operator[SEP] Keyword[new] identifier[MvcBinder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[tempConf] operator[=] identifier[Maps] operator[SEP] identifier[newHashMap] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[config] operator[SEP] identifier[getPropertyNames] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] identifier[TemplateHelper] operator[SEP] identifier[TPL_ENGINE_DIR_PR] operator[SEP] operator[SEP] {
identifier[String] identifier[engine] operator[=] identifier[key] operator[SEP] identifier[replaceFirst] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[TemplateHelper] operator[SEP] identifier[TPL_ENGINE_DIR_PR] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[TemplateHelper] operator[SEP] identifier[TPL_ENGINE_DIR_PR] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[confKey] operator[=] identifier[TEMPLATE_BASE_PATH] operator[+] identifier[engine] operator[SEP] identifier[append] operator[SEP] identifier[config] , identifier[engine] , identifier[tempConf] , identifier[key] , identifier[confKey] , identifier[context] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] identifier[TPL_MODULE_DIR_PR] operator[SEP] operator[SEP] {
identifier[String] identifier[confKey] operator[=] identifier[key] operator[SEP] identifier[replaceFirst] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[TPL_MODULE_DIR_PR] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[confKey] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[String] identifier[engine] operator[=] identifier[confKey] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[i] operator[SEP] operator[SEP] identifier[confKey] operator[=] identifier[TEMPLATE_BASE_PATH] operator[+] literal[String] operator[+] identifier[engine] operator[SEP] identifier[append] operator[SEP] identifier[config] , identifier[engine] , identifier[tempConf] , identifier[key] , identifier[confKey] , identifier[context] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[startsWith] operator[SEP] identifier[TPL_CACHE] operator[+] literal[String] operator[SEP] operator[SEP] {
identifier[tempConf] operator[SEP] identifier[put] operator[SEP] identifier[CACHE_TEMPLATES] operator[+] identifier[key] operator[SEP] identifier[replaceFirst] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[TPL_CACHE] operator[SEP] , literal[String] operator[SEP] , operator[SEP] identifier[String] operator[SEP] identifier[config] operator[SEP] identifier[getProperty] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[tempConf] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[property] operator[SEP] identifier[key] , identifier[tempConf] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
identifier[context] operator[SEP] identifier[property] operator[SEP] identifier[TEMPLATE_BASE_PATH] , identifier[config] operator[SEP] identifier[getProperty] operator[SEP] identifier[TemplateHelper] operator[SEP] identifier[TPL_DIR] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[property] operator[SEP] identifier[CACHE_TEMPLATES] , identifier[config] operator[SEP] identifier[getProperty] operator[SEP] identifier[TPL_CACHE] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public Response toResponse(Exception e) {
String id = System.nanoTime() + "";
LOGGER.error(id, e);
if (e instanceof RobeRuntimeException) {
return ((RobeRuntimeException) e).getResponse(id);
} else if (e instanceof ConstraintViolationException) {
ConstraintViolationException exception = (ConstraintViolationException) e;
RobeMessage[] errors = new RobeMessage[exception.getConstraintViolations().size()];
int i = 0;
for (ConstraintViolation error : exception.getConstraintViolations()) {
errors[i++] = new RobeMessage.Builder().message(error.getMessage()).status(422).id(id).build();
}
return Response.status(422).entity(errors).type(MediaType.APPLICATION_JSON).build();
} else if (e instanceof WebApplicationException) {
WebApplicationException we = (WebApplicationException) e;
RobeMessage error = new RobeMessage.Builder().id(id).message(we.getMessage()).status(we.getResponse().getStatus()).build();
return Response.fromResponse(we.getResponse()).entity(error).type(MediaType.APPLICATION_JSON).build();
} else {
if (e.getClass().getName().equals("org.hibernate.exception.ConstraintViolationException")) {
if (e.getCause() != null && e.getCause().getMessage() != null) {
RobeMessage error = new RobeMessage.Builder().message(e.getCause().getMessage().split("for")[0]).status(Response.Status.CONFLICT.getStatusCode()).id(id).build();
return Response.status(Response.Status.CONFLICT).entity(error).type(MediaType.APPLICATION_JSON).build();
}
}
RobeMessage error = new RobeMessage.Builder().message(e.getMessage()).id(id).build();
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).type(MediaType.APPLICATION_JSON).build();
}
} | class class_name[name] begin[{]
method[toResponse, return_type[type[Response]], modifier[public], parameter[e]] begin[{]
local_variable[type[String], id]
call[LOGGER.error, parameter[member[.id], member[.e]]]
if[binary_operation[member[.e], instanceof, type[RobeRuntimeException]]] begin[{]
return[Cast(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=RobeRuntimeException, sub_type=None))]
else begin[{]
if[binary_operation[member[.e], instanceof, type[ConstraintViolationException]]] begin[{]
local_variable[type[ConstraintViolationException], exception]
local_variable[type[RobeMessage], errors]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=error, selectors=[], type_arguments=None)], member=message, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=422)], member=status, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=RobeMessage, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getConstraintViolations, postfix_operators=[], prefix_operators=[], qualifier=exception, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=error)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConstraintViolation, sub_type=None))), label=None)
return[call[Response.status, parameter[literal[422]]]]
else begin[{]
if[binary_operation[member[.e], instanceof, type[WebApplicationException]]] begin[{]
local_variable[type[WebApplicationException], we]
local_variable[type[RobeMessage], error]
return[call[Response.fromResponse, parameter[call[we.getResponse, parameter[]]]]]
else begin[{]
if[call[e.getClass, parameter[]]] begin[{]
if[binary_operation[binary_operation[call[e.getCause, parameter[]], !=, literal[null]], &&, binary_operation[call[e.getCause, parameter[]], !=, literal[null]]]] begin[{]
local_variable[type[RobeMessage], error]
return[call[Response.status, parameter[member[Response.Status.CONFLICT]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[RobeMessage], error]
return[call[Response.status, parameter[member[Response.Status.INTERNAL_SERVER_ERROR]]]]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Response] identifier[toResponse] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[String] identifier[id] operator[=] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[id] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[RobeRuntimeException] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[RobeRuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[getResponse] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[ConstraintViolationException] operator[SEP] {
identifier[ConstraintViolationException] identifier[exception] operator[=] operator[SEP] identifier[ConstraintViolationException] operator[SEP] identifier[e] operator[SEP] identifier[RobeMessage] operator[SEP] operator[SEP] identifier[errors] operator[=] Keyword[new] identifier[RobeMessage] operator[SEP] identifier[exception] operator[SEP] identifier[getConstraintViolations] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[ConstraintViolation] identifier[error] operator[:] identifier[exception] operator[SEP] identifier[getConstraintViolations] operator[SEP] operator[SEP] operator[SEP] {
identifier[errors] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] Keyword[new] identifier[RobeMessage] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[error] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[status] operator[SEP] Other[422] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Response] operator[SEP] identifier[status] operator[SEP] Other[422] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[errors] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[MediaType] operator[SEP] identifier[APPLICATION_JSON] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[WebApplicationException] operator[SEP] {
identifier[WebApplicationException] identifier[we] operator[=] operator[SEP] identifier[WebApplicationException] operator[SEP] identifier[e] operator[SEP] identifier[RobeMessage] identifier[error] operator[=] Keyword[new] identifier[RobeMessage] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[we] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[status] operator[SEP] identifier[we] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[fromResponse] operator[SEP] identifier[we] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[error] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[MediaType] operator[SEP] identifier[APPLICATION_JSON] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[RobeMessage] identifier[error] operator[=] Keyword[new] identifier[RobeMessage] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[status] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[CONFLICT] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[status] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[CONFLICT] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[error] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[MediaType] operator[SEP] identifier[APPLICATION_JSON] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[RobeMessage] identifier[error] operator[=] Keyword[new] identifier[RobeMessage] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[status] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[INTERNAL_SERVER_ERROR] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[error] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[MediaType] operator[SEP] identifier[APPLICATION_JSON] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static TimeOfDay fromCalendarFields(Calendar calendar) {
if (calendar == null) {
throw new IllegalArgumentException("The calendar must not be null");
}
return new TimeOfDay(
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
calendar.get(Calendar.SECOND),
calendar.get(Calendar.MILLISECOND)
);
} | class class_name[name] begin[{]
method[fromCalendarFields, return_type[type[TimeOfDay]], modifier[public static], parameter[calendar]] begin[{]
if[binary_operation[member[.calendar], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The calendar must not 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[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=HOUR_OF_DAY, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=MINUTE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=SECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=MILLISECOND, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TimeOfDay, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TimeOfDay] identifier[fromCalendarFields] operator[SEP] identifier[Calendar] identifier[calendar] operator[SEP] {
Keyword[if] operator[SEP] identifier[calendar] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[TimeOfDay] operator[SEP] identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] operator[SEP] , identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] operator[SEP] , identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] operator[SEP] , identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[MILLISECOND] operator[SEP] operator[SEP] operator[SEP]
}
|
public PGPPublicKeyRingCollection getAnnouncedPublicKeys() throws IOException, PGPException {
PGPPublicKeyRingCollection anyKeys = getAnyPublicKeys();
Map<OpenPgpV4Fingerprint, Date> announced = store.getAnnouncedFingerprintsOf(jid);
BareJidUserId.PubRingSelectionStrategy userIdFilter = new BareJidUserId.PubRingSelectionStrategy();
PGPPublicKeyRingCollection announcedKeysCollection = null;
for (OpenPgpV4Fingerprint announcedFingerprint : announced.keySet()) {
PGPPublicKeyRing ring = anyKeys.getPublicKeyRing(announcedFingerprint.getKeyId());
if (ring == null) continue;
ring = BCUtil.removeUnassociatedKeysFromKeyRing(ring, ring.getPublicKey(announcedFingerprint.getKeyId()));
if (!userIdFilter.accept(getJid(), ring)) {
LOGGER.log(Level.WARNING, "Ignore key " + Long.toHexString(ring.getPublicKey().getKeyID()) +
" as it lacks the user-id \"xmpp" + getJid().toString() + "\"");
continue;
}
if (announcedKeysCollection == null) {
announcedKeysCollection = new PGPPublicKeyRingCollection(Collections.singleton(ring));
} else {
announcedKeysCollection = PGPPublicKeyRingCollection.addPublicKeyRing(announcedKeysCollection, ring);
}
}
return announcedKeysCollection;
} | class class_name[name] begin[{]
method[getAnnouncedPublicKeys, return_type[type[PGPPublicKeyRingCollection]], modifier[public], parameter[]] begin[{]
local_variable[type[PGPPublicKeyRingCollection], anyKeys]
local_variable[type[Map], announced]
local_variable[type[BareJidUserId], userIdFilter]
local_variable[type[PGPPublicKeyRingCollection], announcedKeysCollection]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKeyId, postfix_operators=[], prefix_operators=[], qualifier=announcedFingerprint, selectors=[], type_arguments=None)], member=getPublicKeyRing, postfix_operators=[], prefix_operators=[], qualifier=anyKeys, selectors=[], type_arguments=None), name=ring)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PGPPublicKeyRing, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ring, 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=ContinueStatement(goto=None, label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKeyId, postfix_operators=[], prefix_operators=[], qualifier=announcedFingerprint, selectors=[], type_arguments=None)], member=getPublicKey, postfix_operators=[], prefix_operators=[], qualifier=ring, selectors=[], type_arguments=None)], member=removeUnassociatedKeysFromKeyRing, postfix_operators=[], prefix_operators=[], qualifier=BCUtil, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=ring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=['!'], qualifier=userIdFilter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ignore key "), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPublicKey, postfix_operators=[], prefix_operators=[], qualifier=ring, selectors=[MethodInvocation(arguments=[], member=getKeyID, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" as it lacks the user-id \"xmpp"), operator=+), operandr=MethodInvocation(arguments=[], member=getJid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=announcedKeysCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=announcedKeysCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=announcedKeysCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addPublicKeyRing, postfix_operators=[], prefix_operators=[], qualifier=PGPPublicKeyRingCollection, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=announcedKeysCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ring, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=singleton, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PGPPublicKeyRingCollection, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=announced, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=announcedFingerprint)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OpenPgpV4Fingerprint, sub_type=None))), label=None)
return[member[.announcedKeysCollection]]
end[}]
END[}] | Keyword[public] identifier[PGPPublicKeyRingCollection] identifier[getAnnouncedPublicKeys] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] , identifier[PGPException] {
identifier[PGPPublicKeyRingCollection] identifier[anyKeys] operator[=] identifier[getAnyPublicKeys] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[OpenPgpV4Fingerprint] , identifier[Date] operator[>] identifier[announced] operator[=] identifier[store] operator[SEP] identifier[getAnnouncedFingerprintsOf] operator[SEP] identifier[jid] operator[SEP] operator[SEP] identifier[BareJidUserId] operator[SEP] identifier[PubRingSelectionStrategy] identifier[userIdFilter] operator[=] Keyword[new] identifier[BareJidUserId] operator[SEP] identifier[PubRingSelectionStrategy] operator[SEP] operator[SEP] operator[SEP] identifier[PGPPublicKeyRingCollection] identifier[announcedKeysCollection] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[OpenPgpV4Fingerprint] identifier[announcedFingerprint] operator[:] identifier[announced] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[PGPPublicKeyRing] identifier[ring] operator[=] identifier[anyKeys] operator[SEP] identifier[getPublicKeyRing] operator[SEP] identifier[announcedFingerprint] operator[SEP] identifier[getKeyId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ring] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] identifier[ring] operator[=] identifier[BCUtil] operator[SEP] identifier[removeUnassociatedKeysFromKeyRing] operator[SEP] identifier[ring] , identifier[ring] operator[SEP] identifier[getPublicKey] operator[SEP] identifier[announcedFingerprint] operator[SEP] identifier[getKeyId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[userIdFilter] operator[SEP] identifier[accept] operator[SEP] identifier[getJid] operator[SEP] operator[SEP] , identifier[ring] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , literal[String] operator[+] identifier[Long] operator[SEP] identifier[toHexString] operator[SEP] identifier[ring] operator[SEP] identifier[getPublicKey] operator[SEP] operator[SEP] operator[SEP] identifier[getKeyID] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getJid] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[announcedKeysCollection] operator[==] Other[null] operator[SEP] {
identifier[announcedKeysCollection] operator[=] Keyword[new] identifier[PGPPublicKeyRingCollection] operator[SEP] identifier[Collections] operator[SEP] identifier[singleton] operator[SEP] identifier[ring] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[announcedKeysCollection] operator[=] identifier[PGPPublicKeyRingCollection] operator[SEP] identifier[addPublicKeyRing] operator[SEP] identifier[announcedKeysCollection] , identifier[ring] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[announcedKeysCollection] operator[SEP]
}
|
public static Point getPixelRelative(LatLong latLong, long mapSize, Point origin) {
return getPixelRelative(latLong, mapSize, origin.x, origin.y);
} | class class_name[name] begin[{]
method[getPixelRelative, return_type[type[Point]], modifier[public static], parameter[latLong, mapSize, origin]] begin[{]
return[call[.getPixelRelative, parameter[member[.latLong], member[.mapSize], member[origin.x], member[origin.y]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Point] identifier[getPixelRelative] operator[SEP] identifier[LatLong] identifier[latLong] , Keyword[long] identifier[mapSize] , identifier[Point] identifier[origin] operator[SEP] {
Keyword[return] identifier[getPixelRelative] operator[SEP] identifier[latLong] , identifier[mapSize] , identifier[origin] operator[SEP] identifier[x] , identifier[origin] operator[SEP] identifier[y] operator[SEP] operator[SEP]
}
|
public CircuitBreaker build() {
if (counterSlidingWindow.compareTo(counterUpdateInterval) <= 0) {
throw new IllegalStateException(
"counterSlidingWindow: " + counterSlidingWindow + " (expected: > counterUpdateInterval)");
}
return new NonBlockingCircuitBreaker(
ticker,
new CircuitBreakerConfig(name, failureRateThreshold, minimumRequestThreshold,
circuitOpenWindow, trialRequestInterval,
counterSlidingWindow, counterUpdateInterval,
Collections.unmodifiableList(listeners)));
} | class class_name[name] begin[{]
method[build, return_type[type[CircuitBreaker]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[counterSlidingWindow.compareTo, parameter[member[.counterUpdateInterval]]], <=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="counterSlidingWindow: "), operandr=MemberReference(member=counterSlidingWindow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (expected: > counterUpdateInterval)"), 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[ClassCreator(arguments=[MemberReference(member=ticker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failureRateThreshold, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minimumRequestThreshold, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=circuitOpenWindow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trialRequestInterval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=counterSlidingWindow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=counterUpdateInterval, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableList, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CircuitBreakerConfig, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NonBlockingCircuitBreaker, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[CircuitBreaker] identifier[build] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[counterSlidingWindow] operator[SEP] identifier[compareTo] operator[SEP] identifier[counterUpdateInterval] operator[SEP] operator[<=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[counterSlidingWindow] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[NonBlockingCircuitBreaker] operator[SEP] identifier[ticker] , Keyword[new] identifier[CircuitBreakerConfig] operator[SEP] identifier[name] , identifier[failureRateThreshold] , identifier[minimumRequestThreshold] , identifier[circuitOpenWindow] , identifier[trialRequestInterval] , identifier[counterSlidingWindow] , identifier[counterUpdateInterval] , identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] identifier[listeners] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void sendPong(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback, long timeoutmillis) {
sendInternal(mergeBuffers(data), WebSocketFrameType.PONG, wsChannel, callback, null, timeoutmillis);
} | class class_name[name] begin[{]
method[sendPong, return_type[void], modifier[public static], parameter[data, wsChannel, callback, timeoutmillis]] begin[{]
call[.sendInternal, parameter[call[.mergeBuffers, parameter[member[.data]]], member[WebSocketFrameType.PONG], member[.wsChannel], member[.callback], literal[null], member[.timeoutmillis]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[sendPong] operator[SEP] Keyword[final] identifier[ByteBuffer] operator[SEP] operator[SEP] identifier[data] , Keyword[final] identifier[WebSocketChannel] identifier[wsChannel] , Keyword[final] identifier[WebSocketCallback] operator[<] identifier[Void] operator[>] identifier[callback] , Keyword[long] identifier[timeoutmillis] operator[SEP] {
identifier[sendInternal] operator[SEP] identifier[mergeBuffers] operator[SEP] identifier[data] operator[SEP] , identifier[WebSocketFrameType] operator[SEP] identifier[PONG] , identifier[wsChannel] , identifier[callback] , Other[null] , identifier[timeoutmillis] operator[SEP] operator[SEP]
}
|
@Transactional(readOnly = true)
public Collection<Event> findAll() {
return em.createQuery("FROM Event", Event.class).getResultList();
} | class class_name[name] begin[{]
method[findAll, return_type[type[Collection]], modifier[public], parameter[]] begin[{]
return[call[em.createQuery, parameter[literal["FROM Event"], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Event, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Transactional] operator[SEP] identifier[readOnly] operator[=] literal[boolean] operator[SEP] Keyword[public] identifier[Collection] operator[<] identifier[Event] operator[>] identifier[findAll] operator[SEP] operator[SEP] {
Keyword[return] identifier[em] operator[SEP] identifier[createQuery] operator[SEP] literal[String] , identifier[Event] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getResultList] operator[SEP] operator[SEP] operator[SEP]
}
|
private static void validateGenotypes(Map<String, Set<Integer>> gt, PedigreeManager pedigreeManager) {
List<Member> withoutChildren = pedigreeManager.getWithoutChildren();
Queue<String> queue = new LinkedList<>();
for (Member member : withoutChildren) {
queue.add(member.getId());
}
while (!queue.isEmpty()) {
String individualId = queue.remove();
Member member = pedigreeManager.getIndividualMap().get(individualId);
processIndividual(member, gt);
if (member.getFather() != null) {
if (!queue.contains(member.getFather().getId())) {
queue.add(member.getFather().getId());
}
}
if (member.getMother() != null) {
if (!queue.contains(member.getMother().getId())) {
queue.add(member.getMother().getId());
}
}
}
} | class class_name[name] begin[{]
method[validateGenotypes, return_type[void], modifier[private static], parameter[gt, pedigreeManager]] begin[{]
local_variable[type[List], withoutChildren]
local_variable[type[Queue], queue]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=member, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=withoutChildren, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=member)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Member, sub_type=None))), label=None)
while[call[queue.isEmpty, parameter[]]] begin[{]
local_variable[type[String], individualId]
local_variable[type[Member], member]
call[.processIndividual, parameter[member[.member], member[.gt]]]
if[binary_operation[call[member.getFather, parameter[]], !=, literal[null]]] begin[{]
if[call[queue.contains, parameter[call[member.getFather, parameter[]]]]] begin[{]
call[queue.add, parameter[call[member.getFather, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[member.getMother, parameter[]], !=, literal[null]]] begin[{]
if[call[queue.contains, parameter[call[member.getMother, parameter[]]]]] begin[{]
call[queue.add, parameter[call[member.getMother, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[validateGenotypes] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Set] operator[<] identifier[Integer] operator[>] operator[>] identifier[gt] , identifier[PedigreeManager] identifier[pedigreeManager] operator[SEP] {
identifier[List] operator[<] identifier[Member] operator[>] identifier[withoutChildren] operator[=] identifier[pedigreeManager] operator[SEP] identifier[getWithoutChildren] operator[SEP] operator[SEP] operator[SEP] identifier[Queue] operator[<] identifier[String] operator[>] identifier[queue] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Member] identifier[member] operator[:] identifier[withoutChildren] operator[SEP] {
identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[member] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[!] identifier[queue] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[individualId] operator[=] identifier[queue] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] identifier[Member] identifier[member] operator[=] identifier[pedigreeManager] operator[SEP] identifier[getIndividualMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[individualId] operator[SEP] operator[SEP] identifier[processIndividual] operator[SEP] identifier[member] , identifier[gt] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[member] operator[SEP] identifier[getFather] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[queue] operator[SEP] identifier[contains] operator[SEP] identifier[member] operator[SEP] identifier[getFather] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[member] operator[SEP] identifier[getFather] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[member] operator[SEP] identifier[getMother] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[queue] operator[SEP] identifier[contains] operator[SEP] identifier[member] operator[SEP] identifier[getMother] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[member] operator[SEP] identifier[getMother] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static CommandLine forAssist(String rawCommandLine) {
final List<String> splitCommandLine = splitCommandLine(rawCommandLine);
// If the commandLine ends with a space (or is empty), we manually insert an empty arg.
// This implies that the user wanted assistance about the NEXT argument and not the last one that was typed.
if (rawCommandLine.isEmpty() || rawCommandLine.endsWith(" ")) {
splitCommandLine.add("");
}
return new CommandLine(splitCommandLine);
} | class class_name[name] begin[{]
method[forAssist, return_type[type[CommandLine]], modifier[public static], parameter[rawCommandLine]] begin[{]
local_variable[type[List], splitCommandLine]
if[binary_operation[call[rawCommandLine.isEmpty, parameter[]], ||, call[rawCommandLine.endsWith, parameter[literal[" "]]]]] begin[{]
call[splitCommandLine.add, parameter[literal[""]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=splitCommandLine, 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=CommandLine, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CommandLine] identifier[forAssist] operator[SEP] identifier[String] identifier[rawCommandLine] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[splitCommandLine] operator[=] identifier[splitCommandLine] operator[SEP] identifier[rawCommandLine] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rawCommandLine] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[rawCommandLine] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[splitCommandLine] operator[SEP] identifier[add] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[CommandLine] operator[SEP] identifier[splitCommandLine] operator[SEP] operator[SEP]
}
|
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName,
Iterable<?> exampleRequests) {
requireNonNull(serviceName, "serviceName");
requireNonNull(methodName, "methodName");
requireNonNull(exampleRequests, "exampleRequests");
for (Object e : exampleRequests) {
requireNonNull(e, "exampleRequests contains null.");
exampleRequest0(serviceName, methodName,
serializeExampleRequest(serviceName, methodName, e));
}
return this;
} | class class_name[name] begin[{]
method[exampleRequestForMethod, return_type[type[DocServiceBuilder]], modifier[public], parameter[serviceName, methodName, exampleRequests]] begin[{]
call[.requireNonNull, parameter[member[.serviceName], literal["serviceName"]]]
call[.requireNonNull, parameter[member[.methodName], literal["methodName"]]]
call[.requireNonNull, parameter[member[.exampleRequests], literal["exampleRequests"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="exampleRequests contains null.")], member=requireNonNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serializeExampleRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=exampleRequest0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=exampleRequests, 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=Object, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DocServiceBuilder] identifier[exampleRequestForMethod] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[methodName] , identifier[Iterable] operator[<] operator[?] operator[>] identifier[exampleRequests] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[serviceName] , literal[String] operator[SEP] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[methodName] , literal[String] operator[SEP] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[exampleRequests] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[e] operator[:] identifier[exampleRequests] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[e] , literal[String] operator[SEP] operator[SEP] identifier[exampleRequest0] operator[SEP] identifier[serviceName] , identifier[methodName] , identifier[serializeExampleRequest] operator[SEP] identifier[serviceName] , identifier[methodName] , identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static void populate(Object instance, Map<String, Object> values) {
try {
BeanUtilsBean beanUtilBean = new BeanUtilsBean();
for (String key : values.keySet()) {
Object value = values.get(key);
beanUtilBean.setProperty(instance, key, value);
}
} catch (Exception e) {
JKExceptionUtil.handle(e);
}
} | class class_name[name] begin[{]
method[populate, return_type[void], modifier[public static], parameter[instance, values]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanUtilsBean, sub_type=None)), name=beanUtilBean)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanUtilsBean, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=beanUtilBean, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=JKExceptionUtil, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[populate] operator[SEP] identifier[Object] identifier[instance] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[values] operator[SEP] {
Keyword[try] {
identifier[BeanUtilsBean] identifier[beanUtilBean] operator[=] Keyword[new] identifier[BeanUtilsBean] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[values] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[values] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[beanUtilBean] operator[SEP] identifier[setProperty] operator[SEP] identifier[instance] , identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[JKExceptionUtil] operator[SEP] identifier[handle] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public int subscribe_event(DeviceProxy device,
String attribute,
int event,
int max_size,
String[] filters,
boolean stateless)
throws DevFailed {
return subscribe_event(device, attribute, event, null, max_size, filters, stateless);
} | class class_name[name] begin[{]
method[subscribe_event, return_type[type[int]], modifier[public], parameter[device, attribute, event, max_size, filters, stateless]] begin[{]
return[call[.subscribe_event, parameter[member[.device], member[.attribute], member[.event], literal[null], member[.max_size], member[.filters], member[.stateless]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[subscribe_event] operator[SEP] identifier[DeviceProxy] identifier[device] , identifier[String] identifier[attribute] , Keyword[int] identifier[event] , Keyword[int] identifier[max_size] , identifier[String] operator[SEP] operator[SEP] identifier[filters] , Keyword[boolean] identifier[stateless] operator[SEP] Keyword[throws] identifier[DevFailed] {
Keyword[return] identifier[subscribe_event] operator[SEP] identifier[device] , identifier[attribute] , identifier[event] , Other[null] , identifier[max_size] , identifier[filters] , identifier[stateless] operator[SEP] operator[SEP]
}
|
public final void nextToken() {
skipIgnoredToken();
if (isVariableBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanVariable();
} else if (isNCharBegin()) {
currentToken = new Tokenizer(input, dictionary, ++offset).scanChars();
} else if (isIdentifierBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanIdentifier();
} else if (isHexDecimalBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanHexDecimal();
} else if (isNumberBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanNumber();
} else if (isSymbolBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanSymbol();
} else if (isCharsBegin()) {
currentToken = new Tokenizer(input, dictionary, offset).scanChars();
} else if (isEnd()) {
currentToken = new Token(Assist.END, "", offset);
} else {
throw new SQLParsingException(this, Assist.ERROR);
}
offset = currentToken.getEndPosition();
} | class class_name[name] begin[{]
method[nextToken, return_type[void], modifier[final public], parameter[]] begin[{]
call[.skipIgnoredToken, parameter[]]
if[call[.isVariableBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanVariable, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isNCharBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanChars, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isIdentifierBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanIdentifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isHexDecimalBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanHexDecimal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isNumberBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanNumber, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isSymbolBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanSymbol, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isCharsBegin, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dictionary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=scanChars, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Tokenizer, sub_type=None))]
else begin[{]
if[call[.isEnd, parameter[]]] begin[{]
assign[member[.currentToken], ClassCreator(arguments=[MemberReference(member=END, postfix_operators=[], prefix_operators=[], qualifier=Assist, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=offset, 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=Token, sub_type=None))]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=Assist, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLParsingException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
assign[member[.offset], call[currentToken.getEndPosition, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[nextToken] operator[SEP] operator[SEP] {
identifier[skipIgnoredToken] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isVariableBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanVariable] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNCharBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , operator[++] identifier[offset] operator[SEP] operator[SEP] identifier[scanChars] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isIdentifierBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanIdentifier] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isHexDecimalBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanHexDecimal] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isNumberBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanNumber] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isSymbolBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanSymbol] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isCharsBegin] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Tokenizer] operator[SEP] identifier[input] , identifier[dictionary] , identifier[offset] operator[SEP] operator[SEP] identifier[scanChars] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isEnd] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentToken] operator[=] Keyword[new] identifier[Token] operator[SEP] identifier[Assist] operator[SEP] identifier[END] , literal[String] , identifier[offset] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[SQLParsingException] operator[SEP] Keyword[this] , identifier[Assist] operator[SEP] identifier[ERROR] operator[SEP] operator[SEP]
}
identifier[offset] operator[=] identifier[currentToken] operator[SEP] identifier[getEndPosition] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(ProjectDetails projectDetails, ProtocolMarshaller protocolMarshaller) {
if (projectDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(projectDetails.getName(), NAME_BINDING);
protocolMarshaller.marshall(projectDetails.getProjectId(), PROJECTID_BINDING);
protocolMarshaller.marshall(projectDetails.getRegion(), REGION_BINDING);
protocolMarshaller.marshall(projectDetails.getState(), STATE_BINDING);
protocolMarshaller.marshall(projectDetails.getCreatedDate(), CREATEDDATE_BINDING);
protocolMarshaller.marshall(projectDetails.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING);
protocolMarshaller.marshall(projectDetails.getConsoleUrl(), CONSOLEURL_BINDING);
protocolMarshaller.marshall(projectDetails.getResources(), RESOURCES_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[projectDetails, protocolMarshaller]] begin[{]
if[binary_operation[member[.projectDetails], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=NAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProjectId, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=PROJECTID_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=getRegion, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=REGION_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=getState, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=STATE_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=getCreatedDate, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=CREATEDDATE_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=getLastUpdatedDate, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=LASTUPDATEDDATE_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=getConsoleUrl, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=CONSOLEURL_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=getResources, postfix_operators=[], prefix_operators=[], qualifier=projectDetails, selectors=[], type_arguments=None), MemberReference(member=RESOURCES_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[ProjectDetails] identifier[projectDetails] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[projectDetails] 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[projectDetails] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[NAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getProjectId] operator[SEP] operator[SEP] , identifier[PROJECTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getRegion] operator[SEP] operator[SEP] , identifier[REGION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getState] operator[SEP] operator[SEP] , identifier[STATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getCreatedDate] operator[SEP] operator[SEP] , identifier[CREATEDDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getLastUpdatedDate] operator[SEP] operator[SEP] , identifier[LASTUPDATEDDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getConsoleUrl] operator[SEP] operator[SEP] , identifier[CONSOLEURL_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[projectDetails] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] , identifier[RESOURCES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void setBooleanAttribute(String name, Boolean value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof BooleanAttribute)) {
throw new IllegalStateException("Cannot set boolean value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((BooleanAttribute) attribute).setValue(value);
} | class class_name[name] begin[{]
method[setBooleanAttribute, return_type[void], modifier[public], parameter[name, value]] begin[{]
local_variable[type[Attribute], attribute]
if[binary_operation[member[.attribute], instanceof, type[BooleanAttribute]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set boolean value on attribute with different type, "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" setting value "), operator=+), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
Cast(expression=MemberReference(member=attribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BooleanAttribute, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBooleanAttribute] operator[SEP] identifier[String] identifier[name] , identifier[Boolean] identifier[value] operator[SEP] {
identifier[Attribute] identifier[attribute] operator[=] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[attribute] Keyword[instanceof] identifier[BooleanAttribute] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[attribute] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[BooleanAttribute] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public void visit(int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) {
ClassInfo classInfo = new ClassInfo(name,
superName,
interfaces,
access,
location);
foundClasses.put(classInfo.getClassName(), classInfo);
currentClass = classInfo;
} | class class_name[name] begin[{]
method[visit, return_type[void], modifier[public], parameter[version, access, name, signature, superName, interfaces]] begin[{]
local_variable[type[ClassInfo], classInfo]
call[foundClasses.put, parameter[call[classInfo.getClassName, parameter[]], member[.classInfo]]]
assign[member[.currentClass], member[.classInfo]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visit] operator[SEP] Keyword[int] identifier[version] , Keyword[int] identifier[access] , identifier[String] identifier[name] , identifier[String] identifier[signature] , identifier[String] identifier[superName] , identifier[String] operator[SEP] operator[SEP] identifier[interfaces] operator[SEP] {
identifier[ClassInfo] identifier[classInfo] operator[=] Keyword[new] identifier[ClassInfo] operator[SEP] identifier[name] , identifier[superName] , identifier[interfaces] , identifier[access] , identifier[location] operator[SEP] operator[SEP] identifier[foundClasses] operator[SEP] identifier[put] operator[SEP] identifier[classInfo] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] , identifier[classInfo] operator[SEP] operator[SEP] identifier[currentClass] operator[=] identifier[classInfo] operator[SEP]
}
|
public static void concatenate(List<File> files, File concatenatedFile) {
BufferedWriter writer;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(concatenatedFile.getAbsoluteFile(),
false), DataUtilDefaults.charSet));
FileInputStream inputStream;
for(File input : files) {
inputStream = new FileInputStream(input);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
String line;
while((line = reader.readLine()) != null) {
writer.write(line + DataUtilDefaults.lineTerminator);
}
inputStream.close();
}
writer.flush();
writer.close();
} catch (UnsupportedEncodingException e) {
throw new DataUtilException(e);
} catch (FileNotFoundException e) {
throw new DataUtilException(e);
} catch (IOException e) {
throw new DataUtilException(e);
}
} | class class_name[name] begin[{]
method[concatenate, return_type[void], modifier[public static], parameter[files, concatenatedFile]] begin[{]
local_variable[type[BufferedWriter], writer]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getAbsoluteFile, postfix_operators=[], prefix_operators=[], qualifier=concatenatedFile, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None)), MemberReference(member=charSet, postfix_operators=[], prefix_operators=[], qualifier=DataUtilDefaults, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutputStreamWriter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedWriter, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=inputStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileInputStream, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=input, 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=FileInputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)), name=reader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lineTerminator, postfix_operators=[], prefix_operators=[], qualifier=DataUtilDefaults, selectors=[]), operator=+)], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=input)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataUtilException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataUtilException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileNotFoundException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataUtilException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[concatenate] operator[SEP] identifier[List] operator[<] identifier[File] operator[>] identifier[files] , identifier[File] identifier[concatenatedFile] operator[SEP] {
identifier[BufferedWriter] identifier[writer] operator[SEP] Keyword[try] {
identifier[writer] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] Keyword[new] identifier[OutputStreamWriter] operator[SEP] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[concatenatedFile] operator[SEP] identifier[getAbsoluteFile] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] , identifier[DataUtilDefaults] operator[SEP] identifier[charSet] operator[SEP] operator[SEP] operator[SEP] identifier[FileInputStream] identifier[inputStream] operator[SEP] Keyword[for] operator[SEP] identifier[File] identifier[input] operator[:] identifier[files] operator[SEP] {
identifier[inputStream] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[inputStream] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[line] operator[+] identifier[DataUtilDefaults] operator[SEP] identifier[lineTerminator] operator[SEP] operator[SEP]
}
identifier[inputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DataUtilException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DataUtilException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DataUtilException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void createUrl(String accessToken, String apiKey){
wsuri = new Routes().getWsuri().replace(":access_token", accessToken).replace(":api_key", apiKey);
} | class class_name[name] begin[{]
method[createUrl, return_type[void], modifier[private], parameter[accessToken, apiKey]] begin[{]
assign[member[.wsuri], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getWsuri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":access_token"), MemberReference(member=accessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":api_key"), MemberReference(member=apiKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Routes, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[createUrl] operator[SEP] identifier[String] identifier[accessToken] , identifier[String] identifier[apiKey] operator[SEP] {
identifier[wsuri] operator[=] Keyword[new] identifier[Routes] operator[SEP] operator[SEP] operator[SEP] identifier[getWsuri] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[accessToken] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[apiKey] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"PMD.NPathComplexity"})
/*package*/ URI buildUri(final String rawUrl, final String branch, final String lastKnownCommit) throws URISyntaxException {
URIBuilder builder = new URIBuilder();
/*
* Examples:
*
* ssh://git@company.com/project/repository.git
* https://username@company.com/scm/project/repository.git
* ssh://git@company.com/~username/repository.git
* https://username@company.com/scm/~username/repository.git
*
*/
String repoUrlRaw = rawUrl;
String repoUrlProcessed = repoUrlRaw;
if (repoUrlProcessed.endsWith(".git")) {
repoUrlProcessed = repoUrlProcessed.substring(0, repoUrlProcessed.lastIndexOf(".git"));
}
URI uri = URI.create(repoUrlProcessed.replaceAll(" ", "%20"));
String host = uri.getHost();
String scheme = "ssh".equalsIgnoreCase(uri.getScheme())? "https" : uri.getScheme();
int port = uri.getPort();
String path = uri.getPath();
if ((path.startsWith("scm/") || path.startsWith("/scm")) && path.length() > 4) {
path = path.substring(4);
}
if (path.length() > 0 && path.charAt(0) == '/') {
path = path.substring(1, path.length());
}
String[] splitPath = path.split("/");
String projectKey = "";
String repositorySlug = "";
if (splitPath.length > 1) {
projectKey = splitPath[0];
repositorySlug = path.substring(path.indexOf('/') + 1, path.length());
} else {
// Shouldn't get to this case
projectKey = "";
repositorySlug = path;
}
String apiPath = settings.getApi() != null? settings.getApi() : "";
if (apiPath.endsWith("/")) {
apiPath = settings.getApi().substring(0, settings.getApi().length() - 1);
}
builder.setScheme(scheme);
builder.setHost(host);
if (port != -1) {
builder.setPort(port);
}
builder.setPath(apiPath + "/projects/" + projectKey + "/repos/" + repositorySlug + "/commits");
if (branch == null || branch.length() == 0) {
builder.addParameter("until", "master");
} else {
builder.addParameter("until", branch.replaceAll(" ", "%20"));
}
if (lastKnownCommit != null && lastKnownCommit.length() > 0) {
builder.addParameter("since", lastKnownCommit);
}
if (settings.getPageSize() > 0) {
builder.addParameter("limit", String.valueOf(settings.getPageSize()));
}
return builder.build();
} | class class_name[name] begin[{]
method[buildUri, return_type[type[URI]], modifier[default], parameter[rawUrl, branch, lastKnownCommit]] begin[{]
local_variable[type[URIBuilder], builder]
local_variable[type[String], repoUrlRaw]
local_variable[type[String], repoUrlProcessed]
if[call[repoUrlProcessed.endsWith, parameter[literal[".git"]]]] begin[{]
assign[member[.repoUrlProcessed], call[repoUrlProcessed.substring, parameter[literal[0], call[repoUrlProcessed.lastIndexOf, parameter[literal[".git"]]]]]]
else begin[{]
None
end[}]
local_variable[type[URI], uri]
local_variable[type[String], host]
local_variable[type[String], scheme]
local_variable[type[int], port]
local_variable[type[String], path]
if[binary_operation[binary_operation[call[path.startsWith, parameter[literal["scm/"]]], ||, call[path.startsWith, parameter[literal["/scm"]]]], &&, binary_operation[call[path.length, parameter[]], >, literal[4]]]] begin[{]
assign[member[.path], call[path.substring, parameter[literal[4]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[path.length, parameter[]], >, literal[0]], &&, binary_operation[call[path.charAt, parameter[literal[0]]], ==, literal['/']]]] begin[{]
assign[member[.path], call[path.substring, parameter[literal[1], call[path.length, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[String], splitPath]
local_variable[type[String], projectKey]
local_variable[type[String], repositorySlug]
if[binary_operation[member[splitPath.length], >, literal[1]]] begin[{]
assign[member[.projectKey], member[.splitPath]]
assign[member[.repositorySlug], call[path.substring, parameter[binary_operation[call[path.indexOf, parameter[literal['/']]], +, literal[1]], call[path.length, parameter[]]]]]
else begin[{]
assign[member[.projectKey], literal[""]]
assign[member[.repositorySlug], member[.path]]
end[}]
local_variable[type[String], apiPath]
if[call[apiPath.endsWith, parameter[literal["/"]]]] begin[{]
assign[member[.apiPath], call[settings.getApi, parameter[]]]
else begin[{]
None
end[}]
call[builder.setScheme, parameter[member[.scheme]]]
call[builder.setHost, parameter[member[.host]]]
if[binary_operation[member[.port], !=, literal[1]]] begin[{]
call[builder.setPort, parameter[member[.port]]]
else begin[{]
None
end[}]
call[builder.setPath, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.apiPath], +, literal["/projects/"]], +, member[.projectKey]], +, literal["/repos/"]], +, member[.repositorySlug]], +, literal["/commits"]]]]
if[binary_operation[binary_operation[member[.branch], ==, literal[null]], ||, binary_operation[call[branch.length, parameter[]], ==, literal[0]]]] begin[{]
call[builder.addParameter, parameter[literal["until"], literal["master"]]]
else begin[{]
call[builder.addParameter, parameter[literal["until"], call[branch.replaceAll, parameter[literal[" "], literal["%20"]]]]]
end[}]
if[binary_operation[binary_operation[member[.lastKnownCommit], !=, literal[null]], &&, binary_operation[call[lastKnownCommit.length, parameter[]], >, literal[0]]]] begin[{]
call[builder.addParameter, parameter[literal["since"], member[.lastKnownCommit]]]
else begin[{]
None
end[}]
if[binary_operation[call[settings.getPageSize, parameter[]], >, literal[0]]] begin[{]
call[builder.addParameter, parameter[literal["limit"], call[String.valueOf, parameter[call[settings.getPageSize, parameter[]]]]]]
else begin[{]
None
end[}]
return[call[builder.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] identifier[URI] identifier[buildUri] operator[SEP] Keyword[final] identifier[String] identifier[rawUrl] , Keyword[final] identifier[String] identifier[branch] , Keyword[final] identifier[String] identifier[lastKnownCommit] operator[SEP] Keyword[throws] identifier[URISyntaxException] {
identifier[URIBuilder] identifier[builder] operator[=] Keyword[new] identifier[URIBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[repoUrlRaw] operator[=] identifier[rawUrl] operator[SEP] identifier[String] identifier[repoUrlProcessed] operator[=] identifier[repoUrlRaw] operator[SEP] Keyword[if] operator[SEP] identifier[repoUrlProcessed] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[repoUrlProcessed] operator[=] identifier[repoUrlProcessed] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[repoUrlProcessed] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[URI] identifier[uri] operator[=] identifier[URI] operator[SEP] identifier[create] operator[SEP] identifier[repoUrlProcessed] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[host] operator[=] identifier[uri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[scheme] operator[=] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[uri] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] identifier[uri] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[port] operator[=] identifier[uri] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[uri] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[path] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[4] operator[SEP] {
identifier[path] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[4] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] identifier[path] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[path] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[1] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[splitPath] operator[=] identifier[path] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[projectKey] operator[=] literal[String] operator[SEP] identifier[String] identifier[repositorySlug] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[splitPath] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[projectKey] operator[=] identifier[splitPath] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[repositorySlug] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] identifier[path] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[projectKey] operator[=] literal[String] operator[SEP] identifier[repositorySlug] operator[=] identifier[path] operator[SEP]
}
identifier[String] identifier[apiPath] operator[=] identifier[settings] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[settings] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[apiPath] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[apiPath] operator[=] identifier[settings] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[settings] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[setScheme] operator[SEP] identifier[scheme] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[setHost] operator[SEP] identifier[host] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[port] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[builder] operator[SEP] identifier[setPort] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[setPath] operator[SEP] identifier[apiPath] operator[+] literal[String] operator[+] identifier[projectKey] operator[+] literal[String] operator[+] identifier[repositorySlug] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[branch] operator[==] Other[null] operator[||] identifier[branch] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[builder] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[branch] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastKnownCommit] operator[!=] Other[null] operator[&&] identifier[lastKnownCommit] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[lastKnownCommit] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[settings] operator[SEP] identifier[getPageSize] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[builder] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[settings] operator[SEP] identifier[getPageSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public long getLastCompleted() {
// If there are any queued events, return the index prior to the first event in the queue.
EventHolder event = events.peek();
if (event != null && event.eventIndex > completeIndex) {
return event.eventIndex - 1;
}
// If no events are queued, return the highest index applied to the session.
return lastApplied;
} | class class_name[name] begin[{]
method[getLastCompleted, return_type[type[long]], modifier[public], parameter[]] begin[{]
local_variable[type[EventHolder], event]
if[binary_operation[binary_operation[member[.event], !=, literal[null]], &&, binary_operation[member[event.eventIndex], >, member[.completeIndex]]]] begin[{]
return[binary_operation[member[event.eventIndex], -, literal[1]]]
else begin[{]
None
end[}]
return[member[.lastApplied]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getLastCompleted] operator[SEP] operator[SEP] {
identifier[EventHolder] identifier[event] operator[=] identifier[events] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[event] operator[!=] Other[null] operator[&&] identifier[event] operator[SEP] identifier[eventIndex] operator[>] identifier[completeIndex] operator[SEP] {
Keyword[return] identifier[event] operator[SEP] identifier[eventIndex] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[lastApplied] operator[SEP]
}
|
public void activateChannels(
String agentId,
String placeName
) throws WorkspaceApiException {
this.activateChannels(agentId, null, placeName, null, null);
} | class class_name[name] begin[{]
method[activateChannels, return_type[void], modifier[public], parameter[agentId, placeName]] begin[{]
THIS[call[None.activateChannels, parameter[member[.agentId], literal[null], member[.placeName], literal[null], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[activateChannels] operator[SEP] identifier[String] identifier[agentId] , identifier[String] identifier[placeName] operator[SEP] Keyword[throws] identifier[WorkspaceApiException] {
Keyword[this] operator[SEP] identifier[activateChannels] operator[SEP] identifier[agentId] , Other[null] , identifier[placeName] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public void setOutgoingLinks(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null)
jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_outgoingLinks), i, jcasType.ll_cas.ll_getFSRef(v));} | class class_name[name] begin[{]
method[setOutgoingLinks, return_type[void], modifier[public], parameter[i, v]] begin[{]
if[binary_operation[member[Descriptor_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Descriptor_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["outgoingLinks"], literal["de.julielab.jules.types.wikipedia.Descriptor"]]]
else begin[{]
None
end[}]
call[jcasType.jcas.checkArrayBounds, parameter[call[jcasType.ll_cas.ll_getRefValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Descriptor_Type, sub_type=None))]], member[.i]]]
call[jcasType.ll_cas.ll_setRefArrayValue, parameter[call[jcasType.ll_cas.ll_getRefValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Descriptor_Type, sub_type=None))]], member[.i], call[jcasType.ll_cas.ll_getFSRef, parameter[member[.v]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setOutgoingLinks] operator[SEP] Keyword[int] identifier[i] , identifier[Title] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_outgoingLinks] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[checkArrayBounds] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getRefValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_outgoingLinks] operator[SEP] , identifier[i] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setRefArrayValue] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getRefValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Descriptor_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_outgoingLinks] operator[SEP] , identifier[i] , identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getFSRef] operator[SEP] identifier[v] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean checkDestinationAccess(
SecurityContext secContext,
OperationType operation)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkDestinationAccess",
new Object[] { secContext, operation });
boolean allow = false;
// This style of access check is against a bus only.
if(accessChecker.checkForeignBusAccess(secContext,
getName(),
operation))
{
allow = true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkDestinationAccess", Boolean.valueOf(allow));
return allow;
} | class class_name[name] begin[{]
method[checkDestinationAccess, return_type[type[boolean]], modifier[public], parameter[secContext, operation]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["checkDestinationAccess"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=secContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[boolean], allow]
if[call[accessChecker.checkForeignBusAccess, parameter[member[.secContext], call[.getName, parameter[]], member[.operation]]]] begin[{]
assign[member[.allow], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["checkDestinationAccess"], call[Boolean.valueOf, parameter[member[.allow]]]]]
else begin[{]
None
end[}]
return[member[.allow]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[checkDestinationAccess] operator[SEP] identifier[SecurityContext] identifier[secContext] , identifier[OperationType] identifier[operation] 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] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[secContext] , identifier[operation]
} operator[SEP] operator[SEP] Keyword[boolean] identifier[allow] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[accessChecker] operator[SEP] identifier[checkForeignBusAccess] operator[SEP] identifier[secContext] , identifier[getName] operator[SEP] operator[SEP] , identifier[operation] operator[SEP] operator[SEP] {
identifier[allow] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[allow] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[allow] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.