code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
checkNotNull(messageListenerDefinition);
ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
.put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
try {
createMessageConsumer(messageListenerDefinition);
} catch (JMSException e) {
throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
}
|
class class_name[name] begin[{]
method[registerMessageListener, return_type[void], modifier[public], parameter[messageListenerDefinition]] begin[{]
call[.checkNotNull, parameter[member[.messageListenerDefinition]]]
local_variable[type[ConnectionDefinition], connectionDefinition]
if[binary_operation[call[connectionDefinition.isJeeMode, parameter[]], &&, binary_operation[call[messageListenerDefinition.getPoller, parameter[]], ==, literal[null]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=MESSAGE_POLLER_REQUIRED_IN_JEE_MODE, postfix_operators=[], prefix_operators=[], qualifier=JmsErrorCode, selectors=[])], member=createNew, postfix_operators=[], prefix_operators=[], qualifier=SeedException, selectors=[MethodInvocation(arguments=[MemberReference(member=ERROR_CONNECTION_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=connectionDefinition, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ERROR_MESSAGE_LISTENER_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=messageListenerDefinition, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=messageListenerDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createMessageConsumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UNABLE_TO_CREATE_MESSAGE_CONSUMER, postfix_operators=[], prefix_operators=[], qualifier=JmsErrorCode, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=SeedException, selectors=[MethodInvocation(arguments=[MemberReference(member=ERROR_MESSAGE_LISTENER_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=messageListenerDefinition, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JMSException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[messageListenerDefinitions.putIfAbsent, parameter[call[messageListenerDefinition.getName, parameter[]], member[.messageListenerDefinition]]], !=, literal[null]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=DUPLICATE_MESSAGE_LISTENER_NAME, postfix_operators=[], prefix_operators=[], qualifier=JmsErrorCode, selectors=[])], member=createNew, postfix_operators=[], prefix_operators=[], qualifier=SeedException, selectors=[MethodInvocation(arguments=[MemberReference(member=ERROR_MESSAGE_LISTENER_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=messageListenerDefinition, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[registerMessageListener] operator[SEP] identifier[MessageListenerDefinition] identifier[messageListenerDefinition] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[messageListenerDefinition] operator[SEP] operator[SEP] identifier[ConnectionDefinition] identifier[connectionDefinition] operator[=] identifier[connectionDefinitions] operator[SEP] identifier[get] operator[SEP] identifier[messageListenerDefinition] operator[SEP] identifier[getConnectionName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connectionDefinition] operator[SEP] identifier[isJeeMode] operator[SEP] operator[SEP] operator[&&] identifier[messageListenerDefinition] operator[SEP] identifier[getPoller] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] identifier[SeedException] operator[SEP] identifier[createNew] operator[SEP] identifier[JmsErrorCode] operator[SEP] identifier[MESSAGE_POLLER_REQUIRED_IN_JEE_MODE] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ERROR_CONNECTION_NAME] , identifier[connectionDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ERROR_MESSAGE_LISTENER_NAME] , identifier[messageListenerDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[createMessageConsumer] operator[SEP] identifier[messageListenerDefinition] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JMSException] identifier[e] operator[SEP] {
Keyword[throw] identifier[SeedException] operator[SEP] identifier[wrap] operator[SEP] identifier[e] , identifier[JmsErrorCode] operator[SEP] identifier[UNABLE_TO_CREATE_MESSAGE_CONSUMER] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ERROR_MESSAGE_LISTENER_NAME] , identifier[messageListenerDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[messageListenerDefinitions] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[messageListenerDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[messageListenerDefinition] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[throw] identifier[SeedException] operator[SEP] identifier[createNew] operator[SEP] identifier[JmsErrorCode] operator[SEP] identifier[DUPLICATE_MESSAGE_LISTENER_NAME] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[ERROR_MESSAGE_LISTENER_NAME] , identifier[messageListenerDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPositionRange(
String field, int docId, List<String> prefixes, int startPosition,
int endPosition) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
if (doc != null) {
ArrayList<MtasTreeHit<?>> hitItems = CodecSearchTree.searchMtasTree(
startPosition, endPosition, inIndexObjectPosition,
doc.fpIndexObjectPosition, doc.smallestObjectFilepointer);
List<MtasTreeHit<String>> hits = new ArrayList<>();
Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes);
if (prefixIds != null && prefixIds.size() > 0) {
ArrayList<MtasTreeHit<?>> filteredHitItems = new ArrayList<MtasTreeHit<?>>();
for (MtasTreeHit<?> hitItem : hitItems) {
if (prefixIds.containsValue(hitItem.additionalId)) {
filteredHitItems.add(hitItem);
}
}
if (filteredHitItems.size() > 0) {
ArrayList<MtasTokenString> objects = getObjects(filteredHitItems);
for (MtasTokenString token : objects) {
MtasTreeHit<String> hit = new MtasTreeHit<String>(
token.getPositionStart(), token.getPositionEnd(),
token.getTokenRef(), 0, 0, token.getValue());
hits.add(hit);
}
}
}
return hits;
} else {
return new ArrayList<MtasTreeHit<String>>();
}
}
|
class class_name[name] begin[{]
method[getPositionedTermsByPrefixesAndPositionRange, return_type[type[List]], modifier[public], parameter[field, docId, prefixes, startPosition, endPosition]] begin[{]
local_variable[type[IndexDoc], doc]
local_variable[type[IndexInput], inIndexObjectPosition]
if[binary_operation[member[.doc], !=, literal[null]]] begin[{]
local_variable[type[ArrayList], hitItems]
local_variable[type[List], hits]
local_variable[type[Map], prefixIds]
if[binary_operation[binary_operation[member[.prefixIds], !=, literal[null]], &&, binary_operation[call[prefixIds.size, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[ArrayList], filteredHitItems]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=additionalId, postfix_operators=[], prefix_operators=[], qualifier=hitItem, selectors=[])], member=containsValue, postfix_operators=[], prefix_operators=[], qualifier=prefixIds, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hitItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=filteredHitItems, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=hitItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=hitItem)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=MtasTreeHit, sub_type=None))), label=None)
if[binary_operation[call[filteredHitItems.size, parameter[]], >, literal[0]]] begin[{]
local_variable[type[ArrayList], objects]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPositionStart, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPositionEnd, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTokenRef, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=token, 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=String, sub_type=None))], dimensions=None, name=MtasTreeHit, sub_type=None)), name=hit)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=MtasTreeHit, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=hits, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=objects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=token)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MtasTokenString, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.hits]]
else begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=MtasTreeHit, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[MtasTreeHit] operator[<] identifier[String] operator[>] operator[>] identifier[getPositionedTermsByPrefixesAndPositionRange] operator[SEP] identifier[String] identifier[field] , Keyword[int] identifier[docId] , identifier[List] operator[<] identifier[String] operator[>] identifier[prefixes] , Keyword[int] identifier[startPosition] , Keyword[int] identifier[endPosition] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[IndexDoc] identifier[doc] operator[=] identifier[getDoc] operator[SEP] identifier[field] , identifier[docId] operator[SEP] operator[SEP] identifier[IndexInput] identifier[inIndexObjectPosition] operator[=] identifier[indexInputList] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[doc] operator[!=] Other[null] operator[SEP] {
identifier[ArrayList] operator[<] identifier[MtasTreeHit] operator[<] operator[?] operator[>] operator[>] identifier[hitItems] operator[=] identifier[CodecSearchTree] operator[SEP] identifier[searchMtasTree] operator[SEP] identifier[startPosition] , identifier[endPosition] , identifier[inIndexObjectPosition] , identifier[doc] operator[SEP] identifier[fpIndexObjectPosition] , identifier[doc] operator[SEP] identifier[smallestObjectFilepointer] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[MtasTreeHit] operator[<] identifier[String] operator[>] operator[>] identifier[hits] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[prefixIds] operator[=] identifier[getPrefixesIds] operator[SEP] identifier[field] , identifier[prefixes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prefixIds] operator[!=] Other[null] operator[&&] identifier[prefixIds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[ArrayList] operator[<] identifier[MtasTreeHit] operator[<] operator[?] operator[>] operator[>] identifier[filteredHitItems] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MtasTreeHit] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MtasTreeHit] operator[<] operator[?] operator[>] identifier[hitItem] operator[:] identifier[hitItems] operator[SEP] {
Keyword[if] operator[SEP] identifier[prefixIds] operator[SEP] identifier[containsValue] operator[SEP] identifier[hitItem] operator[SEP] identifier[additionalId] operator[SEP] operator[SEP] {
identifier[filteredHitItems] operator[SEP] identifier[add] operator[SEP] identifier[hitItem] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[filteredHitItems] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[ArrayList] operator[<] identifier[MtasTokenString] operator[>] identifier[objects] operator[=] identifier[getObjects] operator[SEP] identifier[filteredHitItems] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MtasTokenString] identifier[token] operator[:] identifier[objects] operator[SEP] {
identifier[MtasTreeHit] operator[<] identifier[String] operator[>] identifier[hit] operator[=] Keyword[new] identifier[MtasTreeHit] operator[<] identifier[String] operator[>] operator[SEP] identifier[token] operator[SEP] identifier[getPositionStart] operator[SEP] operator[SEP] , identifier[token] operator[SEP] identifier[getPositionEnd] operator[SEP] operator[SEP] , identifier[token] operator[SEP] identifier[getTokenRef] operator[SEP] operator[SEP] , Other[0] , Other[0] , identifier[token] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[hits] operator[SEP] identifier[add] operator[SEP] identifier[hit] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[hits] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] identifier[MtasTreeHit] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public TransactionInfoBaseMessage nextTask() throws IOException {
if (!hasMoreEntries()) {
return null;
}
ByteBuffer bb = m_container.b();
int position = bb.position();
int length = bb.getInt();
long sourceHSId = bb.getLong();
VoltDbMessageFactory factory = new VoltDbMessageFactory();
/*
* create a new buffer that just contains the message, deserialization
* of the messsage may assert on the capacity of the buffer
*/
final int oldLimit = bb.limit();
bb.limit(bb.position() + length);
ByteBuffer slice = bb.slice();
bb.limit(oldLimit);
VoltMessage msg = factory.createMessageFromBuffer(slice, sourceHSId);
// createMessageFromBuffer() doesn't move the position pointer, set it here
bb.position(position + length + 8 + 4); // sourceHSId + buf len
return (TransactionInfoBaseMessage) msg;
}
|
class class_name[name] begin[{]
method[nextTask, return_type[type[TransactionInfoBaseMessage]], modifier[public], parameter[]] begin[{]
if[call[.hasMoreEntries, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ByteBuffer], bb]
local_variable[type[int], position]
local_variable[type[int], length]
local_variable[type[long], sourceHSId]
local_variable[type[VoltDbMessageFactory], factory]
local_variable[type[int], oldLimit]
call[bb.limit, parameter[binary_operation[call[bb.position, parameter[]], +, member[.length]]]]
local_variable[type[ByteBuffer], slice]
call[bb.limit, parameter[member[.oldLimit]]]
local_variable[type[VoltMessage], msg]
call[bb.position, parameter[binary_operation[binary_operation[binary_operation[member[.position], +, member[.length]], +, literal[8]], +, literal[4]]]]
return[Cast(expression=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TransactionInfoBaseMessage, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[TransactionInfoBaseMessage] identifier[nextTask] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[hasMoreEntries] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[ByteBuffer] identifier[bb] operator[=] identifier[m_container] operator[SEP] identifier[b] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[position] operator[=] identifier[bb] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[length] operator[=] identifier[bb] operator[SEP] identifier[getInt] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[sourceHSId] operator[=] identifier[bb] operator[SEP] identifier[getLong] operator[SEP] operator[SEP] operator[SEP] identifier[VoltDbMessageFactory] identifier[factory] operator[=] Keyword[new] identifier[VoltDbMessageFactory] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[oldLimit] operator[=] identifier[bb] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[SEP] identifier[bb] operator[SEP] identifier[limit] operator[SEP] identifier[bb] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[length] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[slice] operator[=] identifier[bb] operator[SEP] identifier[slice] operator[SEP] operator[SEP] operator[SEP] identifier[bb] operator[SEP] identifier[limit] operator[SEP] identifier[oldLimit] operator[SEP] operator[SEP] identifier[VoltMessage] identifier[msg] operator[=] identifier[factory] operator[SEP] identifier[createMessageFromBuffer] operator[SEP] identifier[slice] , identifier[sourceHSId] operator[SEP] operator[SEP] identifier[bb] operator[SEP] identifier[position] operator[SEP] identifier[position] operator[+] identifier[length] operator[+] Other[8] operator[+] Other[4] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[TransactionInfoBaseMessage] operator[SEP] identifier[msg] operator[SEP]
}
|
private long getSpaceCount(ContentStore store, String spaceId)
throws ContentStoreException {
SpaceStatsDTOList stats =
store.getSpaceStats(spaceId, new Date(System.currentTimeMillis() - (24 * 60 * 60 * 1000)), new Date());
long count = 0;
if (stats != null && stats.size() > 0) {
count = stats.getLast().getObjectCount();
}
return count;
}
|
class class_name[name] begin[{]
method[getSpaceCount, return_type[type[long]], modifier[private], parameter[store, spaceId]] begin[{]
local_variable[type[SpaceStatsDTOList], stats]
local_variable[type[long], count]
if[binary_operation[binary_operation[member[.stats], !=, literal[null]], &&, binary_operation[call[stats.size, parameter[]], >, literal[0]]]] begin[{]
assign[member[.count], call[stats.getLast, parameter[]]]
else begin[{]
None
end[}]
return[member[.count]]
end[}]
END[}]
|
Keyword[private] Keyword[long] identifier[getSpaceCount] operator[SEP] identifier[ContentStore] identifier[store] , identifier[String] identifier[spaceId] operator[SEP] Keyword[throws] identifier[ContentStoreException] {
identifier[SpaceStatsDTOList] identifier[stats] operator[=] identifier[store] operator[SEP] identifier[getSpaceStats] operator[SEP] identifier[spaceId] , Keyword[new] identifier[Date] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] operator[SEP] Other[24] operator[*] Other[60] operator[*] Other[60] operator[*] Other[1000] operator[SEP] operator[SEP] , Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[count] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[stats] operator[!=] Other[null] operator[&&] identifier[stats] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[count] operator[=] identifier[stats] operator[SEP] identifier[getLast] operator[SEP] operator[SEP] operator[SEP] identifier[getObjectCount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
@Override
public ExtensionProcessor createExtensionProcessor(IServletContext webapp) throws Exception {
ExtensionFactory delegate = this.delegate;
if (delegate != null)
return delegate.createExtensionProcessor(webapp);
return null;
}
|
class class_name[name] begin[{]
method[createExtensionProcessor, return_type[type[ExtensionProcessor]], modifier[public], parameter[webapp]] begin[{]
local_variable[type[ExtensionFactory], delegate]
if[binary_operation[member[.delegate], !=, literal[null]]] begin[{]
return[call[delegate.createExtensionProcessor, parameter[member[.webapp]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ExtensionProcessor] identifier[createExtensionProcessor] operator[SEP] identifier[IServletContext] identifier[webapp] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ExtensionFactory] identifier[delegate] operator[=] Keyword[this] operator[SEP] identifier[delegate] operator[SEP] Keyword[if] operator[SEP] identifier[delegate] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[delegate] operator[SEP] identifier[createExtensionProcessor] operator[SEP] identifier[webapp] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public static String lookupParameterValue(String key, String string) {
Pattern p = Pattern.compile("\\[" + key + "=[^\\]]*\\]");
Matcher m = p.matcher(string);
m.find();
String f = m.group();
int p1 = f.indexOf('=');
int p2 = f.indexOf(']');
return f.substring(p1+1, p2);
}
|
class class_name[name] begin[{]
method[lookupParameterValue, return_type[type[String]], modifier[public static], parameter[key, string]] begin[{]
local_variable[type[Pattern], p]
local_variable[type[Matcher], m]
call[m.find, parameter[]]
local_variable[type[String], f]
local_variable[type[int], p1]
local_variable[type[int], p2]
return[call[f.substring, parameter[binary_operation[member[.p1], +, literal[1]], member[.p2]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[lookupParameterValue] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[string] operator[SEP] {
identifier[Pattern] identifier[p] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[SEP] operator[SEP] identifier[Matcher] identifier[m] operator[=] identifier[p] operator[SEP] identifier[matcher] operator[SEP] identifier[string] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[f] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[p1] operator[=] identifier[f] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[p2] operator[=] identifier[f] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP] identifier[substring] operator[SEP] identifier[p1] operator[+] Other[1] , identifier[p2] operator[SEP] operator[SEP]
}
|
private static Object invokeDefaultMethodUsingPrivateLookup(Class<?> declaringClass, Object o, Method m,
Object[] params) throws WrappedException, NoSuchMethodException {
try {
final Method privateLookup = MethodHandles
.class
.getDeclaredMethod("privateLookupIn", Class.class, MethodHandles.Lookup.class);
return ((MethodHandles.Lookup)privateLookup
.invoke(null, declaringClass, MethodHandles.lookup()))
.unreflectSpecial(m, declaringClass)
.bindTo(o)
.invokeWithArguments(params);
} catch (NoSuchMethodException t) {
throw t;
} catch (Throwable t) {
throw new WrappedException(t);
}
}
|
class class_name[name] begin[{]
method[invokeDefaultMethodUsingPrivateLookup, return_type[type[Object]], modifier[private static], parameter[declaringClass, o, m, params]] 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="privateLookupIn"), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=MethodHandles, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Lookup, sub_type=None))], member=getDeclaredMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=MethodHandles, sub_type=None)), name=privateLookup)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None)), ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=declaringClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=lookup, postfix_operators=[], prefix_operators=[], qualifier=MethodHandles, selectors=[], type_arguments=None)], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=privateLookup, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MethodHandles, sub_type=ReferenceType(arguments=None, dimensions=None, name=Lookup, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['NoSuchMethodException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WrappedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Object] identifier[invokeDefaultMethodUsingPrivateLookup] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[declaringClass] , identifier[Object] identifier[o] , identifier[Method] identifier[m] , identifier[Object] operator[SEP] operator[SEP] identifier[params] operator[SEP] Keyword[throws] identifier[WrappedException] , identifier[NoSuchMethodException] {
Keyword[try] {
Keyword[final] identifier[Method] identifier[privateLookup] operator[=] identifier[MethodHandles] operator[SEP] Keyword[class] operator[SEP] identifier[getDeclaredMethod] operator[SEP] literal[String] , identifier[Class] operator[SEP] Keyword[class] , identifier[MethodHandles] operator[SEP] identifier[Lookup] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[MethodHandles] operator[SEP] identifier[Lookup] operator[SEP] identifier[privateLookup] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[declaringClass] , identifier[MethodHandles] operator[SEP] identifier[lookup] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[unreflectSpecial] operator[SEP] identifier[m] , identifier[declaringClass] operator[SEP] operator[SEP] identifier[bindTo] operator[SEP] identifier[o] operator[SEP] operator[SEP] identifier[invokeWithArguments] operator[SEP] identifier[params] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[t] operator[SEP] {
Keyword[throw] identifier[t] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WrappedException] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
|
@Implementation
protected boolean isActiveNetworkMetered() {
if (defaultNetworkActive && activeNetworkInfo != null) {
return activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE;
} else {
return false;
}
}
|
class class_name[name] begin[{]
method[isActiveNetworkMetered, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.defaultNetworkActive], &&, binary_operation[member[.activeNetworkInfo], !=, literal[null]]]] begin[{]
return[binary_operation[call[activeNetworkInfo.getType, parameter[]], ==, member[ConnectivityManager.TYPE_MOBILE]]]
else begin[{]
return[literal[false]]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Implementation] Keyword[protected] Keyword[boolean] identifier[isActiveNetworkMetered] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[defaultNetworkActive] operator[&&] identifier[activeNetworkInfo] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[activeNetworkInfo] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[ConnectivityManager] operator[SEP] identifier[TYPE_MOBILE] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public synchronized InputStreamHandle executeSelect(SPARQLQueryDefinition qdef,
InputStreamHandle handle, Long offset, Long limit) {
if (limit == null) {
this.sparqlQueryManager.clearPageLength();
} else {
this.sparqlQueryManager.setPageLength(limit);
}
if (offset != null) {
return this.sparqlQueryManager.executeSelect(qdef, handle, offset,
currentTransaction);
} else {
return this.sparqlQueryManager.executeSelect(qdef, handle,
currentTransaction);
}
}
|
class class_name[name] begin[{]
method[executeSelect, return_type[type[InputStreamHandle]], modifier[synchronized public], parameter[qdef, handle, offset, limit]] begin[{]
if[binary_operation[member[.limit], ==, literal[null]]] begin[{]
THIS[member[None.sparqlQueryManager]call[None.clearPageLength, parameter[]]]
else begin[{]
THIS[member[None.sparqlQueryManager]call[None.setPageLength, parameter[member[.limit]]]]
end[}]
if[binary_operation[member[.offset], !=, literal[null]]] begin[{]
return[THIS[member[None.sparqlQueryManager]call[None.executeSelect, parameter[member[.qdef], member[.handle], member[.offset], member[.currentTransaction]]]]]
else begin[{]
return[THIS[member[None.sparqlQueryManager]call[None.executeSelect, parameter[member[.qdef], member[.handle], member[.currentTransaction]]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] identifier[InputStreamHandle] identifier[executeSelect] operator[SEP] identifier[SPARQLQueryDefinition] identifier[qdef] , identifier[InputStreamHandle] identifier[handle] , identifier[Long] identifier[offset] , identifier[Long] identifier[limit] operator[SEP] {
Keyword[if] operator[SEP] identifier[limit] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[sparqlQueryManager] operator[SEP] identifier[clearPageLength] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[sparqlQueryManager] operator[SEP] identifier[setPageLength] operator[SEP] identifier[limit] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[offset] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[sparqlQueryManager] operator[SEP] identifier[executeSelect] operator[SEP] identifier[qdef] , identifier[handle] , identifier[offset] , identifier[currentTransaction] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP] identifier[sparqlQueryManager] operator[SEP] identifier[executeSelect] operator[SEP] identifier[qdef] , identifier[handle] , identifier[currentTransaction] operator[SEP] operator[SEP]
}
}
|
private void destroyProcessors() throws Exception {
for (final ResourcePreProcessor processor : processorsFactory.getPreProcessors()) {
if (processor instanceof Destroyable) {
((Destroyable) processor).destroy();
}
}
for (final ResourcePostProcessor processor : processorsFactory.getPostProcessors()) {
if (processor instanceof Destroyable) {
((Destroyable) processor).destroy();
}
}
}
|
class class_name[name] begin[{]
method[destroyProcessors, return_type[void], modifier[private], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Destroyable, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Destroyable, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPreProcessors, postfix_operators=[], prefix_operators=[], qualifier=processorsFactory, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=processor)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ResourcePreProcessor, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Destroyable, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Destroyable, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPostProcessors, postfix_operators=[], prefix_operators=[], qualifier=processorsFactory, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=processor)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ResourcePostProcessor, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[destroyProcessors] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[for] operator[SEP] Keyword[final] identifier[ResourcePreProcessor] identifier[processor] operator[:] identifier[processorsFactory] operator[SEP] identifier[getPreProcessors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[processor] Keyword[instanceof] identifier[Destroyable] operator[SEP] {
operator[SEP] operator[SEP] identifier[Destroyable] operator[SEP] identifier[processor] operator[SEP] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[final] identifier[ResourcePostProcessor] identifier[processor] operator[:] identifier[processorsFactory] operator[SEP] identifier[getPostProcessors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[processor] Keyword[instanceof] identifier[Destroyable] operator[SEP] {
operator[SEP] operator[SEP] identifier[Destroyable] operator[SEP] identifier[processor] operator[SEP] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public void getKey(int keyIndex, Quaternionf q)
{
int index = keyIndex * mFloatsPerKey;
q.x = mKeys[index + 1];
q.y = mKeys[index + 2];
q.z = mKeys[index + 3];
q.w = mKeys[index + 4];
}
|
class class_name[name] begin[{]
method[getKey, return_type[void], modifier[public], parameter[keyIndex, q]] begin[{]
local_variable[type[int], index]
assign[member[q.x], member[.mKeys]]
assign[member[q.y], member[.mKeys]]
assign[member[q.z], member[.mKeys]]
assign[member[q.w], member[.mKeys]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[getKey] operator[SEP] Keyword[int] identifier[keyIndex] , identifier[Quaternionf] identifier[q] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[keyIndex] operator[*] identifier[mFloatsPerKey] operator[SEP] identifier[q] operator[SEP] identifier[x] operator[=] identifier[mKeys] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] identifier[q] operator[SEP] identifier[y] operator[=] identifier[mKeys] operator[SEP] identifier[index] operator[+] Other[2] operator[SEP] operator[SEP] identifier[q] operator[SEP] identifier[z] operator[=] identifier[mKeys] operator[SEP] identifier[index] operator[+] Other[3] operator[SEP] operator[SEP] identifier[q] operator[SEP] identifier[w] operator[=] identifier[mKeys] operator[SEP] identifier[index] operator[+] Other[4] operator[SEP] operator[SEP]
}
|
protected Example doFilter( Example example )
{
for (Example table = example.nextSibling(); table != null; table = table.nextSibling())
{
if (END_INFO.equalsIgnoreCase( contentOf( table.at( 0, 0, 0 ) ) )) return table.nextSibling();
}
return null;
}
|
class class_name[name] begin[{]
method[doFilter, return_type[type[Example]], modifier[protected], parameter[example]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=at, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None)], member=contentOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=END_INFO, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MethodInvocation(arguments=[], member=nextSibling, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=nextSibling, postfix_operators=[], prefix_operators=[], qualifier=example, selectors=[], type_arguments=None), name=table)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Example, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextSibling, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None))]), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[protected] identifier[Example] identifier[doFilter] operator[SEP] identifier[Example] identifier[example] operator[SEP] {
Keyword[for] operator[SEP] identifier[Example] identifier[table] operator[=] identifier[example] operator[SEP] identifier[nextSibling] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[!=] Other[null] operator[SEP] identifier[table] operator[=] identifier[table] operator[SEP] identifier[nextSibling] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[END_INFO] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[contentOf] operator[SEP] identifier[table] operator[SEP] identifier[at] operator[SEP] Other[0] , Other[0] , Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[table] operator[SEP] identifier[nextSibling] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
private FastRequestHandler verifyBase(URL baseUrl, String baseSupplied) {
if (null == baseUrl) {
if ("META-INF/resources/webjars".equalsIgnoreCase(baseSupplied)) {
// webjars not provided, just ignore it.
} else {
logger.warn("URL base not exists: " + baseSupplied);
}
return AlwaysNotFound.INSTANCE;
}
return null;
}
|
class class_name[name] begin[{]
method[verifyBase, return_type[type[FastRequestHandler]], modifier[private], parameter[baseUrl, baseSupplied]] begin[{]
if[binary_operation[literal[null], ==, member[.baseUrl]]] begin[{]
if[literal["META-INF/resources/webjars"]] begin[{]
else begin[{]
call[logger.warn, parameter[binary_operation[literal["URL base not exists: "], +, member[.baseSupplied]]]]
end[}]
return[member[AlwaysNotFound.INSTANCE]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[private] identifier[FastRequestHandler] identifier[verifyBase] operator[SEP] identifier[URL] identifier[baseUrl] , identifier[String] identifier[baseSupplied] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[baseUrl] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[baseSupplied] operator[SEP] operator[SEP] {
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[baseSupplied] operator[SEP] operator[SEP]
}
Keyword[return] identifier[AlwaysNotFound] operator[SEP] identifier[INSTANCE] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
void addDriver(String name, String path, int slot, int slotListIndex) {
names.add(name);
paths.add(path);
slots.add(slot);
slotListIndexes.add(slotListIndex);
updateConfiguration();
}
|
class class_name[name] begin[{]
method[addDriver, return_type[void], modifier[default], parameter[name, path, slot, slotListIndex]] begin[{]
call[names.add, parameter[member[.name]]]
call[paths.add, parameter[member[.path]]]
call[slots.add, parameter[member[.slot]]]
call[slotListIndexes.add, parameter[member[.slotListIndex]]]
call[.updateConfiguration, parameter[]]
end[}]
END[}]
|
Keyword[void] identifier[addDriver] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[path] , Keyword[int] identifier[slot] , Keyword[int] identifier[slotListIndex] operator[SEP] {
identifier[names] operator[SEP] identifier[add] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[paths] operator[SEP] identifier[add] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[slots] operator[SEP] identifier[add] operator[SEP] identifier[slot] operator[SEP] operator[SEP] identifier[slotListIndexes] operator[SEP] identifier[add] operator[SEP] identifier[slotListIndex] operator[SEP] operator[SEP] identifier[updateConfiguration] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void write(List<? extends SnapshotContentItem> items) throws Exception {
for (SnapshotContentItem item : items) {
Map<String, String> props = PropertiesSerializer.deserialize(item.getMetadata());
String contentId = item.getContentId();
String checksum = props.get(ContentStore.CONTENT_CHECKSUM);
// verify that manifest contains every item from the database except
// SNAPSHOT_PROPS_FILENAME
if (!contentId.equals(Constants.SNAPSHOT_PROPS_FILENAME)) {
if (!this.manifestSet.contains(ManifestFileHelper.formatManifestSetString(contentId, checksum))) {
addError(MessageFormat.format("Content item {0} with checksum {1} not found in manifest "
+ "for snapshot {2}", contentId, checksum, this.snapshotName));
}
}
}
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[items]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMetadata, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=deserialize, postfix_operators=[], prefix_operators=[], qualifier=PropertiesSerializer, selectors=[], type_arguments=None), name=props)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentId, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=contentId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=CONTENT_CHECKSUM, postfix_operators=[], prefix_operators=[], qualifier=ContentStore, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), name=checksum)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=SNAPSHOT_PROPS_FILENAME, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=contentId, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=This(postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MemberReference(member=manifestSet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=contentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=checksum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=formatManifestSetString, postfix_operators=[], prefix_operators=[], qualifier=ManifestFileHelper, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Content item {0} with checksum {1} not found in manifest "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="for snapshot {2}"), operator=+), MemberReference(member=contentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=checksum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=snapshotName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=format, postfix_operators=[], prefix_operators=[], qualifier=MessageFormat, selectors=[], type_arguments=None)], member=addError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SnapshotContentItem, sub_type=None))), label=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[SnapshotContentItem] operator[>] identifier[items] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[for] operator[SEP] identifier[SnapshotContentItem] identifier[item] operator[:] identifier[items] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[props] operator[=] identifier[PropertiesSerializer] operator[SEP] identifier[deserialize] operator[SEP] identifier[item] operator[SEP] identifier[getMetadata] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[contentId] operator[=] identifier[item] operator[SEP] identifier[getContentId] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[checksum] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[ContentStore] operator[SEP] identifier[CONTENT_CHECKSUM] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[contentId] operator[SEP] identifier[equals] operator[SEP] identifier[Constants] operator[SEP] identifier[SNAPSHOT_PROPS_FILENAME] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[manifestSet] operator[SEP] identifier[contains] operator[SEP] identifier[ManifestFileHelper] operator[SEP] identifier[formatManifestSetString] operator[SEP] identifier[contentId] , identifier[checksum] operator[SEP] operator[SEP] operator[SEP] {
identifier[addError] operator[SEP] identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] , identifier[contentId] , identifier[checksum] , Keyword[this] operator[SEP] identifier[snapshotName] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public void moveChildView(View pChildView, float pScale_Left, float pScale_Top) {
ScalableLayout.LayoutParams lSLLP = getChildLayoutParams(pChildView);
lSLLP.mScale_Left = pScale_Left;
lSLLP.mScale_Top = pScale_Top;
postInvalidate();
}
|
class class_name[name] begin[{]
method[moveChildView, return_type[void], modifier[public], parameter[pChildView, pScale_Left, pScale_Top]] begin[{]
local_variable[type[ScalableLayout], lSLLP]
assign[member[lSLLP.mScale_Left], member[.pScale_Left]]
assign[member[lSLLP.mScale_Top], member[.pScale_Top]]
call[.postInvalidate, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[moveChildView] operator[SEP] identifier[View] identifier[pChildView] , Keyword[float] identifier[pScale_Left] , Keyword[float] identifier[pScale_Top] operator[SEP] {
identifier[ScalableLayout] operator[SEP] identifier[LayoutParams] identifier[lSLLP] operator[=] identifier[getChildLayoutParams] operator[SEP] identifier[pChildView] operator[SEP] operator[SEP] identifier[lSLLP] operator[SEP] identifier[mScale_Left] operator[=] identifier[pScale_Left] operator[SEP] identifier[lSLLP] operator[SEP] identifier[mScale_Top] operator[=] identifier[pScale_Top] operator[SEP] identifier[postInvalidate] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {
// by OSGi JNDI spec Name and Context should be null
// if they are not then this code is being called in
// the wrong way
if (n != null || c != null)
return null;
// Object is String, String[] or null
// Hashtable contains any environment properties
if (o == null) {
return new JavaURLContext(envmt, helperServices);
} else if (o instanceof String) {
return new JavaURLContext(envmt, helperServices).lookup((String) o);
} else {
throw new OperationNotSupportedException();
}
}
|
class class_name[name] begin[{]
method[getObjectInstance, return_type[type[Object]], modifier[public], parameter[o, n, c, envmt]] begin[{]
if[binary_operation[binary_operation[member[.n], !=, literal[null]], ||, binary_operation[member[.c], !=, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.o], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=envmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=helperServices, 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=JavaURLContext, sub_type=None))]
else begin[{]
if[binary_operation[member[.o], instanceof, type[String]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=envmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=helperServices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=lookup, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JavaURLContext, sub_type=None))]
else 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=OperationNotSupportedException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[getObjectInstance] operator[SEP] identifier[Object] identifier[o] , identifier[Name] identifier[n] , identifier[Context] identifier[c] , identifier[Hashtable] operator[<] operator[?] , operator[?] operator[>] identifier[envmt] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[n] operator[!=] Other[null] operator[||] identifier[c] operator[!=] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[JavaURLContext] operator[SEP] identifier[envmt] , identifier[helperServices] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] Keyword[new] identifier[JavaURLContext] operator[SEP] identifier[envmt] , identifier[helperServices] operator[SEP] operator[SEP] identifier[lookup] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[OperationNotSupportedException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String generateHELMFromFastaPeptide(String notation)
throws FastaFormatException, MonomerLoadingException, ChemistryException {
String result = FastaFormat.generatePeptidePolymersFromFASTAFormatHELM1(notation).toHELM2();
setMonomerFactoryToDefault(notation);
return result;
}
|
class class_name[name] begin[{]
method[generateHELMFromFastaPeptide, return_type[type[String]], modifier[public], parameter[notation]] begin[{]
local_variable[type[String], result]
call[.setMonomerFactoryToDefault, parameter[member[.notation]]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[generateHELMFromFastaPeptide] operator[SEP] identifier[String] identifier[notation] operator[SEP] Keyword[throws] identifier[FastaFormatException] , identifier[MonomerLoadingException] , identifier[ChemistryException] {
identifier[String] identifier[result] operator[=] identifier[FastaFormat] operator[SEP] identifier[generatePeptidePolymersFromFASTAFormatHELM1] operator[SEP] identifier[notation] operator[SEP] operator[SEP] identifier[toHELM2] operator[SEP] operator[SEP] operator[SEP] identifier[setMonomerFactoryToDefault] operator[SEP] identifier[notation] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public CRCResourceManagementFmtQual createCRCResourceManagementFmtQualFromString(EDataType eDataType, String initialValue) {
CRCResourceManagementFmtQual result = CRCResourceManagementFmtQual.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
|
class class_name[name] begin[{]
method[createCRCResourceManagementFmtQualFromString, return_type[type[CRCResourceManagementFmtQual]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[CRCResourceManagementFmtQual], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[CRCResourceManagementFmtQual] identifier[createCRCResourceManagementFmtQualFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[CRCResourceManagementFmtQual] identifier[result] operator[=] identifier[CRCResourceManagementFmtQual] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private static boolean isTokenNtlm(final byte[] token) {
if (token == null || token.length < NTLM_TOKEN_MAX_LENGTH) {
return false;
}
return IntStream.range(0, NTLM_TOKEN_MAX_LENGTH).noneMatch(i -> NTLMSSP_SIGNATURE[i] != token[i]);
}
|
class class_name[name] begin[{]
method[isTokenNtlm, return_type[type[boolean]], modifier[private static], parameter[token]] begin[{]
if[binary_operation[binary_operation[member[.token], ==, literal[null]], ||, binary_operation[member[token.length], <, member[.NTLM_TOKEN_MAX_LENGTH]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[IntStream.range, parameter[literal[0], member[.NTLM_TOKEN_MAX_LENGTH]]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[isTokenNtlm] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[token] operator[SEP] {
Keyword[if] operator[SEP] identifier[token] operator[==] Other[null] operator[||] identifier[token] operator[SEP] identifier[length] operator[<] identifier[NTLM_TOKEN_MAX_LENGTH] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[NTLM_TOKEN_MAX_LENGTH] operator[SEP] operator[SEP] identifier[noneMatch] operator[SEP] identifier[i] operator[->] identifier[NTLMSSP_SIGNATURE] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[token] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
|
public int getMaximumNumberOfInstances(final InstanceType instanceType) {
final Integer val = this.maximumMap.get(instanceType);
if (val != null) {
return val.intValue();
}
return 0;
}
|
class class_name[name] begin[{]
method[getMaximumNumberOfInstances, return_type[type[int]], modifier[public], parameter[instanceType]] begin[{]
local_variable[type[Integer], val]
if[binary_operation[member[.val], !=, literal[null]]] begin[{]
return[call[val.intValue, parameter[]]]
else begin[{]
None
end[}]
return[literal[0]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getMaximumNumberOfInstances] operator[SEP] Keyword[final] identifier[InstanceType] identifier[instanceType] operator[SEP] {
Keyword[final] identifier[Integer] identifier[val] operator[=] Keyword[this] operator[SEP] identifier[maximumMap] operator[SEP] identifier[get] operator[SEP] identifier[instanceType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[val] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[0] operator[SEP]
}
|
private static void longToByteArray(long l, byte[] ba, int offset) {
for (int i = 0; i < SIZE_OF_LONG; ++i) {
final int shift = i << 3; // i * 8
ba[offset + SIZE_OF_LONG - 1 - i] = (byte) ((l & (0xffL << shift)) >>> shift);
}
}
|
class class_name[name] begin[{]
method[longToByteArray, return_type[void], modifier[private static], parameter[l, ba, offset]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=<<), name=shift)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ba, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SIZE_OF_LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-))]), type==, value=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xffL), operandr=MemberReference(member=shift, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<<), operator=&), operandr=MemberReference(member=shift, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>>>), type=BasicType(dimensions=[], name=byte))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SIZE_OF_LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[longToByteArray] operator[SEP] Keyword[long] identifier[l] , Keyword[byte] operator[SEP] operator[SEP] identifier[ba] , Keyword[int] identifier[offset] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[SIZE_OF_LONG] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[final] Keyword[int] identifier[shift] operator[=] identifier[i] operator[<<] Other[3] operator[SEP] identifier[ba] operator[SEP] identifier[offset] operator[+] identifier[SIZE_OF_LONG] operator[-] Other[1] operator[-] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[l] operator[&] operator[SEP] literal[Integer] operator[<<] identifier[shift] operator[SEP] operator[SEP] operator[>] operator[>] operator[>] identifier[shift] operator[SEP] operator[SEP]
}
}
|
public ByteArrayOutputStream toJSON() throws IOException
{
final ByteArrayOutputStream out = new ByteArrayOutputStream();
mapper.writeValue(out, this);
return out;
}
|
class class_name[name] begin[{]
method[toJSON, return_type[type[ByteArrayOutputStream]], modifier[public], parameter[]] begin[{]
local_variable[type[ByteArrayOutputStream], out]
call[mapper.writeValue, parameter[member[.out], THIS[]]]
return[member[.out]]
end[}]
END[}]
|
Keyword[public] identifier[ByteArrayOutputStream] identifier[toJSON] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[ByteArrayOutputStream] identifier[out] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[mapper] operator[SEP] identifier[writeValue] operator[SEP] identifier[out] , Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
|
public static int count(String keyword, String srcText)
{
int count = 0;
int leng = srcText.length();
int j = 0;
for (int i = 0; i < leng; i++)
{
if (srcText.charAt(i) == keyword.charAt(j))
{
j++;
if (j == keyword.length())
{
count++;
j = 0;
}
}
else
{
i = i - j;// should rollback when not match
j = 0;
}
}
return count;
}
|
class class_name[name] begin[{]
method[count, return_type[type[int]], modifier[public static], parameter[keyword, srcText]] begin[{]
local_variable[type[int], count]
local_variable[type[int], leng]
local_variable[type[int], j]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=srcText, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=keyword, selectors=[], type_arguments=None), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=keyword, selectors=[], type_arguments=None), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=leng, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.count]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[count] operator[SEP] identifier[String] identifier[keyword] , identifier[String] identifier[srcText] operator[SEP] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[int] identifier[leng] operator[=] identifier[srcText] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[leng] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[srcText] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[keyword] operator[SEP] identifier[charAt] operator[SEP] identifier[j] operator[SEP] operator[SEP] {
identifier[j] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[j] operator[==] identifier[keyword] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[count] operator[++] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP]
}
}
Keyword[else] {
identifier[i] operator[=] identifier[i] operator[-] identifier[j] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP]
}
}
Keyword[return] identifier[count] operator[SEP]
}
|
@Override
public Value get(Object key) {
if (key instanceof String) {
String name = (String) key;
return get(name);
}
return fields.get(key);
}
|
class class_name[name] begin[{]
method[get, return_type[type[Value]], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.key], instanceof, type[String]]] begin[{]
local_variable[type[String], name]
return[call[.get, parameter[member[.name]]]]
else begin[{]
None
end[}]
return[call[fields.get, parameter[member[.key]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Value] identifier[get] operator[SEP] identifier[Object] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[String] identifier[name] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[key] operator[SEP] Keyword[return] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fields] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public void sort ()
{
int size = size();
if (DEBUG_SORT) {
log.info("Sorting dirty item list", "size", size);
}
// if we've only got one item, we need to do no sorting
if (size > 1) {
// get items sorted by increasing origin x-coordinate
_xitems.addAll(_items);
_xitems.sort(ORIGIN_X_COMP);
if (DEBUG_SORT) {
log.info("Sorted by x-origin", "items", toString(_xitems));
}
// get items sorted by increasing origin y-coordinate
_yitems.addAll(_items);
_yitems.sort(ORIGIN_Y_COMP);
if (DEBUG_SORT) {
log.info("Sorted by y-origin", "items", toString(_yitems));
}
// sort the items according to the depth of the rear-most tile
_ditems.addAll(_items);
_ditems.sort(REAR_DEPTH_COMP);
if (DEBUG_SORT) {
log.info("Sorted by rear-depth", "items", toString(_ditems));
}
// now insertion sort the items from back to front into the render-sorted array
_items.clear();
POS_LOOP:
for (int ii = 0; ii < size; ii++) {
DirtyItem item = _ditems.get(ii);
for (int rr = _items.size()-1; rr >= 0; rr--) {
DirtyItem pitem = _items.get(rr);
// if we render in front of this item, insert
// ourselves immediately following it
if (_rcomp.compare(item, pitem) > 0) {
_items.add(rr+1, item);
continue POS_LOOP;
}
}
// we don't render in front of anyone, so we go at the front of the list
_items.add(0, item);
}
// clear out our temporary arrays
_xitems.clear();
_yitems.clear();
_ditems.clear();
}
if (DEBUG_SORT) {
log.info("Sorted for render", "items", toString(_items));
for (int ii = 0, ll = _items.size()-1; ii < ll; ii++) {
DirtyItem a = _items.get(ii);
DirtyItem b = _items.get(ii+1);
if (_rcomp.compare(a, b) > 0) {
log.warning("Invalid ordering", "a", a, "b", b);
}
}
}
}
|
class class_name[name] begin[{]
method[sort, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[int], size]
if[member[.DEBUG_SORT]] begin[{]
call[log.info, parameter[literal["Sorting dirty item list"], literal["size"], member[.size]]]
else begin[{]
None
end[}]
if[binary_operation[member[.size], >, literal[1]]] begin[{]
call[_xitems.addAll, parameter[member[._items]]]
call[_xitems.sort, parameter[member[.ORIGIN_X_COMP]]]
if[member[.DEBUG_SORT]] begin[{]
call[log.info, parameter[literal["Sorted by x-origin"], literal["items"], call[.toString, parameter[member[._xitems]]]]]
else begin[{]
None
end[}]
call[_yitems.addAll, parameter[member[._items]]]
call[_yitems.sort, parameter[member[.ORIGIN_Y_COMP]]]
if[member[.DEBUG_SORT]] begin[{]
call[log.info, parameter[literal["Sorted by y-origin"], literal["items"], call[.toString, parameter[member[._yitems]]]]]
else begin[{]
None
end[}]
call[_ditems.addAll, parameter[member[._items]]]
call[_ditems.sort, parameter[member[.REAR_DEPTH_COMP]]]
if[member[.DEBUG_SORT]] begin[{]
call[log.info, parameter[literal["Sorted by rear-depth"], literal["items"], call[.toString, parameter[member[._ditems]]]]]
else begin[{]
None
end[}]
call[_items.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_ditems, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DirtyItem, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), name=pitem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DirtyItem, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pitem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=_rcomp, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=rr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=POS_LOOP, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=rr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=rr)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=rr, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=POS_LOOP)
call[_xitems.clear, parameter[]]
call[_yitems.clear, parameter[]]
call[_ditems.clear, parameter[]]
else begin[{]
None
end[}]
if[member[.DEBUG_SORT]] begin[{]
call[log.info, parameter[literal["Sorted for render"], literal["items"], call[.toString, parameter[member[._items]]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DirtyItem, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), name=b)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DirtyItem, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=_rcomp, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid ordering"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="a"), MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="b"), MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii), VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_items, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=ll)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[sort] operator[SEP] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_SORT] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , literal[String] , identifier[size] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[size] operator[>] Other[1] operator[SEP] {
identifier[_xitems] operator[SEP] identifier[addAll] operator[SEP] identifier[_items] operator[SEP] operator[SEP] identifier[_xitems] operator[SEP] identifier[sort] operator[SEP] identifier[ORIGIN_X_COMP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_SORT] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , literal[String] , identifier[toString] operator[SEP] identifier[_xitems] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_yitems] operator[SEP] identifier[addAll] operator[SEP] identifier[_items] operator[SEP] operator[SEP] identifier[_yitems] operator[SEP] identifier[sort] operator[SEP] identifier[ORIGIN_Y_COMP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_SORT] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , literal[String] , identifier[toString] operator[SEP] identifier[_yitems] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_ditems] operator[SEP] identifier[addAll] operator[SEP] identifier[_items] operator[SEP] operator[SEP] identifier[_ditems] operator[SEP] identifier[sort] operator[SEP] identifier[REAR_DEPTH_COMP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_SORT] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , literal[String] , identifier[toString] operator[SEP] identifier[_ditems] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_items] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[POS_LOOP] operator[:] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] identifier[ii] operator[<] identifier[size] operator[SEP] identifier[ii] operator[++] operator[SEP] {
identifier[DirtyItem] identifier[item] operator[=] identifier[_ditems] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[rr] operator[=] identifier[_items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[rr] operator[>=] Other[0] operator[SEP] identifier[rr] operator[--] operator[SEP] {
identifier[DirtyItem] identifier[pitem] operator[=] identifier[_items] operator[SEP] identifier[get] operator[SEP] identifier[rr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_rcomp] operator[SEP] identifier[compare] operator[SEP] identifier[item] , identifier[pitem] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[_items] operator[SEP] identifier[add] operator[SEP] identifier[rr] operator[+] Other[1] , identifier[item] operator[SEP] operator[SEP] Keyword[continue] identifier[POS_LOOP] operator[SEP]
}
}
identifier[_items] operator[SEP] identifier[add] operator[SEP] Other[0] , identifier[item] operator[SEP] operator[SEP]
}
identifier[_xitems] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[_yitems] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[_ditems] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[DEBUG_SORT] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , literal[String] , identifier[toString] operator[SEP] identifier[_items] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] , identifier[ll] operator[=] identifier[_items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[ii] operator[<] identifier[ll] operator[SEP] identifier[ii] operator[++] operator[SEP] {
identifier[DirtyItem] identifier[a] operator[=] identifier[_items] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[SEP] operator[SEP] identifier[DirtyItem] identifier[b] operator[=] identifier[_items] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_rcomp] operator[SEP] identifier[compare] operator[SEP] identifier[a] , identifier[b] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] , literal[String] , identifier[a] , literal[String] , identifier[b] operator[SEP] operator[SEP]
}
}
}
}
|
public ByteBuffer read(long offset, int length, ByteBuffer block)
throws IllegalArgumentException, IllegalStateException, IOException {
if (!this.valid) {
throw new IllegalStateException("Attempting to read an " +
"known-to-be invalid piece!");
}
return this._read(offset, length, block);
}
|
class class_name[name] begin[{]
method[read, return_type[type[ByteBuffer]], modifier[public], parameter[offset, length, block]] begin[{]
if[THIS[member[None.valid]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Attempting to read an "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="known-to-be invalid piece!"), 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[THIS[call[None._read, parameter[member[.offset], member[.length], member[.block]]]]]
end[}]
END[}]
|
Keyword[public] identifier[ByteBuffer] identifier[read] operator[SEP] Keyword[long] identifier[offset] , Keyword[int] identifier[length] , identifier[ByteBuffer] identifier[block] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] , identifier[IllegalStateException] , identifier[IOException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[valid] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[_read] operator[SEP] identifier[offset] , identifier[length] , identifier[block] operator[SEP] operator[SEP]
}
|
private void updateLastAccessTime(boolean creation) {
if (creation) {
cacheData.putObject(NODE_MAP_KEY_LAST_ACCESS,
Long.valueOf(System.currentTimeMillis()));
} else {
ActivityManagementConfiguration configuration = factory
.getConfiguration();
Long lastUpdate = (Long) cacheData
.getObject(NODE_MAP_KEY_LAST_ACCESS);
if (lastUpdate != null) {
final long now = System.currentTimeMillis();
if ((now - configuration.getMinTimeBetweenUpdatesInMs()) > lastUpdate
.longValue()) {
// last update
if (logger.isTraceEnabled()) {
logger.trace("Updating access time for AC with handle "
+ getActivityContextHandle());
}
cacheData.putObject(NODE_MAP_KEY_LAST_ACCESS,
Long.valueOf(now));
} else {
if (logger.isDebugEnabled()) {
logger.debug("Skipping update of access time for AC with handle "
+ getActivityContextHandle());
}
}
} else {
cacheData.putObject(NODE_MAP_KEY_LAST_ACCESS,
Long.valueOf(System.currentTimeMillis()));
if (logger.isTraceEnabled()) {
logger.trace("Updating access time for AC with handle "
+ getActivityContextHandle());
}
}
}
}
|
class class_name[name] begin[{]
method[updateLastAccessTime, return_type[void], modifier[private], parameter[creation]] begin[{]
if[member[.creation]] begin[{]
call[cacheData.putObject, parameter[member[.NODE_MAP_KEY_LAST_ACCESS], call[Long.valueOf, parameter[call[System.currentTimeMillis, parameter[]]]]]]
else begin[{]
local_variable[type[ActivityManagementConfiguration], configuration]
local_variable[type[Long], lastUpdate]
if[binary_operation[member[.lastUpdate], !=, literal[null]]] begin[{]
local_variable[type[long], now]
if[binary_operation[binary_operation[member[.now], -, call[configuration.getMinTimeBetweenUpdatesInMs, parameter[]]], >, call[lastUpdate.longValue, parameter[]]]] begin[{]
if[call[logger.isTraceEnabled, parameter[]]] begin[{]
call[logger.trace, parameter[binary_operation[literal["Updating access time for AC with handle "], +, call[.getActivityContextHandle, parameter[]]]]]
else begin[{]
None
end[}]
call[cacheData.putObject, parameter[member[.NODE_MAP_KEY_LAST_ACCESS], call[Long.valueOf, parameter[member[.now]]]]]
else begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[binary_operation[literal["Skipping update of access time for AC with handle "], +, call[.getActivityContextHandle, parameter[]]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
call[cacheData.putObject, parameter[member[.NODE_MAP_KEY_LAST_ACCESS], call[Long.valueOf, parameter[call[System.currentTimeMillis, parameter[]]]]]]
if[call[logger.isTraceEnabled, parameter[]]] begin[{]
call[logger.trace, parameter[binary_operation[literal["Updating access time for AC with handle "], +, call[.getActivityContextHandle, parameter[]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[updateLastAccessTime] operator[SEP] Keyword[boolean] identifier[creation] operator[SEP] {
Keyword[if] operator[SEP] identifier[creation] operator[SEP] {
identifier[cacheData] operator[SEP] identifier[putObject] operator[SEP] identifier[NODE_MAP_KEY_LAST_ACCESS] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ActivityManagementConfiguration] identifier[configuration] operator[=] identifier[factory] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[lastUpdate] operator[=] operator[SEP] identifier[Long] operator[SEP] identifier[cacheData] operator[SEP] identifier[getObject] operator[SEP] identifier[NODE_MAP_KEY_LAST_ACCESS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastUpdate] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[long] identifier[now] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[now] operator[-] identifier[configuration] operator[SEP] identifier[getMinTimeBetweenUpdatesInMs] operator[SEP] operator[SEP] operator[SEP] operator[>] identifier[lastUpdate] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[getActivityContextHandle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[cacheData] operator[SEP] identifier[putObject] operator[SEP] identifier[NODE_MAP_KEY_LAST_ACCESS] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[getActivityContextHandle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[cacheData] operator[SEP] identifier[putObject] operator[SEP] identifier[NODE_MAP_KEY_LAST_ACCESS] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[getActivityContextHandle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
private Object populateEntityFromHBaseData(Object entity, HBaseDataWrapper hbaseData, EntityMetadata m,
Object rowKey)
{
try
{
Map<String, Object> relations = new HashMap<String, Object>();
if (entity.getClass().isAssignableFrom(EnhanceEntity.class))
{
relations = ((EnhanceEntity) entity).getRelations();
entity = ((EnhanceEntity) entity).getEntity();
}
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
EntityType entityType = metaModel.entity(m.getEntityClazz());
Set<Attribute> attributes = ((AbstractManagedType) entityType).getAttributes();
writeValuesToEntity(entity, hbaseData, m, metaModel, attributes, m.getRelationNames(), relations, -1, "");
if (!relations.isEmpty())
{
return new EnhanceEntity(entity, rowKey, relations);
}
return entity;
}
catch (PropertyAccessException e1)
{
throw new RuntimeException(e1);
}
}
|
class class_name[name] begin[{]
method[populateEntityFromHBaseData, return_type[type[Object]], modifier[private], parameter[entity, hbaseData, m, rowKey]] 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=relations)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EnhanceEntity, sub_type=None))], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=EnhanceEntity, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=EnhanceEntity, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getApplicationMetadata, postfix_operators=[], prefix_operators=[], qualifier=kunderaMetadata, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPersistenceUnit, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=getMetamodel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MetamodelImpl, sub_type=None)), name=metaModel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetamodelImpl, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEntityClazz, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=entity, postfix_operators=[], prefix_operators=[], qualifier=metaModel, selectors=[], type_arguments=None), name=entityType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EntityType, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=entityType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AbstractManagedType, sub_type=None)), name=attributes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))], dimensions=[], name=Set, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hbaseData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRelationNames, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), MemberReference(member=relations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=writeValuesToEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=relations, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relations, 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=EnhanceEntity, sub_type=None)), label=None)])), ReturnStatement(expression=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['PropertyAccessException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] identifier[Object] identifier[populateEntityFromHBaseData] operator[SEP] identifier[Object] identifier[entity] , identifier[HBaseDataWrapper] identifier[hbaseData] , identifier[EntityMetadata] identifier[m] , identifier[Object] identifier[rowKey] operator[SEP] {
Keyword[try] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[relations] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[EnhanceEntity] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[relations] operator[=] operator[SEP] operator[SEP] identifier[EnhanceEntity] operator[SEP] identifier[entity] operator[SEP] operator[SEP] identifier[getRelations] operator[SEP] operator[SEP] operator[SEP] identifier[entity] operator[=] operator[SEP] operator[SEP] identifier[EnhanceEntity] operator[SEP] identifier[entity] operator[SEP] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MetamodelImpl] identifier[metaModel] operator[=] operator[SEP] identifier[MetamodelImpl] operator[SEP] identifier[kunderaMetadata] operator[SEP] identifier[getApplicationMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getMetamodel] operator[SEP] identifier[m] operator[SEP] identifier[getPersistenceUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[EntityType] identifier[entityType] operator[=] identifier[metaModel] operator[SEP] identifier[entity] operator[SEP] identifier[m] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Attribute] operator[>] identifier[attributes] operator[=] operator[SEP] operator[SEP] identifier[AbstractManagedType] operator[SEP] identifier[entityType] operator[SEP] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[writeValuesToEntity] operator[SEP] identifier[entity] , identifier[hbaseData] , identifier[m] , identifier[metaModel] , identifier[attributes] , identifier[m] operator[SEP] identifier[getRelationNames] operator[SEP] operator[SEP] , identifier[relations] , operator[-] Other[1] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[relations] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[EnhanceEntity] operator[SEP] identifier[entity] , identifier[rowKey] , identifier[relations] operator[SEP] operator[SEP]
}
Keyword[return] identifier[entity] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PropertyAccessException] identifier[e1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e1] operator[SEP] operator[SEP]
}
}
|
public void setObservations( List<Point2D_F64> observations,
List<DMatrixRMaj> essential ) {
this.observations = observations;
this.essential = essential;
}
|
class class_name[name] begin[{]
method[setObservations, return_type[void], modifier[public], parameter[observations, essential]] begin[{]
assign[THIS[member[None.observations]], member[.observations]]
assign[THIS[member[None.essential]], member[.essential]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setObservations] operator[SEP] identifier[List] operator[<] identifier[Point2D_F64] operator[>] identifier[observations] , identifier[List] operator[<] identifier[DMatrixRMaj] operator[>] identifier[essential] operator[SEP] {
Keyword[this] operator[SEP] identifier[observations] operator[=] identifier[observations] operator[SEP] Keyword[this] operator[SEP] identifier[essential] operator[=] identifier[essential] operator[SEP]
}
|
@Override
public PutAppLaunchConfigurationResult putAppLaunchConfiguration(PutAppLaunchConfigurationRequest request) {
request = beforeClientExecution(request);
return executePutAppLaunchConfiguration(request);
}
|
class class_name[name] begin[{]
method[putAppLaunchConfiguration, return_type[type[PutAppLaunchConfigurationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executePutAppLaunchConfiguration, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[PutAppLaunchConfigurationResult] identifier[putAppLaunchConfiguration] operator[SEP] identifier[PutAppLaunchConfigurationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executePutAppLaunchConfiguration] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
Configuration copy(Configuration configuration) {
Configuration copy = new Configuration();
copy.restoreState(configuration);
return copy;
}
|
class class_name[name] begin[{]
method[copy, return_type[type[Configuration]], modifier[default], parameter[configuration]] begin[{]
local_variable[type[Configuration], copy]
call[copy.restoreState, parameter[member[.configuration]]]
return[member[.copy]]
end[}]
END[}]
|
identifier[Configuration] identifier[copy] operator[SEP] identifier[Configuration] identifier[configuration] operator[SEP] {
identifier[Configuration] identifier[copy] operator[=] Keyword[new] identifier[Configuration] operator[SEP] operator[SEP] operator[SEP] identifier[copy] operator[SEP] identifier[restoreState] operator[SEP] identifier[configuration] operator[SEP] operator[SEP] Keyword[return] identifier[copy] operator[SEP]
}
|
@Override
public String getUserSecurityName(String uniqueUserId) throws EntryNotFoundException, RegistryException {
if (uniqueUserId == null) {
throw new IllegalArgumentException("uniqueUserId is null");
}
if (uniqueUserId.isEmpty()) {
throw new IllegalArgumentException("uniqueUserId is an empty String");
}
if (user.equals(uniqueUserId)) {
return user;
} else {
throw new EntryNotFoundException(uniqueUserId + " does not exist");
}
}
|
class class_name[name] begin[{]
method[getUserSecurityName, return_type[type[String]], modifier[public], parameter[uniqueUserId]] begin[{]
if[binary_operation[member[.uniqueUserId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="uniqueUserId is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[uniqueUserId.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="uniqueUserId is an empty String")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[user.equals, parameter[member[.uniqueUserId]]]] begin[{]
return[member[.user]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=uniqueUserId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not exist"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EntryNotFoundException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getUserSecurityName] operator[SEP] identifier[String] identifier[uniqueUserId] operator[SEP] Keyword[throws] identifier[EntryNotFoundException] , identifier[RegistryException] {
Keyword[if] operator[SEP] identifier[uniqueUserId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[uniqueUserId] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[user] operator[SEP] identifier[equals] operator[SEP] identifier[uniqueUserId] operator[SEP] operator[SEP] {
Keyword[return] identifier[user] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[EntryNotFoundException] operator[SEP] identifier[uniqueUserId] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
@Override
public void setEnabled(boolean enabled) {
if (enabled == false) {
closePopup();
}
setTextFieldToValidStateIfNeeded();
super.setEnabled(enabled);
toggleTimeMenuButton.setEnabled(enabled);
timeTextField.setEnabled(enabled);
zDrawTextFieldIndicators();
}
|
class class_name[name] begin[{]
method[setEnabled, return_type[void], modifier[public], parameter[enabled]] begin[{]
if[binary_operation[member[.enabled], ==, literal[false]]] begin[{]
call[.closePopup, parameter[]]
else begin[{]
None
end[}]
call[.setTextFieldToValidStateIfNeeded, parameter[]]
SuperMethodInvocation(arguments=[MemberReference(member=enabled, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setEnabled, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[toggleTimeMenuButton.setEnabled, parameter[member[.enabled]]]
call[timeTextField.setEnabled, parameter[member[.enabled]]]
call[.zDrawTextFieldIndicators, parameter[]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setEnabled] operator[SEP] Keyword[boolean] identifier[enabled] operator[SEP] {
Keyword[if] operator[SEP] identifier[enabled] operator[==] literal[boolean] operator[SEP] {
identifier[closePopup] operator[SEP] operator[SEP] operator[SEP]
}
identifier[setTextFieldToValidStateIfNeeded] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[setEnabled] operator[SEP] identifier[enabled] operator[SEP] operator[SEP] identifier[toggleTimeMenuButton] operator[SEP] identifier[setEnabled] operator[SEP] identifier[enabled] operator[SEP] operator[SEP] identifier[timeTextField] operator[SEP] identifier[setEnabled] operator[SEP] identifier[enabled] operator[SEP] operator[SEP] identifier[zDrawTextFieldIndicators] operator[SEP] operator[SEP] operator[SEP]
}
|
public JandexAssert hasNullabilityInfoOnAllMethods() {
// Precondition
isNotNull();
final RuleMethodHasNullabilityInfo rule = new RuleMethodHasNullabilityInfo();
final StringBuilder sb = new StringBuilder();
boolean ok = true;
final Collection<ClassInfo> classes = actual.getKnownClasses();
for (final ClassInfo clasz : classes) {
final List<MethodInfo> methods = clasz.methods();
for (final MethodInfo method : methods) {
if (!ignored(method) && !Modifier.isPrivate(method.flags())) {
final List<MethodInfo> overrideMethods = Utils.findOverrideMethods(actual, method);
if (overrideMethods.size() == 0) {
// Only check methods that DON'T override an interface or super method
final AssertionResult result = rule.verify(method);
if (!result.isValid()) {
ok = false;
sb.append(result.getErrorMessage());
}
}
}
}
}
if (!ok) {
failWithMessage("A parameter or the return value has neither a " + "@NotNull nor a @Nullable annotation:\n" + sb.toString());
}
return this;
}
|
class class_name[name] begin[{]
method[hasNullabilityInfoOnAllMethods, return_type[type[JandexAssert]], modifier[public], parameter[]] begin[{]
call[.isNotNull, parameter[]]
local_variable[type[RuleMethodHasNullabilityInfo], rule]
local_variable[type[StringBuilder], sb]
local_variable[type[boolean], ok]
local_variable[type[Collection], classes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=methods, postfix_operators=[], prefix_operators=[], qualifier=clasz, selectors=[], type_arguments=None), name=methods)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MethodInfo, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ignored, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=flags, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)], member=isPrivate, postfix_operators=[], prefix_operators=['!'], qualifier=Modifier, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findOverrideMethods, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), name=overrideMethods)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MethodInfo, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=overrideMethods, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=verify, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), name=result)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AssertionResult, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isValid, postfix_operators=[], prefix_operators=['!'], qualifier=result, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=MethodInfo, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=clasz)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ClassInfo, sub_type=None))), label=None)
if[member[.ok]] begin[{]
call[.failWithMessage, parameter[binary_operation[binary_operation[literal["A parameter or the return value has neither a "], +, literal["@NotNull nor a @Nullable annotation:\n"]], +, call[sb.toString, parameter[]]]]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[JandexAssert] identifier[hasNullabilityInfoOnAllMethods] operator[SEP] operator[SEP] {
identifier[isNotNull] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[RuleMethodHasNullabilityInfo] identifier[rule] operator[=] Keyword[new] identifier[RuleMethodHasNullabilityInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[ok] operator[=] literal[boolean] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[ClassInfo] operator[>] identifier[classes] operator[=] identifier[actual] operator[SEP] identifier[getKnownClasses] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ClassInfo] identifier[clasz] operator[:] identifier[classes] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[MethodInfo] operator[>] identifier[methods] operator[=] identifier[clasz] operator[SEP] identifier[methods] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[MethodInfo] identifier[method] operator[:] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ignored] operator[SEP] identifier[method] operator[SEP] operator[&&] operator[!] identifier[Modifier] operator[SEP] identifier[isPrivate] operator[SEP] identifier[method] operator[SEP] identifier[flags] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[MethodInfo] operator[>] identifier[overrideMethods] operator[=] identifier[Utils] operator[SEP] identifier[findOverrideMethods] operator[SEP] identifier[actual] , identifier[method] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[overrideMethods] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[final] identifier[AssertionResult] identifier[result] operator[=] identifier[rule] operator[SEP] identifier[verify] operator[SEP] identifier[method] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[result] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP] {
identifier[ok] operator[=] literal[boolean] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[result] operator[SEP] identifier[getErrorMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[ok] operator[SEP] {
identifier[failWithMessage] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static String toBase58WithChecksum(byte[] b) {
byte[] cs = Hash.hash(b);
byte[] extended = new byte[b.length + 4];
System.arraycopy(b, 0, extended, 0, b.length);
System.arraycopy(cs, 0, extended, b.length, 4);
return toBase58(extended);
}
|
class class_name[name] begin[{]
method[toBase58WithChecksum, return_type[type[String]], modifier[public static], parameter[b]] begin[{]
local_variable[type[byte], cs]
local_variable[type[byte], extended]
call[System.arraycopy, parameter[member[.b], literal[0], member[.extended], literal[0], member[b.length]]]
call[System.arraycopy, parameter[member[.cs], literal[0], member[.extended], member[b.length], literal[4]]]
return[call[.toBase58, parameter[member[.extended]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[toBase58WithChecksum] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[cs] operator[=] identifier[Hash] operator[SEP] identifier[hash] operator[SEP] identifier[b] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[extended] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[b] operator[SEP] identifier[length] operator[+] Other[4] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[b] , Other[0] , identifier[extended] , Other[0] , identifier[b] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[cs] , Other[0] , identifier[extended] , identifier[b] operator[SEP] identifier[length] , Other[4] operator[SEP] operator[SEP] Keyword[return] identifier[toBase58] operator[SEP] identifier[extended] operator[SEP] operator[SEP]
}
|
public static boolean iterateOnChildDirs(File parentDir,FileIterator iterator) {
if (parentDir==null){
log.warn("Parent dir is null");
return true;
}
// verify that we can read dir.
String message=verifyReadDir(parentDir);
if (message !=null){
log.warn(message);
return true;
}
File childs[]=parentDir.listFiles(DIR_FILTER);
if (childs==null){
log.info("Parent dir:"+parentDir.getAbsolutePath()+" do not have child dirs");
return true;
} else {
for (File child:childs){
boolean iteratorRet=iterator.iterate(child);
if (iteratorRet==false){
if (log.isDebugEnabled()){
log.debug("Iterator returns false. Iteration on:"+parentDir.getAbsolutePath()+" stopped.");
}
return false;
}
}
return true;
}
}
|
class class_name[name] begin[{]
method[iterateOnChildDirs, return_type[type[boolean]], modifier[public static], parameter[parentDir, iterator]] begin[{]
if[binary_operation[member[.parentDir], ==, literal[null]]] begin[{]
call[log.warn, parameter[literal["Parent dir is null"]]]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], message]
if[binary_operation[member[.message], !=, literal[null]]] begin[{]
call[log.warn, parameter[member[.message]]]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[File], childs]
if[binary_operation[member[.childs], ==, literal[null]]] begin[{]
call[log.info, parameter[binary_operation[binary_operation[literal["Parent dir:"], +, call[parentDir.getAbsolutePath, parameter[]]], +, literal[" do not have child dirs"]]]]
return[literal[true]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=iterate, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), name=iteratorRet)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=iteratorRet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Iterator returns false. Iteration on:"), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=parentDir, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" stopped."), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=childs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None)
return[literal[true]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[iterateOnChildDirs] operator[SEP] identifier[File] identifier[parentDir] , identifier[FileIterator] identifier[iterator] operator[SEP] {
Keyword[if] operator[SEP] identifier[parentDir] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[message] operator[=] identifier[verifyReadDir] operator[SEP] identifier[parentDir] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[message] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[File] identifier[childs] operator[SEP] operator[SEP] operator[=] identifier[parentDir] operator[SEP] identifier[listFiles] operator[SEP] identifier[DIR_FILTER] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childs] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[parentDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[File] identifier[child] operator[:] identifier[childs] operator[SEP] {
Keyword[boolean] identifier[iteratorRet] operator[=] identifier[iterator] operator[SEP] identifier[iterate] operator[SEP] identifier[child] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iteratorRet] operator[==] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[parentDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public synchronized void shutdown() {
// mark this as no longer running
active = false;
// close the socket
try {
if (socketNode != null) {
socketNode.close();
socketNode = null;
}
} catch (Exception e) {
getLogger().info("Excpetion closing socket", e);
// ignore for now
}
// stop the connector
if (connector != null) {
connector.interrupted = true;
connector = null; // allow gc
}
if (advertiseViaMulticastDNS) {
zeroConf.unadvertise();
}
}
|
class class_name[name] begin[{]
method[shutdown, return_type[void], modifier[synchronized public], parameter[]] begin[{]
assign[member[.active], literal[false]]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=socketNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=socketNode, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=socketNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Excpetion closing socket"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.connector], !=, literal[null]]] begin[{]
assign[member[connector.interrupted], literal[true]]
assign[member[.connector], literal[null]]
else begin[{]
None
end[}]
if[member[.advertiseViaMulticastDNS]] begin[{]
call[zeroConf.unadvertise, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[shutdown] operator[SEP] operator[SEP] {
identifier[active] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[socketNode] operator[!=] Other[null] operator[SEP] {
identifier[socketNode] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[socketNode] operator[=] Other[null] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[connector] operator[!=] Other[null] operator[SEP] {
identifier[connector] operator[SEP] identifier[interrupted] operator[=] literal[boolean] operator[SEP] identifier[connector] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[advertiseViaMulticastDNS] operator[SEP] {
identifier[zeroConf] operator[SEP] identifier[unadvertise] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <T> T toEntity(final Class<T> targetClass, final JsonDocument jsonDocument) {
final T result = toEntity(targetClass, jsonDocument.content());
final String id = jsonDocument.id();
if (N.notNullOrEmpty(id) && result != null) {
if (Map.class.isAssignableFrom(targetClass)) {
((Map<String, Object>) result).put(_ID, id);
} else {
final Method idSetMethod = getObjectIdSetMethod(targetClass);
if (idSetMethod != null) {
ClassUtil.setPropValue(result, idSetMethod, id);
}
}
}
return result;
}
|
class class_name[name] begin[{]
method[toEntity, return_type[type[T]], modifier[public static], parameter[targetClass, jsonDocument]] begin[{]
local_variable[type[T], result]
local_variable[type[String], id]
if[binary_operation[call[N.notNullOrEmpty, parameter[member[.id]]], &&, binary_operation[member[.result], !=, literal[null]]]] begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=targetClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Map, sub_type=None))] begin[{]
Cast(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None))
else begin[{]
local_variable[type[Method], idSetMethod]
if[binary_operation[member[.idSetMethod], !=, literal[null]]] begin[{]
call[ClassUtil.setPropValue, parameter[member[.result], member[.idSetMethod], member[.id]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[toEntity] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[targetClass] , Keyword[final] identifier[JsonDocument] identifier[jsonDocument] operator[SEP] {
Keyword[final] identifier[T] identifier[result] operator[=] identifier[toEntity] operator[SEP] identifier[targetClass] , identifier[jsonDocument] operator[SEP] identifier[content] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[id] operator[=] identifier[jsonDocument] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[notNullOrEmpty] operator[SEP] identifier[id] operator[SEP] operator[&&] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[Map] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[targetClass] operator[SEP] operator[SEP] {
operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[result] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[_ID] , identifier[id] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[Method] identifier[idSetMethod] operator[=] identifier[getObjectIdSetMethod] operator[SEP] identifier[targetClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idSetMethod] operator[!=] Other[null] operator[SEP] {
identifier[ClassUtil] operator[SEP] identifier[setPropValue] operator[SEP] identifier[result] , identifier[idSetMethod] , identifier[id] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public <T> T createSpyComponent(final T instance) {
checkArgument(instance != null, "instance must not be null!");
if (isFinalOrPrimitive(instance.getClass())) {
LOG.warn("Skipping creation of a spy : {} as it is final or primitive type.", instance.getClass()
.getSimpleName());
return null;
}
return Mockito.spy(instance);
}
|
class class_name[name] begin[{]
method[createSpyComponent, return_type[type[T]], modifier[public], parameter[instance]] begin[{]
call[.checkArgument, parameter[binary_operation[member[.instance], !=, literal[null]], literal["instance must not be null!"]]]
if[call[.isFinalOrPrimitive, parameter[call[instance.getClass, parameter[]]]]] begin[{]
call[LOG.warn, parameter[literal["Skipping creation of a spy : {} as it is final or primitive type."], call[instance.getClass, parameter[]]]]
return[literal[null]]
else begin[{]
None
end[}]
return[call[Mockito.spy, parameter[member[.instance]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[createSpyComponent] operator[SEP] Keyword[final] identifier[T] identifier[instance] operator[SEP] {
identifier[checkArgument] operator[SEP] identifier[instance] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isFinalOrPrimitive] operator[SEP] identifier[instance] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[instance] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[Mockito] operator[SEP] identifier[spy] operator[SEP] identifier[instance] operator[SEP] operator[SEP]
}
|
public <A, E extends SimpleExpression<A>> ListPath<A, E> getList(String property, Class<A> type, Class<? super E> queryType) {
validate(property, List.class);
return super.createList(property, type, queryType, PathInits.DIRECT);
}
|
class class_name[name] begin[{]
method[getList, return_type[type[ListPath]], modifier[public], parameter[property, type, queryType]] begin[{]
call[.validate, parameter[member[.property], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=List, sub_type=None))]]
return[SuperMethodInvocation(arguments=[MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=queryType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DIRECT, postfix_operators=[], prefix_operators=[], qualifier=PathInits, selectors=[])], member=createList, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[A] , identifier[E] Keyword[extends] identifier[SimpleExpression] operator[<] identifier[A] operator[>] operator[>] identifier[ListPath] operator[<] identifier[A] , identifier[E] operator[>] identifier[getList] operator[SEP] identifier[String] identifier[property] , identifier[Class] operator[<] identifier[A] operator[>] identifier[type] , identifier[Class] operator[<] operator[?] Keyword[super] identifier[E] operator[>] identifier[queryType] operator[SEP] {
identifier[validate] operator[SEP] identifier[property] , identifier[List] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[createList] operator[SEP] identifier[property] , identifier[type] , identifier[queryType] , identifier[PathInits] operator[SEP] identifier[DIRECT] operator[SEP] operator[SEP]
}
|
protected MatchResult checkConsistent(Variable field, Variable value, BindingSet bindingSet) {
// Ensure that the field and value variables are consistent with
// previous definitions (if any)
bindingSet = addOrCheckDefinition(fieldVarName, field, bindingSet);
if (bindingSet == null) {
return null;
}
bindingSet = addOrCheckDefinition(valueVarName, value, bindingSet);
if (bindingSet == null) {
return null;
}
return new MatchResult(this, bindingSet);
}
|
class class_name[name] begin[{]
method[checkConsistent, return_type[type[MatchResult]], modifier[protected], parameter[field, value, bindingSet]] begin[{]
assign[member[.bindingSet], call[.addOrCheckDefinition, parameter[member[.fieldVarName], member[.field], member[.bindingSet]]]]
if[binary_operation[member[.bindingSet], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
assign[member[.bindingSet], call[.addOrCheckDefinition, parameter[member[.valueVarName], member[.value], member[.bindingSet]]]]
if[binary_operation[member[.bindingSet], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=bindingSet, 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=MatchResult, sub_type=None))]
end[}]
END[}]
|
Keyword[protected] identifier[MatchResult] identifier[checkConsistent] operator[SEP] identifier[Variable] identifier[field] , identifier[Variable] identifier[value] , identifier[BindingSet] identifier[bindingSet] operator[SEP] {
identifier[bindingSet] operator[=] identifier[addOrCheckDefinition] operator[SEP] identifier[fieldVarName] , identifier[field] , identifier[bindingSet] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bindingSet] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[bindingSet] operator[=] identifier[addOrCheckDefinition] operator[SEP] identifier[valueVarName] , identifier[value] , identifier[bindingSet] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bindingSet] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[MatchResult] operator[SEP] Keyword[this] , identifier[bindingSet] operator[SEP] operator[SEP]
}
|
private void updateCoord(MouseEvent event)
{
oldX = x;
oldY = y;
x = event.getX();
y = event.getY();
mx = x - oldX;
my = y - oldY;
}
|
class class_name[name] begin[{]
method[updateCoord, return_type[void], modifier[private], parameter[event]] begin[{]
assign[member[.oldX], member[.x]]
assign[member[.oldY], member[.y]]
assign[member[.x], call[event.getX, parameter[]]]
assign[member[.y], call[event.getY, parameter[]]]
assign[member[.mx], binary_operation[member[.x], -, member[.oldX]]]
assign[member[.my], binary_operation[member[.y], -, member[.oldY]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[updateCoord] operator[SEP] identifier[MouseEvent] identifier[event] operator[SEP] {
identifier[oldX] operator[=] identifier[x] operator[SEP] identifier[oldY] operator[=] identifier[y] operator[SEP] identifier[x] operator[=] identifier[event] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] identifier[y] operator[=] identifier[event] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] identifier[mx] operator[=] identifier[x] operator[-] identifier[oldX] operator[SEP] identifier[my] operator[=] identifier[y] operator[-] identifier[oldY] operator[SEP]
}
|
private void assertSortedByDistance(DoubleDBIDList results) {
// TODO: sort results instead?
double dist = -1.0;
boolean sorted = true;
for(DoubleDBIDListIter it = results.iter(); it.valid(); it.advance()) {
double qr = it.doubleValue();
if(qr < dist) {
sorted = false;
}
dist = qr;
}
if(!sorted) {
try {
ModifiableDoubleDBIDList.class.cast(results).sort();
}
catch(ClassCastException | UnsupportedOperationException e) {
LoggingUtil.warning("WARNING: results not sorted by distance!", e);
}
}
}
|
class class_name[name] begin[{]
method[assertSortedByDistance, return_type[void], modifier[private], parameter[results]] begin[{]
local_variable[type[double], dist]
local_variable[type[boolean], sorted]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=doubleValue, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=qr)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=qr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sorted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=qr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=valid, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iter, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DoubleDBIDListIter, sub_type=None)), update=[MethodInvocation(arguments=[], member=advance, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None)]), label=None)
if[member[.sorted]] begin[{]
TryStatement(block=[StatementExpression(expression=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cast, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=sort, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ModifiableDoubleDBIDList, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="WARNING: results not sorted by distance!"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LoggingUtil, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException', 'UnsupportedOperationException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[assertSortedByDistance] operator[SEP] identifier[DoubleDBIDList] identifier[results] operator[SEP] {
Keyword[double] identifier[dist] operator[=] operator[-] literal[Float] operator[SEP] Keyword[boolean] identifier[sorted] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[DoubleDBIDListIter] identifier[it] operator[=] identifier[results] operator[SEP] identifier[iter] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[valid] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[advance] operator[SEP] operator[SEP] operator[SEP] {
Keyword[double] identifier[qr] operator[=] identifier[it] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[qr] operator[<] identifier[dist] operator[SEP] {
identifier[sorted] operator[=] literal[boolean] operator[SEP]
}
identifier[dist] operator[=] identifier[qr] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[sorted] operator[SEP] {
Keyword[try] {
identifier[ModifiableDoubleDBIDList] operator[SEP] Keyword[class] operator[SEP] identifier[cast] operator[SEP] identifier[results] operator[SEP] operator[SEP] identifier[sort] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] operator[|] identifier[UnsupportedOperationException] identifier[e] operator[SEP] {
identifier[LoggingUtil] operator[SEP] identifier[warning] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
private Context getURLContextOrFail(String name) throws NamingException {
Context urlContext = null;
if (name.contains(":")) {
urlContext = getURLContext(name);
if (urlContext == null) {
fail(name);
}
} else {
fail(name);
}
return urlContext;
}
|
class class_name[name] begin[{]
method[getURLContextOrFail, return_type[type[Context]], modifier[private], parameter[name]] begin[{]
local_variable[type[Context], urlContext]
if[call[name.contains, parameter[literal[":"]]]] begin[{]
assign[member[.urlContext], call[.getURLContext, parameter[member[.name]]]]
if[binary_operation[member[.urlContext], ==, literal[null]]] begin[{]
call[.fail, parameter[member[.name]]]
else begin[{]
None
end[}]
else begin[{]
call[.fail, parameter[member[.name]]]
end[}]
return[member[.urlContext]]
end[}]
END[}]
|
Keyword[private] identifier[Context] identifier[getURLContextOrFail] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[NamingException] {
identifier[Context] identifier[urlContext] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[urlContext] operator[=] identifier[getURLContext] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[urlContext] operator[==] Other[null] operator[SEP] {
identifier[fail] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[fail] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[return] identifier[urlContext] operator[SEP]
}
|
private OutputStream checkAndMarkRunningBalancer() throws IOException {
try {
DataOutputStream out = fs.create(BALANCER_ID_PATH);
out. writeBytes(InetAddress.getLocalHost().getHostName());
out.flush();
return out;
} catch(RemoteException e) {
if(AlreadyBeingCreatedException.class.getName().equals(e.getClassName())){
return null;
} else {
throw e;
}
}
}
|
class class_name[name] begin[{]
method[checkAndMarkRunningBalancer, return_type[type[OutputStream]], modifier[private], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=BALANCER_ID_PATH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[], type_arguments=None), name=out)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataOutputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalHost, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[MethodInvocation(arguments=[], member=getHostName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=writeBytes, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[IfStatement(condition=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=AlreadyBeingCreatedException, sub_type=None)), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RemoteException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] identifier[OutputStream] identifier[checkAndMarkRunningBalancer] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[DataOutputStream] identifier[out] operator[=] identifier[fs] operator[SEP] identifier[create] operator[SEP] identifier[BALANCER_ID_PATH] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBytes] operator[SEP] identifier[InetAddress] operator[SEP] identifier[getLocalHost] operator[SEP] operator[SEP] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RemoteException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[AlreadyBeingCreatedException] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[e] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[e] operator[SEP]
}
}
}
|
protected void addValue(String name, ValuePanel valuePanel) {
named.put(name, valuePanel);
valuePanel.setBounds(0,10+yPos,280,63);
valuePanel.addListener(this);
add(valuePanel);
yPos+=63;
}
|
class class_name[name] begin[{]
method[addValue, return_type[void], modifier[protected], parameter[name, valuePanel]] begin[{]
call[named.put, parameter[member[.name], member[.valuePanel]]]
call[valuePanel.setBounds, parameter[literal[0], binary_operation[literal[10], +, member[.yPos]], literal[280], literal[63]]]
call[valuePanel.addListener, parameter[THIS[]]]
call[.add, parameter[member[.valuePanel]]]
assign[member[.yPos], literal[63]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addValue] operator[SEP] identifier[String] identifier[name] , identifier[ValuePanel] identifier[valuePanel] operator[SEP] {
identifier[named] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[valuePanel] operator[SEP] operator[SEP] identifier[valuePanel] operator[SEP] identifier[setBounds] operator[SEP] Other[0] , Other[10] operator[+] identifier[yPos] , Other[280] , Other[63] operator[SEP] operator[SEP] identifier[valuePanel] operator[SEP] identifier[addListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[valuePanel] operator[SEP] operator[SEP] identifier[yPos] operator[+=] Other[63] operator[SEP]
}
|
public synchronized void addOpenChannels(List<FileIOChannel> toOpen) {
checkArgument(!closed);
for (FileIOChannel channel : toOpen) {
openChannels.add(channel);
channels.remove(channel.getChannelID());
}
}
|
class class_name[name] begin[{]
method[addOpenChannels, return_type[void], modifier[synchronized public], parameter[toOpen]] begin[{]
call[.checkArgument, parameter[member[.closed]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=openChannels, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChannelID, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=channels, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=toOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=channel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileIOChannel, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[addOpenChannels] operator[SEP] identifier[List] operator[<] identifier[FileIOChannel] operator[>] identifier[toOpen] operator[SEP] {
identifier[checkArgument] operator[SEP] operator[!] identifier[closed] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FileIOChannel] identifier[channel] operator[:] identifier[toOpen] operator[SEP] {
identifier[openChannels] operator[SEP] identifier[add] operator[SEP] identifier[channel] operator[SEP] operator[SEP] identifier[channels] operator[SEP] identifier[remove] operator[SEP] identifier[channel] operator[SEP] identifier[getChannelID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void fireStatementErrorOccured(Statement st, SQLException ex) {
if (st instanceof PreparedStatement) {
StatementEvent event = new StatementEvent(this, (PreparedStatement) st, ex);
for (StatementEventListener listener : statementEventListeners) {
listener.statementErrorOccurred(event);
}
}
}
|
class class_name[name] begin[{]
method[fireStatementErrorOccured, return_type[void], modifier[public], parameter[st, ex]] begin[{]
if[binary_operation[member[.st], instanceof, type[PreparedStatement]]] begin[{]
local_variable[type[StatementEvent], event]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=statementErrorOccurred, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=statementEventListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StatementEventListener, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[fireStatementErrorOccured] operator[SEP] identifier[Statement] identifier[st] , identifier[SQLException] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[st] Keyword[instanceof] identifier[PreparedStatement] operator[SEP] {
identifier[StatementEvent] identifier[event] operator[=] Keyword[new] identifier[StatementEvent] operator[SEP] Keyword[this] , operator[SEP] identifier[PreparedStatement] operator[SEP] identifier[st] , identifier[ex] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[StatementEventListener] identifier[listener] operator[:] identifier[statementEventListeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[statementErrorOccurred] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
}
}
|
public boolean isEagerSingleton(Stage stage) {
if (this == EAGER_SINGLETON) {
return true;
}
if (stage == Stage.PRODUCTION) {
return this == SINGLETON_ANNOTATION || this == SINGLETON_INSTANCE;
}
return false;
}
|
class class_name[name] begin[{]
method[isEagerSingleton, return_type[type[boolean]], modifier[public], parameter[stage]] begin[{]
if[binary_operation[THIS[], ==, member[.EAGER_SINGLETON]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.stage], ==, member[Stage.PRODUCTION]]] begin[{]
return[binary_operation[binary_operation[THIS[], ==, member[.SINGLETON_ANNOTATION]], ||, binary_operation[THIS[], ==, member[.SINGLETON_INSTANCE]]]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isEagerSingleton] operator[SEP] identifier[Stage] identifier[stage] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[==] identifier[EAGER_SINGLETON] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[stage] operator[==] identifier[Stage] operator[SEP] identifier[PRODUCTION] operator[SEP] {
Keyword[return] Keyword[this] operator[==] identifier[SINGLETON_ANNOTATION] operator[||] Keyword[this] operator[==] identifier[SINGLETON_INSTANCE] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private Document prepareTBXDocument() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document tbxDocument = builder.newDocument();
Element martif = tbxDocument.createElement("martif");
martif.setAttribute("type", "TBX");
tbxDocument.appendChild(martif);
Element header = tbxDocument.createElement("martifHeader");
martif.appendChild(header);
Element fileDesc = tbxDocument.createElement("fileDesc");
header.appendChild(fileDesc);
Element encodingDesc = tbxDocument.createElement("encodingDesc");
header.appendChild(encodingDesc);
Element encodingP = tbxDocument.createElement("p");
encodingP.setAttribute("type", "XCSURI");
encodingP.setTextContent("http://ttc-project.googlecode.com/files/ttctbx.xcs");
encodingDesc.appendChild(encodingP);
Element sourceDesc = tbxDocument.createElement("sourceDesc");
Element p = tbxDocument.createElement("p");
// p.setTextContent(workingDir.getAbsolutePath());
sourceDesc.appendChild(p);
fileDesc.appendChild(sourceDesc);
Element text = tbxDocument.createElement("text");
martif.appendChild(text);
Element body = tbxDocument.createElement("body");
text.appendChild(body);
return tbxDocument;
}
|
class class_name[name] begin[{]
method[prepareTBXDocument, return_type[type[Document]], modifier[private], parameter[]] begin[{]
local_variable[type[DocumentBuilderFactory], factory]
local_variable[type[DocumentBuilder], builder]
local_variable[type[Document], tbxDocument]
local_variable[type[Element], martif]
call[martif.setAttribute, parameter[literal["type"], literal["TBX"]]]
call[tbxDocument.appendChild, parameter[member[.martif]]]
local_variable[type[Element], header]
call[martif.appendChild, parameter[member[.header]]]
local_variable[type[Element], fileDesc]
call[header.appendChild, parameter[member[.fileDesc]]]
local_variable[type[Element], encodingDesc]
call[header.appendChild, parameter[member[.encodingDesc]]]
local_variable[type[Element], encodingP]
call[encodingP.setAttribute, parameter[literal["type"], literal["XCSURI"]]]
call[encodingP.setTextContent, parameter[literal["http://ttc-project.googlecode.com/files/ttctbx.xcs"]]]
call[encodingDesc.appendChild, parameter[member[.encodingP]]]
local_variable[type[Element], sourceDesc]
local_variable[type[Element], p]
call[sourceDesc.appendChild, parameter[member[.p]]]
call[fileDesc.appendChild, parameter[member[.sourceDesc]]]
local_variable[type[Element], text]
call[martif.appendChild, parameter[member[.text]]]
local_variable[type[Element], body]
call[text.appendChild, parameter[member[.body]]]
return[member[.tbxDocument]]
end[}]
END[}]
|
Keyword[private] identifier[Document] identifier[prepareTBXDocument] operator[SEP] operator[SEP] Keyword[throws] identifier[ParserConfigurationException] {
identifier[DocumentBuilderFactory] identifier[factory] operator[=] identifier[DocumentBuilderFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[DocumentBuilder] identifier[builder] operator[=] identifier[factory] operator[SEP] identifier[newDocumentBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Document] identifier[tbxDocument] operator[=] identifier[builder] operator[SEP] identifier[newDocument] operator[SEP] operator[SEP] operator[SEP] identifier[Element] identifier[martif] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[martif] operator[SEP] identifier[setAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[tbxDocument] operator[SEP] identifier[appendChild] operator[SEP] identifier[martif] operator[SEP] operator[SEP] identifier[Element] identifier[header] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[martif] operator[SEP] identifier[appendChild] operator[SEP] identifier[header] operator[SEP] operator[SEP] identifier[Element] identifier[fileDesc] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[appendChild] operator[SEP] identifier[fileDesc] operator[SEP] operator[SEP] identifier[Element] identifier[encodingDesc] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[appendChild] operator[SEP] identifier[encodingDesc] operator[SEP] operator[SEP] identifier[Element] identifier[encodingP] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[encodingP] operator[SEP] identifier[setAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[encodingP] operator[SEP] identifier[setTextContent] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[encodingDesc] operator[SEP] identifier[appendChild] operator[SEP] identifier[encodingP] operator[SEP] operator[SEP] identifier[Element] identifier[sourceDesc] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Element] identifier[p] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sourceDesc] operator[SEP] identifier[appendChild] operator[SEP] identifier[p] operator[SEP] operator[SEP] identifier[fileDesc] operator[SEP] identifier[appendChild] operator[SEP] identifier[sourceDesc] operator[SEP] operator[SEP] identifier[Element] identifier[text] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[martif] operator[SEP] identifier[appendChild] operator[SEP] identifier[text] operator[SEP] operator[SEP] identifier[Element] identifier[body] operator[=] identifier[tbxDocument] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[text] operator[SEP] identifier[appendChild] operator[SEP] identifier[body] operator[SEP] operator[SEP] Keyword[return] identifier[tbxDocument] operator[SEP]
}
|
@Override
public CheckedFunction1<Object[], Object> decorate(CheckedFunction1<Object[], Object> invocationCall,
Method method,
MethodHandler methodHandler,
Target<?> target) {
final Method fallbackMethod;
validateFallback(method);
fallbackMethod = getFallbackMethod(method);
return args -> {
try {
return invocationCall.apply(args);
} catch (final Exception exception) {
if (filter.test(exception)) {
return fallbackMethod.invoke(fallback, args);
}
throw exception;
}
};
}
|
class class_name[name] begin[{]
method[decorate, return_type[type[CheckedFunction1]], modifier[public], parameter[invocationCall, method, methodHandler, target]] begin[{]
local_variable[type[Method], fallbackMethod]
call[.validateFallback, parameter[member[.method]]]
assign[member[.fallbackMethod], call[.getFallbackMethod, parameter[member[.method]]]]
return[LambdaExpression(body=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=invocationCall, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=test, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=fallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=fallbackMethod, selectors=[], type_arguments=None), label=None)])), ThrowStatement(expression=MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['Exception']))], finally_block=None, label=None, resources=None)], parameters=[MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[CheckedFunction1] operator[<] identifier[Object] operator[SEP] operator[SEP] , identifier[Object] operator[>] identifier[decorate] operator[SEP] identifier[CheckedFunction1] operator[<] identifier[Object] operator[SEP] operator[SEP] , identifier[Object] operator[>] identifier[invocationCall] , identifier[Method] identifier[method] , identifier[MethodHandler] identifier[methodHandler] , identifier[Target] operator[<] operator[?] operator[>] identifier[target] operator[SEP] {
Keyword[final] identifier[Method] identifier[fallbackMethod] operator[SEP] identifier[validateFallback] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[fallbackMethod] operator[=] identifier[getFallbackMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] Keyword[return] identifier[args] operator[->] {
Keyword[try] {
Keyword[return] identifier[invocationCall] operator[SEP] identifier[apply] operator[SEP] identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[exception] operator[SEP] {
Keyword[if] operator[SEP] identifier[filter] operator[SEP] identifier[test] operator[SEP] identifier[exception] operator[SEP] operator[SEP] {
Keyword[return] identifier[fallbackMethod] operator[SEP] identifier[invoke] operator[SEP] identifier[fallback] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[throw] identifier[exception] operator[SEP]
}
} operator[SEP]
}
|
public String[][] load(String[][] options, DocErrorReporter errorReporter) {
LinkedList<String[]> optionsList = new LinkedList<>(Arrays.asList(options));
Iterator<String[]> optionsIter = optionsList.iterator();
while ( optionsIter.hasNext() ) {
String[] opt = optionsIter.next();
if ( !handleOption(optionsIter, opt, errorReporter) ) {
return null;
}
}
if ( pegdownExtensions == null ) {
setPegdownExtensions(DEFAULT_PEGDOWN_EXTENSIONS);
}
return optionsList.toArray(new String[optionsList.size()][]);
}
|
class class_name[name] begin[{]
method[load, return_type[type[String]], modifier[public], parameter[options, errorReporter]] begin[{]
local_variable[type[LinkedList], optionsList]
local_variable[type[Iterator], optionsIter]
while[call[optionsIter.hasNext, parameter[]]] begin[{]
local_variable[type[String], opt]
if[call[.handleOption, parameter[member[.optionsIter], member[.opt], member[.errorReporter]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.pegdownExtensions], ==, literal[null]]] begin[{]
call[.setPegdownExtensions, parameter[member[.DEFAULT_PEGDOWN_EXTENSIONS]]]
else begin[{]
None
end[}]
return[call[optionsList.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=optionsList, selectors=[], type_arguments=None), None], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[load] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[options] , identifier[DocErrorReporter] identifier[errorReporter] operator[SEP] {
identifier[LinkedList] operator[<] identifier[String] operator[SEP] operator[SEP] operator[>] identifier[optionsList] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[SEP] operator[SEP] operator[>] identifier[optionsIter] operator[=] identifier[optionsList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[optionsIter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[opt] operator[=] identifier[optionsIter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[handleOption] operator[SEP] identifier[optionsIter] , identifier[opt] , identifier[errorReporter] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[pegdownExtensions] operator[==] Other[null] operator[SEP] {
identifier[setPegdownExtensions] operator[SEP] identifier[DEFAULT_PEGDOWN_EXTENSIONS] operator[SEP] operator[SEP]
}
Keyword[return] identifier[optionsList] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[optionsList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public CmsUrlNameMappingFilter filterLocale(String locale) {
if (locale == null) {
throw new IllegalArgumentException();
}
CmsUrlNameMappingFilter result = new CmsUrlNameMappingFilter(this);
result.m_locale = locale;
return result;
}
|
class class_name[name] begin[{]
method[filterLocale, return_type[type[CmsUrlNameMappingFilter]], modifier[public], parameter[locale]] begin[{]
if[binary_operation[member[.locale], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[CmsUrlNameMappingFilter], result]
assign[member[result.m_locale], member[.locale]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[CmsUrlNameMappingFilter] identifier[filterLocale] operator[SEP] identifier[String] identifier[locale] operator[SEP] {
Keyword[if] operator[SEP] identifier[locale] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[CmsUrlNameMappingFilter] identifier[result] operator[=] Keyword[new] identifier[CmsUrlNameMappingFilter] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[m_locale] operator[=] identifier[locale] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public void failExternally(Throwable cause) {
LOG.info("Attempting to fail task externally {} ({}).", taskNameWithSubtask, executionId);
cancelOrFailAndCancelInvokable(ExecutionState.FAILED, cause);
}
|
class class_name[name] begin[{]
method[failExternally, return_type[void], modifier[public], parameter[cause]] begin[{]
call[LOG.info, parameter[literal["Attempting to fail task externally {} ({})."], member[.taskNameWithSubtask], member[.executionId]]]
call[.cancelOrFailAndCancelInvokable, parameter[member[ExecutionState.FAILED], member[.cause]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[failExternally] operator[SEP] identifier[Throwable] identifier[cause] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[taskNameWithSubtask] , identifier[executionId] operator[SEP] operator[SEP] identifier[cancelOrFailAndCancelInvokable] operator[SEP] identifier[ExecutionState] operator[SEP] identifier[FAILED] , identifier[cause] operator[SEP] operator[SEP]
}
|
private static JsonNode federatedFlowStep1(LoginInput loginInput)
throws SnowflakeSQLException
{
JsonNode dataNode = null;
try
{
URIBuilder fedUriBuilder = new URIBuilder(loginInput.getServerUrl());
fedUriBuilder.setPath(SF_PATH_AUTHENTICATOR_REQUEST);
URI fedUrlUri = fedUriBuilder.build();
Map<String, Object> data = new HashMap<>();
data.put(ClientAuthnParameter.ACCOUNT_NAME.name(),
loginInput.getAccountName());
data.put(ClientAuthnParameter.AUTHENTICATOR.name(),
loginInput.getAuthenticator());
data.put(ClientAuthnParameter.CLIENT_APP_ID.name(), loginInput.getAppId());
data.put(ClientAuthnParameter.CLIENT_APP_VERSION.name(),
loginInput.getAppVersion());
ClientAuthnDTO authnData = new ClientAuthnDTO();
authnData.setData(data);
String json = mapper.writeValueAsString(authnData);
// attach the login info json body to the post request
StringEntity input = new StringEntity(json, Charset.forName("UTF-8"));
input.setContentType("application/json");
HttpPost postRequest = new HttpPost(fedUrlUri);
postRequest.setEntity(input);
postRequest.addHeader("accept", "application/json");
final String gsResponse = HttpUtil.executeRequest(postRequest,
loginInput.getLoginTimeout(), 0, null);
logger.debug("authenticator-request response: {}", gsResponse);
JsonNode jsonNode = mapper.readTree(gsResponse);
// check the success field first
if (!jsonNode.path("success").asBoolean())
{
logger.debug("response = {}", gsResponse);
String errorCode = jsonNode.path("code").asText();
throw new SnowflakeSQLException(
SqlState.SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,
ErrorCode.CONNECTION_ERROR.getMessageCode(),
errorCode, jsonNode.path("message").asText());
}
// session token is in the data field of the returned json response
dataNode = jsonNode.path("data");
}
catch (IOException | URISyntaxException ex)
{
handleFederatedFlowError(loginInput, ex);
}
return dataNode;
}
|
class class_name[name] begin[{]
method[federatedFlowStep1, return_type[type[JsonNode]], modifier[private static], parameter[loginInput]] begin[{]
local_variable[type[JsonNode], dataNode]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getServerUrl, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URIBuilder, sub_type=None)), name=fedUriBuilder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URIBuilder, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SF_PATH_AUTHENTICATOR_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPath, postfix_operators=[], prefix_operators=[], qualifier=fedUriBuilder, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=fedUriBuilder, selectors=[], type_arguments=None), name=fedUrlUri)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None)), name=data)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=ClientAuthnParameter.ACCOUNT_NAME, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAccountName, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=ClientAuthnParameter.AUTHENTICATOR, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAuthenticator, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=ClientAuthnParameter.CLIENT_APP_ID, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAppId, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=ClientAuthnParameter.CLIENT_APP_VERSION, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAppVersion, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClientAuthnDTO, sub_type=None)), name=authnData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ClientAuthnDTO, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setData, postfix_operators=[], prefix_operators=[], qualifier=authnData, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=authnData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeValueAsString, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), name=json)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringEntity, sub_type=None)), name=input)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringEntity, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/json")], member=setContentType, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=fedUrlUri, 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=HttpPost, sub_type=None)), name=postRequest)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpPost, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setEntity, postfix_operators=[], prefix_operators=[], qualifier=postRequest, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="accept"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/json")], member=addHeader, postfix_operators=[], prefix_operators=[], qualifier=postRequest, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=postRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getLoginTimeout, postfix_operators=[], prefix_operators=[], qualifier=loginInput, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=executeRequest, postfix_operators=[], prefix_operators=[], qualifier=HttpUtil, selectors=[], type_arguments=None), name=gsResponse)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="authenticator-request response: {}"), MemberReference(member=gsResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=gsResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readTree, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), name=jsonNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonNode, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="success")], member=path, postfix_operators=[], prefix_operators=['!'], qualifier=jsonNode, selectors=[MethodInvocation(arguments=[], member=asBoolean, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="response = {}"), MemberReference(member=gsResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="code")], member=path, postfix_operators=[], prefix_operators=[], qualifier=jsonNode, selectors=[MethodInvocation(arguments=[], member=asText, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=errorCode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION, postfix_operators=[], prefix_operators=[], qualifier=SqlState, selectors=[]), MethodInvocation(arguments=[], member=getMessageCode, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode.CONNECTION_ERROR, selectors=[], type_arguments=None), MemberReference(member=errorCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message")], member=path, postfix_operators=[], prefix_operators=[], qualifier=jsonNode, selectors=[MethodInvocation(arguments=[], member=asText, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SnowflakeSQLException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dataNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="data")], member=path, postfix_operators=[], prefix_operators=[], qualifier=jsonNode, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=loginInput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleFederatedFlowError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException', 'URISyntaxException']))], finally_block=None, label=None, resources=None)
return[member[.dataNode]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[JsonNode] identifier[federatedFlowStep1] operator[SEP] identifier[LoginInput] identifier[loginInput] operator[SEP] Keyword[throws] identifier[SnowflakeSQLException] {
identifier[JsonNode] identifier[dataNode] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[URIBuilder] identifier[fedUriBuilder] operator[=] Keyword[new] identifier[URIBuilder] operator[SEP] identifier[loginInput] operator[SEP] identifier[getServerUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[fedUriBuilder] operator[SEP] identifier[setPath] operator[SEP] identifier[SF_PATH_AUTHENTICATOR_REQUEST] operator[SEP] operator[SEP] identifier[URI] identifier[fedUrlUri] operator[=] identifier[fedUriBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[data] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[ClientAuthnParameter] operator[SEP] identifier[ACCOUNT_NAME] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[loginInput] operator[SEP] identifier[getAccountName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[ClientAuthnParameter] operator[SEP] identifier[AUTHENTICATOR] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[loginInput] operator[SEP] identifier[getAuthenticator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[ClientAuthnParameter] operator[SEP] identifier[CLIENT_APP_ID] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[loginInput] operator[SEP] identifier[getAppId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[ClientAuthnParameter] operator[SEP] identifier[CLIENT_APP_VERSION] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[loginInput] operator[SEP] identifier[getAppVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ClientAuthnDTO] identifier[authnData] operator[=] Keyword[new] identifier[ClientAuthnDTO] operator[SEP] operator[SEP] operator[SEP] identifier[authnData] operator[SEP] identifier[setData] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[String] identifier[json] operator[=] identifier[mapper] operator[SEP] identifier[writeValueAsString] operator[SEP] identifier[authnData] operator[SEP] operator[SEP] identifier[StringEntity] identifier[input] operator[=] Keyword[new] identifier[StringEntity] operator[SEP] identifier[json] , identifier[Charset] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[HttpPost] identifier[postRequest] operator[=] Keyword[new] identifier[HttpPost] operator[SEP] identifier[fedUrlUri] operator[SEP] operator[SEP] identifier[postRequest] operator[SEP] identifier[setEntity] operator[SEP] identifier[input] operator[SEP] operator[SEP] identifier[postRequest] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[gsResponse] operator[=] identifier[HttpUtil] operator[SEP] identifier[executeRequest] operator[SEP] identifier[postRequest] , identifier[loginInput] operator[SEP] identifier[getLoginTimeout] operator[SEP] operator[SEP] , Other[0] , Other[null] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[gsResponse] operator[SEP] operator[SEP] identifier[JsonNode] identifier[jsonNode] operator[=] identifier[mapper] operator[SEP] identifier[readTree] operator[SEP] identifier[gsResponse] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[jsonNode] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asBoolean] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[gsResponse] operator[SEP] operator[SEP] identifier[String] identifier[errorCode] operator[=] identifier[jsonNode] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SnowflakeSQLException] operator[SEP] identifier[SqlState] operator[SEP] identifier[SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION] , identifier[ErrorCode] operator[SEP] identifier[CONNECTION_ERROR] operator[SEP] identifier[getMessageCode] operator[SEP] operator[SEP] , identifier[errorCode] , identifier[jsonNode] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[dataNode] operator[=] identifier[jsonNode] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[URISyntaxException] identifier[ex] operator[SEP] {
identifier[handleFederatedFlowError] operator[SEP] identifier[loginInput] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dataNode] operator[SEP]
}
|
@Deprecated
public ResponseMessageBuilder headers(Map<String, ModelReference> headers) {
this.headers.putAll(nullToEmptyMap(headers).entrySet().stream()
.map(toHeaderEntry())
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue)));
return this;
}
|
class class_name[name] begin[{]
method[headers, return_type[type[ResponseMessageBuilder]], modifier[public], parameter[headers]] begin[{]
THIS[member[None.headers]call[None.putAll, parameter[call[.nullToEmptyMap, parameter[member[.headers]]]]]]
return[THIS[]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] identifier[ResponseMessageBuilder] identifier[headers] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[ModelReference] operator[>] identifier[headers] operator[SEP] {
Keyword[this] operator[SEP] identifier[headers] operator[SEP] identifier[putAll] operator[SEP] identifier[nullToEmptyMap] operator[SEP] identifier[headers] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[toHeaderEntry] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[toMap] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[::] identifier[getKey] , identifier[Map] operator[SEP] identifier[Entry] operator[::] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
protected static void validateNumerical(String opName, SDVariable v1, SDVariable v2) {
if (v1.dataType() == DataType.BOOL || v1.dataType() == DataType.UTF8 || v2.dataType() == DataType.BOOL || v2.dataType() == DataType.UTF8)
throw new IllegalStateException("Cannot perform operation \"" + opName + "\" on variables \"" + v1.getVarName() + "\" and \"" +
v2.getVarName() + "\" if one or both variables are non-numerical: " + v1.dataType() + " and " + v2.dataType());
}
|
class class_name[name] begin[{]
method[validateNumerical, return_type[void], modifier[static protected], parameter[opName, v1, v2]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[call[v1.dataType, parameter[]], ==, member[DataType.BOOL]], ||, binary_operation[call[v1.dataType, parameter[]], ==, member[DataType.UTF8]]], ||, binary_operation[call[v2.dataType, parameter[]], ==, member[DataType.BOOL]]], ||, binary_operation[call[v2.dataType, parameter[]], ==, member[DataType.UTF8]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot perform operation \""), operandr=MemberReference(member=opName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" on variables \""), operator=+), operandr=MethodInvocation(arguments=[], member=getVarName, postfix_operators=[], prefix_operators=[], qualifier=v1, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" and \""), operator=+), operandr=MethodInvocation(arguments=[], member=getVarName, postfix_operators=[], prefix_operators=[], qualifier=v2, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" if one or both variables are non-numerical: "), operator=+), operandr=MethodInvocation(arguments=[], member=dataType, postfix_operators=[], prefix_operators=[], qualifier=v1, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" and "), operator=+), operandr=MethodInvocation(arguments=[], member=dataType, postfix_operators=[], prefix_operators=[], qualifier=v2, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[static] Keyword[void] identifier[validateNumerical] operator[SEP] identifier[String] identifier[opName] , identifier[SDVariable] identifier[v1] , identifier[SDVariable] identifier[v2] operator[SEP] {
Keyword[if] operator[SEP] identifier[v1] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[==] identifier[DataType] operator[SEP] identifier[BOOL] operator[||] identifier[v1] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[==] identifier[DataType] operator[SEP] identifier[UTF8] operator[||] identifier[v2] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[==] identifier[DataType] operator[SEP] identifier[BOOL] operator[||] identifier[v2] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[==] identifier[DataType] operator[SEP] identifier[UTF8] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[opName] operator[+] literal[String] operator[+] identifier[v1] operator[SEP] identifier[getVarName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[v2] operator[SEP] identifier[getVarName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[v1] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[v2] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException {
T post = klass.newInstance();
post.setClient(this);
post.setBlogName(blogName);
return post;
}
|
class class_name[name] begin[{]
method[newPost, return_type[type[T]], modifier[public], parameter[blogName, klass]] begin[{]
local_variable[type[T], post]
call[post.setClient, parameter[THIS[]]]
call[post.setBlogName, parameter[member[.blogName]]]
return[member[.post]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Post] operator[>] identifier[T] identifier[newPost] operator[SEP] identifier[String] identifier[blogName] , identifier[Class] operator[<] identifier[T] operator[>] identifier[klass] operator[SEP] Keyword[throws] identifier[IllegalAccessException] , identifier[InstantiationException] {
identifier[T] identifier[post] operator[=] identifier[klass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[post] operator[SEP] identifier[setClient] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[post] operator[SEP] identifier[setBlogName] operator[SEP] identifier[blogName] operator[SEP] operator[SEP] Keyword[return] identifier[post] operator[SEP]
}
|
public void triggerSessionCreated(JingleSession jingleSession) {
jingleSessions.add(jingleSession);
jingleSession.addListener(this);
for (CreatedJingleSessionListener createdJingleSessionListener : creationListeners) {
try {
createdJingleSessionListener.sessionCreated(jingleSession);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
}
|
class class_name[name] begin[{]
method[triggerSessionCreated, return_type[void], modifier[public], parameter[jingleSession]] begin[{]
call[jingleSessions.add, parameter[member[.jingleSession]]]
call[jingleSession.addListener, parameter[THIS[]]]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jingleSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sessionCreated, postfix_operators=[], prefix_operators=[], qualifier=createdJingleSessionListener, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="exception"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, 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)]), control=EnhancedForControl(iterable=MemberReference(member=creationListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=createdJingleSessionListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreatedJingleSessionListener, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[triggerSessionCreated] operator[SEP] identifier[JingleSession] identifier[jingleSession] operator[SEP] {
identifier[jingleSessions] operator[SEP] identifier[add] operator[SEP] identifier[jingleSession] operator[SEP] operator[SEP] identifier[jingleSession] operator[SEP] identifier[addListener] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CreatedJingleSessionListener] identifier[createdJingleSessionListener] operator[:] identifier[creationListeners] operator[SEP] {
Keyword[try] {
identifier[createdJingleSessionListener] operator[SEP] identifier[sessionCreated] operator[SEP] identifier[jingleSession] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public Observable<AgentRegistrationInner> regenerateKeyAsync(String resourceGroupName, String automationAccountName, AgentRegistrationRegenerateKeyParameter parameters) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).map(new Func1<ServiceResponse<AgentRegistrationInner>, AgentRegistrationInner>() {
@Override
public AgentRegistrationInner call(ServiceResponse<AgentRegistrationInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[regenerateKeyAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, automationAccountName, parameters]] begin[{]
return[call[.regenerateKeyWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.automationAccountName], member[.parameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[AgentRegistrationInner] operator[>] identifier[regenerateKeyAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[automationAccountName] , identifier[AgentRegistrationRegenerateKeyParameter] identifier[parameters] operator[SEP] {
Keyword[return] identifier[regenerateKeyWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[automationAccountName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[AgentRegistrationInner] operator[>] , identifier[AgentRegistrationInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[AgentRegistrationInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[AgentRegistrationInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setTemplate(final String key, final String value) {
pathBuilder.setTemplate(key, value);
return (T) this;
}
|
class class_name[name] begin[{]
method[setTemplate, return_type[type[T]], modifier[public], parameter[key, value]] begin[{]
call[pathBuilder.setTemplate, parameter[member[.key], member[.value]]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[WebLocatorAbstractBuilder] operator[>] identifier[T] identifier[setTemplate] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] identifier[String] identifier[value] operator[SEP] {
identifier[pathBuilder] operator[SEP] identifier[setTemplate] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP]
}
|
@XmlElementDecl(namespace = "", name = "objektnr_intern")
public JAXBElement<String> createObjektnrIntern(String value) {
return new JAXBElement<String>(_ObjektnrIntern_QNAME, String.class, null, value);
}
|
class class_name[name] begin[{]
method[createObjektnrIntern, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_ObjektnrIntern_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[String] operator[>] identifier[createObjektnrIntern] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[String] operator[>] operator[SEP] identifier[_ObjektnrIntern_QNAME] , identifier[String] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
protected int numFreeEntries() {
int res = 0;
for (int i = 0; i < entries.length; i++) {
Entry entry = entries[i];
if (entry.isEmpty()) {
res++;
}
}
assert (NUMBER_ENTRIES == entries.length);
return res;
}
|
class class_name[name] begin[{]
method[numFreeEntries, return_type[type[int]], modifier[protected], parameter[]] begin[{]
local_variable[type[int], res]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=entries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Entry, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=res, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=entries, 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)
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=NUMBER_ENTRIES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=entries, selectors=[]), operator===), label=None, value=None)
return[member[.res]]
end[}]
END[}]
|
Keyword[protected] Keyword[int] identifier[numFreeEntries] operator[SEP] operator[SEP] {
Keyword[int] identifier[res] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[entries] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Entry] identifier[entry] operator[=] identifier[entries] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[res] operator[++] operator[SEP]
}
}
Keyword[assert] operator[SEP] identifier[NUMBER_ENTRIES] operator[==] identifier[entries] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[res] operator[SEP]
}
|
public Point getPoint(String id) {
for (Point point : points)
if (id.equals(point.getId()))
return point;
return null;
}
|
class class_name[name] begin[{]
method[getPoint, return_type[type[Point]], modifier[public], parameter[id]] begin[{]
ForStatement(body=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=point, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), control=EnhancedForControl(iterable=MemberReference(member=points, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=point)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[Point] identifier[getPoint] operator[SEP] identifier[String] identifier[id] operator[SEP] {
Keyword[for] operator[SEP] identifier[Point] identifier[point] operator[:] identifier[points] operator[SEP] Keyword[if] operator[SEP] identifier[id] operator[SEP] identifier[equals] operator[SEP] identifier[point] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[point] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public void setTriggersNotFound(java.util.Collection<String> triggersNotFound) {
if (triggersNotFound == null) {
this.triggersNotFound = null;
return;
}
this.triggersNotFound = new java.util.ArrayList<String>(triggersNotFound);
}
|
class class_name[name] begin[{]
method[setTriggersNotFound, return_type[void], modifier[public], parameter[triggersNotFound]] begin[{]
if[binary_operation[member[.triggersNotFound], ==, literal[null]]] begin[{]
assign[THIS[member[None.triggersNotFound]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.triggersNotFound]], ClassCreator(arguments=[MemberReference(member=triggersNotFound, 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=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setTriggersNotFound] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[triggersNotFound] operator[SEP] {
Keyword[if] operator[SEP] identifier[triggersNotFound] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[triggersNotFound] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[triggersNotFound] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[triggersNotFound] operator[SEP] operator[SEP]
}
|
private TextField buildField(String label, CmsAccountInfo info) {
TextField field = (TextField)m_binder.buildAndBind(label, info);
field.setConverter(new CmsNullToEmptyConverter());
field.setWidth("100%");
boolean editable = (m_editLevel == EditLevel.all)
|| (info.isEditable() && (m_editLevel == EditLevel.configured));
field.setEnabled(editable);
if (editable) {
field.addValidator(new FieldValidator(info.getField()));
}
field.setImmediate(true);
return field;
}
|
class class_name[name] begin[{]
method[buildField, return_type[type[TextField]], modifier[private], parameter[label, info]] begin[{]
local_variable[type[TextField], field]
call[field.setConverter, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsNullToEmptyConverter, sub_type=None))]]
call[field.setWidth, parameter[literal["100%"]]]
local_variable[type[boolean], editable]
call[field.setEnabled, parameter[member[.editable]]]
if[member[.editable]] begin[{]
call[field.addValidator, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getField, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FieldValidator, sub_type=None))]]
else begin[{]
None
end[}]
call[field.setImmediate, parameter[literal[true]]]
return[member[.field]]
end[}]
END[}]
|
Keyword[private] identifier[TextField] identifier[buildField] operator[SEP] identifier[String] identifier[label] , identifier[CmsAccountInfo] identifier[info] operator[SEP] {
identifier[TextField] identifier[field] operator[=] operator[SEP] identifier[TextField] operator[SEP] identifier[m_binder] operator[SEP] identifier[buildAndBind] operator[SEP] identifier[label] , identifier[info] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setConverter] operator[SEP] Keyword[new] identifier[CmsNullToEmptyConverter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setWidth] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[editable] operator[=] operator[SEP] identifier[m_editLevel] operator[==] identifier[EditLevel] operator[SEP] identifier[all] operator[SEP] operator[||] operator[SEP] identifier[info] operator[SEP] identifier[isEditable] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[m_editLevel] operator[==] identifier[EditLevel] operator[SEP] identifier[configured] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setEnabled] operator[SEP] identifier[editable] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[editable] operator[SEP] {
identifier[field] operator[SEP] identifier[addValidator] operator[SEP] Keyword[new] identifier[FieldValidator] operator[SEP] identifier[info] operator[SEP] identifier[getField] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[field] operator[SEP] identifier[setImmediate] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[field] operator[SEP]
}
|
private void calcChannelsStats(List<TaskRec> tasks) {
for (ChannelWorkContext wc : channelContextMap.values()) {
wc.lastGotCount = 0;
}
for (TaskRec taskRec : tasks) {
ChannelWorkContext wc = channelContextMap.get(taskRec.channel);
if (wc == null) {
wc = new ChannelWorkContext(taskRec.channel);
channelContextMap.put(taskRec.channel, wc);
}
wc.lastGotCount++;
}
// update next portion - double if found something, clear to minimum if not
for (ChannelWorkContext wc : channelContextMap.values()) {
if (wc.lastGotCount > 0) {
wc.nextSlowLimit = Math.min(wc.nextSlowLimit * 2, MAX_TASK_COUNT);
logger.debug("Channel " + wc.channelName + " nextSlowLimit=" + wc.nextSlowLimit);
} else {
wc.dropNextSlowLimit();
}
}
}
|
class class_name[name] begin[{]
method[calcChannelsStats, return_type[void], modifier[private], parameter[tasks]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastGotCount, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=channelContextMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=wc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelWorkContext, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=taskRec, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=channelContextMap, selectors=[], type_arguments=None), name=wc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelWorkContext, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=taskRec, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelWorkContext, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=taskRec, selectors=[]), MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=channelContextMap, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=lastGotCount, postfix_operators=['++'], prefix_operators=[], qualifier=wc, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tasks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=taskRec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskRec, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastGotCount, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=dropNextSlowLimit, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=nextSlowLimit, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=nextSlowLimit, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=*), MemberReference(member=MAX_TASK_COUNT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Channel "), operandr=MemberReference(member=channelName, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" nextSlowLimit="), operator=+), operandr=MemberReference(member=nextSlowLimit, postfix_operators=[], prefix_operators=[], qualifier=wc, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=channelContextMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=wc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelWorkContext, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[calcChannelsStats] operator[SEP] identifier[List] operator[<] identifier[TaskRec] operator[>] identifier[tasks] operator[SEP] {
Keyword[for] operator[SEP] identifier[ChannelWorkContext] identifier[wc] operator[:] identifier[channelContextMap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[wc] operator[SEP] identifier[lastGotCount] operator[=] Other[0] operator[SEP]
}
Keyword[for] operator[SEP] identifier[TaskRec] identifier[taskRec] operator[:] identifier[tasks] operator[SEP] {
identifier[ChannelWorkContext] identifier[wc] operator[=] identifier[channelContextMap] operator[SEP] identifier[get] operator[SEP] identifier[taskRec] operator[SEP] identifier[channel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wc] operator[==] Other[null] operator[SEP] {
identifier[wc] operator[=] Keyword[new] identifier[ChannelWorkContext] operator[SEP] identifier[taskRec] operator[SEP] identifier[channel] operator[SEP] operator[SEP] identifier[channelContextMap] operator[SEP] identifier[put] operator[SEP] identifier[taskRec] operator[SEP] identifier[channel] , identifier[wc] operator[SEP] operator[SEP]
}
identifier[wc] operator[SEP] identifier[lastGotCount] operator[++] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ChannelWorkContext] identifier[wc] operator[:] identifier[channelContextMap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[wc] operator[SEP] identifier[lastGotCount] operator[>] Other[0] operator[SEP] {
identifier[wc] operator[SEP] identifier[nextSlowLimit] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[wc] operator[SEP] identifier[nextSlowLimit] operator[*] Other[2] , identifier[MAX_TASK_COUNT] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[wc] operator[SEP] identifier[channelName] operator[+] literal[String] operator[+] identifier[wc] operator[SEP] identifier[nextSlowLimit] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[wc] operator[SEP] identifier[dropNextSlowLimit] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected URI createRedirectUri(String servletpath, UserGroupInformation ugi,
DatanodeID host, HttpServletRequest request, NameNode nn) throws URISyntaxException {
final String hostname = host instanceof DatanodeInfo?
((DatanodeInfo)host).getHostName(): host.getHost();
final String scheme = request.getScheme();
final int port = "https".equals(scheme)?
(Integer)getServletContext().getAttribute("datanode.https.port")
: host.getInfoPort();
// Add namenode address to the URL params
final String nnAddr = NetUtils.toIpPort(nn.getNameNodeAddress());
final String filename = request.getPathInfo();
return new URI(scheme, null, hostname, port, servletpath,
"filename=" + filename + "&ugi=" + ugi +
JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr), null);
}
|
class class_name[name] begin[{]
method[createRedirectUri, return_type[type[URI]], modifier[protected], parameter[servletpath, ugi, host, request, nn]] begin[{]
local_variable[type[String], hostname]
local_variable[type[String], scheme]
local_variable[type[int], port]
local_variable[type[String], nnAddr]
local_variable[type[String], filename]
return[ClassCreator(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=hostname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=servletpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filename="), operandr=MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&ugi="), operator=+), operandr=MemberReference(member=ugi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=NAMENODE_ADDRESS, postfix_operators=[], prefix_operators=[], qualifier=JspHelper, selectors=[]), MemberReference(member=nnAddr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getUrlParam, postfix_operators=[], prefix_operators=[], qualifier=JspHelper, selectors=[], type_arguments=None), operator=+), 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=URI, sub_type=None))]
end[}]
END[}]
|
Keyword[protected] identifier[URI] identifier[createRedirectUri] operator[SEP] identifier[String] identifier[servletpath] , identifier[UserGroupInformation] identifier[ugi] , identifier[DatanodeID] identifier[host] , identifier[HttpServletRequest] identifier[request] , identifier[NameNode] identifier[nn] operator[SEP] Keyword[throws] identifier[URISyntaxException] {
Keyword[final] identifier[String] identifier[hostname] operator[=] identifier[host] Keyword[instanceof] identifier[DatanodeInfo] operator[?] operator[SEP] operator[SEP] identifier[DatanodeInfo] operator[SEP] identifier[host] operator[SEP] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[:] identifier[host] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[scheme] operator[=] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[port] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[scheme] operator[SEP] operator[?] operator[SEP] identifier[Integer] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[:] identifier[host] operator[SEP] identifier[getInfoPort] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[nnAddr] operator[=] identifier[NetUtils] operator[SEP] identifier[toIpPort] operator[SEP] identifier[nn] operator[SEP] identifier[getNameNodeAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[filename] operator[=] identifier[request] operator[SEP] identifier[getPathInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[URI] operator[SEP] identifier[scheme] , Other[null] , identifier[hostname] , identifier[port] , identifier[servletpath] , literal[String] operator[+] identifier[filename] operator[+] literal[String] operator[+] identifier[ugi] operator[+] identifier[JspHelper] operator[SEP] identifier[getUrlParam] operator[SEP] identifier[JspHelper] operator[SEP] identifier[NAMENODE_ADDRESS] , identifier[nnAddr] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
|
public static synchronized void setOpenHelperClass(Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) {
if (openHelperClass == null) {
helperClass = null;
} else {
innerSetHelperClass(openHelperClass);
}
}
|
class class_name[name] begin[{]
method[setOpenHelperClass, return_type[void], modifier[synchronized public static], parameter[openHelperClass]] begin[{]
if[binary_operation[member[.openHelperClass], ==, literal[null]]] begin[{]
assign[member[.helperClass], literal[null]]
else begin[{]
call[.innerSetHelperClass, parameter[member[.openHelperClass]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[synchronized] Keyword[void] identifier[setOpenHelperClass] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[OrmLiteSqliteOpenHelper] operator[>] identifier[openHelperClass] operator[SEP] {
Keyword[if] operator[SEP] identifier[openHelperClass] operator[==] Other[null] operator[SEP] {
identifier[helperClass] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[innerSetHelperClass] operator[SEP] identifier[openHelperClass] operator[SEP] operator[SEP]
}
}
|
public final CClassLoader removeLoader(final String loaderToRemove) {
if (loaderToRemove.trim().length() == 0) {
throw new NullPointerException();
}
return (CClassLoader) this.childrenMap.remove(loaderToRemove);
}
|
class class_name[name] begin[{]
method[removeLoader, return_type[type[CClassLoader]], modifier[final public], parameter[loaderToRemove]] begin[{]
if[binary_operation[call[loaderToRemove.trim, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=childrenMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=loaderToRemove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=CClassLoader, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[final] identifier[CClassLoader] identifier[removeLoader] operator[SEP] Keyword[final] identifier[String] identifier[loaderToRemove] operator[SEP] {
Keyword[if] operator[SEP] identifier[loaderToRemove] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[CClassLoader] operator[SEP] Keyword[this] operator[SEP] identifier[childrenMap] operator[SEP] identifier[remove] operator[SEP] identifier[loaderToRemove] operator[SEP] operator[SEP]
}
|
@Override
public ReplicationGroup modifyReplicationGroup(ModifyReplicationGroupRequest request) {
request = beforeClientExecution(request);
return executeModifyReplicationGroup(request);
}
|
class class_name[name] begin[{]
method[modifyReplicationGroup, return_type[type[ReplicationGroup]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeModifyReplicationGroup, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ReplicationGroup] identifier[modifyReplicationGroup] operator[SEP] identifier[ModifyReplicationGroupRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeModifyReplicationGroup] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static BoxUser.Info createAppUser(BoxAPIConnection api, String name) {
return createAppUser(api, name, new CreateUserParams());
}
|
class class_name[name] begin[{]
method[createAppUser, return_type[type[BoxUser]], modifier[public static], parameter[api, name]] begin[{]
return[call[.createAppUser, parameter[member[.api], member[.name], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CreateUserParams, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BoxUser] operator[SEP] identifier[Info] identifier[createAppUser] operator[SEP] identifier[BoxAPIConnection] identifier[api] , identifier[String] identifier[name] operator[SEP] {
Keyword[return] identifier[createAppUser] operator[SEP] identifier[api] , identifier[name] , Keyword[new] identifier[CreateUserParams] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Iterator<URL> getResources(String name) {
ArrayList<URL> collectedResources = new ArrayList<URL>();
try {
synchronized (bundles) {
Collection<Bundle> values = bundles.values();
for (Bundle bundle : values) {
final Enumeration<URL> enumeration = bundle.getResources(name);
if (enumeration == null) {
continue;
}
while (enumeration.hasMoreElements()) {
collectedResources.add(enumeration.nextElement());
}
}
}
} catch (IOException e) {
LOGGER.warn("IO exception during reading resources from bundle; returning current state.");
collectedResources.iterator();
}
return collectedResources.iterator();
}
|
class class_name[name] begin[{]
method[getResources, return_type[type[Iterator]], modifier[public], parameter[name]] begin[{]
local_variable[type[ArrayList], collectedResources]
TryStatement(block=[SynchronizedStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=bundles, selectors=[], type_arguments=None), name=values)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None), name=enumeration)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None))], dimensions=[], name=Enumeration, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=enumeration, 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=[ContinueStatement(goto=None, label=None)])), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=enumeration, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=collectedResources, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=enumeration, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bundle)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None))), label=None)], label=None, lock=MemberReference(member=bundles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IO exception during reading resources from bundle; returning current state.")], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=collectedResources, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[call[collectedResources.iterator, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Iterator] operator[<] identifier[URL] operator[>] identifier[getResources] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[ArrayList] operator[<] identifier[URL] operator[>] identifier[collectedResources] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[URL] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[synchronized] operator[SEP] identifier[bundles] operator[SEP] {
identifier[Collection] operator[<] identifier[Bundle] operator[>] identifier[values] operator[=] identifier[bundles] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Bundle] identifier[bundle] operator[:] identifier[values] operator[SEP] {
Keyword[final] identifier[Enumeration] operator[<] identifier[URL] operator[>] identifier[enumeration] operator[=] identifier[bundle] operator[SEP] identifier[getResources] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[enumeration] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[while] operator[SEP] identifier[enumeration] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[collectedResources] operator[SEP] identifier[add] operator[SEP] identifier[enumeration] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[collectedResources] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[collectedResources] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator)
{
m_symbols.setDecimalSeparator(decimalSeparator);
m_symbols.setGroupingSeparator(groupingSeparator);
setDecimalFormatSymbols(m_symbols);
applyPattern(primaryPattern);
if (alternativePatterns != null && alternativePatterns.length != 0)
{
int loop;
if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length)
{
m_alternativeFormats = new DecimalFormat[alternativePatterns.length];
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop] = new DecimalFormat();
}
}
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols);
m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]);
}
}
}
|
class class_name[name] begin[{]
method[applyPattern, return_type[void], modifier[public], parameter[primaryPattern, alternativePatterns, decimalSeparator, groupingSeparator]] begin[{]
call[m_symbols.setDecimalSeparator, parameter[member[.decimalSeparator]]]
call[m_symbols.setGroupingSeparator, parameter[member[.groupingSeparator]]]
call[.setDecimalFormatSymbols, parameter[member[.m_symbols]]]
call[.applyPattern, parameter[member[.primaryPattern]]]
if[binary_operation[binary_operation[member[.alternativePatterns], !=, literal[null]], &&, binary_operation[member[alternativePatterns.length], !=, literal[0]]]] begin[{]
local_variable[type[int], loop]
if[binary_operation[binary_operation[member[.m_alternativeFormats], ==, literal[null]], ||, binary_operation[member[m_alternativeFormats.length], !=, member[alternativePatterns.length]]]] begin[{]
assign[member[.m_alternativeFormats], ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=alternativePatterns, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DecimalFormat, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_alternativeFormats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DecimalFormat, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=alternativePatterns, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=loop, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=m_alternativeFormats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=m_symbols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDecimalFormatSymbols, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=MemberReference(member=m_alternativeFormats, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=alternativePatterns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=applyPattern, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=alternativePatterns, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=loop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=loop, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[applyPattern] operator[SEP] identifier[String] identifier[primaryPattern] , identifier[String] operator[SEP] operator[SEP] identifier[alternativePatterns] , Keyword[char] identifier[decimalSeparator] , Keyword[char] identifier[groupingSeparator] operator[SEP] {
identifier[m_symbols] operator[SEP] identifier[setDecimalSeparator] operator[SEP] identifier[decimalSeparator] operator[SEP] operator[SEP] identifier[m_symbols] operator[SEP] identifier[setGroupingSeparator] operator[SEP] identifier[groupingSeparator] operator[SEP] operator[SEP] identifier[setDecimalFormatSymbols] operator[SEP] identifier[m_symbols] operator[SEP] operator[SEP] identifier[applyPattern] operator[SEP] identifier[primaryPattern] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[alternativePatterns] operator[!=] Other[null] operator[&&] identifier[alternativePatterns] operator[SEP] identifier[length] operator[!=] Other[0] operator[SEP] {
Keyword[int] identifier[loop] operator[SEP] Keyword[if] operator[SEP] identifier[m_alternativeFormats] operator[==] Other[null] operator[||] identifier[m_alternativeFormats] operator[SEP] identifier[length] operator[!=] identifier[alternativePatterns] operator[SEP] identifier[length] operator[SEP] {
identifier[m_alternativeFormats] operator[=] Keyword[new] identifier[DecimalFormat] operator[SEP] identifier[alternativePatterns] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[loop] operator[=] Other[0] operator[SEP] identifier[loop] operator[<] identifier[alternativePatterns] operator[SEP] identifier[length] operator[SEP] identifier[loop] operator[++] operator[SEP] {
identifier[m_alternativeFormats] operator[SEP] identifier[loop] operator[SEP] operator[=] Keyword[new] identifier[DecimalFormat] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[loop] operator[=] Other[0] operator[SEP] identifier[loop] operator[<] identifier[alternativePatterns] operator[SEP] identifier[length] operator[SEP] identifier[loop] operator[++] operator[SEP] {
identifier[m_alternativeFormats] operator[SEP] identifier[loop] operator[SEP] operator[SEP] identifier[setDecimalFormatSymbols] operator[SEP] identifier[m_symbols] operator[SEP] operator[SEP] identifier[m_alternativeFormats] operator[SEP] identifier[loop] operator[SEP] operator[SEP] identifier[applyPattern] operator[SEP] identifier[alternativePatterns] operator[SEP] identifier[loop] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void writeObject(ObjectOutputStream stream) throws IOException {
/*
* Since this is a simple class all we have to do is write each member to the stream.
* the order has to remain identical to readObject, so I've just gone alphabetically.
*
* If we change the serialversionUID, we may need to modify this method as well.
*/
if (tc.isEntryEnabled()) {
Tr.entry(this, tc, "writeObject", stream);
}
ObjectOutputStream.PutField putField = stream.putFields();
putField.put("activationConfigProps", activationConfigProps);
putField.put("destinationRef", destinationRef);
putField.put("authenticationAlias", authenticationAlias);
putField.put("applicationName", applicationName);
putField.put("qmid", qmid);
stream.writeFields();
if (tc.isEntryEnabled()) {
Tr.exit(this, tc, "writeObject activation config - " + this.toString());
}
}
|
class class_name[name] begin[{]
method[writeObject, return_type[void], modifier[private], parameter[stream]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["writeObject"], member[.stream]]]
else begin[{]
None
end[}]
local_variable[type[ObjectOutputStream], putField]
call[putField.put, parameter[literal["activationConfigProps"], member[.activationConfigProps]]]
call[putField.put, parameter[literal["destinationRef"], member[.destinationRef]]]
call[putField.put, parameter[literal["authenticationAlias"], member[.authenticationAlias]]]
call[putField.put, parameter[literal["applicationName"], member[.applicationName]]]
call[putField.put, parameter[literal["qmid"], member[.qmid]]]
call[stream.writeFields, parameter[]]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], binary_operation[literal["writeObject activation config - "], +, THIS[call[None.toString, parameter[]]]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[writeObject] operator[SEP] identifier[ObjectOutputStream] identifier[stream] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[stream] operator[SEP] operator[SEP]
}
identifier[ObjectOutputStream] operator[SEP] identifier[PutField] identifier[putField] operator[=] identifier[stream] operator[SEP] identifier[putFields] operator[SEP] operator[SEP] operator[SEP] identifier[putField] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[activationConfigProps] operator[SEP] operator[SEP] identifier[putField] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[destinationRef] operator[SEP] operator[SEP] identifier[putField] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[authenticationAlias] operator[SEP] operator[SEP] identifier[putField] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[applicationName] operator[SEP] operator[SEP] identifier[putField] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[qmid] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[writeFields] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public Set<java.util.Map.Entry<Long, V>> entrySet() {
return this.timeSeriesMap.entrySet();
}
|
class class_name[name] begin[{]
method[entrySet, return_type[type[Set]], modifier[public], parameter[]] begin[{]
return[THIS[member[None.timeSeriesMap]call[None.entrySet, parameter[]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Set] operator[<] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Long] , identifier[V] operator[>] operator[>] identifier[entrySet] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[timeSeriesMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP]
}
|
private ICondition makeConditionWithSymbolOperand(String key, String operand, String valueString,
boolean ipAddress) throws FilterException {
if (operand.equals("==")) {
return new EqualCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equals("!=")) {
NotContainsCondition cond = new NotContainsCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equals("^=")) {
OrCondition cond = new OrCondition(key, operand);
processOrValues(valueString, ipAddress, cond);
return cond;
} else if (operand.equals("%=")) {
return new ContainsCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equals("<")) {
return new LessCondition(key, makeValue(valueString, ipAddress), operand);
} else if (operand.equals(">")) {
return new GreaterCondition(key, makeValue(valueString, ipAddress), operand);
} else {
Tr.error(tc, "AUTH_FILTER_MALFORMED_SYMBOL_MATCH_TYPE", new Object[] { operand });
throw new FilterException(TraceNLS.getFormattedMessage(this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"AUTH_FILTER_MALFORMED_SYMBOL_MATCH_TYPE",
null,
"CWWKS4352E: The filter match type should be one of: ==, !=, %=, > or <. The match type used was {0}."));
}
}
|
class class_name[name] begin[{]
method[makeConditionWithSymbolOperand, return_type[type[ICondition]], modifier[private], parameter[key, operand, valueString, ipAddress]] begin[{]
if[call[operand.equals, parameter[literal["=="]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=valueString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=operand, 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=EqualCondition, sub_type=None))]
else begin[{]
if[call[operand.equals, parameter[literal["!="]]]] begin[{]
local_variable[type[NotContainsCondition], cond]
call[.processOrValues, parameter[member[.valueString], member[.ipAddress], member[.cond]]]
return[member[.cond]]
else begin[{]
if[call[operand.equals, parameter[literal["^="]]]] begin[{]
local_variable[type[OrCondition], cond]
call[.processOrValues, parameter[member[.valueString], member[.ipAddress], member[.cond]]]
return[member[.cond]]
else begin[{]
if[call[operand.equals, parameter[literal["%="]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=valueString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=operand, 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=ContainsCondition, sub_type=None))]
else begin[{]
if[call[operand.equals, parameter[literal["<"]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=valueString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=operand, 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=LessCondition, sub_type=None))]
else begin[{]
if[call[operand.equals, parameter[literal[">"]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=valueString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=makeValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=operand, 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=GreaterCondition, sub_type=None))]
else begin[{]
call[Tr.error, parameter[member[.tc], literal["AUTH_FILTER_MALFORMED_SYMBOL_MATCH_TYPE"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=operand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=MESSAGE_BUNDLE, postfix_operators=[], prefix_operators=[], qualifier=TraceConstants, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="AUTH_FILTER_MALFORMED_SYMBOL_MATCH_TYPE"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKS4352E: The filter match type should be one of: ==, !=, %=, > or <. The match type used was {0}.")], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=TraceNLS, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FilterException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] identifier[ICondition] identifier[makeConditionWithSymbolOperand] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[operand] , identifier[String] identifier[valueString] , Keyword[boolean] identifier[ipAddress] operator[SEP] Keyword[throws] identifier[FilterException] {
Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[EqualCondition] operator[SEP] identifier[key] , identifier[makeValue] operator[SEP] identifier[valueString] , identifier[ipAddress] operator[SEP] , identifier[operand] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[NotContainsCondition] identifier[cond] operator[=] Keyword[new] identifier[NotContainsCondition] operator[SEP] identifier[key] , identifier[operand] operator[SEP] operator[SEP] identifier[processOrValues] operator[SEP] identifier[valueString] , identifier[ipAddress] , identifier[cond] operator[SEP] operator[SEP] Keyword[return] identifier[cond] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[OrCondition] identifier[cond] operator[=] Keyword[new] identifier[OrCondition] operator[SEP] identifier[key] , identifier[operand] operator[SEP] operator[SEP] identifier[processOrValues] operator[SEP] identifier[valueString] , identifier[ipAddress] , identifier[cond] operator[SEP] operator[SEP] Keyword[return] identifier[cond] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ContainsCondition] operator[SEP] identifier[key] , identifier[makeValue] operator[SEP] identifier[valueString] , identifier[ipAddress] operator[SEP] , identifier[operand] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[LessCondition] operator[SEP] identifier[key] , identifier[makeValue] operator[SEP] identifier[valueString] , identifier[ipAddress] operator[SEP] , identifier[operand] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[operand] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[GreaterCondition] operator[SEP] identifier[key] , identifier[makeValue] operator[SEP] identifier[valueString] , identifier[ipAddress] operator[SEP] , identifier[operand] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[operand]
} operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[FilterException] operator[SEP] identifier[TraceNLS] operator[SEP] identifier[getFormattedMessage] operator[SEP] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[TraceConstants] operator[SEP] identifier[MESSAGE_BUNDLE] , literal[String] , Other[null] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <S, I, O> ADTNode<S, I, O> buildADSFromObservation(final Word<I> input,
final Word<O> output,
final S finalState) {
if (input.size() != output.size()) {
throw new IllegalArgumentException("Arguments differ in length");
}
final Iterator<I> inputIterator = input.iterator();
final Iterator<O> outputIterator = output.iterator();
final ADTNode<S, I, O> result = new ADTSymbolNode<>(null, inputIterator.next());
ADTNode<S, I, O> nodeIter = result;
while (inputIterator.hasNext()) {
final ADTNode<S, I, O> nextNode = new ADTSymbolNode<>(nodeIter, inputIterator.next());
nodeIter.getChildren().put(outputIterator.next(), nextNode);
nodeIter = nextNode;
}
final ADTNode<S, I, O> finalNode = new ADTLeafNode<>(nodeIter, finalState);
nodeIter.getChildren().put(outputIterator.next(), finalNode);
return result;
}
|
class class_name[name] begin[{]
method[buildADSFromObservation, return_type[type[ADTNode]], modifier[public static], parameter[input, output, finalState]] begin[{]
if[binary_operation[call[input.size, parameter[]], !=, call[output.size, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Arguments differ in length")], 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[Iterator], inputIterator]
local_variable[type[Iterator], outputIterator]
local_variable[type[ADTNode], result]
local_variable[type[ADTNode], nodeIter]
while[call[inputIterator.hasNext, parameter[]]] begin[{]
local_variable[type[ADTNode], nextNode]
call[nodeIter.getChildren, parameter[]]
assign[member[.nodeIter], member[.nextNode]]
end[}]
local_variable[type[ADTNode], finalNode]
call[nodeIter.getChildren, parameter[]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[buildADSFromObservation] operator[SEP] Keyword[final] identifier[Word] operator[<] identifier[I] operator[>] identifier[input] , Keyword[final] identifier[Word] operator[<] identifier[O] operator[>] identifier[output] , Keyword[final] identifier[S] identifier[finalState] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[output] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Iterator] operator[<] identifier[I] operator[>] identifier[inputIterator] operator[=] identifier[input] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[O] operator[>] identifier[outputIterator] operator[=] identifier[output] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[result] operator[=] Keyword[new] identifier[ADTSymbolNode] operator[<] operator[>] operator[SEP] Other[null] , identifier[inputIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[nodeIter] operator[=] identifier[result] operator[SEP] Keyword[while] operator[SEP] identifier[inputIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[nextNode] operator[=] Keyword[new] identifier[ADTSymbolNode] operator[<] operator[>] operator[SEP] identifier[nodeIter] , identifier[inputIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[nodeIter] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[outputIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] , identifier[nextNode] operator[SEP] operator[SEP] identifier[nodeIter] operator[=] identifier[nextNode] operator[SEP]
}
Keyword[final] identifier[ADTNode] operator[<] identifier[S] , identifier[I] , identifier[O] operator[>] identifier[finalNode] operator[=] Keyword[new] identifier[ADTLeafNode] operator[<] operator[>] operator[SEP] identifier[nodeIter] , identifier[finalState] operator[SEP] operator[SEP] identifier[nodeIter] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[outputIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] , identifier[finalNode] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public Double getAvgDelayNumber() {
Double avgDelayNumber = 0.0;
if (items.size() != 0) {
for (DelayStat item : items) {
avgDelayNumber += item.getDelayNumber();
}
avgDelayNumber = avgDelayNumber / items.size();
}
return avgDelayNumber;
}
|
class class_name[name] begin[{]
method[getAvgDelayNumber, return_type[type[Double]], modifier[public], parameter[]] begin[{]
local_variable[type[Double], avgDelayNumber]
if[binary_operation[call[items.size, parameter[]], !=, literal[0]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=avgDelayNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getDelayNumber, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DelayStat, sub_type=None))), label=None)
assign[member[.avgDelayNumber], binary_operation[member[.avgDelayNumber], /, call[items.size, parameter[]]]]
else begin[{]
None
end[}]
return[member[.avgDelayNumber]]
end[}]
END[}]
|
Keyword[public] identifier[Double] identifier[getAvgDelayNumber] operator[SEP] operator[SEP] {
identifier[Double] identifier[avgDelayNumber] operator[=] literal[Float] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[DelayStat] identifier[item] operator[:] identifier[items] operator[SEP] {
identifier[avgDelayNumber] operator[+=] identifier[item] operator[SEP] identifier[getDelayNumber] operator[SEP] operator[SEP] operator[SEP]
}
identifier[avgDelayNumber] operator[=] identifier[avgDelayNumber] operator[/] identifier[items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[avgDelayNumber] operator[SEP]
}
|
public T attr(Attribute attribute) {
Iterator<Attribute> iterator = attributes.iterator();
String name = attribute.getName();
if (name != null) {
// name == null is allowed, but those Attributes are not rendered. So we add them anyway.
while (iterator.hasNext()) {
Attribute existingAttribute = iterator.next();
if (existingAttribute.getName().equals(name)) {
iterator.remove();
}
}
}
attributes.add(attribute);
return (T) this;
}
|
class class_name[name] begin[{]
method[attr, return_type[type[T]], modifier[public], parameter[attribute]] begin[{]
local_variable[type[Iterator], iterator]
local_variable[type[String], name]
if[binary_operation[member[.name], !=, literal[null]]] begin[{]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[Attribute], existingAttribute]
if[call[existingAttribute.getName, parameter[]]] begin[{]
call[iterator.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
call[attributes.add, parameter[member[.attribute]]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[T] identifier[attr] operator[SEP] identifier[Attribute] identifier[attribute] operator[SEP] {
identifier[Iterator] operator[<] identifier[Attribute] operator[>] identifier[iterator] operator[=] identifier[attributes] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] identifier[attribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[!=] Other[null] operator[SEP] {
Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Attribute] identifier[existingAttribute] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existingAttribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[attributes] operator[SEP] identifier[add] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP]
}
|
public CronDefinition instance() {
final Set<CronConstraint> validations = new HashSet<>();
validations.addAll(cronConstraints);
final List<FieldDefinition> values = new ArrayList<>(fields.values());
values.sort(FieldDefinition.createFieldDefinitionComparator());
return new CronDefinition(values, validations, enforceStrictRanges, matchDayOfWeekAndDayOfMonth);
}
|
class class_name[name] begin[{]
method[instance, return_type[type[CronDefinition]], modifier[public], parameter[]] begin[{]
local_variable[type[Set], validations]
call[validations.addAll, parameter[member[.cronConstraints]]]
local_variable[type[List], values]
call[values.sort, parameter[call[FieldDefinition.createFieldDefinitionComparator, parameter[]]]]
return[ClassCreator(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=validations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=enforceStrictRanges, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matchDayOfWeekAndDayOfMonth, 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=CronDefinition, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[CronDefinition] identifier[instance] operator[SEP] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[CronConstraint] operator[>] identifier[validations] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[validations] operator[SEP] identifier[addAll] operator[SEP] identifier[cronConstraints] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[FieldDefinition] operator[>] identifier[values] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[fields] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[sort] operator[SEP] identifier[FieldDefinition] operator[SEP] identifier[createFieldDefinitionComparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CronDefinition] operator[SEP] identifier[values] , identifier[validations] , identifier[enforceStrictRanges] , identifier[matchDayOfWeekAndDayOfMonth] operator[SEP] operator[SEP]
}
|
public String getString(int id)
{
Activity activity = activityUtils.getCurrentActivity(false);
if(activity == null){
return "";
}
return activity.getString(id);
}
|
class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[id]] begin[{]
local_variable[type[Activity], activity]
if[binary_operation[member[.activity], ==, literal[null]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
return[call[activity.getString, parameter[member[.id]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getString] operator[SEP] Keyword[int] identifier[id] operator[SEP] {
identifier[Activity] identifier[activity] operator[=] identifier[activityUtils] operator[SEP] identifier[getCurrentActivity] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[activity] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[return] identifier[activity] operator[SEP] identifier[getString] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
|
protected void onClickSave() {
Timer timer = new Timer() {
@Override
public void run() {
m_aliasList.clearValidationErrors();
m_aliasValidationStatus = VALIDATION_RUNNING;
m_propertyValidationStatus = VALIDATION_RUNNING;
m_aliasList.validate(new Runnable() {
public void run() {
m_aliasValidationStatus = !m_aliasList.hasValidationErrors()
? VALIDATION_OK
: VALIDATION_FAILED;
update(true);
}
});
m_propertyEditor.getForm().validateAndSubmit();
}
};
// slight delay so that the validation doesn't interfere with validations triggered by the change event
timer.schedule(20);
}
|
class class_name[name] begin[{]
method[onClickSave, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[Timer], timer]
call[timer.schedule, parameter[literal[20]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[onClickSave] operator[SEP] operator[SEP] {
identifier[Timer] identifier[timer] operator[=] Keyword[new] identifier[Timer] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[m_aliasList] operator[SEP] identifier[clearValidationErrors] operator[SEP] operator[SEP] operator[SEP] identifier[m_aliasValidationStatus] operator[=] identifier[VALIDATION_RUNNING] operator[SEP] identifier[m_propertyValidationStatus] operator[=] identifier[VALIDATION_RUNNING] operator[SEP] identifier[m_aliasList] operator[SEP] identifier[validate] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[m_aliasValidationStatus] operator[=] operator[!] identifier[m_aliasList] operator[SEP] identifier[hasValidationErrors] operator[SEP] operator[SEP] operator[?] identifier[VALIDATION_OK] operator[:] identifier[VALIDATION_FAILED] operator[SEP] identifier[update] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[m_propertyEditor] operator[SEP] identifier[getForm] operator[SEP] operator[SEP] operator[SEP] identifier[validateAndSubmit] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[timer] operator[SEP] identifier[schedule] operator[SEP] Other[20] operator[SEP] operator[SEP]
}
|
public void marshall(BurninDestinationSettings burninDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (burninDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(burninDestinationSettings.getAlignment(), ALIGNMENT_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontColor(), FONTCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontScript(), FONTSCRIPT_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getFontSize(), FONTSIZE_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getXPosition(), XPOSITION_BINDING);
protocolMarshaller.marshall(burninDestinationSettings.getYPosition(), YPOSITION_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[burninDestinationSettings, protocolMarshaller]] begin[{]
if[binary_operation[member[.burninDestinationSettings], ==, 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=getAlignment, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=ALIGNMENT_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=getBackgroundColor, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=BACKGROUNDCOLOR_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=getBackgroundOpacity, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=BACKGROUNDOPACITY_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=getFontColor, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=FONTCOLOR_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=getFontOpacity, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=FONTOPACITY_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=getFontResolution, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=FONTRESOLUTION_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=getFontScript, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=FONTSCRIPT_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=getFontSize, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=FONTSIZE_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=getOutlineColor, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=OUTLINECOLOR_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=getOutlineSize, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=OUTLINESIZE_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=getShadowColor, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=SHADOWCOLOR_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=getShadowOpacity, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=SHADOWOPACITY_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=getShadowXOffset, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=SHADOWXOFFSET_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=getShadowYOffset, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=SHADOWYOFFSET_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=getTeletextSpacing, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=TELETEXTSPACING_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=getXPosition, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=XPOSITION_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=getYPosition, postfix_operators=[], prefix_operators=[], qualifier=burninDestinationSettings, selectors=[], type_arguments=None), MemberReference(member=YPOSITION_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[BurninDestinationSettings] identifier[burninDestinationSettings] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[burninDestinationSettings] 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[burninDestinationSettings] operator[SEP] identifier[getAlignment] operator[SEP] operator[SEP] , identifier[ALIGNMENT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getBackgroundColor] operator[SEP] operator[SEP] , identifier[BACKGROUNDCOLOR_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getBackgroundOpacity] operator[SEP] operator[SEP] , identifier[BACKGROUNDOPACITY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getFontColor] operator[SEP] operator[SEP] , identifier[FONTCOLOR_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getFontOpacity] operator[SEP] operator[SEP] , identifier[FONTOPACITY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getFontResolution] operator[SEP] operator[SEP] , identifier[FONTRESOLUTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getFontScript] operator[SEP] operator[SEP] , identifier[FONTSCRIPT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getFontSize] operator[SEP] operator[SEP] , identifier[FONTSIZE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getOutlineColor] operator[SEP] operator[SEP] , identifier[OUTLINECOLOR_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getOutlineSize] operator[SEP] operator[SEP] , identifier[OUTLINESIZE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getShadowColor] operator[SEP] operator[SEP] , identifier[SHADOWCOLOR_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getShadowOpacity] operator[SEP] operator[SEP] , identifier[SHADOWOPACITY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getShadowXOffset] operator[SEP] operator[SEP] , identifier[SHADOWXOFFSET_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getShadowYOffset] operator[SEP] operator[SEP] , identifier[SHADOWYOFFSET_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getTeletextSpacing] operator[SEP] operator[SEP] , identifier[TELETEXTSPACING_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getXPosition] operator[SEP] operator[SEP] , identifier[XPOSITION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[burninDestinationSettings] operator[SEP] identifier[getYPosition] operator[SEP] operator[SEP] , identifier[YPOSITION_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]
}
}
|
private SOAPElement constructSoapHeader(
Map<String, Object> headerData, AdManagerServiceDescriptor adManagerServiceDescriptor) {
String requestHeaderNamespace =
adManagerApiConfiguration.getNamespacePrefix()
+ "/"
+ adManagerServiceDescriptor.getVersion();
try {
SOAPFactory soapFactory = SOAPFactory.newInstance();
SOAPElement requestHeader =
soapFactory.createElement(REQUEST_HEADER_LOCAL_PART, "ns1", requestHeaderNamespace);
for (String headerElementName : headerData.keySet()) {
if (headerData.get(headerElementName) != null) {
SOAPElement newElement =
requestHeader.addChildElement(headerElementName, "ns1", requestHeaderNamespace);
newElement.addTextNode(headerData.get(headerElementName).toString());
}
}
return requestHeader;
} catch (SOAPException e) {
throw new ServiceException("Unexpected exception.", e);
}
}
|
class class_name[name] begin[{]
method[constructSoapHeader, return_type[type[SOAPElement]], modifier[private], parameter[headerData, adManagerServiceDescriptor]] begin[{]
local_variable[type[String], requestHeaderNamespace]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=SOAPFactory, selectors=[], type_arguments=None), name=soapFactory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SOAPFactory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=REQUEST_HEADER_LOCAL_PART, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ns1"), MemberReference(member=requestHeaderNamespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createElement, postfix_operators=[], prefix_operators=[], qualifier=soapFactory, selectors=[], type_arguments=None), name=requestHeader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SOAPElement, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=headerData, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ns1"), MemberReference(member=requestHeaderNamespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChildElement, postfix_operators=[], prefix_operators=[], qualifier=requestHeader, selectors=[], type_arguments=None), name=newElement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SOAPElement, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=headerData, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addTextNode, postfix_operators=[], prefix_operators=[], qualifier=newElement, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=headerData, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=headerElementName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=requestHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected exception."), 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)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SOAPException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] identifier[SOAPElement] identifier[constructSoapHeader] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[headerData] , identifier[AdManagerServiceDescriptor] identifier[adManagerServiceDescriptor] operator[SEP] {
identifier[String] identifier[requestHeaderNamespace] operator[=] identifier[adManagerApiConfiguration] operator[SEP] identifier[getNamespacePrefix] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[adManagerServiceDescriptor] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SOAPFactory] identifier[soapFactory] operator[=] identifier[SOAPFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[SOAPElement] identifier[requestHeader] operator[=] identifier[soapFactory] operator[SEP] identifier[createElement] operator[SEP] identifier[REQUEST_HEADER_LOCAL_PART] , literal[String] , identifier[requestHeaderNamespace] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[headerElementName] operator[:] identifier[headerData] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[headerData] operator[SEP] identifier[get] operator[SEP] identifier[headerElementName] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[SOAPElement] identifier[newElement] operator[=] identifier[requestHeader] operator[SEP] identifier[addChildElement] operator[SEP] identifier[headerElementName] , literal[String] , identifier[requestHeaderNamespace] operator[SEP] operator[SEP] identifier[newElement] operator[SEP] identifier[addTextNode] operator[SEP] identifier[headerData] operator[SEP] identifier[get] operator[SEP] identifier[headerElementName] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[requestHeader] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SOAPException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void registerType(Class<?> type) {
if (type == null) {
throw new NullPointerException("Cannot register null type class.");
}
TypeInformation<?> typeInfo = TypeExtractor.createTypeInfo(type);
if (typeInfo instanceof PojoTypeInfo) {
config.registerPojoType(type);
} else {
config.registerKryoType(type);
}
}
|
class class_name[name] begin[{]
method[registerType, return_type[void], modifier[public], parameter[type]] begin[{]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot register null type class.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[TypeInformation], typeInfo]
if[binary_operation[member[.typeInfo], instanceof, type[PojoTypeInfo]]] begin[{]
call[config.registerPojoType, parameter[member[.type]]]
else begin[{]
call[config.registerKryoType, parameter[member[.type]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[registerType] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[TypeInformation] operator[<] operator[?] operator[>] identifier[typeInfo] operator[=] identifier[TypeExtractor] operator[SEP] identifier[createTypeInfo] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeInfo] Keyword[instanceof] identifier[PojoTypeInfo] operator[SEP] {
identifier[config] operator[SEP] identifier[registerPojoType] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[config] operator[SEP] identifier[registerKryoType] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
}
|
public static String fixEncodedTagsInNameAfterPrefix(final String name) {
if (name == null)
return name;
int tagStart = name.indexOf("TAG(");
if (tagStart == -1)
return name; // no tags in this name
if (tagStart == 0)
return name; // tag string is already correct
// extract the "TAG(...)" string from the middle of the name and put it at the front.
int tagEnd = name.lastIndexOf(')');
if (tagEnd == -1) {
throw new IllegalArgumentException("Tag definition missing closing parenthesis for metric '" + name + "'");
}
String tagString = name.substring(tagStart, tagEnd+1);
return tagString + name.substring(0, tagStart) + name.substring(tagEnd+1);
}
|
class class_name[name] begin[{]
method[fixEncodedTagsInNameAfterPrefix, return_type[type[String]], modifier[public static], parameter[name]] begin[{]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
return[member[.name]]
else begin[{]
None
end[}]
local_variable[type[int], tagStart]
if[binary_operation[member[.tagStart], ==, literal[1]]] begin[{]
return[member[.name]]
else begin[{]
None
end[}]
if[binary_operation[member[.tagStart], ==, literal[0]]] begin[{]
return[member[.name]]
else begin[{]
None
end[}]
local_variable[type[int], tagEnd]
if[binary_operation[member[.tagEnd], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Tag definition missing closing parenthesis for metric '"), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], tagString]
return[binary_operation[binary_operation[member[.tagString], +, call[name.substring, parameter[literal[0], member[.tagStart]]]], +, call[name.substring, parameter[binary_operation[member[.tagEnd], +, literal[1]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[fixEncodedTagsInNameAfterPrefix] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] Keyword[return] identifier[name] operator[SEP] Keyword[int] identifier[tagStart] operator[=] identifier[name] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tagStart] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] identifier[name] operator[SEP] Keyword[if] operator[SEP] identifier[tagStart] operator[==] Other[0] operator[SEP] Keyword[return] identifier[name] operator[SEP] Keyword[int] identifier[tagEnd] operator[=] identifier[name] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tagEnd] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[tagString] operator[=] identifier[name] operator[SEP] identifier[substring] operator[SEP] identifier[tagStart] , identifier[tagEnd] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[tagString] operator[+] identifier[name] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[tagStart] operator[SEP] operator[+] identifier[name] operator[SEP] identifier[substring] operator[SEP] identifier[tagEnd] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
protected void removeModule(String moduleName, I_CmsReport report) throws CmsException {
if (OpenCms.getModuleManager().getModule(moduleName) != null) {
OpenCms.getModuleManager().deleteModule(
m_cms,
moduleName,
true,
m_preserveLibModules.contains(moduleName),
report);
}
}
|
class class_name[name] begin[{]
method[removeModule, return_type[void], modifier[protected], parameter[moduleName, report]] begin[{]
if[binary_operation[call[OpenCms.getModuleManager, parameter[]], !=, literal[null]]] begin[{]
call[OpenCms.getModuleManager, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[removeModule] operator[SEP] identifier[String] identifier[moduleName] , identifier[I_CmsReport] identifier[report] operator[SEP] Keyword[throws] identifier[CmsException] {
Keyword[if] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[getModule] operator[SEP] identifier[moduleName] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[deleteModule] operator[SEP] identifier[m_cms] , identifier[moduleName] , literal[boolean] , identifier[m_preserveLibModules] operator[SEP] identifier[contains] operator[SEP] identifier[moduleName] operator[SEP] , identifier[report] operator[SEP] operator[SEP]
}
}
|
public Deferred<Boolean> syncToStorage(final TSDB tsdb,
final boolean overwrite) {
if (uid == null || uid.isEmpty()) {
throw new IllegalArgumentException("Missing UID");
}
if (type == null) {
throw new IllegalArgumentException("Missing type");
}
boolean has_changes = false;
for (Map.Entry<String, Boolean> entry : changed.entrySet()) {
if (entry.getValue()) {
has_changes = true;
break;
}
}
if (!has_changes) {
LOG.debug(this + " does not have changes, skipping sync to storage");
throw new IllegalStateException("No changes detected in UID meta data");
}
/**
* Callback used to verify that the UID to name mapping exists. Uses the TSD
* for verification so the name may be cached. If the name does not exist
* it will throw a NoSuchUniqueId and the meta data will not be saved to
* storage
*/
final class NameCB implements Callback<Deferred<Boolean>, String> {
private final UIDMeta local_meta;
public NameCB(final UIDMeta meta) {
local_meta = meta;
}
/**
* Nested callback used to merge and store the meta data after verifying
* that the UID mapping exists. It has to access the {@code local_meta}
* object so that's why it's nested within the NameCB class
*/
final class StoreUIDMeta implements Callback<Deferred<Boolean>,
ArrayList<KeyValue>> {
/**
* Executes the CompareAndSet after merging changes
* @return True if the CAS was successful, false if the stored data
* was modified during flight.
*/
@Override
public Deferred<Boolean> call(final ArrayList<KeyValue> row)
throws Exception {
final UIDMeta stored_meta;
if (row == null || row.isEmpty()) {
stored_meta = null;
} else {
stored_meta = JSON.parseToObject(row.get(0).value(), UIDMeta.class);
stored_meta.initializeChangedMap();
}
final byte[] original_meta = row == null || row.isEmpty() ?
new byte[0] : row.get(0).value();
if (stored_meta != null) {
local_meta.syncMeta(stored_meta, overwrite);
}
// verify the name is set locally just to be safe
if (name == null || name.isEmpty()) {
local_meta.name = name;
}
final PutRequest put = new PutRequest(tsdb.uidTable(),
UniqueId.stringToUid(uid), FAMILY,
(type.toString().toLowerCase() + "_meta").getBytes(CHARSET),
local_meta.getStorageJSON());
return tsdb.getClient().compareAndSet(put, original_meta);
}
}
/**
* NameCB method that fetches the object from storage for merging and
* use in the CAS call
* @return The results of the {@link #StoreUIDMeta} callback
*/
@Override
public Deferred<Boolean> call(final String name) throws Exception {
final GetRequest get = new GetRequest(tsdb.uidTable(),
UniqueId.stringToUid(uid));
get.family(FAMILY);
get.qualifier((type.toString().toLowerCase() + "_meta").getBytes(CHARSET));
// #2 deferred
return tsdb.getClient().get(get)
.addCallbackDeferring(new StoreUIDMeta());
}
}
// start the callback chain by veryfing that the UID name mapping exists
return tsdb.getUidName(type, UniqueId.stringToUid(uid))
.addCallbackDeferring(new NameCB(this));
}
|
class class_name[name] begin[{]
method[syncToStorage, return_type[type[Deferred]], modifier[public], parameter[tsdb, overwrite]] begin[{]
if[binary_operation[binary_operation[member[.uid], ==, literal[null]], ||, call[uid.isEmpty, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing UID")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing type")], 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[boolean], has_changes]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=has_changes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=changed, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
if[member[.has_changes]] begin[{]
call[LOG.debug, parameter[binary_operation[THIS[], +, literal[" does not have changes, skipping sync to storage"]]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No changes detected in UID meta data")], 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[}]
class class_name[NameCB] begin[{]
type[UIDMeta] field[local_meta]
method[NameCB, modifier[public], parameter[meta]] begin[{]
assign[member[.local_meta], member[.meta]]
end[}]
class class_name[StoreUIDMeta] begin[{]
method[call, return_type[type[Deferred]], modifier[public], parameter[row]] begin[{]
local_variable[type[UIDMeta], stored_meta]
if[binary_operation[binary_operation[member[.row], ==, literal[null]], ||, call[row.isEmpty, parameter[]]]] begin[{]
assign[member[.stored_meta], literal[null]]
else begin[{]
assign[member[.stored_meta], call[JSON.parseToObject, parameter[call[row.get, parameter[literal[0]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UIDMeta, sub_type=None))]]]
call[stored_meta.initializeChangedMap, parameter[]]
end[}]
local_variable[type[byte], original_meta]
if[binary_operation[member[.stored_meta], !=, literal[null]]] begin[{]
call[local_meta.syncMeta, parameter[member[.stored_meta], member[.overwrite]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.name], ==, literal[null]], ||, call[name.isEmpty, parameter[]]]] begin[{]
assign[member[local_meta.name], member[.name]]
else begin[{]
None
end[}]
local_variable[type[PutRequest], put]
return[call[tsdb.getClient, parameter[]]]
end[}]
END[}]
method[call, return_type[type[Deferred]], modifier[public], parameter[name]] begin[{]
local_variable[type[GetRequest], get]
call[get.family, parameter[member[.FAMILY]]]
call[get.qualifier, parameter[binary_operation[call[type.toString, parameter[]], +, literal["_meta"]]]]
return[call[tsdb.getClient, parameter[]]]
end[}]
END[}]
return[call[tsdb.getUidName, parameter[member[.type], call[UniqueId.stringToUid, parameter[member[.uid]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Deferred] operator[<] identifier[Boolean] operator[>] identifier[syncToStorage] operator[SEP] Keyword[final] identifier[TSDB] identifier[tsdb] , Keyword[final] Keyword[boolean] identifier[overwrite] operator[SEP] {
Keyword[if] operator[SEP] identifier[uid] operator[==] Other[null] operator[||] identifier[uid] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[has_changes] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Boolean] operator[>] identifier[entry] operator[:] identifier[changed] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[has_changes] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[has_changes] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] Keyword[this] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[class] identifier[NameCB] Keyword[implements] identifier[Callback] operator[<] identifier[Deferred] operator[<] identifier[Boolean] operator[>] , identifier[String] operator[>] {
Keyword[private] Keyword[final] identifier[UIDMeta] identifier[local_meta] operator[SEP] Keyword[public] identifier[NameCB] operator[SEP] Keyword[final] identifier[UIDMeta] identifier[meta] operator[SEP] {
identifier[local_meta] operator[=] identifier[meta] operator[SEP]
}
Keyword[final] Keyword[class] identifier[StoreUIDMeta] Keyword[implements] identifier[Callback] operator[<] identifier[Deferred] operator[<] identifier[Boolean] operator[>] , identifier[ArrayList] operator[<] identifier[KeyValue] operator[>] operator[>] {
annotation[@] identifier[Override] Keyword[public] identifier[Deferred] operator[<] identifier[Boolean] operator[>] identifier[call] operator[SEP] Keyword[final] identifier[ArrayList] operator[<] identifier[KeyValue] operator[>] identifier[row] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[UIDMeta] identifier[stored_meta] operator[SEP] Keyword[if] operator[SEP] identifier[row] operator[==] Other[null] operator[||] identifier[row] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[stored_meta] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[stored_meta] operator[=] identifier[JSON] operator[SEP] identifier[parseToObject] operator[SEP] identifier[row] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] , identifier[UIDMeta] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[stored_meta] operator[SEP] identifier[initializeChangedMap] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[original_meta] operator[=] identifier[row] operator[==] Other[null] operator[||] identifier[row] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] Keyword[new] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[:] identifier[row] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stored_meta] operator[!=] Other[null] operator[SEP] {
identifier[local_meta] operator[SEP] identifier[syncMeta] operator[SEP] identifier[stored_meta] , identifier[overwrite] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[||] identifier[name] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[local_meta] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP]
}
Keyword[final] identifier[PutRequest] identifier[put] operator[=] Keyword[new] identifier[PutRequest] operator[SEP] identifier[tsdb] operator[SEP] identifier[uidTable] operator[SEP] operator[SEP] , identifier[UniqueId] operator[SEP] identifier[stringToUid] operator[SEP] identifier[uid] operator[SEP] , identifier[FAMILY] , operator[SEP] identifier[type] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[CHARSET] operator[SEP] , identifier[local_meta] operator[SEP] identifier[getStorageJSON] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tsdb] operator[SEP] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[put] , identifier[original_meta] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] identifier[Deferred] operator[<] identifier[Boolean] operator[>] identifier[call] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[GetRequest] identifier[get] operator[=] Keyword[new] identifier[GetRequest] operator[SEP] identifier[tsdb] operator[SEP] identifier[uidTable] operator[SEP] operator[SEP] , identifier[UniqueId] operator[SEP] identifier[stringToUid] operator[SEP] identifier[uid] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[family] operator[SEP] identifier[FAMILY] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[qualifier] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[CHARSET] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tsdb] operator[SEP] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[get] operator[SEP] operator[SEP] identifier[addCallbackDeferring] operator[SEP] Keyword[new] identifier[StoreUIDMeta] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[tsdb] operator[SEP] identifier[getUidName] operator[SEP] identifier[type] , identifier[UniqueId] operator[SEP] identifier[stringToUid] operator[SEP] identifier[uid] operator[SEP] operator[SEP] operator[SEP] identifier[addCallbackDeferring] operator[SEP] Keyword[new] identifier[NameCB] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Modifiers getInstance(int bitmask) {
switch (bitmask) {
case 0:
return NONE;
case Modifier.PUBLIC:
return PUBLIC;
case Modifier.PUBLIC | Modifier.ABSTRACT:
return PUBLIC_ABSTRACT;
case Modifier.PUBLIC | Modifier.STATIC:
return PUBLIC_STATIC;
case Modifier.PROTECTED:
return PROTECTED;
case Modifier.PRIVATE:
return PRIVATE;
}
return new Modifiers(bitmask);
}
|
class class_name[name] begin[{]
method[getInstance, return_type[type[Modifiers]], modifier[public static], parameter[bitmask]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[ReturnStatement(expression=MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=PUBLIC, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=PUBLIC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[BinaryOperation(operandl=MemberReference(member=PUBLIC, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[]), operandr=MemberReference(member=ABSTRACT, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[]), operator=|)], statements=[ReturnStatement(expression=MemberReference(member=PUBLIC_ABSTRACT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[BinaryOperation(operandl=MemberReference(member=PUBLIC, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[]), operandr=MemberReference(member=STATIC, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[]), operator=|)], statements=[ReturnStatement(expression=MemberReference(member=PUBLIC_STATIC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=PROTECTED, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=PROTECTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=PRIVATE, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=PRIVATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])], expression=MemberReference(member=bitmask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[ClassCreator(arguments=[MemberReference(member=bitmask, 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=Modifiers, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Modifiers] identifier[getInstance] operator[SEP] Keyword[int] identifier[bitmask] operator[SEP] {
Keyword[switch] operator[SEP] identifier[bitmask] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[return] identifier[NONE] operator[SEP] Keyword[case] identifier[Modifier] operator[SEP] identifier[PUBLIC] operator[:] Keyword[return] identifier[PUBLIC] operator[SEP] Keyword[case] identifier[Modifier] operator[SEP] identifier[PUBLIC] operator[|] identifier[Modifier] operator[SEP] identifier[ABSTRACT] operator[:] Keyword[return] identifier[PUBLIC_ABSTRACT] operator[SEP] Keyword[case] identifier[Modifier] operator[SEP] identifier[PUBLIC] operator[|] identifier[Modifier] operator[SEP] identifier[STATIC] operator[:] Keyword[return] identifier[PUBLIC_STATIC] operator[SEP] Keyword[case] identifier[Modifier] operator[SEP] identifier[PROTECTED] operator[:] Keyword[return] identifier[PROTECTED] operator[SEP] Keyword[case] identifier[Modifier] operator[SEP] identifier[PRIVATE] operator[:] Keyword[return] identifier[PRIVATE] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Modifiers] operator[SEP] identifier[bitmask] operator[SEP] operator[SEP]
}
|
@Override
public final <R2> Either<L, R2> pure(R2 r2) {
return right(r2);
}
|
class class_name[name] begin[{]
method[pure, return_type[type[Either]], modifier[final public], parameter[r2]] begin[{]
return[call[.right, parameter[member[.r2]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] operator[<] identifier[R2] operator[>] identifier[Either] operator[<] identifier[L] , identifier[R2] operator[>] identifier[pure] operator[SEP] identifier[R2] identifier[r2] operator[SEP] {
Keyword[return] identifier[right] operator[SEP] identifier[r2] operator[SEP] operator[SEP]
}
|
public Set<T> resolve(Matcher<T> matcher) throws IOException {
Set<T> classes = new HashSet<T>();
for (URL url : paths) {
if (url.toString().endsWith(".jar")) {
// System.out.println(url);
JarFile jarFile = new JarFile(URLDecoder.decode(url.getPath(), "UTF-8"));
Manifest manifest = jarFile.getManifest();
if (manifest != null) {
// System.out.println(manifest);
Attributes mainAttributes = manifest.getMainAttributes();
if (mainAttributes != null) {
// System.out.println(mainAttributes);
String classpath = mainAttributes.getValue(Name.CLASS_PATH);
if (classpath != null) {
// System.out.println(classpath);
StringTokenizer stringTokenizer = new StringTokenizer(classpath);
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
URL entry = new URL(url, token);
if (entry.toString().endsWith("/")) {
// System.out.println(entry);
classes.addAll(getMatchedClasses(matcher, new File(URLDecoder.decode(entry.getPath(), "UTF-8"))));
} else {
// System.out.println(entry);
classes.addAll(getMatchedClasses(matcher, new JarFile(URLDecoder.decode(entry.getPath(), "UTF-8"))));
}
}
}
}
}
classes.addAll(getMatchedClasses(matcher, jarFile));
} else {
File base = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
classes.addAll(getMatchedClasses(matcher, base));
}
}
return classes;
}
|
class class_name[name] begin[{]
method[resolve, return_type[type[Set]], modifier[public], parameter[matcher]] begin[{]
local_variable[type[Set], classes]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".jar")], member=endsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=base)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMatchedClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JarFile, sub_type=None)), name=jarFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JarFile, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getManifest, postfix_operators=[], prefix_operators=[], qualifier=jarFile, selectors=[], type_arguments=None), name=manifest)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Manifest, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=manifest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMainAttributes, postfix_operators=[], prefix_operators=[], qualifier=manifest, selectors=[], type_arguments=None), name=mainAttributes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attributes, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mainAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=CLASS_PATH, postfix_operators=[], prefix_operators=[], qualifier=Name, selectors=[])], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=mainAttributes, selectors=[], type_arguments=None), name=classpath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=classpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=classpath, 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=StringTokenizer, sub_type=None)), name=stringTokenizer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTokenizer, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=stringTokenizer, selectors=[], type_arguments=None), name=token)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=token, 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)), name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=endsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JarFile, sub_type=None))], member=getMatchedClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=getMatchedClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasMoreTokens, postfix_operators=[], prefix_operators=[], qualifier=stringTokenizer, selectors=[], type_arguments=None), label=None)]))]))])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jarFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMatchedClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=url)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None))), label=None)
return[member[.classes]]
end[}]
END[}]
|
Keyword[public] identifier[Set] operator[<] identifier[T] operator[>] identifier[resolve] operator[SEP] identifier[Matcher] operator[<] identifier[T] operator[>] identifier[matcher] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Set] operator[<] identifier[T] operator[>] identifier[classes] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[URL] identifier[url] operator[:] identifier[paths] operator[SEP] {
Keyword[if] operator[SEP] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[JarFile] identifier[jarFile] operator[=] Keyword[new] identifier[JarFile] operator[SEP] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Manifest] identifier[manifest] operator[=] identifier[jarFile] operator[SEP] identifier[getManifest] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[manifest] operator[!=] Other[null] operator[SEP] {
identifier[Attributes] identifier[mainAttributes] operator[=] identifier[manifest] operator[SEP] identifier[getMainAttributes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mainAttributes] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[classpath] operator[=] identifier[mainAttributes] operator[SEP] identifier[getValue] operator[SEP] identifier[Name] operator[SEP] identifier[CLASS_PATH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[classpath] operator[!=] Other[null] operator[SEP] {
identifier[StringTokenizer] identifier[stringTokenizer] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[classpath] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[stringTokenizer] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[token] operator[=] identifier[stringTokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[URL] identifier[entry] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[url] , identifier[token] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[classes] operator[SEP] identifier[addAll] operator[SEP] identifier[getMatchedClasses] operator[SEP] identifier[matcher] , Keyword[new] identifier[File] operator[SEP] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[entry] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[classes] operator[SEP] identifier[addAll] operator[SEP] identifier[getMatchedClasses] operator[SEP] identifier[matcher] , Keyword[new] identifier[JarFile] operator[SEP] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[entry] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
identifier[classes] operator[SEP] identifier[addAll] operator[SEP] identifier[getMatchedClasses] operator[SEP] identifier[matcher] , identifier[jarFile] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[File] identifier[base] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[SEP] identifier[addAll] operator[SEP] identifier[getMatchedClasses] operator[SEP] identifier[matcher] , identifier[base] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[classes] operator[SEP]
}
|
public void set(Object obj, Object val, Object... args)
throws SQLException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException,
BeanPropertyException, NoSuchMethodException {
boolean noValue[] = new boolean[1];
val = convert(val, getTypeCode(), noValue);
if (noValue[0])
return;
if (m_f != null) {
m_f.set(obj, val);
return;
}
if (m_mSet != null) {
if (args == null || args.length == 0)
m_mSet.invoke(obj, val);
else {
Object[] all = new Object[args.length + 1];
for (int i = 0; i < args.length; i++)
all[i] = args[i];
all[all.length - 1] = val;
m_mSet.invoke(obj, all);
}
return;
}
throw new BeanPropertyException("Try to write read-only property.");
}
|
class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[obj, val, args]] begin[{]
local_variable[type[boolean], noValue]
assign[member[.val], call[.convert, parameter[member[.val], call[.getTypeCode, parameter[]], member[.noValue]]]]
if[member[.noValue]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.m_f], !=, literal[null]]] begin[{]
call[m_f.set, parameter[member[.obj], member[.val]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.m_mSet], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[member[.args], ==, literal[null]], ||, binary_operation[member[args.length], ==, literal[0]]]] begin[{]
call[m_mSet.invoke, parameter[member[.obj], member[.val]]]
else begin[{]
local_variable[type[Object], all]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=all, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=args, 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)
assign[member[.all], member[.val]]
call[m_mSet.invoke, parameter[member[.obj], member[.all]]]
end[}]
return[None]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Try to write read-only property.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanPropertyException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[Object] identifier[obj] , identifier[Object] identifier[val] , identifier[Object] operator[...] identifier[args] operator[SEP] Keyword[throws] identifier[SQLException] , identifier[IllegalArgumentException] , identifier[IllegalAccessException] , identifier[InvocationTargetException] , identifier[BeanPropertyException] , identifier[NoSuchMethodException] {
Keyword[boolean] identifier[noValue] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[boolean] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[val] operator[=] identifier[convert] operator[SEP] identifier[val] , identifier[getTypeCode] operator[SEP] operator[SEP] , identifier[noValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[noValue] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[m_f] operator[!=] Other[null] operator[SEP] {
identifier[m_f] operator[SEP] identifier[set] operator[SEP] identifier[obj] , identifier[val] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_mSet] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[==] Other[null] operator[||] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] identifier[m_mSet] operator[SEP] identifier[invoke] operator[SEP] identifier[obj] , identifier[val] operator[SEP] operator[SEP] Keyword[else] {
identifier[Object] operator[SEP] operator[SEP] identifier[all] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[args] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[all] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[args] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[all] operator[SEP] identifier[all] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[=] identifier[val] operator[SEP] identifier[m_mSet] operator[SEP] identifier[invoke] operator[SEP] identifier[obj] , identifier[all] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[BeanPropertyException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
protected void addActionKeyBinding(KeyStroke key, String actionKey, Action action) {
getInputMap().put(key, actionKey);
getActionMap().put(actionKey, action);
}
|
class class_name[name] begin[{]
method[addActionKeyBinding, return_type[void], modifier[protected], parameter[key, actionKey, action]] begin[{]
call[.getInputMap, parameter[]]
call[.getActionMap, parameter[]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addActionKeyBinding] operator[SEP] identifier[KeyStroke] identifier[key] , identifier[String] identifier[actionKey] , identifier[Action] identifier[action] operator[SEP] {
identifier[getInputMap] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[actionKey] operator[SEP] operator[SEP] identifier[getActionMap] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[actionKey] , identifier[action] operator[SEP] operator[SEP]
}
|
boolean containsPoint(@Nonnull final Point p) {
if (!p.isDefined()) {
return false;
}
final int latMicroDeg = p.getLatMicroDeg();
if ((latMicroDegMin > latMicroDeg) || (latMicroDeg >= latMicroDegMax)) {
return false;
}
final int lonMicroDeg = p.getLonMicroDeg();
// Longitude boundaries can extend (slightly) outside the [-180,180) range.
if (lonMicroDeg < lonMicroDegMin) {
return (lonMicroDegMin <= (lonMicroDeg + Point.MICRO_DEG_360)) && ((lonMicroDeg + Point.MICRO_DEG_360) < lonMicroDegMax);
} else if (lonMicroDeg >= lonMicroDegMax) {
return (lonMicroDegMin <= (lonMicroDeg - Point.MICRO_DEG_360)) && ((lonMicroDeg - Point.MICRO_DEG_360) < lonMicroDegMax);
} else {
return true;
}
}
|
class class_name[name] begin[{]
method[containsPoint, return_type[type[boolean]], modifier[default], parameter[p]] begin[{]
if[call[p.isDefined, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], latMicroDeg]
if[binary_operation[binary_operation[member[.latMicroDegMin], >, member[.latMicroDeg]], ||, binary_operation[member[.latMicroDeg], >=, member[.latMicroDegMax]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], lonMicroDeg]
if[binary_operation[member[.lonMicroDeg], <, member[.lonMicroDegMin]]] begin[{]
return[binary_operation[binary_operation[member[.lonMicroDegMin], <=, binary_operation[member[.lonMicroDeg], +, member[Point.MICRO_DEG_360]]], &&, binary_operation[binary_operation[member[.lonMicroDeg], +, member[Point.MICRO_DEG_360]], <, member[.lonMicroDegMax]]]]
else begin[{]
if[binary_operation[member[.lonMicroDeg], >=, member[.lonMicroDegMax]]] begin[{]
return[binary_operation[binary_operation[member[.lonMicroDegMin], <=, binary_operation[member[.lonMicroDeg], -, member[Point.MICRO_DEG_360]]], &&, binary_operation[binary_operation[member[.lonMicroDeg], -, member[Point.MICRO_DEG_360]], <, member[.lonMicroDegMax]]]]
else begin[{]
return[literal[true]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[boolean] identifier[containsPoint] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Point] identifier[p] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[p] operator[SEP] identifier[isDefined] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] Keyword[int] identifier[latMicroDeg] operator[=] identifier[p] operator[SEP] identifier[getLatMicroDeg] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[latMicroDegMin] operator[>] identifier[latMicroDeg] operator[SEP] operator[||] operator[SEP] identifier[latMicroDeg] operator[>=] identifier[latMicroDegMax] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] Keyword[int] identifier[lonMicroDeg] operator[=] identifier[p] operator[SEP] identifier[getLonMicroDeg] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lonMicroDeg] operator[<] identifier[lonMicroDegMin] operator[SEP] {
Keyword[return] operator[SEP] identifier[lonMicroDegMin] operator[<=] operator[SEP] identifier[lonMicroDeg] operator[+] identifier[Point] operator[SEP] identifier[MICRO_DEG_360] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[lonMicroDeg] operator[+] identifier[Point] operator[SEP] identifier[MICRO_DEG_360] operator[SEP] operator[<] identifier[lonMicroDegMax] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[lonMicroDeg] operator[>=] identifier[lonMicroDegMax] operator[SEP] {
Keyword[return] operator[SEP] identifier[lonMicroDegMin] operator[<=] operator[SEP] identifier[lonMicroDeg] operator[-] identifier[Point] operator[SEP] identifier[MICRO_DEG_360] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[lonMicroDeg] operator[-] identifier[Point] operator[SEP] identifier[MICRO_DEG_360] operator[SEP] operator[<] identifier[lonMicroDegMax] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
@Nonnull
public static ApiError parseError(@Nullable String errorBody, int statusCode, @Nullable String message) {
if (errorBody == null) {
return new ApiError(null, statusCode, message);
}
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<CompatibilityApiError> oldApiErrorJsonAdapter = moshi.adapter(CompatibilityApiError.class).failOnUnknown();
try {
return new ApiError(oldApiErrorJsonAdapter.fromJson(errorBody), statusCode);
} catch (IOException | JsonDataException exception) {
// Not old type of error, move on
}
JsonAdapter<ApiError> apiErrorJsonAdapter = moshi.adapter(ApiError.class).failOnUnknown();
try {
return apiErrorJsonAdapter.fromJson(errorBody);
} catch (IOException | JsonDataException exception) {
return new ApiError(null, statusCode, "Unknown Error");
}
}
|
class class_name[name] begin[{]
method[parseError, return_type[type[ApiError]], modifier[public static], parameter[errorBody, statusCode, message]] begin[{]
if[binary_operation[member[.errorBody], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApiError, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Moshi], moshi]
local_variable[type[JsonAdapter], oldApiErrorJsonAdapter]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=errorBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromJson, postfix_operators=[], prefix_operators=[], qualifier=oldApiErrorJsonAdapter, selectors=[], type_arguments=None), MemberReference(member=statusCode, 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=ApiError, sub_type=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IOException', 'JsonDataException']))], finally_block=None, label=None, resources=None)
local_variable[type[JsonAdapter], apiErrorJsonAdapter]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=errorBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromJson, postfix_operators=[], prefix_operators=[], qualifier=apiErrorJsonAdapter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown Error")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApiError, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IOException', 'JsonDataException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[ApiError] identifier[parseError] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[errorBody] , Keyword[int] identifier[statusCode] , annotation[@] identifier[Nullable] identifier[String] identifier[message] operator[SEP] {
Keyword[if] operator[SEP] identifier[errorBody] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ApiError] operator[SEP] Other[null] , identifier[statusCode] , identifier[message] operator[SEP] operator[SEP]
}
identifier[Moshi] identifier[moshi] operator[=] Keyword[new] identifier[Moshi] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[JsonAdapter] operator[<] identifier[CompatibilityApiError] operator[>] identifier[oldApiErrorJsonAdapter] operator[=] identifier[moshi] operator[SEP] identifier[adapter] operator[SEP] identifier[CompatibilityApiError] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[failOnUnknown] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] Keyword[new] identifier[ApiError] operator[SEP] identifier[oldApiErrorJsonAdapter] operator[SEP] identifier[fromJson] operator[SEP] identifier[errorBody] operator[SEP] , identifier[statusCode] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[JsonDataException] identifier[exception] operator[SEP] {
}
identifier[JsonAdapter] operator[<] identifier[ApiError] operator[>] identifier[apiErrorJsonAdapter] operator[=] identifier[moshi] operator[SEP] identifier[adapter] operator[SEP] identifier[ApiError] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[failOnUnknown] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[apiErrorJsonAdapter] operator[SEP] identifier[fromJson] operator[SEP] identifier[errorBody] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[JsonDataException] identifier[exception] operator[SEP] {
Keyword[return] Keyword[new] identifier[ApiError] operator[SEP] Other[null] , identifier[statusCode] , literal[String] operator[SEP] operator[SEP]
}
}
|
public Set<String> getIndices(final IndexSet indexSet, final String... statusFilter) {
final List<String> status = Arrays.asList(statusFilter);
final Cat catRequest = new Cat.IndicesBuilder()
.addIndex(indexSet.getIndexWildcard())
.setParameter("h", "index,status")
.build();
final CatResult result = JestUtils.execute(jestClient, catRequest,
() -> "Couldn't get index list for index set <" + indexSet.getConfig().id() + ">");
return StreamSupport.stream(result.getJsonObject().path("result").spliterator(), false)
.filter(cat -> status.isEmpty() || status.contains(cat.path("status").asText()))
.map(cat -> cat.path("index").asText())
.collect(Collectors.toSet());
}
|
class class_name[name] begin[{]
method[getIndices, return_type[type[Set]], modifier[public], parameter[indexSet, statusFilter]] begin[{]
local_variable[type[List], status]
local_variable[type[Cat], catRequest]
local_variable[type[CatResult], result]
return[call[StreamSupport.stream, parameter[call[result.getJsonObject, parameter[]], literal[false]]]]
end[}]
END[}]
|
Keyword[public] identifier[Set] operator[<] identifier[String] operator[>] identifier[getIndices] operator[SEP] Keyword[final] identifier[IndexSet] identifier[indexSet] , Keyword[final] identifier[String] operator[...] identifier[statusFilter] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[status] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[statusFilter] operator[SEP] operator[SEP] Keyword[final] identifier[Cat] identifier[catRequest] operator[=] Keyword[new] identifier[Cat] operator[SEP] identifier[IndicesBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addIndex] operator[SEP] identifier[indexSet] operator[SEP] identifier[getIndexWildcard] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[CatResult] identifier[result] operator[=] identifier[JestUtils] operator[SEP] identifier[execute] operator[SEP] identifier[jestClient] , identifier[catRequest] , operator[SEP] operator[SEP] operator[->] literal[String] operator[+] identifier[indexSet] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[StreamSupport] operator[SEP] identifier[stream] operator[SEP] identifier[result] operator[SEP] identifier[getJsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[spliterator] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[cat] operator[->] identifier[status] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[status] operator[SEP] identifier[contains] operator[SEP] identifier[cat] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[cat] operator[->] identifier[cat] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String format(ITemplate template, Date date, String pattern, Locale locale, String timezone) {
if (null == date) throw new NullPointerException();
RythmEngine engine = null == template ? RythmEngine.get() : template.__engine();
DateFormat df = (null == engine ? IDateFormatFactory.DefaultDateFormatFactory.INSTANCE : engine.dateFormatFactory()).createDateFormat(template, pattern, locale, timezone);
return df.format(date);
}
|
class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[public static], parameter[template, date, pattern, locale, timezone]] begin[{]
if[binary_operation[literal[null], ==, member[.date]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[RythmEngine], engine]
local_variable[type[DateFormat], df]
return[call[df.format, parameter[member[.date]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[format] operator[SEP] identifier[ITemplate] identifier[template] , identifier[Date] identifier[date] , identifier[String] identifier[pattern] , identifier[Locale] identifier[locale] , identifier[String] identifier[timezone] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[date] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP] identifier[RythmEngine] identifier[engine] operator[=] Other[null] operator[==] identifier[template] operator[?] identifier[RythmEngine] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[:] identifier[template] operator[SEP] identifier[__engine] operator[SEP] operator[SEP] operator[SEP] identifier[DateFormat] identifier[df] operator[=] operator[SEP] Other[null] operator[==] identifier[engine] operator[?] identifier[IDateFormatFactory] operator[SEP] identifier[DefaultDateFormatFactory] operator[SEP] identifier[INSTANCE] operator[:] identifier[engine] operator[SEP] identifier[dateFormatFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[createDateFormat] operator[SEP] identifier[template] , identifier[pattern] , identifier[locale] , identifier[timezone] operator[SEP] operator[SEP] Keyword[return] identifier[df] operator[SEP] identifier[format] operator[SEP] identifier[date] operator[SEP] operator[SEP]
}
|
private void startGeneralJobConfigFileMonitor()
throws Exception {
SchedulerUtils.addPathAlterationObserver(this.pathAlterationDetector, this.listener, jobConfigFileDirPath);
this.pathAlterationDetector.start();
this.closer.register(new Closeable() {
@Override
public void close() throws IOException {
try {
pathAlterationDetector.stop(1000);
} catch (InterruptedException e) {
throw new IOException(e);
}
}
});
}
|
class class_name[name] begin[{]
method[startGeneralJobConfigFileMonitor, return_type[void], modifier[private], parameter[]] begin[{]
call[SchedulerUtils.addPathAlterationObserver, parameter[THIS[member[None.pathAlterationDetector]], THIS[member[None.listener]], member[.jobConfigFileDirPath]]]
THIS[member[None.pathAlterationDetector]call[None.start, parameter[]]]
THIS[member[None.closer]call[None.register, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000)], member=stop, postfix_operators=[], prefix_operators=[], qualifier=pathAlterationDetector, 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=close, parameters=[], return_type=None, throws=['IOException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Closeable, sub_type=None))]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[startGeneralJobConfigFileMonitor] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[SchedulerUtils] operator[SEP] identifier[addPathAlterationObserver] operator[SEP] Keyword[this] operator[SEP] identifier[pathAlterationDetector] , Keyword[this] operator[SEP] identifier[listener] , identifier[jobConfigFileDirPath] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[pathAlterationDetector] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[closer] operator[SEP] identifier[register] operator[SEP] Keyword[new] identifier[Closeable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[pathAlterationDetector] operator[SEP] identifier[stop] operator[SEP] Other[1000] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.