code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public ISarlEnumerationBuilder addSarlEnumeration(String name) {
ISarlEnumerationBuilder builder = this.iSarlEnumerationBuilderProvider.get();
builder.eInit(getSarlAgent(), name, getTypeResolutionContext());
return builder;
} | class class_name[name] begin[{]
method[addSarlEnumeration, return_type[type[ISarlEnumerationBuilder]], modifier[public], parameter[name]] begin[{]
local_variable[type[ISarlEnumerationBuilder], builder]
call[builder.eInit, parameter[call[.getSarlAgent, parameter[]], member[.name], call[.getTypeResolutionContext, parameter[]]]]
return[member[.builder]]
end[}]
END[}] | Keyword[public] identifier[ISarlEnumerationBuilder] identifier[addSarlEnumeration] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[ISarlEnumerationBuilder] identifier[builder] operator[=] Keyword[this] operator[SEP] identifier[iSarlEnumerationBuilderProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[eInit] operator[SEP] identifier[getSarlAgent] operator[SEP] operator[SEP] , identifier[name] , identifier[getTypeResolutionContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP]
}
|
private Boolean _convertToBoolean(Object value)
{
Boolean booleanValue;
if (value instanceof Boolean)
{
booleanValue = (Boolean) value;
}
else
{
booleanValue = Boolean.parseBoolean(value.toString());
}
return booleanValue;
} | class class_name[name] begin[{]
method[_convertToBoolean, return_type[type[Boolean]], modifier[private], parameter[value]] begin[{]
local_variable[type[Boolean], booleanValue]
if[binary_operation[member[.value], instanceof, type[Boolean]]] begin[{]
assign[member[.booleanValue], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))]
else begin[{]
assign[member[.booleanValue], call[Boolean.parseBoolean, parameter[call[value.toString, parameter[]]]]]
end[}]
return[member[.booleanValue]]
end[}]
END[}] | Keyword[private] identifier[Boolean] identifier[_convertToBoolean] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
identifier[Boolean] identifier[booleanValue] operator[SEP] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Boolean] operator[SEP] {
identifier[booleanValue] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP]
}
Keyword[else] {
identifier[booleanValue] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[booleanValue] operator[SEP]
}
|
public static Map<String, String> mapBean(final Object bean,
final String exclude)
{
final Set<String> excludes = new HashSet<String>();
if (!StringUtils.isBlank(exclude))
{
excludes.add(exclude);
}
return mapBean(bean, excludes);
} | class class_name[name] begin[{]
method[mapBean, return_type[type[Map]], modifier[public static], parameter[bean, exclude]] begin[{]
local_variable[type[Set], excludes]
if[call[StringUtils.isBlank, parameter[member[.exclude]]]] begin[{]
call[excludes.add, parameter[member[.exclude]]]
else begin[{]
None
end[}]
return[call[.mapBean, parameter[member[.bean], member[.excludes]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[mapBean] operator[SEP] Keyword[final] identifier[Object] identifier[bean] , Keyword[final] identifier[String] identifier[exclude] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[excludes] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[exclude] operator[SEP] operator[SEP] {
identifier[excludes] operator[SEP] identifier[add] operator[SEP] identifier[exclude] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mapBean] operator[SEP] identifier[bean] , identifier[excludes] operator[SEP] operator[SEP]
}
|
protected ActionResponse processHookBefore(ActionHook hook) {
if (hook == null) {
return ActionResponse.undefined();
}
showBefore(runtime);
ActionResponse response = hook.godHandPrologue(runtime);
if (isUndefined(response)) {
response = hook.hookBefore(runtime);
}
if (isDefined(response)) {
runtime.manageActionResponse(response);
}
redCardableAssist.assertAfterTxCommitHookNotSpecified("before", response);
return response;
} | class class_name[name] begin[{]
method[processHookBefore, return_type[type[ActionResponse]], modifier[protected], parameter[hook]] begin[{]
if[binary_operation[member[.hook], ==, literal[null]]] begin[{]
return[call[ActionResponse.undefined, parameter[]]]
else begin[{]
None
end[}]
call[.showBefore, parameter[member[.runtime]]]
local_variable[type[ActionResponse], response]
if[call[.isUndefined, parameter[member[.response]]]] begin[{]
assign[member[.response], call[hook.hookBefore, parameter[member[.runtime]]]]
else begin[{]
None
end[}]
if[call[.isDefined, parameter[member[.response]]]] begin[{]
call[runtime.manageActionResponse, parameter[member[.response]]]
else begin[{]
None
end[}]
call[redCardableAssist.assertAfterTxCommitHookNotSpecified, parameter[literal["before"], member[.response]]]
return[member[.response]]
end[}]
END[}] | Keyword[protected] identifier[ActionResponse] identifier[processHookBefore] operator[SEP] identifier[ActionHook] identifier[hook] operator[SEP] {
Keyword[if] operator[SEP] identifier[hook] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[ActionResponse] operator[SEP] identifier[undefined] operator[SEP] operator[SEP] operator[SEP]
}
identifier[showBefore] operator[SEP] identifier[runtime] operator[SEP] operator[SEP] identifier[ActionResponse] identifier[response] operator[=] identifier[hook] operator[SEP] identifier[godHandPrologue] operator[SEP] identifier[runtime] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isUndefined] operator[SEP] identifier[response] operator[SEP] operator[SEP] {
identifier[response] operator[=] identifier[hook] operator[SEP] identifier[hookBefore] operator[SEP] identifier[runtime] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isDefined] operator[SEP] identifier[response] operator[SEP] operator[SEP] {
identifier[runtime] operator[SEP] identifier[manageActionResponse] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
identifier[redCardableAssist] operator[SEP] identifier[assertAfterTxCommitHookNotSpecified] operator[SEP] literal[String] , identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public final Factory registerFactory(Factory factory) {
if (factory == null) {
throw new NullPointerException();
}
try {
factoryLock.acquireWrite();
factories.add(0, factory);
clearCaches();
}
finally {
factoryLock.releaseWrite();
}
notifyChanged();
return factory;
} | class class_name[name] begin[{]
method[registerFactory, return_type[type[Factory]], modifier[final public], parameter[factory]] begin[{]
if[binary_operation[member[.factory], ==, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=acquireWrite, postfix_operators=[], prefix_operators=[], qualifier=factoryLock, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=factory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=factories, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clearCaches, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=releaseWrite, postfix_operators=[], prefix_operators=[], qualifier=factoryLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
call[.notifyChanged, parameter[]]
return[member[.factory]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Factory] identifier[registerFactory] operator[SEP] identifier[Factory] identifier[factory] operator[SEP] {
Keyword[if] operator[SEP] identifier[factory] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[factoryLock] operator[SEP] identifier[acquireWrite] operator[SEP] operator[SEP] operator[SEP] identifier[factories] operator[SEP] identifier[add] operator[SEP] Other[0] , identifier[factory] operator[SEP] operator[SEP] identifier[clearCaches] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[factoryLock] operator[SEP] identifier[releaseWrite] operator[SEP] operator[SEP] operator[SEP]
}
identifier[notifyChanged] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[factory] operator[SEP]
}
|
@Override
public ImmutableListMultimap<V, K> inverse() {
ImmutableListMultimap<V, K> result = inverse;
return (result == null) ? (inverse = invert()) : result;
} | class class_name[name] begin[{]
method[inverse, return_type[type[ImmutableListMultimap]], modifier[public], parameter[]] begin[{]
local_variable[type[ImmutableListMultimap], result]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Assignment(expressionl=MemberReference(member=inverse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=invert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ImmutableListMultimap] operator[<] identifier[V] , identifier[K] operator[>] identifier[inverse] operator[SEP] operator[SEP] {
identifier[ImmutableListMultimap] operator[<] identifier[V] , identifier[K] operator[>] identifier[result] operator[=] identifier[inverse] operator[SEP] Keyword[return] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] operator[?] operator[SEP] identifier[inverse] operator[=] identifier[invert] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[result] operator[SEP]
}
|
public static boolean verify(PublicKey publicKey, String signedData, String signature) {
Signature sig;
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(publicKey);
sig.update(signedData.getBytes());
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
}
return true;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, "NoSuchAlgorithmException.");
} catch (InvalidKeyException e) {
Log.e(TAG, "Invalid key specification.");
} catch (SignatureException e) {
Log.e(TAG, "Signature exception.");
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
}
return false;
} | class class_name[name] begin[{]
method[verify, return_type[type[boolean]], modifier[public static], parameter[publicKey, signedData, signature]] begin[{]
local_variable[type[Signature], sig]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=SIGNATURE_ALGORITHM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Signature, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=publicKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initVerify, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=signedData, selectors=[], type_arguments=None)], member=update, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=Base64, selectors=[], type_arguments=None)], member=verify, postfix_operators=[], prefix_operators=['!'], qualifier=sig, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Signature verification failed.")], member=e, 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)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NoSuchAlgorithmException.")], member=e, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid key specification.")], member=e, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidKeyException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Signature exception.")], member=e, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SignatureException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Base64 decoding failed.")], member=e, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Base64DecoderException']))], finally_block=None, label=None, resources=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[verify] operator[SEP] identifier[PublicKey] identifier[publicKey] , identifier[String] identifier[signedData] , identifier[String] identifier[signature] operator[SEP] {
identifier[Signature] identifier[sig] operator[SEP] Keyword[try] {
identifier[sig] operator[=] identifier[Signature] operator[SEP] identifier[getInstance] operator[SEP] identifier[SIGNATURE_ALGORITHM] operator[SEP] operator[SEP] identifier[sig] operator[SEP] identifier[initVerify] operator[SEP] identifier[publicKey] operator[SEP] operator[SEP] identifier[sig] operator[SEP] identifier[update] operator[SEP] identifier[signedData] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[sig] operator[SEP] identifier[verify] operator[SEP] identifier[Base64] operator[SEP] identifier[decode] operator[SEP] identifier[signature] operator[SEP] operator[SEP] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvalidKeyException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SignatureException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Base64DecoderException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public synchronized NikeFS2RandomAccessStorage copy() throws IOException {
// NOTE: This method's implementation assumes that all blocks served
// from the virtual file system are of equal block size!
// If this condition does not hold, unexpected results will be
// expected!
NikeFS2RandomAccessStorageImpl clone = new NikeFS2RandomAccessStorageImpl(vfs);
if(blocks.size() > 0) {
// add copies of all contained blocks
byte[] buffer = new byte[blocks.get(0).size()];
for(NikeFS2Block block : blocks) {
NikeFS2Block copyBlock = vfs.allocateBlock();
block.read(0, buffer);
copyBlock.write(0, buffer);
clone.blocks.add(copyBlock);
}
}
// adjust state
clone.size = size;
clone.pointer = 0;
return clone;
} | class class_name[name] begin[{]
method[copy, return_type[type[NikeFS2RandomAccessStorage]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[NikeFS2RandomAccessStorageImpl], clone]
if[binary_operation[call[blocks.size, parameter[]], >, literal[0]]] begin[{]
local_variable[type[byte], buffer]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=allocateBlock, postfix_operators=[], prefix_operators=[], qualifier=vfs, selectors=[], type_arguments=None), name=copyBlock)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NikeFS2Block, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=block, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=copyBlock, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=copyBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=clone.blocks, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=blocks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=block)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NikeFS2Block, sub_type=None))), label=None)
else begin[{]
None
end[}]
assign[member[clone.size], member[.size]]
assign[member[clone.pointer], literal[0]]
return[member[.clone]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[NikeFS2RandomAccessStorage] identifier[copy] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[NikeFS2RandomAccessStorageImpl] identifier[clone] operator[=] Keyword[new] identifier[NikeFS2RandomAccessStorageImpl] operator[SEP] identifier[vfs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[blocks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[blocks] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[NikeFS2Block] identifier[block] operator[:] identifier[blocks] operator[SEP] {
identifier[NikeFS2Block] identifier[copyBlock] operator[=] identifier[vfs] operator[SEP] identifier[allocateBlock] operator[SEP] operator[SEP] operator[SEP] identifier[block] operator[SEP] identifier[read] operator[SEP] Other[0] , identifier[buffer] operator[SEP] operator[SEP] identifier[copyBlock] operator[SEP] identifier[write] operator[SEP] Other[0] , identifier[buffer] operator[SEP] operator[SEP] identifier[clone] operator[SEP] identifier[blocks] operator[SEP] identifier[add] operator[SEP] identifier[copyBlock] operator[SEP] operator[SEP]
}
}
identifier[clone] operator[SEP] identifier[size] operator[=] identifier[size] operator[SEP] identifier[clone] operator[SEP] identifier[pointer] operator[=] Other[0] operator[SEP] Keyword[return] identifier[clone] operator[SEP]
}
|
public SessionBeanType<EnterpriseBeansType<T>> getOrCreateSession()
{
List<Node> nodeList = childNode.get("session");
if (nodeList != null && nodeList.size() > 0)
{
return new SessionBeanTypeImpl<EnterpriseBeansType<T>>(this, "session", childNode, nodeList.get(0));
}
return createSession();
} | class class_name[name] begin[{]
method[getOrCreateSession, return_type[type[SessionBeanType]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="session"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=EnterpriseBeansType, sub_type=None))], dimensions=None, name=SessionBeanTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createSession, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[SessionBeanType] operator[<] identifier[EnterpriseBeansType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateSession] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[SessionBeanTypeImpl] operator[<] identifier[EnterpriseBeansType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createSession] operator[SEP] operator[SEP] operator[SEP]
}
|
private void onSetCompactionStrategy(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String compactionStrategy = cfProperties.getProperty(CassandraConstants.COMPACTION_STRATEGY);
if (compactionStrategy != null)
{
if (builder != null)
{
String strategy_class = CQLTranslator.getKeyword(CassandraConstants.COMPACTION_STRATEGY);
builder.append(strategy_class);
builder.append(CQLTranslator.EQ_CLAUSE);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(compactionStrategy);
builder.append(CQLTranslator.QUOTE_STR);
builder.append(CQLTranslator.AND_CLAUSE);
}
else
{
cfDef.setCompaction_strategy(compactionStrategy);
}
}
} | class class_name[name] begin[{]
method[onSetCompactionStrategy, return_type[void], modifier[private], parameter[cfDef, cfProperties, builder]] begin[{]
local_variable[type[String], compactionStrategy]
if[binary_operation[member[.compactionStrategy], !=, literal[null]]] begin[{]
if[binary_operation[member[.builder], !=, literal[null]]] begin[{]
local_variable[type[String], strategy_class]
call[builder.append, parameter[member[.strategy_class]]]
call[builder.append, parameter[member[CQLTranslator.EQ_CLAUSE]]]
call[builder.append, parameter[member[CQLTranslator.QUOTE_STR]]]
call[builder.append, parameter[member[.compactionStrategy]]]
call[builder.append, parameter[member[CQLTranslator.QUOTE_STR]]]
call[builder.append, parameter[member[CQLTranslator.AND_CLAUSE]]]
else begin[{]
call[cfDef.setCompaction_strategy, parameter[member[.compactionStrategy]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[onSetCompactionStrategy] operator[SEP] identifier[CfDef] identifier[cfDef] , identifier[Properties] identifier[cfProperties] , identifier[StringBuilder] identifier[builder] operator[SEP] {
identifier[String] identifier[compactionStrategy] operator[=] identifier[cfProperties] operator[SEP] identifier[getProperty] operator[SEP] identifier[CassandraConstants] operator[SEP] identifier[COMPACTION_STRATEGY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[compactionStrategy] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[builder] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[strategy_class] operator[=] identifier[CQLTranslator] operator[SEP] identifier[getKeyword] operator[SEP] identifier[CassandraConstants] operator[SEP] identifier[COMPACTION_STRATEGY] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[strategy_class] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[CQLTranslator] operator[SEP] identifier[EQ_CLAUSE] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[CQLTranslator] operator[SEP] identifier[QUOTE_STR] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[compactionStrategy] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[CQLTranslator] operator[SEP] identifier[QUOTE_STR] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[CQLTranslator] operator[SEP] identifier[AND_CLAUSE] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[cfDef] operator[SEP] identifier[setCompaction_strategy] operator[SEP] identifier[compactionStrategy] operator[SEP] operator[SEP]
}
}
}
|
static void ensurePrincipalAccessIsAllowedForService(final ServiceTicket serviceTicket,
final RegisteredService registeredService,
final TicketGrantingTicket ticketGrantingTicket,
final boolean retrievePrincipalAttributesFromReleasePolicy)
throws UnauthorizedServiceException, PrincipalException {
ensurePrincipalAccessIsAllowedForService(serviceTicket.getService(),
registeredService, ticketGrantingTicket.getAuthentication(), retrievePrincipalAttributesFromReleasePolicy);
} | class class_name[name] begin[{]
method[ensurePrincipalAccessIsAllowedForService, return_type[void], modifier[static], parameter[serviceTicket, registeredService, ticketGrantingTicket, retrievePrincipalAttributesFromReleasePolicy]] begin[{]
call[.ensurePrincipalAccessIsAllowedForService, parameter[call[serviceTicket.getService, parameter[]], member[.registeredService], call[ticketGrantingTicket.getAuthentication, parameter[]], member[.retrievePrincipalAttributesFromReleasePolicy]]]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[ensurePrincipalAccessIsAllowedForService] operator[SEP] Keyword[final] identifier[ServiceTicket] identifier[serviceTicket] , Keyword[final] identifier[RegisteredService] identifier[registeredService] , Keyword[final] identifier[TicketGrantingTicket] identifier[ticketGrantingTicket] , Keyword[final] Keyword[boolean] identifier[retrievePrincipalAttributesFromReleasePolicy] operator[SEP] Keyword[throws] identifier[UnauthorizedServiceException] , identifier[PrincipalException] {
identifier[ensurePrincipalAccessIsAllowedForService] operator[SEP] identifier[serviceTicket] operator[SEP] identifier[getService] operator[SEP] operator[SEP] , identifier[registeredService] , identifier[ticketGrantingTicket] operator[SEP] identifier[getAuthentication] operator[SEP] operator[SEP] , identifier[retrievePrincipalAttributesFromReleasePolicy] operator[SEP] operator[SEP]
}
|
public static <T, U> U convert(T source, Class<U> targetClass) {
return BeanConvertStrategy.convertBean(source, targetClass);
} | class class_name[name] begin[{]
method[convert, return_type[type[U]], modifier[public static], parameter[source, targetClass]] begin[{]
return[call[BeanConvertStrategy.convertBean, parameter[member[.source], member[.targetClass]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[U] operator[>] identifier[U] identifier[convert] operator[SEP] identifier[T] identifier[source] , identifier[Class] operator[<] identifier[U] operator[>] identifier[targetClass] operator[SEP] {
Keyword[return] identifier[BeanConvertStrategy] operator[SEP] identifier[convertBean] operator[SEP] identifier[source] , identifier[targetClass] operator[SEP] operator[SEP]
}
|
public static Point getSize (float scale, Mirage image)
{
int width = Math.max(0, Math.round(image.getWidth() * scale));
int height = Math.max(0, Math.round(image.getHeight() * scale));
return new Point(width, height);
} | class class_name[name] begin[{]
method[getSize, return_type[type[Point]], modifier[public static], parameter[scale, image]] begin[{]
local_variable[type[int], width]
local_variable[type[int], height]
return[ClassCreator(arguments=[MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, 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=Point, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Point] identifier[getSize] operator[SEP] Keyword[float] identifier[scale] , identifier[Mirage] identifier[image] operator[SEP] {
Keyword[int] identifier[width] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[0] , identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[image] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[*] identifier[scale] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[height] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[0] , identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[image] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[*] identifier[scale] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Point] operator[SEP] identifier[width] , identifier[height] operator[SEP] operator[SEP]
}
|
public void setMethodCalls(final String... pMethodCalls)
{
final Set<String> newMethodCalls = new HashSet<>();
Collections.addAll(newMethodCalls, pMethodCalls);
methodCalls = Collections.unmodifiableSet(newMethodCalls);
} | class class_name[name] begin[{]
method[setMethodCalls, return_type[void], modifier[public], parameter[pMethodCalls]] begin[{]
local_variable[type[Set], newMethodCalls]
call[Collections.addAll, parameter[member[.newMethodCalls], member[.pMethodCalls]]]
assign[member[.methodCalls], call[Collections.unmodifiableSet, parameter[member[.newMethodCalls]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setMethodCalls] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[pMethodCalls] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[newMethodCalls] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[addAll] operator[SEP] identifier[newMethodCalls] , identifier[pMethodCalls] operator[SEP] operator[SEP] identifier[methodCalls] operator[=] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[newMethodCalls] operator[SEP] operator[SEP]
}
|
@Override
public List<String> getSpaces() throws ContentStoreException {
return execute(new Retriable() {
@Override
public List<String> retry() throws ContentStoreException {
// The actual method being executed
return doGetSpaces();
}
});
} | class class_name[name] begin[{]
method[getSpaces, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[call[.execute, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=doGetSpaces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=retry, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None), throws=['ContentStoreException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Retriable, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getSpaces] operator[SEP] operator[SEP] Keyword[throws] identifier[ContentStoreException] {
Keyword[return] identifier[execute] operator[SEP] Keyword[new] identifier[Retriable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[retry] operator[SEP] operator[SEP] Keyword[throws] identifier[ContentStoreException] {
Keyword[return] identifier[doGetSpaces] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public void onMilestoneTrigger(List<Milestone> triggeredMilestones, RouteProgress routeProgress) {
for (Milestone milestone : triggeredMilestones) {
String instruction = buildInstructionString(routeProgress, milestone);
eventDispatcher.onMilestoneEvent(routeProgress, instruction, milestone);
}
} | class class_name[name] begin[{]
method[onMilestoneTrigger, return_type[void], modifier[public], parameter[triggeredMilestones, routeProgress]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=routeProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=milestone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildInstructionString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=instruction)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=routeProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=instruction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=milestone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onMilestoneEvent, postfix_operators=[], prefix_operators=[], qualifier=eventDispatcher, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=triggeredMilestones, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=milestone)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Milestone, sub_type=None))), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onMilestoneTrigger] operator[SEP] identifier[List] operator[<] identifier[Milestone] operator[>] identifier[triggeredMilestones] , identifier[RouteProgress] identifier[routeProgress] operator[SEP] {
Keyword[for] operator[SEP] identifier[Milestone] identifier[milestone] operator[:] identifier[triggeredMilestones] operator[SEP] {
identifier[String] identifier[instruction] operator[=] identifier[buildInstructionString] operator[SEP] identifier[routeProgress] , identifier[milestone] operator[SEP] operator[SEP] identifier[eventDispatcher] operator[SEP] identifier[onMilestoneEvent] operator[SEP] identifier[routeProgress] , identifier[instruction] , identifier[milestone] operator[SEP] operator[SEP]
}
}
|
public static Map<String, String> getQueryParams ()
{
Map<String, String> params = new HashMap<String, String>();
String search = getSearchString();
search = search.substring(search.indexOf("?")+1);
String[] bits = search.split("&");
for (String bit : bits) {
int eqidx = bit.indexOf("=");
if (eqidx >= 0) {
params.put(bit.substring(0, eqidx), bit.substring(eqidx+1));
} else {
params.put(bit, "true");
}
}
return params;
} | class class_name[name] begin[{]
method[getQueryParams, return_type[type[Map]], modifier[public static], parameter[]] begin[{]
local_variable[type[Map], params]
local_variable[type[String], search]
assign[member[.search], call[search.substring, parameter[binary_operation[call[search.indexOf, parameter[literal["?"]]], +, literal[1]]]]]
local_variable[type[String], bits]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=bit, selectors=[], type_arguments=None), name=eqidx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=eqidx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="true")], member=put, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=eqidx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=bit, selectors=[], type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=eqidx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=bit, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=bits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.params]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[getQueryParams] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[search] operator[=] identifier[getSearchString] operator[SEP] operator[SEP] operator[SEP] identifier[search] operator[=] identifier[search] operator[SEP] identifier[substring] operator[SEP] identifier[search] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[bits] operator[=] identifier[search] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[bit] operator[:] identifier[bits] operator[SEP] {
Keyword[int] identifier[eqidx] operator[=] identifier[bit] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eqidx] operator[>=] Other[0] operator[SEP] {
identifier[params] operator[SEP] identifier[put] operator[SEP] identifier[bit] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[eqidx] operator[SEP] , identifier[bit] operator[SEP] identifier[substring] operator[SEP] identifier[eqidx] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[params] operator[SEP] identifier[put] operator[SEP] identifier[bit] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[params] operator[SEP]
}
|
private Artifact extractArtifact(Artifact a, String type, String classifier) {
if (a == null) {
return a;
}
Artifact result = new DefaultArtifact(a.getGroupId(),
a.getArtifactId(),
a.getVersionRange(),
a.getScope(),
type,
classifier,
new DefaultArtifactHandler(type));
return result;
} | class class_name[name] begin[{]
method[extractArtifact, return_type[type[Artifact]], modifier[private], parameter[a, type, classifier]] begin[{]
if[binary_operation[member[.a], ==, literal[null]]] begin[{]
return[member[.a]]
else begin[{]
None
end[}]
local_variable[type[Artifact], result]
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[Artifact] identifier[extractArtifact] operator[SEP] identifier[Artifact] identifier[a] , identifier[String] identifier[type] , identifier[String] identifier[classifier] operator[SEP] {
Keyword[if] operator[SEP] identifier[a] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[a] operator[SEP]
}
identifier[Artifact] identifier[result] operator[=] Keyword[new] identifier[DefaultArtifact] operator[SEP] identifier[a] operator[SEP] identifier[getGroupId] operator[SEP] operator[SEP] , identifier[a] operator[SEP] identifier[getArtifactId] operator[SEP] operator[SEP] , identifier[a] operator[SEP] identifier[getVersionRange] operator[SEP] operator[SEP] , identifier[a] operator[SEP] identifier[getScope] operator[SEP] operator[SEP] , identifier[type] , identifier[classifier] , Keyword[new] identifier[DefaultArtifactHandler] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static String getResourceURL(String resource) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return cl.getResource(resource).toString();
} | class class_name[name] begin[{]
method[getResourceURL, return_type[type[String]], modifier[public static], parameter[resource]] begin[{]
local_variable[type[ClassLoader], cl]
return[call[cl.getResource, parameter[member[.resource]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getResourceURL] operator[SEP] identifier[String] identifier[resource] operator[SEP] {
identifier[ClassLoader] identifier[cl] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cl] operator[SEP] identifier[getResource] operator[SEP] identifier[resource] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public VariableRef[] getVariableRefs() {
Collection<VariableRef> allRefs = new ArrayList<VariableRef>();
fillVariableRefs(allRefs, this);
return allRefs.toArray(new VariableRef[allRefs.size()]);
} | class class_name[name] begin[{]
method[getVariableRefs, return_type[type[VariableRef]], modifier[public], parameter[]] begin[{]
local_variable[type[Collection], allRefs]
call[.fillVariableRefs, parameter[member[.allRefs], THIS[]]]
return[call[allRefs.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=allRefs, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VariableRef, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[VariableRef] operator[SEP] operator[SEP] identifier[getVariableRefs] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[VariableRef] operator[>] identifier[allRefs] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[VariableRef] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[fillVariableRefs] operator[SEP] identifier[allRefs] , Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[allRefs] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[VariableRef] operator[SEP] identifier[allRefs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private List getModes() {
ArrayList ret = new ArrayList();
ret.add(
new CmsSelectWidgetOption(
MODE_VARIATIONS,
getMode().equals(MODE_VARIATIONS),
key(Messages.GUI_FLEXCACHE_CLEAN_MODE_VARIATIONS_0)));
ret.add(
new CmsSelectWidgetOption(
MODE_ALL,
getMode().equals(MODE_ALL),
key(Messages.GUI_FLEXCACHE_CLEAN_MODE_ALL_0)));
return ret;
} | class class_name[name] begin[{]
method[getModes, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[ArrayList], ret]
call[ret.add, parameter[ClassCreator(arguments=[MemberReference(member=MODE_VARIATIONS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=MODE_VARIATIONS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=GUI_FLEXCACHE_CLEAN_MODE_VARIATIONS_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsSelectWidgetOption, sub_type=None))]]
call[ret.add, parameter[ClassCreator(arguments=[MemberReference(member=MODE_ALL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=MODE_ALL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=GUI_FLEXCACHE_CLEAN_MODE_ALL_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsSelectWidgetOption, sub_type=None))]]
return[member[.ret]]
end[}]
END[}] | Keyword[private] identifier[List] identifier[getModes] operator[SEP] operator[SEP] {
identifier[ArrayList] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[CmsSelectWidgetOption] operator[SEP] identifier[MODE_VARIATIONS] , identifier[getMode] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[MODE_VARIATIONS] operator[SEP] , identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_FLEXCACHE_CLEAN_MODE_VARIATIONS_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[CmsSelectWidgetOption] operator[SEP] identifier[MODE_ALL] , identifier[getMode] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[MODE_ALL] operator[SEP] , identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_FLEXCACHE_CLEAN_MODE_ALL_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public static void boundsCheck(final byte[] buffer, final long index, final int length)
{
final int capacity = buffer.length;
final long resultingPosition = index + (long)length;
if (index < 0 || resultingPosition > capacity)
{
throw new IndexOutOfBoundsException("index=" + index + " length=" + length + " capacity=" + capacity);
}
} | class class_name[name] begin[{]
method[boundsCheck, return_type[void], modifier[public static], parameter[buffer, index, length]] begin[{]
local_variable[type[int], capacity]
local_variable[type[long], resultingPosition]
if[binary_operation[binary_operation[member[.index], <, literal[0]], ||, binary_operation[member[.resultingPosition], >, member[.capacity]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="index="), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" length="), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" capacity="), operator=+), operandr=MemberReference(member=capacity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[boundsCheck] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] , Keyword[final] Keyword[long] identifier[index] , Keyword[final] Keyword[int] identifier[length] operator[SEP] {
Keyword[final] Keyword[int] identifier[capacity] operator[=] identifier[buffer] operator[SEP] identifier[length] operator[SEP] Keyword[final] Keyword[long] identifier[resultingPosition] operator[=] identifier[index] operator[+] operator[SEP] Keyword[long] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] Other[0] operator[||] identifier[resultingPosition] operator[>] identifier[capacity] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[+] identifier[length] operator[+] literal[String] operator[+] identifier[capacity] operator[SEP] operator[SEP]
}
}
|
@Nonnull
public static LBoolIntConsumer boolIntConsumerFrom(Consumer<LBoolIntConsumerBuilder> buildingFunction) {
LBoolIntConsumerBuilder builder = new LBoolIntConsumerBuilder();
buildingFunction.accept(builder);
return builder.build();
} | class class_name[name] begin[{]
method[boolIntConsumerFrom, return_type[type[LBoolIntConsumer]], modifier[public static], parameter[buildingFunction]] begin[{]
local_variable[type[LBoolIntConsumerBuilder], builder]
call[buildingFunction.accept, parameter[member[.builder]]]
return[call[builder.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[LBoolIntConsumer] identifier[boolIntConsumerFrom] operator[SEP] identifier[Consumer] operator[<] identifier[LBoolIntConsumerBuilder] operator[>] identifier[buildingFunction] operator[SEP] {
identifier[LBoolIntConsumerBuilder] identifier[builder] operator[=] Keyword[new] identifier[LBoolIntConsumerBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buildingFunction] operator[SEP] identifier[accept] operator[SEP] identifier[builder] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public void writeAll(java.util.List<String[]> allLines) throws IOException {
openWriter();
csvWriter.writeAll(allLines);
} | class class_name[name] begin[{]
method[writeAll, return_type[void], modifier[public], parameter[allLines]] begin[{]
call[.openWriter, parameter[]]
call[csvWriter.writeAll, parameter[member[.allLines]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeAll] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[SEP] operator[SEP] operator[>] identifier[allLines] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[openWriter] operator[SEP] operator[SEP] operator[SEP] identifier[csvWriter] operator[SEP] identifier[writeAll] operator[SEP] identifier[allLines] operator[SEP] operator[SEP]
}
|
public OvhBackendHttp serviceName_http_farm_farmId_GET(String serviceName, Long farmId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}";
StringBuilder sb = path(qPath, serviceName, farmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackendHttp.class);
} | class class_name[name] begin[{]
method[serviceName_http_farm_farmId_GET, return_type[type[OvhBackendHttp]], modifier[public], parameter[serviceName, farmId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhBackendHttp, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhBackendHttp] identifier[serviceName_http_farm_farmId_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[Long] identifier[farmId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[farmId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhBackendHttp] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public Waiter<DescribeCacheClustersRequest> cacheClusterDeleted() {
return new WaiterBuilder<DescribeCacheClustersRequest, DescribeCacheClustersResult>()
.withSdkFunction(new DescribeCacheClustersFunction(client))
.withAcceptors(new CacheClusterDeleted.IsDeletedMatcher(), new CacheClusterDeleted.IsCacheClusterNotFoundMatcher(),
new CacheClusterDeleted.IsAvailableMatcher(), new CacheClusterDeleted.IsCreatingMatcher(),
new CacheClusterDeleted.IsIncompatiblenetworkMatcher(), new CacheClusterDeleted.IsModifyingMatcher(),
new CacheClusterDeleted.IsRestorefailedMatcher(), new CacheClusterDeleted.IsSnapshottingMatcher())
.withDefaultPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(40), new FixedDelayStrategy(15)))
.withExecutorService(executorService).build();
} | class class_name[name] begin[{]
method[cacheClusterDeleted, return_type[type[Waiter]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=client, 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=DescribeCacheClustersFunction, sub_type=None))], member=withSdkFunction, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsDeletedMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsCacheClusterNotFoundMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsAvailableMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsCreatingMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsIncompatiblenetworkMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsModifyingMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsRestorefailedMatcher, sub_type=None))), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheClusterDeleted, sub_type=ReferenceType(arguments=None, dimensions=None, name=IsSnapshottingMatcher, sub_type=None)))], member=withAcceptors, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=40)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MaxAttemptsRetryStrategy, sub_type=None)), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=15)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FixedDelayStrategy, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PollingStrategy, sub_type=None))], member=withDefaultPollingStrategy, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=executorService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withExecutorService, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DescribeCacheClustersRequest, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DescribeCacheClustersResult, sub_type=None))], dimensions=None, name=WaiterBuilder, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Waiter] operator[<] identifier[DescribeCacheClustersRequest] operator[>] identifier[cacheClusterDeleted] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[WaiterBuilder] operator[<] identifier[DescribeCacheClustersRequest] , identifier[DescribeCacheClustersResult] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[withSdkFunction] operator[SEP] Keyword[new] identifier[DescribeCacheClustersFunction] operator[SEP] identifier[client] operator[SEP] operator[SEP] operator[SEP] identifier[withAcceptors] operator[SEP] Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsDeletedMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsCacheClusterNotFoundMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsAvailableMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsCreatingMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsIncompatiblenetworkMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsModifyingMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsRestorefailedMatcher] operator[SEP] operator[SEP] , Keyword[new] identifier[CacheClusterDeleted] operator[SEP] identifier[IsSnapshottingMatcher] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withDefaultPollingStrategy] operator[SEP] Keyword[new] identifier[PollingStrategy] operator[SEP] Keyword[new] identifier[MaxAttemptsRetryStrategy] operator[SEP] Other[40] operator[SEP] , Keyword[new] identifier[FixedDelayStrategy] operator[SEP] Other[15] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withExecutorService] operator[SEP] identifier[executorService] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public void _serializeStruct(PageContext pc, Set test, Struct struct, StringBuilder sb, boolean serializeQueryByColumns, boolean addUDFs, Set<Object> done)
throws ConverterException {
ApplicationContextSupport acs = (ApplicationContextSupport) pc.getApplicationContext();
boolean preserveCase = acs.getSerializationSettings().getPreserveCaseForStructKey(); // preserve case by default for Struct
// Component
if (struct instanceof Component) {
String res = castToJson(pc, (Component) struct, NULL_STRING);
if (res != NULL_STRING) {
sb.append(res);
return;
}
}
sb.append(goIn());
sb.append("{");
Iterator<Entry<Key, Object>> it = struct.entryIterator();
Entry<Key, Object> e;
String k;
Object value;
boolean doIt = false;
while (it.hasNext()) {
e = it.next();
k = e.getKey().getString();
if (!preserveCase) k = k.toUpperCase();
value = e.getValue();
if (!addUDFs && (value instanceof UDF || value == null)) continue;
if (doIt) sb.append(',');
doIt = true;
sb.append(StringUtil.escapeJS(k, '"', charsetEncoder));
sb.append(':');
_serialize(pc, test, value, sb, serializeQueryByColumns, done);
}
if (struct instanceof Component) {
Boolean remotingFetch;
Component comp = (Component) struct;
boolean isPeristent = false;
isPeristent = comp.isPersistent();
Property[] props = comp.getProperties(false, true, false, false);
ComponentScope scope = comp.getComponentScope();
for (int i = 0; i < props.length; i++) {
if (!ignoreRemotingFetch) {
remotingFetch = Caster.toBoolean(props[i].getDynamicAttributes().get(REMOTING_FETCH, null), null);
if (remotingFetch == null) {
if (isPeristent && ORMUtil.isRelated(props[i])) continue;
}
else if (!remotingFetch.booleanValue()) continue;
}
Key key = KeyImpl.getInstance(props[i].getName());
value = scope.get(key, null);
if (!addUDFs && (value instanceof UDF || value == null)) continue;
if (doIt) sb.append(',');
doIt = true;
sb.append(StringUtil.escapeJS(key.getString(), '"', charsetEncoder));
sb.append(':');
_serialize(pc, test, value, sb, serializeQueryByColumns, done);
}
}
sb.append('}');
} | class class_name[name] begin[{]
method[_serializeStruct, return_type[void], modifier[public], parameter[pc, test, struct, sb, serializeQueryByColumns, addUDFs, done]] begin[{]
local_variable[type[ApplicationContextSupport], acs]
local_variable[type[boolean], preserveCase]
if[binary_operation[member[.struct], instanceof, type[Component]]] begin[{]
local_variable[type[String], res]
if[binary_operation[member[.res], !=, member[.NULL_STRING]]] begin[{]
call[sb.append, parameter[member[.res]]]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[sb.append, parameter[call[.goIn, parameter[]]]]
call[sb.append, parameter[literal["{"]]]
local_variable[type[Iterator], it]
local_variable[type[Entry], e]
local_variable[type[String], k]
local_variable[type[Object], value]
local_variable[type[boolean], doIt]
while[call[it.hasNext, parameter[]]] begin[{]
assign[member[.e], call[it.next, parameter[]]]
assign[member[.k], call[e.getKey, parameter[]]]
if[member[.preserveCase]] begin[{]
assign[member[.k], call[k.toUpperCase, parameter[]]]
else begin[{]
None
end[}]
assign[member[.value], call[e.getValue, parameter[]]]
if[binary_operation[member[.addUDFs], &&, binary_operation[binary_operation[member[.value], instanceof, type[UDF]], ||, binary_operation[member[.value], ==, literal[null]]]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[member[.doIt]] begin[{]
call[sb.append, parameter[literal[',']]]
else begin[{]
None
end[}]
assign[member[.doIt], literal[true]]
call[sb.append, parameter[call[StringUtil.escapeJS, parameter[member[.k], literal['"'], member[.charsetEncoder]]]]]
call[sb.append, parameter[literal[':']]]
call[._serialize, parameter[member[.pc], member[.test], member[.value], member[.sb], member[.serializeQueryByColumns], member[.done]]]
end[}]
if[binary_operation[member[.struct], instanceof, type[Component]]] begin[{]
local_variable[type[Boolean], remotingFetch]
local_variable[type[Component], comp]
local_variable[type[boolean], isPeristent]
assign[member[.isPeristent], call[comp.isPersistent, parameter[]]]
local_variable[type[Property], props]
local_variable[type[ComponentScope], scope]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=ignoreRemotingFetch, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=remotingFetch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getDynamicAttributes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=REMOTING_FETCH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=toBoolean, postfix_operators=[], prefix_operators=[], qualifier=Caster, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=remotingFetch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[], member=booleanValue, postfix_operators=[], prefix_operators=['!'], qualifier=remotingFetch, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=isPeristent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isRelated, postfix_operators=[], prefix_operators=[], qualifier=ORMUtil, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None))]))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=KeyImpl, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Key, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=get, postfix_operators=[], prefix_operators=[], qualifier=scope, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=addUDFs, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=UDF, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=||), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), IfStatement(condition=MemberReference(member=doIt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=doIt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getString, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"'), MemberReference(member=charsetEncoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=escapeJS, postfix_operators=[], prefix_operators=[], qualifier=StringUtil, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=test, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serializeQueryByColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=_serialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=props, 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)
else begin[{]
None
end[}]
call[sb.append, parameter[literal['}']]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[_serializeStruct] operator[SEP] identifier[PageContext] identifier[pc] , identifier[Set] identifier[test] , identifier[Struct] identifier[struct] , identifier[StringBuilder] identifier[sb] , Keyword[boolean] identifier[serializeQueryByColumns] , Keyword[boolean] identifier[addUDFs] , identifier[Set] operator[<] identifier[Object] operator[>] identifier[done] operator[SEP] Keyword[throws] identifier[ConverterException] {
identifier[ApplicationContextSupport] identifier[acs] operator[=] operator[SEP] identifier[ApplicationContextSupport] operator[SEP] identifier[pc] operator[SEP] identifier[getApplicationContext] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[preserveCase] operator[=] identifier[acs] operator[SEP] identifier[getSerializationSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getPreserveCaseForStructKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[struct] Keyword[instanceof] identifier[Component] operator[SEP] {
identifier[String] identifier[res] operator[=] identifier[castToJson] operator[SEP] identifier[pc] , operator[SEP] identifier[Component] operator[SEP] identifier[struct] , identifier[NULL_STRING] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[res] operator[!=] identifier[NULL_STRING] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[res] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[goIn] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Entry] operator[<] identifier[Key] , identifier[Object] operator[>] operator[>] identifier[it] operator[=] identifier[struct] operator[SEP] identifier[entryIterator] operator[SEP] operator[SEP] operator[SEP] identifier[Entry] operator[<] identifier[Key] , identifier[Object] operator[>] identifier[e] operator[SEP] identifier[String] identifier[k] operator[SEP] identifier[Object] identifier[value] operator[SEP] Keyword[boolean] identifier[doIt] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[e] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[k] operator[=] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[preserveCase] operator[SEP] identifier[k] operator[=] identifier[k] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[addUDFs] operator[&&] operator[SEP] identifier[value] Keyword[instanceof] identifier[UDF] operator[||] identifier[value] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[doIt] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[doIt] operator[=] literal[boolean] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[StringUtil] operator[SEP] identifier[escapeJS] operator[SEP] identifier[k] , literal[String] , identifier[charsetEncoder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[_serialize] operator[SEP] identifier[pc] , identifier[test] , identifier[value] , identifier[sb] , identifier[serializeQueryByColumns] , identifier[done] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[struct] Keyword[instanceof] identifier[Component] operator[SEP] {
identifier[Boolean] identifier[remotingFetch] operator[SEP] identifier[Component] identifier[comp] operator[=] operator[SEP] identifier[Component] operator[SEP] identifier[struct] operator[SEP] Keyword[boolean] identifier[isPeristent] operator[=] literal[boolean] operator[SEP] identifier[isPeristent] operator[=] identifier[comp] operator[SEP] identifier[isPersistent] operator[SEP] operator[SEP] operator[SEP] identifier[Property] operator[SEP] operator[SEP] identifier[props] operator[=] identifier[comp] operator[SEP] identifier[getProperties] operator[SEP] literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[ComponentScope] identifier[scope] operator[=] identifier[comp] operator[SEP] identifier[getComponentScope] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[props] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ignoreRemotingFetch] operator[SEP] {
identifier[remotingFetch] operator[=] identifier[Caster] operator[SEP] identifier[toBoolean] operator[SEP] identifier[props] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getDynamicAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[REMOTING_FETCH] , Other[null] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[remotingFetch] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[isPeristent] operator[&&] identifier[ORMUtil] operator[SEP] identifier[isRelated] operator[SEP] identifier[props] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[remotingFetch] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[Key] identifier[key] operator[=] identifier[KeyImpl] operator[SEP] identifier[getInstance] operator[SEP] identifier[props] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[scope] operator[SEP] identifier[get] operator[SEP] identifier[key] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[addUDFs] operator[&&] operator[SEP] identifier[value] Keyword[instanceof] identifier[UDF] operator[||] identifier[value] operator[==] Other[null] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[doIt] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[doIt] operator[=] literal[boolean] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[StringUtil] operator[SEP] identifier[escapeJS] operator[SEP] identifier[key] operator[SEP] identifier[getString] operator[SEP] operator[SEP] , literal[String] , identifier[charsetEncoder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[_serialize] operator[SEP] identifier[pc] , identifier[test] , identifier[value] , identifier[sb] , identifier[serializeQueryByColumns] , identifier[done] operator[SEP] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static int convert(byte[] data, int start) {
return (Byte.toUnsignedInt(data[start]) << 24) | (Byte.toUnsignedInt(data[start + 1]) << 16)
| (Byte.toUnsignedInt(data[start + 2]) << 8) | Byte.toUnsignedInt(data[start + 3]);
} | class class_name[name] begin[{]
method[convert, return_type[type[int]], modifier[public static], parameter[data, start]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[call[Byte.toUnsignedInt, parameter[member[.data]]], <<, literal[24]], |, binary_operation[call[Byte.toUnsignedInt, parameter[member[.data]]], <<, literal[16]]], |, binary_operation[call[Byte.toUnsignedInt, parameter[member[.data]]], <<, literal[8]]], |, call[Byte.toUnsignedInt, parameter[member[.data]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[convert] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[int] identifier[start] operator[SEP] {
Keyword[return] operator[SEP] identifier[Byte] operator[SEP] identifier[toUnsignedInt] operator[SEP] identifier[data] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[<<] Other[24] operator[SEP] operator[|] operator[SEP] identifier[Byte] operator[SEP] identifier[toUnsignedInt] operator[SEP] identifier[data] operator[SEP] identifier[start] operator[+] Other[1] operator[SEP] operator[SEP] operator[<<] Other[16] operator[SEP] operator[|] operator[SEP] identifier[Byte] operator[SEP] identifier[toUnsignedInt] operator[SEP] identifier[data] operator[SEP] identifier[start] operator[+] Other[2] operator[SEP] operator[SEP] operator[<<] Other[8] operator[SEP] operator[|] identifier[Byte] operator[SEP] identifier[toUnsignedInt] operator[SEP] identifier[data] operator[SEP] identifier[start] operator[+] Other[3] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EntityManager createEntityManager(Map arg0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createEntityManager : " + this);
throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
} | class class_name[name] begin[{]
method[createEntityManager, return_type[type[EntityManager]], modifier[public], parameter[arg0]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["createEntityManager : "], +, THIS[]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This operation is not supported on a pooling EntityManagerFactory.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EntityManager] identifier[createEntityManager] operator[SEP] identifier[Map] identifier[arg0] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static InetAddress getLocalIPFromServerSocket(final int port, final int backlog)
throws UnknownHostException, IOException
{
InetAddress inetAddress = null;
ServerSocket socket = null;
try
{
socket = new ServerSocket(port, backlog, InetAddress.getLocalHost());
inetAddress = socket.getInetAddress();
socket.close();
}
finally
{
SocketExtensions.closeServerSocket(socket);
}
return inetAddress;
} | class class_name[name] begin[{]
method[getLocalIPFromServerSocket, return_type[type[InetAddress]], modifier[public static], parameter[port, backlog]] begin[{]
local_variable[type[InetAddress], inetAddress]
local_variable[type[ServerSocket], socket]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=backlog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getLocalHost, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServerSocket, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=inetAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getInetAddress, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeServerSocket, postfix_operators=[], prefix_operators=[], qualifier=SocketExtensions, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.inetAddress]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InetAddress] identifier[getLocalIPFromServerSocket] operator[SEP] Keyword[final] Keyword[int] identifier[port] , Keyword[final] Keyword[int] identifier[backlog] operator[SEP] Keyword[throws] identifier[UnknownHostException] , identifier[IOException] {
identifier[InetAddress] identifier[inetAddress] operator[=] Other[null] operator[SEP] identifier[ServerSocket] identifier[socket] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[socket] operator[=] Keyword[new] identifier[ServerSocket] operator[SEP] identifier[port] , identifier[backlog] , identifier[InetAddress] operator[SEP] identifier[getLocalHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[inetAddress] operator[=] identifier[socket] operator[SEP] identifier[getInetAddress] operator[SEP] operator[SEP] operator[SEP] identifier[socket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[SocketExtensions] operator[SEP] identifier[closeServerSocket] operator[SEP] identifier[socket] operator[SEP] operator[SEP]
}
Keyword[return] identifier[inetAddress] operator[SEP]
}
|
public Layer withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | class class_name[name] begin[{]
method[withAttributes, return_type[type[Layer]], modifier[public], parameter[attributes]] begin[{]
call[.setAttributes, parameter[member[.attributes]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Layer] identifier[withAttributes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[attributes] operator[SEP] {
identifier[setAttributes] operator[SEP] identifier[attributes] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public java.util.List<CloudWatchDimensionConfiguration> getDimensionConfigurations() {
if (dimensionConfigurations == null) {
dimensionConfigurations = new com.amazonaws.internal.SdkInternalList<CloudWatchDimensionConfiguration>();
}
return dimensionConfigurations;
} | class class_name[name] begin[{]
method[getDimensionConfigurations, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.dimensionConfigurations], ==, literal[null]]] begin[{]
assign[member[.dimensionConfigurations], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CloudWatchDimensionConfiguration, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.dimensionConfigurations]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[CloudWatchDimensionConfiguration] operator[>] identifier[getDimensionConfigurations] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[dimensionConfigurations] operator[==] Other[null] operator[SEP] {
identifier[dimensionConfigurations] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[CloudWatchDimensionConfiguration] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dimensionConfigurations] operator[SEP]
}
|
public ImageAttribute withLaunchPermissions(LaunchPermission... launchPermissions) {
if (this.launchPermissions == null) {
setLaunchPermissions(new com.amazonaws.internal.SdkInternalList<LaunchPermission>(launchPermissions.length));
}
for (LaunchPermission ele : launchPermissions) {
this.launchPermissions.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withLaunchPermissions, return_type[type[ImageAttribute]], modifier[public], parameter[launchPermissions]] begin[{]
if[binary_operation[THIS[member[None.launchPermissions]], ==, literal[null]]] begin[{]
call[.setLaunchPermissions, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=launchPermissions, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LaunchPermission, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=launchPermissions, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=launchPermissions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LaunchPermission, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ImageAttribute] identifier[withLaunchPermissions] operator[SEP] identifier[LaunchPermission] operator[...] identifier[launchPermissions] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[launchPermissions] operator[==] Other[null] operator[SEP] {
identifier[setLaunchPermissions] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[LaunchPermission] operator[>] operator[SEP] identifier[launchPermissions] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[LaunchPermission] identifier[ele] operator[:] identifier[launchPermissions] operator[SEP] {
Keyword[this] operator[SEP] identifier[launchPermissions] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Boolean getAsBoolean(String key) {
Object value = mValues.get(key);
try {
return (Boolean) value;
} catch (ClassCastException e) {
if (value instanceof CharSequence) {
return Boolean.valueOf(value.toString());
} else if (value instanceof Number) {
return ((Number) value).intValue() != 0;
} else {
DLog.e(TAG, "Cannot cast value for " + key + " to a Boolean: " + value, e);
return null;
}
}
} | class class_name[name] begin[{]
method[getAsBoolean, return_type[type[Boolean]], modifier[public], parameter[key]] begin[{]
local_variable[type[Object], value]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CharSequence, sub_type=None), operator=instanceof), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot cast value for "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to a Boolean: "), operator=+), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=e, postfix_operators=[], prefix_operators=[], qualifier=DLog, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=BinaryOperation(operandl=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Boolean] identifier[getAsBoolean] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[mValues] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[CharSequence] operator[SEP] {
Keyword[return] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Number] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[DLog] operator[SEP] identifier[e] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[value] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
}
|
public static Timestamp forSecond(int year, int month, int day,
int hour, int minute, int second,
Integer offset)
{
return new Timestamp(year, month, day, hour, minute, second, offset);
} | class class_name[name] begin[{]
method[forSecond, return_type[type[Timestamp]], modifier[public static], parameter[year, month, day, hour, minute, second, offset]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=month, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=day, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hour, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Timestamp, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Timestamp] identifier[forSecond] operator[SEP] Keyword[int] identifier[year] , Keyword[int] identifier[month] , Keyword[int] identifier[day] , Keyword[int] identifier[hour] , Keyword[int] identifier[minute] , Keyword[int] identifier[second] , identifier[Integer] identifier[offset] operator[SEP] {
Keyword[return] Keyword[new] identifier[Timestamp] operator[SEP] identifier[year] , identifier[month] , identifier[day] , identifier[hour] , identifier[minute] , identifier[second] , identifier[offset] operator[SEP] operator[SEP]
}
|
public CloseableIterator<GeometryIndex> queryIndexedFeatures(int x, int y,
int zoom) {
// Get the web mercator bounding box
BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Query for the geometries matching the bounds in the index
return queryIndexedFeatures(webMercatorBoundingBox);
} | class class_name[name] begin[{]
method[queryIndexedFeatures, return_type[type[CloseableIterator]], modifier[public], parameter[x, y, zoom]] begin[{]
local_variable[type[BoundingBox], webMercatorBoundingBox]
return[call[.queryIndexedFeatures, parameter[member[.webMercatorBoundingBox]]]]
end[}]
END[}] | Keyword[public] identifier[CloseableIterator] operator[<] identifier[GeometryIndex] operator[>] identifier[queryIndexedFeatures] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[y] , Keyword[int] identifier[zoom] operator[SEP] {
identifier[BoundingBox] identifier[webMercatorBoundingBox] operator[=] identifier[TileBoundingBoxUtils] operator[SEP] identifier[getWebMercatorBoundingBox] operator[SEP] identifier[x] , identifier[y] , identifier[zoom] operator[SEP] operator[SEP] Keyword[return] identifier[queryIndexedFeatures] operator[SEP] identifier[webMercatorBoundingBox] operator[SEP] operator[SEP]
}
|
public void marshall(CreateExclusionsPreviewRequest createExclusionsPreviewRequest, ProtocolMarshaller protocolMarshaller) {
if (createExclusionsPreviewRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createExclusionsPreviewRequest.getAssessmentTemplateArn(), ASSESSMENTTEMPLATEARN_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[createExclusionsPreviewRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createExclusionsPreviewRequest], ==, 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=getAssessmentTemplateArn, postfix_operators=[], prefix_operators=[], qualifier=createExclusionsPreviewRequest, selectors=[], type_arguments=None), MemberReference(member=ASSESSMENTTEMPLATEARN_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[CreateExclusionsPreviewRequest] identifier[createExclusionsPreviewRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createExclusionsPreviewRequest] 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[createExclusionsPreviewRequest] operator[SEP] identifier[getAssessmentTemplateArn] operator[SEP] operator[SEP] , identifier[ASSESSMENTTEMPLATEARN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public List<DecisionService> getDecisionService() {
return drgElement.stream().filter(DecisionService.class::isInstance).map(DecisionService.class::cast).collect(Collectors.toList());
} | class class_name[name] begin[{]
method[getDecisionService, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[call[drgElement.stream, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[DecisionService] operator[>] identifier[getDecisionService] operator[SEP] operator[SEP] {
Keyword[return] identifier[drgElement] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[DecisionService] operator[SEP] Keyword[class] operator[::] identifier[isInstance] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[DecisionService] operator[SEP] Keyword[class] operator[::] identifier[cast] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EClass getIfcRotationalFrequencyMeasure() {
if (ifcRotationalFrequencyMeasureEClass == null) {
ifcRotationalFrequencyMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(858);
}
return ifcRotationalFrequencyMeasureEClass;
} | class class_name[name] begin[{]
method[getIfcRotationalFrequencyMeasure, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcRotationalFrequencyMeasureEClass], ==, literal[null]]] begin[{]
assign[member[.ifcRotationalFrequencyMeasureEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=858)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcRotationalFrequencyMeasureEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcRotationalFrequencyMeasure] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcRotationalFrequencyMeasureEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcRotationalFrequencyMeasureEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[858] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcRotationalFrequencyMeasureEClass] operator[SEP]
}
|
private void readRelationships(Storepoint phoenixProject)
{
for (Relationship relation : phoenixProject.getRelationships().getRelationship())
{
readRelation(relation);
}
} | class class_name[name] begin[{]
method[readRelationships, return_type[void], modifier[private], parameter[phoenixProject]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=relation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationships, postfix_operators=[], prefix_operators=[], qualifier=phoenixProject, selectors=[MethodInvocation(arguments=[], member=getRelationship, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=relation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Relationship, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[readRelationships] operator[SEP] identifier[Storepoint] identifier[phoenixProject] operator[SEP] {
Keyword[for] operator[SEP] identifier[Relationship] identifier[relation] operator[:] identifier[phoenixProject] operator[SEP] identifier[getRelationships] operator[SEP] operator[SEP] operator[SEP] identifier[getRelationship] operator[SEP] operator[SEP] operator[SEP] {
identifier[readRelation] operator[SEP] identifier[relation] operator[SEP] operator[SEP]
}
}
|
public static boolean isAnonymousNodeIRI(String uri) {
return uri != null && uri.startsWith(PREFIX) && uri.contains(NODE_ID_PREFIX);
} | class class_name[name] begin[{]
method[isAnonymousNodeIRI, return_type[type[boolean]], modifier[public static], parameter[uri]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.uri], !=, literal[null]], &&, call[uri.startsWith, parameter[member[.PREFIX]]]], &&, call[uri.contains, parameter[member[.NODE_ID_PREFIX]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isAnonymousNodeIRI] operator[SEP] identifier[String] identifier[uri] operator[SEP] {
Keyword[return] identifier[uri] operator[!=] Other[null] operator[&&] identifier[uri] operator[SEP] identifier[startsWith] operator[SEP] identifier[PREFIX] operator[SEP] operator[&&] identifier[uri] operator[SEP] identifier[contains] operator[SEP] identifier[NODE_ID_PREFIX] operator[SEP] operator[SEP]
}
|
public ResultSet getSuperTypes(final String catalog,
final String schemaPattern,
final String typeNamePattern)
throws SQLException {
return RowLists.rowList6(String.class, String.class, String.class,
String.class, String.class, String.class).
withLabel(1, "TYPE_CAT").
withLabel(2, "TYPE_SCHEM").
withLabel(3, "TYPE_NAME").
withLabel(4, "SUPERTYPE_CAT").
withLabel(5, "SUPERTYPE_SCHEM").
withLabel(6, "SUPERTYPE_NAME").
resultSet();
} | class class_name[name] begin[{]
method[getSuperTypes, return_type[type[ResultSet]], modifier[public], parameter[catalog, schemaPattern, typeNamePattern]] begin[{]
return[call[RowLists.rowList6, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[ResultSet] identifier[getSuperTypes] operator[SEP] Keyword[final] identifier[String] identifier[catalog] , Keyword[final] identifier[String] identifier[schemaPattern] , Keyword[final] identifier[String] identifier[typeNamePattern] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[return] identifier[RowLists] operator[SEP] identifier[rowList6] operator[SEP] identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[1] , literal[String] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[2] , literal[String] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[3] , literal[String] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[4] , literal[String] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[5] , literal[String] operator[SEP] operator[SEP] identifier[withLabel] operator[SEP] Other[6] , literal[String] operator[SEP] operator[SEP] identifier[resultSet] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Resource newResource(String resource)
throws MalformedURLException, IOException
{
URL url=null;
try
{
// Try to format as a URL?
url = new URL(resource);
}
catch(MalformedURLException e)
{
if(!resource.startsWith("ftp:") &&
!resource.startsWith("file:") &&
!resource.startsWith("jar:"))
{
try
{
// It's a file.
if (resource.startsWith("./"))
resource=resource.substring(2);
File file=new File(resource).getCanonicalFile();
url=file.toURI().toURL();
URLConnection connection=url.openConnection();
FileResource fileResource= new FileResource(url,connection,file);
return fileResource;
}
catch(Exception e2)
{
log.debug(LogSupport.EXCEPTION,e2);
throw e;
}
}
else
{
log.warn("Bad Resource: "+resource);
throw e;
}
}
String nurl=url.toString();
if (nurl.length()>0 &&
nurl.charAt(nurl.length()-1)!=
resource.charAt(resource.length()-1))
{
if ((nurl.charAt(nurl.length()-1)!='/' ||
nurl.charAt(nurl.length()-2)!=resource.charAt(resource.length()-1))
&&
(resource.charAt(resource.length()-1)!='/' ||
resource.charAt(resource.length()-2)!=nurl.charAt(nurl.length()-1)
))
{
return new BadResource(url,"Trailing special characters stripped by URL in "+resource);
}
}
return newResource(url);
} | class class_name[name] begin[{]
method[newResource, return_type[type[Resource]], modifier[public static], parameter[resource]] begin[{]
local_variable[type[URL], url]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None))), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ftp:")], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=resource, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file:")], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=resource, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jar:")], member=startsWith, postfix_operators=[], prefix_operators=['!'], qualifier=resource, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad Resource: "), operandr=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="./")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getCanonicalFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), name=connection)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URLConnection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=file, 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=FileResource, sub_type=None)), name=fileResource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileResource, sub_type=None)), ReturnStatement(expression=MemberReference(member=fileResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=EXCEPTION, postfix_operators=[], prefix_operators=[], qualifier=LogSupport, selectors=[]), MemberReference(member=e2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e2, types=['Exception']))], finally_block=None, label=None, resources=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)
local_variable[type[String], nurl]
if[binary_operation[binary_operation[call[nurl.length, parameter[]], >, literal[0]], &&, binary_operation[call[nurl.charAt, parameter[binary_operation[call[nurl.length, parameter[]], -, literal[1]]]], !=, call[resource.charAt, parameter[binary_operation[call[resource.length, parameter[]], -, literal[1]]]]]]] begin[{]
if[binary_operation[binary_operation[binary_operation[call[nurl.charAt, parameter[binary_operation[call[nurl.length, parameter[]], -, literal[1]]]], !=, literal['/']], ||, binary_operation[call[nurl.charAt, parameter[binary_operation[call[nurl.length, parameter[]], -, literal[2]]]], !=, call[resource.charAt, parameter[binary_operation[call[resource.length, parameter[]], -, literal[1]]]]]], &&, binary_operation[binary_operation[call[resource.charAt, parameter[binary_operation[call[resource.length, parameter[]], -, literal[1]]]], !=, literal['/']], ||, binary_operation[call[resource.charAt, parameter[binary_operation[call[resource.length, parameter[]], -, literal[2]]]], !=, call[nurl.charAt, parameter[binary_operation[call[nurl.length, parameter[]], -, literal[1]]]]]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Trailing special characters stripped by URL in "), operandr=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadResource, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[.newResource, parameter[member[.url]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Resource] identifier[newResource] operator[SEP] identifier[String] identifier[resource] operator[SEP] Keyword[throws] identifier[MalformedURLException] , identifier[IOException] {
identifier[URL] identifier[url] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[url] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[resource] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[resource] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[resource] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[resource] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[resource] operator[=] identifier[resource] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[File] identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[resource] operator[SEP] operator[SEP] identifier[getCanonicalFile] operator[SEP] operator[SEP] operator[SEP] identifier[url] operator[=] identifier[file] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP] identifier[URLConnection] identifier[connection] operator[=] identifier[url] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] identifier[FileResource] identifier[fileResource] operator[=] Keyword[new] identifier[FileResource] operator[SEP] identifier[url] , identifier[connection] , identifier[file] operator[SEP] operator[SEP] Keyword[return] identifier[fileResource] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e2] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[LogSupport] operator[SEP] identifier[EXCEPTION] , identifier[e2] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[resource] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
identifier[String] identifier[nurl] operator[=] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nurl] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] identifier[nurl] operator[SEP] identifier[charAt] operator[SEP] identifier[nurl] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[!=] identifier[resource] operator[SEP] identifier[charAt] operator[SEP] identifier[resource] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[nurl] operator[SEP] identifier[charAt] operator[SEP] identifier[nurl] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[!=] literal[String] operator[||] identifier[nurl] operator[SEP] identifier[charAt] operator[SEP] identifier[nurl] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[!=] identifier[resource] operator[SEP] identifier[charAt] operator[SEP] identifier[resource] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[resource] operator[SEP] identifier[charAt] operator[SEP] identifier[resource] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[!=] literal[String] operator[||] identifier[resource] operator[SEP] identifier[charAt] operator[SEP] identifier[resource] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[!=] identifier[nurl] operator[SEP] identifier[charAt] operator[SEP] identifier[nurl] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[BadResource] operator[SEP] identifier[url] , literal[String] operator[+] identifier[resource] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[newResource] operator[SEP] identifier[url] operator[SEP] operator[SEP]
}
|
@Override
public void artifactInstalled(RepositoryEvent event) {
log.fine("Installed " + event.getArtifact() + " to " + event.getFile());
} | class class_name[name] begin[{]
method[artifactInstalled, return_type[void], modifier[public], parameter[event]] begin[{]
call[log.fine, parameter[binary_operation[binary_operation[binary_operation[literal["Installed "], +, call[event.getArtifact, parameter[]]], +, literal[" to "]], +, call[event.getFile, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[artifactInstalled] operator[SEP] identifier[RepositoryEvent] identifier[event] operator[SEP] {
identifier[log] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[getArtifact] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[event] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void formatResultSet(ResultSet r) {
if (r == null) {
String[] g = new String[1];
g[0] = "Result";
gResult.setHead(g);
g[0] = "(empty)";
gResult.addRow(g);
return;
}
try {
ResultSetMetaData m = r.getMetaData();
int col = m.getColumnCount();
Object[] h = new Object[col];
boolean[] isVarChar = new boolean[col];
for (int i = 1; i <= col; i++) {
h[i - 1] = m.getColumnLabel(i);
isVarChar[i - 1] = (m.getColumnType(i)
== java.sql.Types.VARCHAR);
}
gResult.setHead(h);
while (r.next()) {
for (int i = 1; i <= col; i++) {
try {
h[i - 1] = r.getObject(i);
if (r.wasNull()) {
h[i - 1] = (isVarChar[i - 1] ? NULL_STR
: null);
}
} catch (SQLException e) {}
}
gResult.addRow(h);
}
r.close();
} catch (SQLException e) {
// Added: (weconsultants@users)
CommonSwing.errorMessage(e);
}
} | class class_name[name] begin[{]
method[formatResultSet, return_type[void], modifier[private], parameter[r]] begin[{]
if[binary_operation[member[.r], ==, literal[null]]] begin[{]
local_variable[type[String], g]
assign[member[.g], literal["Result"]]
call[gResult.setHead, parameter[member[.g]]]
assign[member[.g], literal["(empty)"]]
call[gResult.addRow, parameter[member[.g]]]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMetaData, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResultSetMetaData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=col)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), name=h)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=boolean)), name=isVarChar)], modifiers=set(), type=BasicType(dimensions=[None], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnLabel, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isVarChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnType, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), operandr=MemberReference(member=VARCHAR, postfix_operators=[], prefix_operators=[], qualifier=java.sql.Types, selectors=[]), operator===)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHead, postfix_operators=[], prefix_operators=[], qualifier=gResult, selectors=[], type_arguments=None), label=None), WhileStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=wasNull, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), type==, value=TernaryExpression(condition=MemberReference(member=isVarChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MemberReference(member=NULL_STR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addRow, postfix_operators=[], prefix_operators=[], qualifier=gResult, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=errorMessage, postfix_operators=[], prefix_operators=[], qualifier=CommonSwing, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[formatResultSet] operator[SEP] identifier[ResultSet] identifier[r] operator[SEP] {
Keyword[if] operator[SEP] identifier[r] operator[==] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[g] operator[=] Keyword[new] identifier[String] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[g] operator[SEP] Other[0] operator[SEP] operator[=] literal[String] operator[SEP] identifier[gResult] operator[SEP] identifier[setHead] operator[SEP] identifier[g] operator[SEP] operator[SEP] identifier[g] operator[SEP] Other[0] operator[SEP] operator[=] literal[String] operator[SEP] identifier[gResult] operator[SEP] identifier[addRow] operator[SEP] identifier[g] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[ResultSetMetaData] identifier[m] operator[=] identifier[r] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[col] operator[=] identifier[m] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[h] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[col] operator[SEP] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[isVarChar] operator[=] Keyword[new] Keyword[boolean] operator[SEP] identifier[col] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[col] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[h] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[=] identifier[m] operator[SEP] identifier[getColumnLabel] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isVarChar] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[=] operator[SEP] identifier[m] operator[SEP] identifier[getColumnType] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[java] operator[SEP] identifier[sql] operator[SEP] identifier[Types] operator[SEP] identifier[VARCHAR] operator[SEP] operator[SEP]
}
identifier[gResult] operator[SEP] identifier[setHead] operator[SEP] identifier[h] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[r] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[col] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[h] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[=] identifier[r] operator[SEP] identifier[getObject] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[SEP] identifier[wasNull] operator[SEP] operator[SEP] operator[SEP] {
identifier[h] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[=] operator[SEP] identifier[isVarChar] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[?] identifier[NULL_STR] operator[:] Other[null] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
}
}
identifier[gResult] operator[SEP] identifier[addRow] operator[SEP] identifier[h] operator[SEP] operator[SEP]
}
identifier[r] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
identifier[CommonSwing] operator[SEP] identifier[errorMessage] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public final List<Metric> poll(MetricFilter filter, boolean reset) {
Map<String, Future<List<Metric>>> futures = new HashMap<>();
for (Map.Entry<String, MetricPoller> e : pollers.entrySet()) {
PollCallable task = new PollCallable(e.getValue(), filter, reset);
futures.put(e.getKey(), executor.submit(task));
}
List<Metric> allMetrics = new ArrayList<>();
for (Map.Entry<String, Future<List<Metric>>> e : futures.entrySet()) {
allMetrics.addAll(getMetrics(e.getKey(), e.getValue()));
}
return allMetrics;
} | class class_name[name] begin[{]
method[poll, return_type[type[List]], modifier[final public], parameter[filter, reset]] begin[{]
local_variable[type[Map], futures]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=reset, 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=PollCallable, sub_type=None)), name=task)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PollCallable, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=submit, postfix_operators=[], prefix_operators=[], qualifier=executor, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=pollers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], 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=MetricPoller, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[List], allMetrics]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=getMetrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=allMetrics, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Metric, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Future, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.allMetrics]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[List] operator[<] identifier[Metric] operator[>] identifier[poll] operator[SEP] identifier[MetricFilter] identifier[filter] , Keyword[boolean] identifier[reset] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Future] operator[<] identifier[List] operator[<] identifier[Metric] operator[>] operator[>] operator[>] identifier[futures] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[MetricPoller] operator[>] identifier[e] operator[:] identifier[pollers] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[PollCallable] identifier[task] operator[=] Keyword[new] identifier[PollCallable] operator[SEP] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[filter] , identifier[reset] operator[SEP] operator[SEP] identifier[futures] operator[SEP] identifier[put] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[executor] operator[SEP] identifier[submit] operator[SEP] identifier[task] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Metric] operator[>] identifier[allMetrics] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Future] operator[<] identifier[List] operator[<] identifier[Metric] operator[>] operator[>] operator[>] identifier[e] operator[:] identifier[futures] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[allMetrics] operator[SEP] identifier[addAll] operator[SEP] identifier[getMetrics] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[allMetrics] operator[SEP]
}
|
public void auditPortableMediaImport(
RFC3881EventOutcomeCodes eventOutcome,
String submissionSetUniqueId,
String patientId,
List<CodedValueType> purposesOfUse)
{
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.DistributeDocumentSetOnMedia(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), false);
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId);
audit(importEvent);
} | class class_name[name] begin[{]
method[auditPortableMediaImport, return_type[void], modifier[public], parameter[eventOutcome, submissionSetUniqueId, patientId, purposesOfUse]] begin[{]
if[call[.isAuditorEnabled, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[ImportEvent], importEvent]
call[importEvent.setAuditSourceId, parameter[call[.getAuditSourceId, parameter[]], call[.getAuditEnterpriseSiteId, parameter[]]]]
call[importEvent.addDestinationActiveParticipant, parameter[call[.getSystemUserId, parameter[]], call[.getSystemAltUserId, parameter[]], call[.getSystemUserName, parameter[]], call[.getSystemNetworkId, parameter[]], literal[false]]]
if[call[EventUtils.isEmptyOrNull, parameter[member[.patientId]]]] begin[{]
call[importEvent.addPatientParticipantObject, parameter[member[.patientId]]]
else begin[{]
None
end[}]
call[importEvent.addSubmissionSetParticipantObject, parameter[member[.submissionSetUniqueId]]]
call[.audit, parameter[member[.importEvent]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[auditPortableMediaImport] operator[SEP] identifier[RFC3881EventOutcomeCodes] identifier[eventOutcome] , identifier[String] identifier[submissionSetUniqueId] , identifier[String] identifier[patientId] , identifier[List] operator[<] identifier[CodedValueType] operator[>] identifier[purposesOfUse] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isAuditorEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[ImportEvent] identifier[importEvent] operator[=] Keyword[new] identifier[ImportEvent] operator[SEP] literal[boolean] , identifier[eventOutcome] , Keyword[new] identifier[IHETransactionEventTypeCodes] operator[SEP] identifier[DistributeDocumentSetOnMedia] operator[SEP] operator[SEP] , identifier[purposesOfUse] operator[SEP] operator[SEP] identifier[importEvent] operator[SEP] identifier[setAuditSourceId] operator[SEP] identifier[getAuditSourceId] operator[SEP] operator[SEP] , identifier[getAuditEnterpriseSiteId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[importEvent] operator[SEP] identifier[addDestinationActiveParticipant] operator[SEP] identifier[getSystemUserId] operator[SEP] operator[SEP] , identifier[getSystemAltUserId] operator[SEP] operator[SEP] , identifier[getSystemUserName] operator[SEP] operator[SEP] , identifier[getSystemNetworkId] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[EventUtils] operator[SEP] identifier[isEmptyOrNull] operator[SEP] identifier[patientId] operator[SEP] operator[SEP] {
identifier[importEvent] operator[SEP] identifier[addPatientParticipantObject] operator[SEP] identifier[patientId] operator[SEP] operator[SEP]
}
identifier[importEvent] operator[SEP] identifier[addSubmissionSetParticipantObject] operator[SEP] identifier[submissionSetUniqueId] operator[SEP] operator[SEP] identifier[audit] operator[SEP] identifier[importEvent] operator[SEP] operator[SEP]
}
|
@Nonnull
public static <T> UBLTRValidatorBuilder <T> create (@Nonnull final Class <T> aClass)
{
return new UBLTRValidatorBuilder <> (aClass);
} | class class_name[name] begin[{]
method[create, return_type[type[UBLTRValidatorBuilder]], modifier[public static], parameter[aClass]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=aClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=UBLTRValidatorBuilder, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[UBLTRValidatorBuilder] operator[<] identifier[T] operator[>] identifier[create] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[aClass] operator[SEP] {
Keyword[return] Keyword[new] identifier[UBLTRValidatorBuilder] operator[<] operator[>] operator[SEP] identifier[aClass] operator[SEP] operator[SEP]
}
|
protected boolean isValidAction(Action action) {
return getActions().contains(action) || Action.cancel.equals(action);
} | class class_name[name] begin[{]
method[isValidAction, return_type[type[boolean]], modifier[protected], parameter[action]] begin[{]
return[binary_operation[call[.getActions, parameter[]], ||, call[Action.cancel.equals, parameter[member[.action]]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isValidAction] operator[SEP] identifier[Action] identifier[action] operator[SEP] {
Keyword[return] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[action] operator[SEP] operator[||] identifier[Action] operator[SEP] identifier[cancel] operator[SEP] identifier[equals] operator[SEP] identifier[action] operator[SEP] operator[SEP]
}
|
private void translate(IQ query, DatalogProgram pr) {
QueryNode root = query.getTree().getRootNode();
if(!(root instanceof ConstructionNode)){
throw new DatalogConversionException("the root is expected to be a Construction Node");
}
UnaryIQTree tree = (UnaryIQTree) query.getTree();
ConstructionNode rootCn = (ConstructionNode) root;
Queue<RuleHead> heads = new LinkedList<>();
ImmutableSubstitution<ImmutableTerm> topSubstitution = Optional.of(rootCn)
.map(ConstructionNode::getSubstitution)
.orElseGet(substitutionFactory::getSubstitution);
heads.add(new RuleHead(topSubstitution, query.getProjectionAtom(), Optional.of(tree.getChild())));
// Mutable (append-only)
Map<QueryNode, DataAtom> subQueryProjectionAtoms = new HashMap<>();
subQueryProjectionAtoms.put(root, query.getProjectionAtom());
//In heads we keep the heads of the sub-rules in the program, e.g. ans5() :- LeftJoin(....)
while(!heads.isEmpty()) {
RuleHead head = heads.poll();
//Applying substitutions in the head.
ImmutableList<? extends ImmutableTerm> substitutedHeadAtomArguments = head.substitution.apply(head.atom.getArguments());
List<Function> atoms = new LinkedList<>();
Function newHead = immutabilityTools.convertToMutableFunction(head.atom.getPredicate(),
substitutedHeadAtomArguments);
//Constructing the rule
CQIE newrule = datalogFactory.getCQIE(newHead, atoms);
pr.appendRule(newrule);
head.optionalChildNode.ifPresent(t -> {
List<Function> uAtoms = getAtomFrom(t, heads, subQueryProjectionAtoms, false);
newrule.getBody().addAll(uAtoms);
});
}
} | class class_name[name] begin[{]
method[translate, return_type[void], modifier[private], parameter[query, pr]] begin[{]
local_variable[type[QueryNode], root]
if[binary_operation[member[.root], instanceof, type[ConstructionNode]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="the root is expected to be a Construction Node")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatalogConversionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[UnaryIQTree], tree]
local_variable[type[ConstructionNode], rootCn]
local_variable[type[Queue], heads]
local_variable[type[ImmutableSubstitution], topSubstitution]
call[heads.add, parameter[ClassCreator(arguments=[MemberReference(member=topSubstitution, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getProjectionAtom, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=tree, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleHead, sub_type=None))]]
local_variable[type[Map], subQueryProjectionAtoms]
call[subQueryProjectionAtoms.put, parameter[member[.root], call[query.getProjectionAtom, parameter[]]]]
while[call[heads.isEmpty, parameter[]]] begin[{]
local_variable[type[RuleHead], head]
local_variable[type[ImmutableList], substitutedHeadAtomArguments]
local_variable[type[List], atoms]
local_variable[type[Function], newHead]
local_variable[type[CQIE], newrule]
call[pr.appendRule, parameter[member[.newrule]]]
call[head.optionalChildNode.ifPresent, parameter[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=heads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subQueryProjectionAtoms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getAtomFrom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=uAtoms)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Function, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=newrule, selectors=[MethodInvocation(arguments=[MemberReference(member=uAtoms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[translate] operator[SEP] identifier[IQ] identifier[query] , identifier[DatalogProgram] identifier[pr] operator[SEP] {
identifier[QueryNode] identifier[root] operator[=] identifier[query] operator[SEP] identifier[getTree] operator[SEP] operator[SEP] operator[SEP] identifier[getRootNode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[root] Keyword[instanceof] identifier[ConstructionNode] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DatalogConversionException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[UnaryIQTree] identifier[tree] operator[=] operator[SEP] identifier[UnaryIQTree] operator[SEP] identifier[query] operator[SEP] identifier[getTree] operator[SEP] operator[SEP] operator[SEP] identifier[ConstructionNode] identifier[rootCn] operator[=] operator[SEP] identifier[ConstructionNode] operator[SEP] identifier[root] operator[SEP] identifier[Queue] operator[<] identifier[RuleHead] operator[>] identifier[heads] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ImmutableSubstitution] operator[<] identifier[ImmutableTerm] operator[>] identifier[topSubstitution] operator[=] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[rootCn] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[ConstructionNode] operator[::] identifier[getSubstitution] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] identifier[substitutionFactory] operator[::] identifier[getSubstitution] operator[SEP] operator[SEP] identifier[heads] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RuleHead] operator[SEP] identifier[topSubstitution] , identifier[query] operator[SEP] identifier[getProjectionAtom] operator[SEP] operator[SEP] , identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[tree] operator[SEP] identifier[getChild] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[QueryNode] , identifier[DataAtom] operator[>] identifier[subQueryProjectionAtoms] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[subQueryProjectionAtoms] operator[SEP] identifier[put] operator[SEP] identifier[root] , identifier[query] operator[SEP] identifier[getProjectionAtom] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[heads] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[RuleHead] identifier[head] operator[=] identifier[heads] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] identifier[ImmutableList] operator[<] operator[?] Keyword[extends] identifier[ImmutableTerm] operator[>] identifier[substitutedHeadAtomArguments] operator[=] identifier[head] operator[SEP] identifier[substitution] operator[SEP] identifier[apply] operator[SEP] identifier[head] operator[SEP] identifier[atom] operator[SEP] identifier[getArguments] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Function] operator[>] identifier[atoms] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Function] identifier[newHead] operator[=] identifier[immutabilityTools] operator[SEP] identifier[convertToMutableFunction] operator[SEP] identifier[head] operator[SEP] identifier[atom] operator[SEP] identifier[getPredicate] operator[SEP] operator[SEP] , identifier[substitutedHeadAtomArguments] operator[SEP] operator[SEP] identifier[CQIE] identifier[newrule] operator[=] identifier[datalogFactory] operator[SEP] identifier[getCQIE] operator[SEP] identifier[newHead] , identifier[atoms] operator[SEP] operator[SEP] identifier[pr] operator[SEP] identifier[appendRule] operator[SEP] identifier[newrule] operator[SEP] operator[SEP] identifier[head] operator[SEP] identifier[optionalChildNode] operator[SEP] identifier[ifPresent] operator[SEP] identifier[t] operator[->] {
identifier[List] operator[<] identifier[Function] operator[>] identifier[uAtoms] operator[=] identifier[getAtomFrom] operator[SEP] identifier[t] , identifier[heads] , identifier[subQueryProjectionAtoms] , literal[boolean] operator[SEP] operator[SEP] identifier[newrule] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[uAtoms] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
}
|
private boolean lexicalClimb(PageCompilingContext pc, Node node) {
if (node.attr(ANNOTATION).length()>1) {
// Setup a new lexical scope (symbol table changes on each scope encountered).
if (REPEAT_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))
|| CHOOSE_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))) {
String[] keyAndContent = {node.attr(ANNOTATION_KEY), node.attr(ANNOTATION_CONTENT)};
pc.lexicalScopes.push(new MvelEvaluatorCompiler(parseRepeatScope(pc, keyAndContent, node)));
return true;
}
// Setup a new lexical scope for compiling against embedded pages (closures).
final PageBook.Page embed = pageBook.forName(node.attr(ANNOTATION_KEY));
if (null != embed) {
final Class<?> embedClass = embed.pageClass();
MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(embedClass);
checkEmbedAgainst(pc, compiler, Parsing.toBindMap(node.attr(ANNOTATION_CONTENT)),
embedClass, node);
pc.lexicalScopes.push(compiler);
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[lexicalClimb, return_type[type[boolean]], modifier[private], parameter[pc, node]] begin[{]
if[binary_operation[call[node.attr, parameter[member[.ANNOTATION]]], >, literal[1]]] begin[{]
if[binary_operation[call[REPEAT_WIDGET.equalsIgnoreCase, parameter[call[node.attr, parameter[member[.ANNOTATION_KEY]]]]], ||, call[CHOOSE_WIDGET.equalsIgnoreCase, parameter[call[node.attr, parameter[member[.ANNOTATION_KEY]]]]]]] begin[{]
local_variable[type[String], keyAndContent]
call[pc.lexicalScopes.push, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=pc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyAndContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseRepeatScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MvelEvaluatorCompiler, sub_type=None))]]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[PageBook], embed]
if[binary_operation[literal[null], !=, member[.embed]]] begin[{]
local_variable[type[Class], embedClass]
local_variable[type[MvelEvaluatorCompiler], compiler]
call[.checkEmbedAgainst, parameter[member[.pc], member[.compiler], call[Parsing.toBindMap, parameter[call[node.attr, parameter[member[.ANNOTATION_CONTENT]]]]], member[.embedClass], member[.node]]]
call[pc.lexicalScopes.push, parameter[member[.compiler]]]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[lexicalClimb] operator[SEP] identifier[PageCompilingContext] identifier[pc] , identifier[Node] identifier[node] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[REPEAT_WIDGET] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_KEY] operator[SEP] operator[SEP] operator[||] identifier[CHOOSE_WIDGET] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_KEY] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[keyAndContent] operator[=] {
identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_KEY] operator[SEP] , identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_CONTENT] operator[SEP]
} operator[SEP] identifier[pc] operator[SEP] identifier[lexicalScopes] operator[SEP] identifier[push] operator[SEP] Keyword[new] identifier[MvelEvaluatorCompiler] operator[SEP] identifier[parseRepeatScope] operator[SEP] identifier[pc] , identifier[keyAndContent] , identifier[node] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[final] identifier[PageBook] operator[SEP] identifier[Page] identifier[embed] operator[=] identifier[pageBook] operator[SEP] identifier[forName] operator[SEP] identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_KEY] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[embed] operator[SEP] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[embedClass] operator[=] identifier[embed] operator[SEP] identifier[pageClass] operator[SEP] operator[SEP] operator[SEP] identifier[MvelEvaluatorCompiler] identifier[compiler] operator[=] Keyword[new] identifier[MvelEvaluatorCompiler] operator[SEP] identifier[embedClass] operator[SEP] operator[SEP] identifier[checkEmbedAgainst] operator[SEP] identifier[pc] , identifier[compiler] , identifier[Parsing] operator[SEP] identifier[toBindMap] operator[SEP] identifier[node] operator[SEP] identifier[attr] operator[SEP] identifier[ANNOTATION_CONTENT] operator[SEP] operator[SEP] , identifier[embedClass] , identifier[node] operator[SEP] operator[SEP] identifier[pc] operator[SEP] identifier[lexicalScopes] operator[SEP] identifier[push] operator[SEP] identifier[compiler] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void obtainShowButtonBarDivider(@StyleRes final int themeResourceId) {
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
new int[]{R.attr.materialDialogShowButtonBarDivider});
showButtonBarDivider(typedArray.getBoolean(0, false));
} | class class_name[name] begin[{]
method[obtainShowButtonBarDivider, return_type[void], modifier[private], parameter[themeResourceId]] begin[{]
local_variable[type[TypedArray], typedArray]
call[.showButtonBarDivider, parameter[call[typedArray.getBoolean, parameter[literal[0], literal[false]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[obtainShowButtonBarDivider] operator[SEP] annotation[@] identifier[StyleRes] Keyword[final] Keyword[int] identifier[themeResourceId] operator[SEP] {
identifier[TypedArray] identifier[typedArray] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getTheme] operator[SEP] operator[SEP] operator[SEP] identifier[obtainStyledAttributes] operator[SEP] identifier[themeResourceId] , Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
identifier[R] operator[SEP] identifier[attr] operator[SEP] identifier[materialDialogShowButtonBarDivider]
} operator[SEP] operator[SEP] identifier[showButtonBarDivider] operator[SEP] identifier[typedArray] operator[SEP] identifier[getBoolean] operator[SEP] Other[0] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean _isValidInYear (@Nonnull final Holiday aHoliday, final int nYear)
{
return (aHoliday.getValidFrom () == null || aHoliday.getValidFrom ().intValue () <= nYear) &&
(aHoliday.getValidTo () == null || aHoliday.getValidTo ().intValue () >= nYear);
} | class class_name[name] begin[{]
method[_isValidInYear, return_type[type[boolean]], modifier[private static], parameter[aHoliday, nYear]] begin[{]
return[binary_operation[binary_operation[binary_operation[call[aHoliday.getValidFrom, parameter[]], ==, literal[null]], ||, binary_operation[call[aHoliday.getValidFrom, parameter[]], <=, member[.nYear]]], &&, binary_operation[binary_operation[call[aHoliday.getValidTo, parameter[]], ==, literal[null]], ||, binary_operation[call[aHoliday.getValidTo, parameter[]], >=, member[.nYear]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[_isValidInYear] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Holiday] identifier[aHoliday] , Keyword[final] Keyword[int] identifier[nYear] operator[SEP] {
Keyword[return] operator[SEP] identifier[aHoliday] operator[SEP] identifier[getValidFrom] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[aHoliday] operator[SEP] identifier[getValidFrom] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[<=] identifier[nYear] operator[SEP] operator[&&] operator[SEP] identifier[aHoliday] operator[SEP] identifier[getValidTo] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[aHoliday] operator[SEP] identifier[getValidTo] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[>=] identifier[nYear] operator[SEP] operator[SEP]
}
|
static String getCharsetFromContentType(String contentType) {
if (contentType == null) return null;
Matcher m = charsetPattern.matcher(contentType);
if (m.find()) {
String charset = m.group(1).trim();
charset = charset.replace("charset=", "");
return validateCharset(charset);
}
return null;
} | class class_name[name] begin[{]
method[getCharsetFromContentType, return_type[type[String]], modifier[static], parameter[contentType]] begin[{]
if[binary_operation[member[.contentType], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Matcher], m]
if[call[m.find, parameter[]]] begin[{]
local_variable[type[String], charset]
assign[member[.charset], call[charset.replace, parameter[literal["charset="], literal[""]]]]
return[call[.validateCharset, parameter[member[.charset]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[static] identifier[String] identifier[getCharsetFromContentType] operator[SEP] identifier[String] identifier[contentType] operator[SEP] {
Keyword[if] operator[SEP] identifier[contentType] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Matcher] identifier[m] operator[=] identifier[charsetPattern] operator[SEP] identifier[matcher] operator[SEP] identifier[contentType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[charset] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[charset] operator[=] identifier[charset] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[validateCharset] operator[SEP] identifier[charset] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public QueryKeys<T> keys() {
QueryImpl<T> q = createQuery();
q.checkKeysOnlyOk();
return new QueryKeysImpl<>(q);
} | class class_name[name] begin[{]
method[keys, return_type[type[QueryKeys]], modifier[public], parameter[]] begin[{]
local_variable[type[QueryImpl], q]
call[q.checkKeysOnlyOk, parameter[]]
return[ClassCreator(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=QueryKeysImpl, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[QueryKeys] operator[<] identifier[T] operator[>] identifier[keys] operator[SEP] operator[SEP] {
identifier[QueryImpl] operator[<] identifier[T] operator[>] identifier[q] operator[=] identifier[createQuery] operator[SEP] operator[SEP] operator[SEP] identifier[q] operator[SEP] identifier[checkKeysOnlyOk] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[QueryKeysImpl] operator[<] operator[>] operator[SEP] identifier[q] operator[SEP] operator[SEP]
}
|
private String getFilteredText(String filename, String encoding, boolean xmlFiltering) throws IOException {
if (options.isVerbose()) {
lt.setOutput(System.err);
}
// don't use StringTools.readStream() as that might add newlines which aren't there:
try (InputStreamReader reader = getInputStreamReader(filename, encoding)) {
String fileContents = readerToString(reader);
if (xmlFiltering) {
return filterXML(fileContents);
} else {
return fileContents;
}
}
} | class class_name[name] begin[{]
method[getFilteredText, return_type[type[String]], modifier[private], parameter[filename, encoding, xmlFiltering]] begin[{]
if[call[options.isVerbose, parameter[]]] begin[{]
call[lt.setOutput, parameter[member[System.err]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readerToString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=fileContents)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MemberReference(member=xmlFiltering, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=fileContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=fileContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=filterXML, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=InputStreamReader, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInputStreamReader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[private] identifier[String] identifier[getFilteredText] operator[SEP] identifier[String] identifier[filename] , identifier[String] identifier[encoding] , Keyword[boolean] identifier[xmlFiltering] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[isVerbose] operator[SEP] operator[SEP] operator[SEP] {
identifier[lt] operator[SEP] identifier[setOutput] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] operator[SEP]
}
Keyword[try] operator[SEP] identifier[InputStreamReader] identifier[reader] operator[=] identifier[getInputStreamReader] operator[SEP] identifier[filename] , identifier[encoding] operator[SEP] operator[SEP] {
identifier[String] identifier[fileContents] operator[=] identifier[readerToString] operator[SEP] identifier[reader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[xmlFiltering] operator[SEP] {
Keyword[return] identifier[filterXML] operator[SEP] identifier[fileContents] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[fileContents] operator[SEP]
}
}
}
|
public static <T> PVectorByteBufferedFloating2s64<T> createWithBase(
final ByteBuffer b,
final MutableLongType base,
final int offset)
{
return new PVectorByteBufferedFloating2s64<>(b, base, offset);
} | class class_name[name] begin[{]
method[createWithBase, return_type[type[PVectorByteBufferedFloating2s64]], modifier[public static], parameter[b, base, offset]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=PVectorByteBufferedFloating2s64, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[PVectorByteBufferedFloating2s64] operator[<] identifier[T] operator[>] identifier[createWithBase] operator[SEP] Keyword[final] identifier[ByteBuffer] identifier[b] , Keyword[final] identifier[MutableLongType] identifier[base] , Keyword[final] Keyword[int] identifier[offset] operator[SEP] {
Keyword[return] Keyword[new] identifier[PVectorByteBufferedFloating2s64] operator[<] operator[>] operator[SEP] identifier[b] , identifier[base] , identifier[offset] operator[SEP] operator[SEP]
}
|
public static String objectName(Object object) {
if (object == null) {
return "<null>";
}
StringBuilder builder = new StringBuilder();
builder.append(Components.className(object.getClass()))
.append('#')
.append(objectId(object));
return builder.toString();
} | class class_name[name] begin[{]
method[objectName, return_type[type[String]], modifier[public static], parameter[object]] begin[{]
if[binary_operation[member[.object], ==, literal[null]]] begin[{]
return[literal["<null>"]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], builder]
call[builder.append, parameter[call[Components.className, parameter[call[object.getClass, parameter[]]]]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[objectName] operator[SEP] identifier[Object] identifier[object] operator[SEP] {
Keyword[if] operator[SEP] identifier[object] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[Components] operator[SEP] identifier[className] operator[SEP] identifier[object] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[objectId] operator[SEP] identifier[object] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void getServers(
GetServersRequest request, StreamObserver<GetServersResponse> responseObserver) {
ServerList servers = channelz.getServers(request.getStartServerId(), maxPageSize);
GetServersResponse resp;
try {
resp = ChannelzProtoUtil.toGetServersResponse(servers);
} catch (StatusRuntimeException e) {
responseObserver.onError(e);
return;
}
responseObserver.onNext(resp);
responseObserver.onCompleted();
} | class class_name[name] begin[{]
method[getServers, return_type[void], modifier[public], parameter[request, responseObserver]] begin[{]
local_variable[type[ServerList], servers]
local_variable[type[GetServersResponse], resp]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=resp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=servers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toGetServersResponse, postfix_operators=[], prefix_operators=[], qualifier=ChannelzProtoUtil, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onError, postfix_operators=[], prefix_operators=[], qualifier=responseObserver, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['StatusRuntimeException']))], finally_block=None, label=None, resources=None)
call[responseObserver.onNext, parameter[member[.resp]]]
call[responseObserver.onCompleted, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[getServers] operator[SEP] identifier[GetServersRequest] identifier[request] , identifier[StreamObserver] operator[<] identifier[GetServersResponse] operator[>] identifier[responseObserver] operator[SEP] {
identifier[ServerList] identifier[servers] operator[=] identifier[channelz] operator[SEP] identifier[getServers] operator[SEP] identifier[request] operator[SEP] identifier[getStartServerId] operator[SEP] operator[SEP] , identifier[maxPageSize] operator[SEP] operator[SEP] identifier[GetServersResponse] identifier[resp] operator[SEP] Keyword[try] {
identifier[resp] operator[=] identifier[ChannelzProtoUtil] operator[SEP] identifier[toGetServersResponse] operator[SEP] identifier[servers] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[StatusRuntimeException] identifier[e] operator[SEP] {
identifier[responseObserver] operator[SEP] identifier[onError] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[responseObserver] operator[SEP] identifier[onNext] operator[SEP] identifier[resp] operator[SEP] operator[SEP] identifier[responseObserver] operator[SEP] identifier[onCompleted] operator[SEP] operator[SEP] operator[SEP]
}
|
public InputStream getInputStream() throws IOException {
if (is != null)
return is;
sendRequest();
String transferEncoding = responseHeader.getFieldValue("Transfer-Encoding"); //$NON-NLS-1$
String contentLength = responseHeader.getFieldValue("Content-Length"); //$NON-NLS-1$
if ("chunked".equalsIgnoreCase(transferEncoding)) { //$NON-NLS-1$
is = new ChunkedInputStream();
} else if (method.equals("HEAD") && statusCode == HTTP_OK) { //$NON-NLS-1$
is = new LimitedInputStream(0);
} else if (contentLength != null) {
try {
is = new LimitedInputStream(Integer.parseInt(contentLength));
} catch (NumberFormatException e) {
throw new IOException(e.getMessage());
}
} else if ((statusCode >= 100 && statusCode < 200) || statusCode == HTTP_NO_CONTENT || statusCode == HTTP_NOT_MODIFIED) {
is = new LimitedInputStream(0);
} else {
closeConnection = true;
is = socketIn;
}
return is;
} | class class_name[name] begin[{]
method[getInputStream, return_type[type[InputStream]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.is], !=, literal[null]]] begin[{]
return[member[.is]]
else begin[{]
None
end[}]
call[.sendRequest, parameter[]]
local_variable[type[String], transferEncoding]
local_variable[type[String], contentLength]
if[literal["chunked"]] begin[{]
assign[member[.is], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChunkedInputStream, sub_type=None))]
else begin[{]
if[binary_operation[call[method.equals, parameter[literal["HEAD"]]], &&, binary_operation[member[.statusCode], ==, member[.HTTP_OK]]]] begin[{]
assign[member[.is], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LimitedInputStream, sub_type=None))]
else begin[{]
if[binary_operation[member[.contentLength], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=contentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LimitedInputStream, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], 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=['NumberFormatException']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.statusCode], >=, literal[100]], &&, binary_operation[member[.statusCode], <, literal[200]]], ||, binary_operation[member[.statusCode], ==, member[.HTTP_NO_CONTENT]]], ||, binary_operation[member[.statusCode], ==, member[.HTTP_NOT_MODIFIED]]]] begin[{]
assign[member[.is], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LimitedInputStream, sub_type=None))]
else begin[{]
assign[member[.closeConnection], literal[true]]
assign[member[.is], member[.socketIn]]
end[}]
end[}]
end[}]
end[}]
return[member[.is]]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[getInputStream] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[is] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[is] operator[SEP] identifier[sendRequest] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[transferEncoding] operator[=] identifier[responseHeader] operator[SEP] identifier[getFieldValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[contentLength] operator[=] identifier[responseHeader] operator[SEP] identifier[getFieldValue] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[transferEncoding] operator[SEP] operator[SEP] {
identifier[is] operator[=] Keyword[new] identifier[ChunkedInputStream] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[statusCode] operator[==] identifier[HTTP_OK] operator[SEP] {
identifier[is] operator[=] Keyword[new] identifier[LimitedInputStream] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[contentLength] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[is] operator[=] Keyword[new] identifier[LimitedInputStream] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[contentLength] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[statusCode] operator[>=] Other[100] operator[&&] identifier[statusCode] operator[<] Other[200] operator[SEP] operator[||] identifier[statusCode] operator[==] identifier[HTTP_NO_CONTENT] operator[||] identifier[statusCode] operator[==] identifier[HTTP_NOT_MODIFIED] operator[SEP] {
identifier[is] operator[=] Keyword[new] identifier[LimitedInputStream] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[closeConnection] operator[=] literal[boolean] operator[SEP] identifier[is] operator[=] identifier[socketIn] operator[SEP]
}
Keyword[return] identifier[is] operator[SEP]
}
|
public EnvelopeTemplateResults listTemplates(String accountId, TemplatesApi.ListTemplatesOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling listTemplates");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/templates".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder", options.folder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder_ids", options.folderIds));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", options.include));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_from_date", options.modifiedFromDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_to_date", options.modifiedToDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", options.order));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order_by", options.orderBy));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "search_text", options.searchText));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "shared_by_me", options.sharedByMe));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_from_date", options.usedFromDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_to_date", options.usedToDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_filter", options.userFilter));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_id", options.userId));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<EnvelopeTemplateResults> localVarReturnType = new GenericType<EnvelopeTemplateResults>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | class class_name[name] begin[{]
method[listTemplates, return_type[type[EnvelopeTemplateResults]], modifier[public], parameter[accountId, options]] begin[{]
local_variable[type[Object], localVarPostBody]
if[binary_operation[member[.accountId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=400), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing the required parameter 'accountId' when calling listTemplates")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApiException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], localVarPath]
local_variable[type[java], localVarQueryParams]
local_variable[type[java], localVarHeaderParams]
local_variable[type[java], localVarFormParams]
if[binary_operation[member[.options], !=, literal[null]]] begin[{]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["count"], member[options.count]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["folder"], member[options.folder]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["folder_ids"], member[options.folderIds]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["from_date"], member[options.fromDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["include"], member[options.include]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["modified_from_date"], member[options.modifiedFromDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["modified_to_date"], member[options.modifiedToDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["order"], member[options.order]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["order_by"], member[options.orderBy]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["search_text"], member[options.searchText]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["shared_by_me"], member[options.sharedByMe]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["start_position"], member[options.startPosition]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["to_date"], member[options.toDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["used_from_date"], member[options.usedFromDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["used_to_date"], member[options.usedToDate]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["user_filter"], member[options.userFilter]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["user_id"], member[options.userId]]]]]
else begin[{]
None
end[}]
local_variable[type[String], localVarAccepts]
local_variable[type[String], localVarAccept]
local_variable[type[String], localVarContentTypes]
local_variable[type[String], localVarContentType]
local_variable[type[String], localVarAuthNames]
local_variable[type[GenericType], localVarReturnType]
return[call[apiClient.invokeAPI, parameter[member[.localVarPath], literal["GET"], member[.localVarQueryParams], member[.localVarPostBody], member[.localVarHeaderParams], member[.localVarFormParams], member[.localVarAccept], member[.localVarContentType], member[.localVarAuthNames], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[EnvelopeTemplateResults] identifier[listTemplates] operator[SEP] identifier[String] identifier[accountId] , identifier[TemplatesApi] operator[SEP] identifier[ListTemplatesOptions] identifier[options] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[Object] identifier[localVarPostBody] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[accountId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] Other[400] , literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[localVarPath] operator[=] literal[String] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[apiClient] operator[SEP] identifier[escapeString] operator[SEP] identifier[accountId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[Pair] operator[>] identifier[localVarQueryParams] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Pair] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[localVarHeaderParams] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[localVarFormParams] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[!=] Other[null] operator[SEP] {
identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[folder] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[folderIds] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[fromDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[include] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[modifiedFromDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[modifiedToDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[order] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[orderBy] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[searchText] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[sharedByMe] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[startPosition] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[toDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[usedFromDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[usedToDate] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[userFilter] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[options] operator[SEP] identifier[userId] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[localVarAccepts] operator[=] {
literal[String]
} operator[SEP] Keyword[final] identifier[String] identifier[localVarAccept] operator[=] identifier[apiClient] operator[SEP] identifier[selectHeaderAccept] operator[SEP] identifier[localVarAccepts] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[localVarContentTypes] operator[=] {
} operator[SEP] Keyword[final] identifier[String] identifier[localVarContentType] operator[=] identifier[apiClient] operator[SEP] identifier[selectHeaderContentType] operator[SEP] identifier[localVarContentTypes] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[localVarAuthNames] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String]
} operator[SEP] identifier[GenericType] operator[<] identifier[EnvelopeTemplateResults] operator[>] identifier[localVarReturnType] operator[=] Keyword[new] identifier[GenericType] operator[<] identifier[EnvelopeTemplateResults] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[invokeAPI] operator[SEP] identifier[localVarPath] , literal[String] , identifier[localVarQueryParams] , identifier[localVarPostBody] , identifier[localVarHeaderParams] , identifier[localVarFormParams] , identifier[localVarAccept] , identifier[localVarContentType] , identifier[localVarAuthNames] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
private List makeDOAs(List l)
{
for (int i = 0; i < l.size(); ++i) {
final byte[] pdu = (byte[]) l.get(i);
if (pdu.length == 4)
l.set(i, new byte[] { pdu[2], pdu[3] });
else if (pdu.length == 8)
l.set(i, new byte[] { pdu[2], pdu[3], pdu[4], pdu[5], pdu[6], pdu[7] });
}
return l;
} | class class_name[name] begin[{]
method[makeDOAs, return_type[type[List]], modifier[private], parameter[l]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), type=BasicType(dimensions=[None], name=byte)), name=pdu)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pdu, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pdu, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7))])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))], member=set, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), label=None)), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), MemberReference(member=pdu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))], member=set, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.l]]
end[}]
END[}] | Keyword[private] identifier[List] identifier[makeDOAs] operator[SEP] identifier[List] identifier[l] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[l] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[pdu] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[l] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pdu] operator[SEP] identifier[length] operator[==] Other[4] operator[SEP] identifier[l] operator[SEP] identifier[set] operator[SEP] identifier[i] , Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
identifier[pdu] operator[SEP] Other[2] operator[SEP] , identifier[pdu] operator[SEP] Other[3] operator[SEP]
} operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[pdu] operator[SEP] identifier[length] operator[==] Other[8] operator[SEP] identifier[l] operator[SEP] identifier[set] operator[SEP] identifier[i] , Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
identifier[pdu] operator[SEP] Other[2] operator[SEP] , identifier[pdu] operator[SEP] Other[3] operator[SEP] , identifier[pdu] operator[SEP] Other[4] operator[SEP] , identifier[pdu] operator[SEP] Other[5] operator[SEP] , identifier[pdu] operator[SEP] Other[6] operator[SEP] , identifier[pdu] operator[SEP] Other[7] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[l] operator[SEP]
}
|
boolean setSnippet(@NonNull View view, @NonNull String attribute) {
final Pair<Integer, String> pair = new Pair<>(view.getId(), attribute);
return snippettedAttributes.add(pair);
//TODO: Expose nbWords parameter (defaults to 10)
} | class class_name[name] begin[{]
method[setSnippet, return_type[type[boolean]], modifier[default], parameter[view, attribute]] begin[{]
local_variable[type[Pair], pair]
return[call[snippettedAttributes.add, parameter[member[.pair]]]]
end[}]
END[}] | Keyword[boolean] identifier[setSnippet] operator[SEP] annotation[@] identifier[NonNull] identifier[View] identifier[view] , annotation[@] identifier[NonNull] identifier[String] identifier[attribute] operator[SEP] {
Keyword[final] identifier[Pair] operator[<] identifier[Integer] , identifier[String] operator[>] identifier[pair] operator[=] Keyword[new] identifier[Pair] operator[<] operator[>] operator[SEP] identifier[view] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[attribute] operator[SEP] operator[SEP] Keyword[return] identifier[snippettedAttributes] operator[SEP] identifier[add] operator[SEP] identifier[pair] operator[SEP] operator[SEP]
}
|
protected void addPackagesList(PackageDoc[] packages, String text,
String tableSummary, Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
getTableCaption(new RawHtml(text)));
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
addPackagesList(packages, tbody);
table.addContent(tbody);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
body.addContent(div);
} | class class_name[name] begin[{]
method[addPackagesList, return_type[void], modifier[protected], parameter[packages, text, tableSummary, body]] begin[{]
local_variable[type[Content], table]
call[table.addContent, parameter[call[.getSummaryTableHeader, parameter[member[.packageTableHeader], literal["col"]]]]]
local_variable[type[Content], tbody]
call[.addPackagesList, parameter[member[.packages], member[.tbody]]]
call[table.addContent, parameter[member[.tbody]]]
local_variable[type[Content], div]
call[body.addContent, parameter[member[.div]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[addPackagesList] operator[SEP] identifier[PackageDoc] operator[SEP] operator[SEP] identifier[packages] , identifier[String] identifier[text] , identifier[String] identifier[tableSummary] , identifier[Content] identifier[body] operator[SEP] {
identifier[Content] identifier[table] operator[=] identifier[HtmlTree] operator[SEP] identifier[TABLE] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[overviewSummary] , Other[0] , Other[3] , Other[0] , identifier[tableSummary] , identifier[getTableCaption] operator[SEP] Keyword[new] identifier[RawHtml] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[addContent] operator[SEP] identifier[getSummaryTableHeader] operator[SEP] identifier[packageTableHeader] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Content] identifier[tbody] operator[=] Keyword[new] identifier[HtmlTree] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[TBODY] operator[SEP] operator[SEP] identifier[addPackagesList] operator[SEP] identifier[packages] , identifier[tbody] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[addContent] operator[SEP] identifier[tbody] operator[SEP] operator[SEP] identifier[Content] identifier[div] operator[=] identifier[HtmlTree] operator[SEP] identifier[DIV] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[contentContainer] , identifier[table] operator[SEP] operator[SEP] identifier[body] operator[SEP] identifier[addContent] operator[SEP] identifier[div] operator[SEP] operator[SEP]
}
|
public static void removeEntries(File zip, String[] paths, OutputStream destOut) {
if (log.isDebugEnabled()) {
log.debug("Copying '" + zip + "' to an output stream and removing paths " + Arrays.asList(paths) + ".");
}
ZipOutputStream out = null;
try {
out = new ZipOutputStream(destOut);
copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths)));
}
finally {
IOUtils.closeQuietly(out);
}
} | class class_name[name] begin[{]
method[removeEntries, return_type[void], modifier[public static], parameter[zip, paths, destOut]] begin[{]
if[call[log.isDebugEnabled, parameter[]]] begin[{]
call[log.debug, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Copying '"], +, member[.zip]], +, literal["' to an output stream and removing paths "]], +, call[Arrays.asList, parameter[member[.paths]]]], +, literal["."]]]]
else begin[{]
None
end[}]
local_variable[type[ZipOutputStream], out]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=destOut, 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=ZipOutputStream, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=zip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, 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=HashSet, sub_type=None))], member=copyEntries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeQuietly, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[removeEntries] operator[SEP] identifier[File] identifier[zip] , identifier[String] operator[SEP] operator[SEP] identifier[paths] , identifier[OutputStream] identifier[destOut] 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[zip] operator[+] literal[String] operator[+] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[paths] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[ZipOutputStream] identifier[out] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[out] operator[=] Keyword[new] identifier[ZipOutputStream] operator[SEP] identifier[destOut] operator[SEP] operator[SEP] identifier[copyEntries] operator[SEP] identifier[zip] , identifier[out] , Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[paths] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[IOUtils] operator[SEP] identifier[closeQuietly] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
}
|
public long getMoonRiseSet(boolean rise)
{
return riseOrSet(new CoordFunc() {
@Override
public Equatorial eval() { return getMoonPosition(); }
},
rise,
.533 * DEG_RAD, // Angular Diameter
34 /60.0 * DEG_RAD, // Refraction correction
MINUTE_MS); // Desired accuracy
} | class class_name[name] begin[{]
method[getMoonRiseSet, return_type[type[long]], modifier[public], parameter[rise]] begin[{]
return[call[.riseOrSet, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getMoonPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=eval, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Equatorial, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CoordFunc, sub_type=None)), member[.rise], binary_operation[literal[.533], *, member[.DEG_RAD]], binary_operation[binary_operation[literal[34], /, literal[60.0]], *, member[.DEG_RAD]], member[.MINUTE_MS]]]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getMoonRiseSet] operator[SEP] Keyword[boolean] identifier[rise] operator[SEP] {
Keyword[return] identifier[riseOrSet] operator[SEP] Keyword[new] identifier[CoordFunc] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Equatorial] identifier[eval] operator[SEP] operator[SEP] {
Keyword[return] identifier[getMoonPosition] operator[SEP] operator[SEP] operator[SEP]
}
} , identifier[rise] , literal[Float] operator[*] identifier[DEG_RAD] , Other[34] operator[/] literal[Float] operator[*] identifier[DEG_RAD] , identifier[MINUTE_MS] operator[SEP] operator[SEP]
}
|
protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) {
if (result == null) {
Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint });
return false;
}
String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null;
String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null;
if (responseStatus == null) {
Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint });
return false;
}
if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) {
Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg });
return false;
}
return true;
} | class class_name[name] begin[{]
method[isSuccessfulResult, return_type[type[boolean]], modifier[protected], parameter[result, endpoint]] begin[{]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], responseStatus]
local_variable[type[String], responseMsg]
if[binary_operation[member[.responseStatus], ==, literal[null]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["TWITTER_RESPONSE_STATUS_MISSING"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
return[literal[false]]
else begin[{]
None
end[}]
if[call[responseStatus.equals, parameter[member[TwitterConstants.RESULT_SUCCESS]]]] begin[{]
call[Tr.error, parameter[member[.tc], literal["TWITTER_RESPONSE_FAILURE"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=endpoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=responseMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=responseMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isSuccessfulResult] operator[SEP] annotation[@] identifier[Sensitive] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[result] , identifier[String] identifier[endpoint] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[endpoint]
} operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[responseStatus] operator[=] identifier[result] operator[SEP] identifier[containsKey] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[RESULT_RESPONSE_STATUS] operator[SEP] operator[?] operator[SEP] identifier[String] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[RESULT_RESPONSE_STATUS] operator[SEP] operator[:] Other[null] operator[SEP] identifier[String] identifier[responseMsg] operator[=] identifier[result] operator[SEP] identifier[containsKey] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[RESULT_MESSAGE] operator[SEP] operator[?] operator[SEP] identifier[String] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[RESULT_MESSAGE] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[responseStatus] operator[==] Other[null] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[endpoint]
} operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[responseStatus] operator[SEP] identifier[equals] operator[SEP] identifier[TwitterConstants] operator[SEP] identifier[RESULT_SUCCESS] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[endpoint] , operator[SEP] identifier[responseMsg] operator[==] Other[null] operator[SEP] operator[?] literal[String] operator[:] identifier[responseMsg]
} operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void setNumberHits(BitSet bits, String value, int min, int max) {
String[] fields = StringUtils.delimitedListToStringArray(value, ",");
for (String field : fields) {
if (!field.contains("/")) {
// Not an incrementer so it must be a range (possibly empty)
int[] range = getRange(field, min, max);
bits.set(range[0], range[1] + 1);
} else {
String[] split = StringUtils.delimitedListToStringArray(field, "/");
if (split.length > 2) {
throw new IllegalArgumentException("Incrementer has more than two fields: '" + field
+ "' in expression \"" + this.expression + "\"");
}
int[] range = getRange(split[0], min, max);
if (!split[0].contains("-")) {
range[1] = max - 1;
}
int delta = Integer.valueOf(split[1]);
for (int i = range[0]; i <= range[1]; i += delta) {
bits.set(i);
}
}
}
} | class class_name[name] begin[{]
method[setNumberHits, return_type[void], modifier[private], parameter[bits, value, min, max]] begin[{]
local_variable[type[String], fields]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=field, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=delimitedListToStringArray, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), name=split)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=split, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Incrementer has more than two fields: '"), operandr=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' in expression \""), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=expression, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=range)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), IfStatement(condition=MemberReference(member=split, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-")], 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=Assignment(expressionl=MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), type==, value=BinaryOperation(operandl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=delta)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=bits, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=range)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), BinaryOperation(operandl=MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=set, postfix_operators=[], prefix_operators=[], qualifier=bits, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setNumberHits] operator[SEP] identifier[BitSet] identifier[bits] , identifier[String] identifier[value] , Keyword[int] identifier[min] , Keyword[int] identifier[max] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[fields] operator[=] identifier[StringUtils] operator[SEP] identifier[delimitedListToStringArray] operator[SEP] identifier[value] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[field] operator[:] identifier[fields] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[field] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[range] operator[=] identifier[getRange] operator[SEP] identifier[field] , identifier[min] , identifier[max] operator[SEP] operator[SEP] identifier[bits] operator[SEP] identifier[set] operator[SEP] identifier[range] operator[SEP] Other[0] operator[SEP] , identifier[range] operator[SEP] Other[1] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] operator[SEP] operator[SEP] identifier[split] operator[=] identifier[StringUtils] operator[SEP] identifier[delimitedListToStringArray] operator[SEP] identifier[field] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[split] operator[SEP] identifier[length] operator[>] Other[2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[field] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[expression] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[range] operator[=] identifier[getRange] operator[SEP] identifier[split] operator[SEP] Other[0] operator[SEP] , identifier[min] , identifier[max] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[split] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[range] operator[SEP] Other[1] operator[SEP] operator[=] identifier[max] operator[-] Other[1] operator[SEP]
}
Keyword[int] identifier[delta] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[split] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[range] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[i] operator[<=] identifier[range] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[i] operator[+=] identifier[delta] operator[SEP] {
identifier[bits] operator[SEP] identifier[set] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
}
}
|
public static MozuUrl priceOrderUrl(Boolean refreshShipping, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/price?refreshShipping={refreshShipping}&responseFields={responseFields}");
formatter.formatUrl("refreshShipping", refreshShipping);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | class class_name[name] begin[{]
method[priceOrderUrl, return_type[type[MozuUrl]], modifier[public static], parameter[refreshShipping, responseFields]] begin[{]
local_variable[type[UrlFormatter], formatter]
call[formatter.formatUrl, parameter[literal["refreshShipping"], member[.refreshShipping]]]
call[formatter.formatUrl, parameter[literal["responseFields"], member[.responseFields]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getResourceUrl, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), MemberReference(member=TENANT_POD, postfix_operators=[], prefix_operators=[], qualifier=MozuUrl.UrlLocation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MozuUrl, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MozuUrl] identifier[priceOrderUrl] operator[SEP] identifier[Boolean] identifier[refreshShipping] , identifier[String] identifier[responseFields] operator[SEP] {
identifier[UrlFormatter] identifier[formatter] operator[=] Keyword[new] identifier[UrlFormatter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[refreshShipping] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[responseFields] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MozuUrl] operator[SEP] identifier[formatter] operator[SEP] identifier[getResourceUrl] operator[SEP] operator[SEP] , identifier[MozuUrl] operator[SEP] identifier[UrlLocation] operator[SEP] identifier[TENANT_POD] operator[SEP] operator[SEP]
}
|
public CreateNotebookInstanceRequest withAcceleratorTypes(String... acceleratorTypes) {
if (this.acceleratorTypes == null) {
setAcceleratorTypes(new java.util.ArrayList<String>(acceleratorTypes.length));
}
for (String ele : acceleratorTypes) {
this.acceleratorTypes.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withAcceleratorTypes, return_type[type[CreateNotebookInstanceRequest]], modifier[public], parameter[acceleratorTypes]] begin[{]
if[binary_operation[THIS[member[None.acceleratorTypes]], ==, literal[null]]] begin[{]
call[.setAcceleratorTypes, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=acceleratorTypes, 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))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=acceleratorTypes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=acceleratorTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CreateNotebookInstanceRequest] identifier[withAcceleratorTypes] operator[SEP] identifier[String] operator[...] identifier[acceleratorTypes] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[acceleratorTypes] operator[==] Other[null] operator[SEP] {
identifier[setAcceleratorTypes] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[acceleratorTypes] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[acceleratorTypes] operator[SEP] {
Keyword[this] operator[SEP] identifier[acceleratorTypes] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public boolean doDeleteObject(Object object, final Wave wave) {
LOGGER.trace("Delete Object.");
final Response deleteResponse = baseWebTarget().path("1"/* object.id() */)
.request(MediaType.APPLICATION_XML)
.delete();
return deleteResponse.getStatusInfo() == Status.OK;
} | class class_name[name] begin[{]
method[doDeleteObject, return_type[type[boolean]], modifier[public], parameter[object, wave]] begin[{]
call[LOGGER.trace, parameter[literal["Delete Object."]]]
local_variable[type[Response], deleteResponse]
return[binary_operation[call[deleteResponse.getStatusInfo, parameter[]], ==, member[Status.OK]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[doDeleteObject] operator[SEP] identifier[Object] identifier[object] , Keyword[final] identifier[Wave] identifier[wave] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Response] identifier[deleteResponse] operator[=] identifier[baseWebTarget] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[MediaType] operator[SEP] identifier[APPLICATION_XML] operator[SEP] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[deleteResponse] operator[SEP] identifier[getStatusInfo] operator[SEP] operator[SEP] operator[==] identifier[Status] operator[SEP] identifier[OK] operator[SEP]
}
|
public void setShowTick(final boolean showTick) {
if (showTick)
attrMixin.setAttribute(SHOW_TICK, Boolean.toString(true));
else
attrMixin.removeAttribute(SHOW_TICK);
} | class class_name[name] begin[{]
method[setShowTick, return_type[void], modifier[public], parameter[showTick]] begin[{]
if[member[.showTick]] begin[{]
call[attrMixin.setAttribute, parameter[member[.SHOW_TICK], call[Boolean.toString, parameter[literal[true]]]]]
else begin[{]
call[attrMixin.removeAttribute, parameter[member[.SHOW_TICK]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setShowTick] operator[SEP] Keyword[final] Keyword[boolean] identifier[showTick] operator[SEP] {
Keyword[if] operator[SEP] identifier[showTick] operator[SEP] identifier[attrMixin] operator[SEP] identifier[setAttribute] operator[SEP] identifier[SHOW_TICK] , identifier[Boolean] operator[SEP] identifier[toString] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[attrMixin] operator[SEP] identifier[removeAttribute] operator[SEP] identifier[SHOW_TICK] operator[SEP] operator[SEP]
}
|
public ServerBuilder gracefulShutdownTimeout(long quietPeriodMillis, long timeoutMillis) {
return gracefulShutdownTimeout(
Duration.ofMillis(quietPeriodMillis), Duration.ofMillis(timeoutMillis));
} | class class_name[name] begin[{]
method[gracefulShutdownTimeout, return_type[type[ServerBuilder]], modifier[public], parameter[quietPeriodMillis, timeoutMillis]] begin[{]
return[call[.gracefulShutdownTimeout, parameter[call[Duration.ofMillis, parameter[member[.quietPeriodMillis]]], call[Duration.ofMillis, parameter[member[.timeoutMillis]]]]]]
end[}]
END[}] | Keyword[public] identifier[ServerBuilder] identifier[gracefulShutdownTimeout] operator[SEP] Keyword[long] identifier[quietPeriodMillis] , Keyword[long] identifier[timeoutMillis] operator[SEP] {
Keyword[return] identifier[gracefulShutdownTimeout] operator[SEP] identifier[Duration] operator[SEP] identifier[ofMillis] operator[SEP] identifier[quietPeriodMillis] operator[SEP] , identifier[Duration] operator[SEP] identifier[ofMillis] operator[SEP] identifier[timeoutMillis] operator[SEP] operator[SEP] operator[SEP]
}
|
private void addQueryParametersFromManager(IFilterCriteriaManager manager) {
Map<FilterCriteriaType, IFilterCriteria> criterias = manager.getFilterCriterias();
for (FilterCriteriaType type : criterias.keySet()) {
IFilterCriteria criteria = criterias.get(type);
if (criteria == null) continue;
if (criteria.getModel().getObject() != null) {
if (type.equals(FilterCriteriaType.RANGE)) {
List<?> list = (List<?>) criteria.getModel().getObject();
Object first = list.get(0);
Object second = list.get(1);
if (first != null && second != null) {
setParameter(criteria.getName() + 0, Model.of((Serializable) first));
setParameter(criteria.getName() + 1, Model.of((Serializable) second));
} else setParameter(criteria.getName(), Model.of(first != null ? (Serializable) first : (Serializable) second));
} else setParameter(criteria.getName(), criteria.getModel());
}
}
} | class class_name[name] begin[{]
method[addQueryParametersFromManager, return_type[void], modifier[private], parameter[manager]] begin[{]
local_variable[type[Map], criterias]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=criterias, selectors=[], type_arguments=None), name=criteria)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IFilterCriteria, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=criteria, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getModel, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[MethodInvocation(arguments=[], member=getObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=RANGE, postfix_operators=[], prefix_operators=[], qualifier=FilterCriteriaType, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getModel, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[], type_arguments=None)], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getModel, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[MethodInvocation(arguments=[], member=getObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None)), name=list)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), name=first)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=get, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), name=second)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[], type_arguments=None), MethodInvocation(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Cast(expression=MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Serializable, sub_type=None)), if_true=Cast(expression=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Serializable, sub_type=None)))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Model, selectors=[], type_arguments=None)], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=+), MethodInvocation(arguments=[Cast(expression=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Serializable, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Model, selectors=[], type_arguments=None)], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=criteria, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MethodInvocation(arguments=[Cast(expression=MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Serializable, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Model, selectors=[], type_arguments=None)], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=criterias, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FilterCriteriaType, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addQueryParametersFromManager] operator[SEP] identifier[IFilterCriteriaManager] identifier[manager] operator[SEP] {
identifier[Map] operator[<] identifier[FilterCriteriaType] , identifier[IFilterCriteria] operator[>] identifier[criterias] operator[=] identifier[manager] operator[SEP] identifier[getFilterCriterias] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FilterCriteriaType] identifier[type] operator[:] identifier[criterias] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[IFilterCriteria] identifier[criteria] operator[=] identifier[criterias] operator[SEP] identifier[get] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[criteria] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[criteria] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[getObject] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[FilterCriteriaType] operator[SEP] identifier[RANGE] operator[SEP] operator[SEP] {
identifier[List] operator[<] operator[?] operator[>] identifier[list] operator[=] operator[SEP] identifier[List] operator[<] operator[?] operator[>] operator[SEP] identifier[criteria] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[getObject] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[first] operator[=] identifier[list] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Object] identifier[second] operator[=] identifier[list] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[first] operator[!=] Other[null] operator[&&] identifier[second] operator[!=] Other[null] operator[SEP] {
identifier[setParameter] operator[SEP] identifier[criteria] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] Other[0] , identifier[Model] operator[SEP] identifier[of] operator[SEP] operator[SEP] identifier[Serializable] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] identifier[setParameter] operator[SEP] identifier[criteria] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] Other[1] , identifier[Model] operator[SEP] identifier[of] operator[SEP] operator[SEP] identifier[Serializable] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] identifier[setParameter] operator[SEP] identifier[criteria] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[Model] operator[SEP] identifier[of] operator[SEP] identifier[first] operator[!=] Other[null] operator[?] operator[SEP] identifier[Serializable] operator[SEP] identifier[first] operator[:] operator[SEP] identifier[Serializable] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] identifier[setParameter] operator[SEP] identifier[criteria] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[criteria] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@SuppressWarnings("deprecation")
public void setMetaData(SoundCloudTrack track, Bitmap artwork) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// set meta data on the lock screen for pre lollipop.
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
RemoteControlClientCompat.MetadataEditorCompat mediaEditorCompat
= mRemoteControlClientCompat.editMetadata(true)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
mediaEditorCompat.putBitmap(
RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK, artwork);
}
mediaEditorCompat.apply();
}
// set meta data to the media session.
MediaMetadataCompat.Builder metadataCompatBuilder = new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
metadataCompatBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, artwork);
}
mMediaSession.setMetadata(metadataCompatBuilder.build());
setMediaSessionCompatPlaybackState(PlaybackStateCompat.STATE_PLAYING);
} | class class_name[name] begin[{]
method[setMetaData, return_type[void], modifier[public], parameter[track, artwork]] begin[{]
if[binary_operation[member[Build.VERSION.SDK_INT], <, member[Build.VERSION_CODES.LOLLIPOP]]] begin[{]
call[mRemoteControlClientCompat.setPlaybackState, parameter[member[RemoteControlClient.PLAYSTATE_PLAYING]]]
local_variable[type[RemoteControlClientCompat], mediaEditorCompat]
if[binary_operation[member[.artwork], !=, literal[null]]] begin[{]
call[mediaEditorCompat.putBitmap, parameter[member[RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK], member[.artwork]]]
else begin[{]
None
end[}]
call[mediaEditorCompat.apply, parameter[]]
else begin[{]
None
end[}]
local_variable[type[MediaMetadataCompat], metadataCompatBuilder]
if[binary_operation[member[.artwork], !=, literal[null]]] begin[{]
call[metadataCompatBuilder.putBitmap, parameter[member[MediaMetadataCompat.METADATA_KEY_ART], member[.artwork]]]
else begin[{]
None
end[}]
call[mMediaSession.setMetadata, parameter[call[metadataCompatBuilder.build, parameter[]]]]
call[.setMediaSessionCompatPlaybackState, parameter[member[PlaybackStateCompat.STATE_PLAYING]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[setMetaData] operator[SEP] identifier[SoundCloudTrack] identifier[track] , identifier[Bitmap] identifier[artwork] operator[SEP] {
Keyword[if] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION] operator[SEP] identifier[SDK_INT] operator[<] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[LOLLIPOP] operator[SEP] {
identifier[mRemoteControlClientCompat] operator[SEP] identifier[setPlaybackState] operator[SEP] identifier[RemoteControlClient] operator[SEP] identifier[PLAYSTATE_PLAYING] operator[SEP] operator[SEP] identifier[RemoteControlClientCompat] operator[SEP] identifier[MetadataEditorCompat] identifier[mediaEditorCompat] operator[=] identifier[mRemoteControlClientCompat] operator[SEP] identifier[editMetadata] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[putString] operator[SEP] identifier[MediaMetadataRetriever] operator[SEP] identifier[METADATA_KEY_TITLE] , identifier[track] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] identifier[MediaMetadataRetriever] operator[SEP] identifier[METADATA_KEY_ARTIST] , identifier[track] operator[SEP] identifier[getArtist] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[artwork] operator[!=] Other[null] operator[SEP] {
identifier[mediaEditorCompat] operator[SEP] identifier[putBitmap] operator[SEP] identifier[RemoteControlClientCompat] operator[SEP] identifier[MetadataEditorCompat] operator[SEP] identifier[METADATA_KEY_ARTWORK] , identifier[artwork] operator[SEP] operator[SEP]
}
identifier[mediaEditorCompat] operator[SEP] identifier[apply] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MediaMetadataCompat] operator[SEP] identifier[Builder] identifier[metadataCompatBuilder] operator[=] Keyword[new] identifier[MediaMetadataCompat] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] identifier[MediaMetadataCompat] operator[SEP] identifier[METADATA_KEY_TITLE] , identifier[track] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] identifier[MediaMetadataCompat] operator[SEP] identifier[METADATA_KEY_ARTIST] , identifier[track] operator[SEP] identifier[getArtist] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[artwork] operator[!=] Other[null] operator[SEP] {
identifier[metadataCompatBuilder] operator[SEP] identifier[putBitmap] operator[SEP] identifier[MediaMetadataCompat] operator[SEP] identifier[METADATA_KEY_ART] , identifier[artwork] operator[SEP] operator[SEP]
}
identifier[mMediaSession] operator[SEP] identifier[setMetadata] operator[SEP] identifier[metadataCompatBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setMediaSessionCompatPlaybackState] operator[SEP] identifier[PlaybackStateCompat] operator[SEP] identifier[STATE_PLAYING] operator[SEP] operator[SEP]
}
|
public static void setTransparency(Element elem, int alpha) {
float ieVersion = getIEVersion();
// only IE 8 requires special treatment, older IE versions are no longer supported
if (ieVersion < 9.0) {
elem.getStyle().setProperty(
"-ms-filter",
"\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + alpha + ")\"");
} else {
// Everyone else
elem.getStyle().setOpacity((1.0 * alpha) / 100);
}
} | class class_name[name] begin[{]
method[setTransparency, return_type[void], modifier[public static], parameter[elem, alpha]] begin[{]
local_variable[type[float], ieVersion]
if[binary_operation[member[.ieVersion], <, literal[9.0]]] begin[{]
call[elem.getStyle, parameter[]]
else begin[{]
call[elem.getStyle, parameter[]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setTransparency] operator[SEP] identifier[Element] identifier[elem] , Keyword[int] identifier[alpha] operator[SEP] {
Keyword[float] identifier[ieVersion] operator[=] identifier[getIEVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ieVersion] operator[<] literal[Float] operator[SEP] {
identifier[elem] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setProperty] operator[SEP] literal[String] , literal[String] operator[+] identifier[alpha] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[elem] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setOpacity] operator[SEP] operator[SEP] literal[Float] operator[*] identifier[alpha] operator[SEP] operator[/] Other[100] operator[SEP] operator[SEP]
}
}
|
public CommandAndIPAddress getCommandAndIPAddress()
{
CommandAndIPAddress command = null;
synchronized(this)
{
if (commandQueue.size() > 0)
{
command = commandQueue.remove(0);
}
}
return command;
} | class class_name[name] begin[{]
method[getCommandAndIPAddress, return_type[type[CommandAndIPAddress]], modifier[public], parameter[]] begin[{]
local_variable[type[CommandAndIPAddress], command]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[call[commandQueue.size, parameter[]], >, literal[0]]] begin[{]
assign[member[.command], call[commandQueue.remove, parameter[literal[0]]]]
else begin[{]
None
end[}]
END[}]
return[member[.command]]
end[}]
END[}] | Keyword[public] identifier[CommandAndIPAddress] identifier[getCommandAndIPAddress] operator[SEP] operator[SEP] {
identifier[CommandAndIPAddress] identifier[command] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[commandQueue] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[command] operator[=] identifier[commandQueue] operator[SEP] identifier[remove] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[command] operator[SEP]
}
|
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
JsonGenerator jg = null;
String jsonpcb = null;
PrintWriter writer = null;
try {
writer = response.getWriter();
// "callback" parameter implies JSONP outpout
jsonpcb = request.getParameter(CALLBACK_PARAM);
if (jsonpcb != null) {
response.setContentType("application/javascript; charset=utf8");
writer.write(jsonpcb + "(");
} else {
response.setContentType("application/json; charset=utf8");
}
jg = jsonFactory.createGenerator(writer);
jg.disable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
jg.useDefaultPrettyPrinter();
jg.writeStartObject();
// query per mbean attribute
String getmethod = request.getParameter("get");
if (getmethod != null) {
String[] splitStrings = getmethod.split("\\:\\:");
if (splitStrings.length != 2) {
jg.writeStringField("result", "ERROR");
jg.writeStringField("message", "query format is not as expected.");
jg.flush();
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
listBeans(jg, new ObjectName(splitStrings[0]), splitStrings[1],
response);
return;
}
// query per mbean
String qry = request.getParameter("qry");
if (qry == null) {
qry = "*:*";
}
listBeans(jg, new ObjectName(qry), null, response);
} finally {
if (jg != null) {
jg.close();
}
if (jsonpcb != null) {
writer.write(");");
}
if (writer != null) {
writer.close();
}
}
} catch (IOException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (MalformedObjectNameException e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
} | class class_name[name] begin[{]
method[doGet, return_type[void], modifier[public], parameter[request, response]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=jg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonGenerator, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=jsonpcb)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=writer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrintWriter, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getWriter, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=jsonpcb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=CALLBACK_PARAM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getParameter, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jsonpcb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/json; charset=utf8")], member=setContentType, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/javascript; charset=utf8")], member=setContentType, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=jsonpcb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="("), operator=+)], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=jg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createGenerator, postfix_operators=[], prefix_operators=[], qualifier=jsonFactory, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=AUTO_CLOSE_TARGET, postfix_operators=[], prefix_operators=[], qualifier=JsonGenerator.Feature, selectors=[])], member=disable, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=useDefaultPrettyPrinter, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeStartObject, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="get")], member=getParameter, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), name=getmethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=getmethod, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\:\\:")], member=split, postfix_operators=[], prefix_operators=[], qualifier=getmethod, selectors=[], type_arguments=None), name=splitStrings)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=splitStrings, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), 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="result"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR")], member=writeStringField, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="query format is not as expected.")], member=writeStringField, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=jg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SC_BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=HttpServletResponse, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=splitStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectName, sub_type=None)), MemberReference(member=splitStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listBeans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="qry")], member=getParameter, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), name=qry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=qry, 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=qry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*:*")), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=qry, 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=ObjectName, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listBeans, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jg, 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=jg, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jsonpcb, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=");")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=writer, 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=writer, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SC_INTERNAL_SERVER_ERROR, postfix_operators=[], prefix_operators=[], qualifier=HttpServletResponse, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SC_BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=HttpServletResponse, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedObjectNameException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doGet] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] {
Keyword[try] {
identifier[JsonGenerator] identifier[jg] operator[=] Other[null] operator[SEP] identifier[String] identifier[jsonpcb] operator[=] Other[null] operator[SEP] identifier[PrintWriter] identifier[writer] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[writer] operator[=] identifier[response] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[jsonpcb] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[CALLBACK_PARAM] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonpcb] operator[!=] Other[null] operator[SEP] {
identifier[response] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[jsonpcb] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[jg] operator[=] identifier[jsonFactory] operator[SEP] identifier[createGenerator] operator[SEP] identifier[writer] operator[SEP] operator[SEP] identifier[jg] operator[SEP] identifier[disable] operator[SEP] identifier[JsonGenerator] operator[SEP] identifier[Feature] operator[SEP] identifier[AUTO_CLOSE_TARGET] operator[SEP] operator[SEP] identifier[jg] operator[SEP] identifier[useDefaultPrettyPrinter] operator[SEP] operator[SEP] operator[SEP] identifier[jg] operator[SEP] identifier[writeStartObject] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[getmethod] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getmethod] operator[!=] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[splitStrings] operator[=] identifier[getmethod] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[splitStrings] operator[SEP] identifier[length] operator[!=] Other[2] operator[SEP] {
identifier[jg] operator[SEP] identifier[writeStringField] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jg] operator[SEP] identifier[writeStringField] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jg] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setStatus] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_BAD_REQUEST] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[listBeans] operator[SEP] identifier[jg] , Keyword[new] identifier[ObjectName] operator[SEP] identifier[splitStrings] operator[SEP] Other[0] operator[SEP] operator[SEP] , identifier[splitStrings] operator[SEP] Other[1] operator[SEP] , identifier[response] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[String] identifier[qry] operator[=] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[qry] operator[==] Other[null] operator[SEP] {
identifier[qry] operator[=] literal[String] operator[SEP]
}
identifier[listBeans] operator[SEP] identifier[jg] , Keyword[new] identifier[ObjectName] operator[SEP] identifier[qry] operator[SEP] , Other[null] , identifier[response] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[jg] operator[!=] Other[null] operator[SEP] {
identifier[jg] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jsonpcb] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[writer] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[response] operator[SEP] identifier[setStatus] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_INTERNAL_SERVER_ERROR] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedObjectNameException] identifier[e] operator[SEP] {
identifier[response] operator[SEP] identifier[setStatus] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_BAD_REQUEST] operator[SEP] operator[SEP]
}
}
|
private void flushData() {
byte[] data = Arrays.copyOf(pendingBuffer, pendingLength);
pendingLength = 0;
handler.onData(data);
} | class class_name[name] begin[{]
method[flushData, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[byte], data]
assign[member[.pendingLength], literal[0]]
call[handler.onData, parameter[member[.data]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[flushData] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[pendingBuffer] , identifier[pendingLength] operator[SEP] operator[SEP] identifier[pendingLength] operator[=] Other[0] operator[SEP] identifier[handler] operator[SEP] identifier[onData] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
|
public void setResponseDescription(Element value) {
Element child = getLastChild(root, "responsedescription"); //$NON-NLS-1$
if (child != null)
root.removeChild(child);
if (value == null) {
child = setChild(root, "responsedescription", childNames, false); //$NON-NLS-1$
child.appendChild(value);
}
} | class class_name[name] begin[{]
method[setResponseDescription, return_type[void], modifier[public], parameter[value]] begin[{]
local_variable[type[Element], child]
if[binary_operation[member[.child], !=, literal[null]]] begin[{]
call[root.removeChild, parameter[member[.child]]]
else begin[{]
None
end[}]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
assign[member[.child], call[.setChild, parameter[member[.root], literal["responsedescription"], member[.childNames], literal[false]]]]
call[child.appendChild, parameter[member[.value]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setResponseDescription] operator[SEP] identifier[Element] identifier[value] operator[SEP] {
identifier[Element] identifier[child] operator[=] identifier[getLastChild] operator[SEP] identifier[root] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[child] operator[!=] Other[null] operator[SEP] identifier[root] operator[SEP] identifier[removeChild] operator[SEP] identifier[child] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[child] operator[=] identifier[setChild] operator[SEP] identifier[root] , literal[String] , identifier[childNames] , literal[boolean] operator[SEP] operator[SEP] identifier[child] operator[SEP] identifier[appendChild] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
|
public ServiceFuture<Void> triggerSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(triggerSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName), serviceCallback);
} | class class_name[name] begin[{]
method[triggerSyncAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, serverName, databaseName, syncGroupName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.triggerSyncWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.serverName], member[.databaseName], member[.syncGroupName]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[Void] operator[>] identifier[triggerSyncAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[serverName] , identifier[String] identifier[databaseName] , identifier[String] identifier[syncGroupName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Void] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[triggerSyncWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[serverName] , identifier[databaseName] , identifier[syncGroupName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private static void chunkedUploadFile(DbxClientV2 dbxClient, File localFile, String dropboxPath) {
long size = localFile.length();
// assert our file is at least the chunk upload size. We make this assumption in the code
// below to simplify the logic.
if (size < CHUNKED_UPLOAD_CHUNK_SIZE) {
System.err.println("File too small, use upload() instead.");
System.exit(1);
return;
}
long uploaded = 0L;
DbxException thrown = null;
ProgressListener progressListener = new ProgressListener() {
long uploadedBytes = 0;
@Override
public void onProgress(long l) {
printProgress(l + uploadedBytes, size);
if (l == CHUNKED_UPLOAD_CHUNK_SIZE) uploadedBytes += CHUNKED_UPLOAD_CHUNK_SIZE;
}
};
// Chunked uploads have 3 phases, each of which can accept uploaded bytes:
//
// (1) Start: initiate the upload and get an upload session ID
// (2) Append: upload chunks of the file to append to our session
// (3) Finish: commit the upload and close the session
//
// We track how many bytes we uploaded to determine which phase we should be in.
String sessionId = null;
for (int i = 0; i < CHUNKED_UPLOAD_MAX_ATTEMPTS; ++i) {
if (i > 0) {
System.out.printf("Retrying chunked upload (%d / %d attempts)\n", i + 1, CHUNKED_UPLOAD_MAX_ATTEMPTS);
}
try (InputStream in = new FileInputStream(localFile)) {
// if this is a retry, make sure seek to the correct offset
in.skip(uploaded);
// (1) Start
if (sessionId == null) {
sessionId = dbxClient.files().uploadSessionStart()
.uploadAndFinish(in, CHUNKED_UPLOAD_CHUNK_SIZE, progressListener)
.getSessionId();
uploaded += CHUNKED_UPLOAD_CHUNK_SIZE;
printProgress(uploaded, size);
}
UploadSessionCursor cursor = new UploadSessionCursor(sessionId, uploaded);
// (2) Append
while ((size - uploaded) > CHUNKED_UPLOAD_CHUNK_SIZE) {
dbxClient.files().uploadSessionAppendV2(cursor)
.uploadAndFinish(in, CHUNKED_UPLOAD_CHUNK_SIZE, progressListener);
uploaded += CHUNKED_UPLOAD_CHUNK_SIZE;
printProgress(uploaded, size);
cursor = new UploadSessionCursor(sessionId, uploaded);
}
// (3) Finish
long remaining = size - uploaded;
CommitInfo commitInfo = CommitInfo.newBuilder(dropboxPath)
.withMode(WriteMode.ADD)
.withClientModified(new Date(localFile.lastModified()))
.build();
FileMetadata metadata = dbxClient.files().uploadSessionFinish(cursor, commitInfo)
.uploadAndFinish(in, remaining, progressListener);
System.out.println(metadata.toStringMultiline());
return;
} catch (RetryException ex) {
thrown = ex;
// RetryExceptions are never automatically retried by the client for uploads. Must
// catch this exception even if DbxRequestConfig.getMaxRetries() > 0.
sleepQuietly(ex.getBackoffMillis());
continue;
} catch (NetworkIOException ex) {
thrown = ex;
// network issue with Dropbox (maybe a timeout?) try again
continue;
} catch (UploadSessionLookupErrorException ex) {
if (ex.errorValue.isIncorrectOffset()) {
thrown = ex;
// server offset into the stream doesn't match our offset (uploaded). Seek to
// the expected offset according to the server and try again.
uploaded = ex.errorValue
.getIncorrectOffsetValue()
.getCorrectOffset();
continue;
} else {
// Some other error occurred, give up.
System.err.println("Error uploading to Dropbox: " + ex.getMessage());
System.exit(1);
return;
}
} catch (UploadSessionFinishErrorException ex) {
if (ex.errorValue.isLookupFailed() && ex.errorValue.getLookupFailedValue().isIncorrectOffset()) {
thrown = ex;
// server offset into the stream doesn't match our offset (uploaded). Seek to
// the expected offset according to the server and try again.
uploaded = ex.errorValue
.getLookupFailedValue()
.getIncorrectOffsetValue()
.getCorrectOffset();
continue;
} else {
// some other error occurred, give up.
System.err.println("Error uploading to Dropbox: " + ex.getMessage());
System.exit(1);
return;
}
} catch (DbxException ex) {
System.err.println("Error uploading to Dropbox: " + ex.getMessage());
System.exit(1);
return;
} catch (IOException ex) {
System.err.println("Error reading from file \"" + localFile + "\": " + ex.getMessage());
System.exit(1);
return;
}
}
// if we made it here, then we must have run out of attempts
System.err.println("Maxed out upload attempts to Dropbox. Most recent error: " + thrown.getMessage());
System.exit(1);
} | class class_name[name] begin[{]
method[chunkedUploadFile, return_type[void], modifier[private static], parameter[dbxClient, localFile, dropboxPath]] begin[{]
local_variable[type[long], size]
if[binary_operation[member[.size], <, member[.CHUNKED_UPLOAD_CHUNK_SIZE]]] begin[{]
call[System.err.println, parameter[literal["File too small, use upload() instead."]]]
call[System.exit, parameter[literal[1]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], uploaded]
local_variable[type[DbxException], thrown]
local_variable[type[ProgressListener], progressListener]
local_variable[type[String], sessionId]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=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="Retrying chunked upload (%d / %d attempts)\n"), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=CHUNKED_UPLOAD_MAX_ATTEMPTS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)])), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=skip, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=sessionId, 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=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=files, postfix_operators=[], prefix_operators=[], qualifier=dbxClient, selectors=[MethodInvocation(arguments=[], member=uploadSessionStart, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CHUNKED_UPLOAD_CHUNK_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=progressListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadAndFinish, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getSessionId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=CHUNKED_UPLOAD_CHUNK_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uploaded, 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=UploadSessionCursor, sub_type=None)), name=cursor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UploadSessionCursor, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=files, postfix_operators=[], prefix_operators=[], qualifier=dbxClient, selectors=[MethodInvocation(arguments=[MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadSessionAppendV2, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CHUNKED_UPLOAD_CHUNK_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=progressListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadAndFinish, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=CHUNKED_UPLOAD_CHUNK_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uploaded, 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=UploadSessionCursor, sub_type=None))), label=None)]), condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=CHUNKED_UPLOAD_CHUNK_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=remaining)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=dropboxPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=CommitInfo, selectors=[MethodInvocation(arguments=[MemberReference(member=ADD, postfix_operators=[], prefix_operators=[], qualifier=WriteMode, selectors=[])], member=withMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=localFile, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))], member=withClientModified, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=commitInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CommitInfo, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=files, postfix_operators=[], prefix_operators=[], qualifier=dbxClient, selectors=[MethodInvocation(arguments=[MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=commitInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadSessionFinish, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=remaining, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=progressListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadAndFinish, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=metadata)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileMetadata, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toStringMultiline, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=thrown, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBackoffMillis, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None)], member=sleepQuietly, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['RetryException'])), CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=thrown, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NetworkIOException'])), CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isIncorrectOffset, postfix_operators=[], prefix_operators=[], qualifier=ex.errorValue, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error uploading to Dropbox: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=thrown, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getIncorrectOffsetValue, postfix_operators=[], prefix_operators=[], qualifier=ex.errorValue, selectors=[MethodInvocation(arguments=[], member=getCorrectOffset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), ContinueStatement(goto=None, label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['UploadSessionLookupErrorException'])), CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isLookupFailed, postfix_operators=[], prefix_operators=[], qualifier=ex.errorValue, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getLookupFailedValue, postfix_operators=[], prefix_operators=[], qualifier=ex.errorValue, selectors=[MethodInvocation(arguments=[], member=isIncorrectOffset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error uploading to Dropbox: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=thrown, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uploaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLookupFailedValue, postfix_operators=[], prefix_operators=[], qualifier=ex.errorValue, selectors=[MethodInvocation(arguments=[], member=getIncorrectOffsetValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getCorrectOffset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), ContinueStatement(goto=None, label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['UploadSessionFinishErrorException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error uploading to Dropbox: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DbxException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error reading from file \""), operandr=MemberReference(member=localFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\": "), operator=+), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=in, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=localFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)))])]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=CHUNKED_UPLOAD_MAX_ATTEMPTS, 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)
call[System.err.println, parameter[binary_operation[literal["Maxed out upload attempts to Dropbox. Most recent error: "], +, call[thrown.getMessage, parameter[]]]]]
call[System.exit, parameter[literal[1]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[chunkedUploadFile] operator[SEP] identifier[DbxClientV2] identifier[dbxClient] , identifier[File] identifier[localFile] , identifier[String] identifier[dropboxPath] operator[SEP] {
Keyword[long] identifier[size] operator[=] identifier[localFile] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[<] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[long] identifier[uploaded] operator[=] Other[0L] operator[SEP] identifier[DbxException] identifier[thrown] operator[=] Other[null] operator[SEP] identifier[ProgressListener] identifier[progressListener] operator[=] Keyword[new] identifier[ProgressListener] operator[SEP] operator[SEP] {
Keyword[long] identifier[uploadedBytes] operator[=] Other[0] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onProgress] operator[SEP] Keyword[long] identifier[l] operator[SEP] {
identifier[printProgress] operator[SEP] identifier[l] operator[+] identifier[uploadedBytes] , identifier[size] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[l] operator[==] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP] identifier[uploadedBytes] operator[+=] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP]
}
} operator[SEP] identifier[String] identifier[sessionId] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[CHUNKED_UPLOAD_MAX_ATTEMPTS] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[i] operator[+] Other[1] , identifier[CHUNKED_UPLOAD_MAX_ATTEMPTS] operator[SEP] operator[SEP]
}
Keyword[try] operator[SEP] identifier[InputStream] identifier[in] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[localFile] operator[SEP] operator[SEP] {
identifier[in] operator[SEP] identifier[skip] operator[SEP] identifier[uploaded] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sessionId] operator[==] Other[null] operator[SEP] {
identifier[sessionId] operator[=] identifier[dbxClient] operator[SEP] identifier[files] operator[SEP] operator[SEP] operator[SEP] identifier[uploadSessionStart] operator[SEP] operator[SEP] operator[SEP] identifier[uploadAndFinish] operator[SEP] identifier[in] , identifier[CHUNKED_UPLOAD_CHUNK_SIZE] , identifier[progressListener] operator[SEP] operator[SEP] identifier[getSessionId] operator[SEP] operator[SEP] operator[SEP] identifier[uploaded] operator[+=] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP] identifier[printProgress] operator[SEP] identifier[uploaded] , identifier[size] operator[SEP] operator[SEP]
}
identifier[UploadSessionCursor] identifier[cursor] operator[=] Keyword[new] identifier[UploadSessionCursor] operator[SEP] identifier[sessionId] , identifier[uploaded] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[size] operator[-] identifier[uploaded] operator[SEP] operator[>] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP] {
identifier[dbxClient] operator[SEP] identifier[files] operator[SEP] operator[SEP] operator[SEP] identifier[uploadSessionAppendV2] operator[SEP] identifier[cursor] operator[SEP] operator[SEP] identifier[uploadAndFinish] operator[SEP] identifier[in] , identifier[CHUNKED_UPLOAD_CHUNK_SIZE] , identifier[progressListener] operator[SEP] operator[SEP] identifier[uploaded] operator[+=] identifier[CHUNKED_UPLOAD_CHUNK_SIZE] operator[SEP] identifier[printProgress] operator[SEP] identifier[uploaded] , identifier[size] operator[SEP] operator[SEP] identifier[cursor] operator[=] Keyword[new] identifier[UploadSessionCursor] operator[SEP] identifier[sessionId] , identifier[uploaded] operator[SEP] operator[SEP]
}
Keyword[long] identifier[remaining] operator[=] identifier[size] operator[-] identifier[uploaded] operator[SEP] identifier[CommitInfo] identifier[commitInfo] operator[=] identifier[CommitInfo] operator[SEP] identifier[newBuilder] operator[SEP] identifier[dropboxPath] operator[SEP] operator[SEP] identifier[withMode] operator[SEP] identifier[WriteMode] operator[SEP] identifier[ADD] operator[SEP] operator[SEP] identifier[withClientModified] operator[SEP] Keyword[new] identifier[Date] operator[SEP] identifier[localFile] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[FileMetadata] identifier[metadata] operator[=] identifier[dbxClient] operator[SEP] identifier[files] operator[SEP] operator[SEP] operator[SEP] identifier[uploadSessionFinish] operator[SEP] identifier[cursor] , identifier[commitInfo] operator[SEP] operator[SEP] identifier[uploadAndFinish] operator[SEP] identifier[in] , identifier[remaining] , identifier[progressListener] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[metadata] operator[SEP] identifier[toStringMultiline] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RetryException] identifier[ex] operator[SEP] {
identifier[thrown] operator[=] identifier[ex] operator[SEP] identifier[sleepQuietly] operator[SEP] identifier[ex] operator[SEP] identifier[getBackoffMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NetworkIOException] identifier[ex] operator[SEP] {
identifier[thrown] operator[=] identifier[ex] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UploadSessionLookupErrorException] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[ex] operator[SEP] identifier[errorValue] operator[SEP] identifier[isIncorrectOffset] operator[SEP] operator[SEP] operator[SEP] {
identifier[thrown] operator[=] identifier[ex] operator[SEP] identifier[uploaded] operator[=] identifier[ex] operator[SEP] identifier[errorValue] operator[SEP] identifier[getIncorrectOffsetValue] operator[SEP] operator[SEP] operator[SEP] identifier[getCorrectOffset] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[UploadSessionFinishErrorException] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[ex] operator[SEP] identifier[errorValue] operator[SEP] identifier[isLookupFailed] operator[SEP] operator[SEP] operator[&&] identifier[ex] operator[SEP] identifier[errorValue] operator[SEP] identifier[getLookupFailedValue] operator[SEP] operator[SEP] operator[SEP] identifier[isIncorrectOffset] operator[SEP] operator[SEP] operator[SEP] {
identifier[thrown] operator[=] identifier[ex] operator[SEP] identifier[uploaded] operator[=] identifier[ex] operator[SEP] identifier[errorValue] operator[SEP] identifier[getLookupFailedValue] operator[SEP] operator[SEP] operator[SEP] identifier[getIncorrectOffsetValue] operator[SEP] operator[SEP] operator[SEP] identifier[getCorrectOffset] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[DbxException] identifier[ex] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[localFile] operator[+] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[thrown] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
|
public void marshall(CdnConfiguration cdnConfiguration, ProtocolMarshaller protocolMarshaller) {
if (cdnConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cdnConfiguration.getAdSegmentUrlPrefix(), ADSEGMENTURLPREFIX_BINDING);
protocolMarshaller.marshall(cdnConfiguration.getContentSegmentUrlPrefix(), CONTENTSEGMENTURLPREFIX_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[cdnConfiguration, protocolMarshaller]] begin[{]
if[binary_operation[member[.cdnConfiguration], ==, 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=getAdSegmentUrlPrefix, postfix_operators=[], prefix_operators=[], qualifier=cdnConfiguration, selectors=[], type_arguments=None), MemberReference(member=ADSEGMENTURLPREFIX_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=getContentSegmentUrlPrefix, postfix_operators=[], prefix_operators=[], qualifier=cdnConfiguration, selectors=[], type_arguments=None), MemberReference(member=CONTENTSEGMENTURLPREFIX_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[CdnConfiguration] identifier[cdnConfiguration] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[cdnConfiguration] 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[cdnConfiguration] operator[SEP] identifier[getAdSegmentUrlPrefix] operator[SEP] operator[SEP] , identifier[ADSEGMENTURLPREFIX_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[cdnConfiguration] operator[SEP] identifier[getContentSegmentUrlPrefix] operator[SEP] operator[SEP] , identifier[CONTENTSEGMENTURLPREFIX_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static final Mem dqword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, disp, segmentPrefix, SIZE_DQWORD);
} | class class_name[name] begin[{]
method[dqword_ptr_abs, return_type[type[Mem]], modifier[final public static], parameter[target, disp, segmentPrefix]] begin[{]
return[call[._ptr_build_abs, parameter[member[.target], member[.disp], member[.segmentPrefix], member[.SIZE_DQWORD]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[Mem] identifier[dqword_ptr_abs] operator[SEP] Keyword[long] identifier[target] , Keyword[long] identifier[disp] , identifier[SEGMENT] identifier[segmentPrefix] operator[SEP] {
Keyword[return] identifier[_ptr_build_abs] operator[SEP] identifier[target] , identifier[disp] , identifier[segmentPrefix] , identifier[SIZE_DQWORD] operator[SEP] operator[SEP]
}
|
public void put(String keyStr, String value) {
put(keyStr, StringData.forValue(value));
} | class class_name[name] begin[{]
method[put, return_type[void], modifier[public], parameter[keyStr, value]] begin[{]
call[.put, parameter[member[.keyStr], call[StringData.forValue, parameter[member[.value]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[put] operator[SEP] identifier[String] identifier[keyStr] , identifier[String] identifier[value] operator[SEP] {
identifier[put] operator[SEP] identifier[keyStr] , identifier[StringData] operator[SEP] identifier[forValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean isPOSBaselineFeatures(final TrainingParameters params) {
final String posFeatures = getPOSBaselineFeatures(params);
return !posFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
} | class class_name[name] begin[{]
method[isPOSBaselineFeatures, return_type[type[boolean]], modifier[public static], parameter[params]] begin[{]
local_variable[type[String], posFeatures]
return[call[posFeatures.equalsIgnoreCase, parameter[member[Flags.DEFAULT_FEATURE_FLAG]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isPOSBaselineFeatures] operator[SEP] Keyword[final] identifier[TrainingParameters] identifier[params] operator[SEP] {
Keyword[final] identifier[String] identifier[posFeatures] operator[=] identifier[getPOSBaselineFeatures] operator[SEP] identifier[params] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[posFeatures] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[Flags] operator[SEP] identifier[DEFAULT_FEATURE_FLAG] operator[SEP] operator[SEP]
}
|
private Map<String, Config> extractProfiles(Config sourceConfig) {
ImmutableMap.Builder<String, Config> result = ImmutableMap.builder();
Config defaultProfileConfig = sourceConfig.withoutPath("profiles");
result.put(DriverExecutionProfile.DEFAULT_NAME, defaultProfileConfig);
// The rest of the method is a bit confusing because we navigate between Typesafe config's two
// APIs, see https://github.com/typesafehub/config#understanding-config-and-configobject
// In an attempt to clarify:
// xxxObject = `ConfigObject` API (config as a hierarchical structure)
// xxxConfig = `Config` API (config as a flat set of options with hierarchical paths)
ConfigObject rootObject = sourceConfig.root();
if (rootObject.containsKey("profiles") && rootObject.get("profiles").valueType() == OBJECT) {
ConfigObject profilesObject = (ConfigObject) rootObject.get("profiles");
for (String profileName : profilesObject.keySet()) {
if (profileName.equals(DriverExecutionProfile.DEFAULT_NAME)) {
throw new IllegalArgumentException(
String.format(
"Can't have %s as a profile name because it's used internally. Pick another name.",
profileName));
}
ConfigValue profileObject = profilesObject.get(profileName);
if (profileObject.valueType() == OBJECT) {
Config profileConfig = ((ConfigObject) profileObject).toConfig();
result.put(profileName, profileConfig.withFallback(defaultProfileConfig));
}
}
}
return result.build();
} | class class_name[name] begin[{]
method[extractProfiles, return_type[type[Map]], modifier[private], parameter[sourceConfig]] begin[{]
local_variable[type[ImmutableMap], result]
local_variable[type[Config], defaultProfileConfig]
call[result.put, parameter[member[DriverExecutionProfile.DEFAULT_NAME], member[.defaultProfileConfig]]]
local_variable[type[ConfigObject], rootObject]
if[binary_operation[call[rootObject.containsKey, parameter[literal["profiles"]]], &&, binary_operation[call[rootObject.get, parameter[literal["profiles"]]], ==, member[.OBJECT]]]] begin[{]
local_variable[type[ConfigObject], profilesObject]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=DEFAULT_NAME, postfix_operators=[], prefix_operators=[], qualifier=DriverExecutionProfile, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=profileName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't have %s as a profile name because it's used internally. Pick another name."), MemberReference(member=profileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=profileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=profilesObject, selectors=[], type_arguments=None), name=profileObject)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConfigValue, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=valueType, postfix_operators=[], prefix_operators=[], qualifier=profileObject, selectors=[], type_arguments=None), operandr=MemberReference(member=OBJECT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=profileObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ConfigObject, sub_type=None)), name=profileConfig)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Config, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=profileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=defaultProfileConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withFallback, postfix_operators=[], prefix_operators=[], qualifier=profileConfig, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=profilesObject, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=profileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[call[result.build, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[Map] operator[<] identifier[String] , identifier[Config] operator[>] identifier[extractProfiles] operator[SEP] identifier[Config] identifier[sourceConfig] operator[SEP] {
identifier[ImmutableMap] operator[SEP] identifier[Builder] operator[<] identifier[String] , identifier[Config] operator[>] identifier[result] operator[=] identifier[ImmutableMap] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[Config] identifier[defaultProfileConfig] operator[=] identifier[sourceConfig] operator[SEP] identifier[withoutPath] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[DriverExecutionProfile] operator[SEP] identifier[DEFAULT_NAME] , identifier[defaultProfileConfig] operator[SEP] operator[SEP] identifier[ConfigObject] identifier[rootObject] operator[=] identifier[sourceConfig] operator[SEP] identifier[root] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rootObject] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[rootObject] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[valueType] operator[SEP] operator[SEP] operator[==] identifier[OBJECT] operator[SEP] {
identifier[ConfigObject] identifier[profilesObject] operator[=] operator[SEP] identifier[ConfigObject] operator[SEP] identifier[rootObject] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[profileName] operator[:] identifier[profilesObject] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[profileName] operator[SEP] identifier[equals] operator[SEP] identifier[DriverExecutionProfile] operator[SEP] identifier[DEFAULT_NAME] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[profileName] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ConfigValue] identifier[profileObject] operator[=] identifier[profilesObject] operator[SEP] identifier[get] operator[SEP] identifier[profileName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[profileObject] operator[SEP] identifier[valueType] operator[SEP] operator[SEP] operator[==] identifier[OBJECT] operator[SEP] {
identifier[Config] identifier[profileConfig] operator[=] operator[SEP] operator[SEP] identifier[ConfigObject] operator[SEP] identifier[profileObject] operator[SEP] operator[SEP] identifier[toConfig] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[put] operator[SEP] identifier[profileName] , identifier[profileConfig] operator[SEP] identifier[withFallback] operator[SEP] identifier[defaultProfileConfig] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setExpan(String v) {
if (Abbreviation_Type.featOkTst && ((Abbreviation_Type)jcasType).casFeat_expan == null)
jcasType.jcas.throwFeatMissing("expan", "de.julielab.jules.types.Abbreviation");
jcasType.ll_cas.ll_setStringValue(addr, ((Abbreviation_Type)jcasType).casFeatCode_expan, v);} | class class_name[name] begin[{]
method[setExpan, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[Abbreviation_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Abbreviation_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["expan"], literal["de.julielab.jules.types.Abbreviation"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Abbreviation_Type, sub_type=None)), member[.v]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setExpan] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[Abbreviation_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Abbreviation_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_expan] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Abbreviation_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_expan] , identifier[v] operator[SEP] operator[SEP]
}
|
public int prepare(Xid xid) throws XAException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(this, tc, "prepare", new Object[]
{
ivManagedConnection,
AdapterUtil.toString(xid)
});
// if the MC marked Stale, it means the user requested a purge pool with an immediate option
// so don't allow any work to continue. In this case, we throw XAER_RMFAIL xa error
// which indicates that the resource manager is not available
if (ivManagedConnection._mcStale) {
Tr.error(tc, "INVALID_CONNECTION");
XAException x = new XAException(XAException.XAER_RMFAIL);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, "prepare", new Object[] { "MC is stale throwing XAER_RMFAIL", ivManagedConnection });
throw x;
}
if (!xid.equals(ivXid)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Xid does not match.", new Object[]
{
"XAResource.start: ",
AdapterUtil.toString(ivXid),
"XAResource.prepare: ",
AdapterUtil.toString(xid)
});
XAException xaX = AdapterUtil.createXAException(
"XID_MISMATCH",
new Object[] { AdapterUtil.toString(ivXid), "prepare", AdapterUtil.toString(xid) },
XAException.XAER_NOTA);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, "prepare", xaX);
throw xaX;
}
int returnValue;
try {
returnValue = ivXaRes.prepare(xid);
//need to check the return value here and determine if we need to clean up the transaction state
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(this, tc, "xa.prepare() status:", new Object[]
{
AdapterUtil.getXAResourceVoteString(returnValue),
AdapterUtil.toString(xid)
});
}
if (returnValue == XAException.XA_RDONLY) {
try {
// flag is reset since no commit/rollbak is issued here
// adn we don't want inGlobalTransaction to return the wrong value
ivManagedConnection.wasLazilyEnlistedInGlobalTran = false;
ivStateManager.setState(WSStateManager.XA_READONLY);
} catch (TransactionException te) {
//Exception means setState failed because it was invalid to set the state in this case
FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare", "373", this);
XAException xae = AdapterUtil.createXAException(
"INVALID_TX_STATE",
new Object[] { "XAResource.prepare", ivManagedConnection.getTransactionStateAsString() },
XAException.XA_RBPROTO);
traceXAException(xae, currClass);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, "prepare", xae);
throw xae;
}
}
} catch (XAException xae) {
FFDCFilter.processException(xae, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare", "386", this);
traceXAException(xae, currClass);
checkXAException(xae);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, "prepare", "Exception");
throw xae;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(this, tc, "prepare", returnValue);
return returnValue;
} | class class_name[name] begin[{]
method[prepare, return_type[type[int]], modifier[public], parameter[xid]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["prepare"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=ivManagedConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=xid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[member[ivManagedConnection._mcStale]] begin[{]
call[Tr.error, parameter[member[.tc], literal["INVALID_CONNECTION"]]]
local_variable[type[XAException], x]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["prepare"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="MC is stale throwing XAER_RMFAIL"), MemberReference(member=ivManagedConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
if[call[xid.equals, parameter[member[.ivXid]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[THIS[], member[.tc], literal["Xid does not match."], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="XAResource.start: "), MethodInvocation(arguments=[MemberReference(member=ivXid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="XAResource.prepare: "), MethodInvocation(arguments=[MemberReference(member=xid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[XAException], xaX]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["prepare"], member[.xaX]]]
else begin[{]
None
end[}]
ThrowStatement(expression=MemberReference(member=xaX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
local_variable[type[int], returnValue]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=xid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepare, postfix_operators=[], prefix_operators=[], qualifier=ivXaRes, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="xa.prepare() status:"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getXAResourceVoteString, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=xid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=XA_RDONLY, postfix_operators=[], prefix_operators=[], qualifier=XAException, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=wasLazilyEnlistedInGlobalTran, postfix_operators=[], prefix_operators=[], qualifier=ivManagedConnection, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=XA_READONLY, postfix_operators=[], prefix_operators=[], qualifier=WSStateManager, selectors=[])], member=setState, postfix_operators=[], prefix_operators=[], qualifier=ivStateManager, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=te, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="373"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INVALID_TX_STATE"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="XAResource.prepare"), MethodInvocation(arguments=[], member=getTransactionStateAsString, postfix_operators=[], prefix_operators=[], qualifier=ivManagedConnection, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), MemberReference(member=XA_RBPROTO, postfix_operators=[], prefix_operators=[], qualifier=XAException, selectors=[])], member=createXAException, postfix_operators=[], prefix_operators=[], qualifier=AdapterUtil, selectors=[], type_arguments=None), name=xae)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XAException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=traceXAException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="prepare"), MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=te, types=['TransactionException']))], finally_block=None, label=None, resources=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.prepare"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="386"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=traceXAException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkXAException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="prepare"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception")], member=exit, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=MemberReference(member=xae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=xae, types=['XAException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], literal["prepare"], member[.returnValue]]]
else begin[{]
None
end[}]
return[member[.returnValue]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[prepare] operator[SEP] identifier[Xid] identifier[xid] operator[SEP] Keyword[throws] identifier[XAException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[ivManagedConnection] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[xid] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ivManagedConnection] operator[SEP] identifier[_mcStale] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[XAException] identifier[x] operator[=] Keyword[new] identifier[XAException] operator[SEP] identifier[XAException] operator[SEP] identifier[XAER_RMFAIL] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , identifier[ivManagedConnection]
} operator[SEP] operator[SEP] Keyword[throw] identifier[x] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[xid] operator[SEP] identifier[equals] operator[SEP] identifier[ivXid] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[ivXid] operator[SEP] , literal[String] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[xid] operator[SEP]
} operator[SEP] operator[SEP] identifier[XAException] identifier[xaX] operator[=] identifier[AdapterUtil] operator[SEP] identifier[createXAException] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[ivXid] operator[SEP] , literal[String] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[xid] operator[SEP]
} , identifier[XAException] operator[SEP] identifier[XAER_NOTA] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[xaX] operator[SEP] operator[SEP] Keyword[throw] identifier[xaX] operator[SEP]
}
Keyword[int] identifier[returnValue] operator[SEP] Keyword[try] {
identifier[returnValue] operator[=] identifier[ivXaRes] operator[SEP] identifier[prepare] operator[SEP] identifier[xid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[AdapterUtil] operator[SEP] identifier[getXAResourceVoteString] operator[SEP] identifier[returnValue] operator[SEP] , identifier[AdapterUtil] operator[SEP] identifier[toString] operator[SEP] identifier[xid] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[returnValue] operator[==] identifier[XAException] operator[SEP] identifier[XA_RDONLY] operator[SEP] {
Keyword[try] {
identifier[ivManagedConnection] operator[SEP] identifier[wasLazilyEnlistedInGlobalTran] operator[=] literal[boolean] operator[SEP] identifier[ivStateManager] operator[SEP] identifier[setState] operator[SEP] identifier[WSStateManager] operator[SEP] identifier[XA_READONLY] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TransactionException] identifier[te] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[te] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[XAException] identifier[xae] operator[=] identifier[AdapterUtil] operator[SEP] identifier[createXAException] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , identifier[ivManagedConnection] operator[SEP] identifier[getTransactionStateAsString] operator[SEP] operator[SEP]
} , identifier[XAException] operator[SEP] identifier[XA_RBPROTO] operator[SEP] operator[SEP] identifier[traceXAException] operator[SEP] identifier[xae] , identifier[currClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[xae] operator[SEP] operator[SEP] Keyword[throw] identifier[xae] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[XAException] identifier[xae] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[xae] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[traceXAException] operator[SEP] identifier[xae] , identifier[currClass] operator[SEP] operator[SEP] identifier[checkXAException] operator[SEP] identifier[xae] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] identifier[xae] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[returnValue] operator[SEP] operator[SEP] Keyword[return] identifier[returnValue] operator[SEP]
}
|
public void dispose ()
{
if (_buffer != null) {
// if there are sources bound to this buffer, we must wait
// for them to be unbound
if (_bound > 0) {
_state = UNLOADING;
return;
}
// free up our buffer
_buffer.delete();
_buffer = null;
_state = UNLOADED;
}
} | class class_name[name] begin[{]
method[dispose, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[._buffer], !=, literal[null]]] begin[{]
if[binary_operation[member[._bound], >, literal[0]]] begin[{]
assign[member[._state], member[.UNLOADING]]
return[None]
else begin[{]
None
end[}]
call[_buffer.delete, parameter[]]
assign[member[._buffer], literal[null]]
assign[member[._state], member[.UNLOADED]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[dispose] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_buffer] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[_bound] operator[>] Other[0] operator[SEP] {
identifier[_state] operator[=] identifier[UNLOADING] operator[SEP] Keyword[return] operator[SEP]
}
identifier[_buffer] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] identifier[_buffer] operator[=] Other[null] operator[SEP] identifier[_state] operator[=] identifier[UNLOADED] operator[SEP]
}
}
|
public java.util.Map<String, java.util.List<String>> getFields() {
if (fields == null) {
fields = new com.amazonaws.internal.SdkInternalMap<String, java.util.List<String>>();
}
return fields;
} | class class_name[name] begin[{]
method[getFields, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.fields], ==, literal[null]]] begin[{]
assign[member[.fields], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], 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=List, sub_type=None))))], dimensions=None, name=SdkInternalMap, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.fields]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[getFields] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[fields] operator[==] Other[null] operator[SEP] {
identifier[fields] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalMap] operator[<] identifier[String] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fields] operator[SEP]
}
|
public static Config load(ClassLoader loader, Config config, ConfigResolveOptions resolveOptions) {
return defaultOverrides(loader).withFallback(config).withFallback(defaultReference(loader))
.resolve(resolveOptions);
} | class class_name[name] begin[{]
method[load, return_type[type[Config]], modifier[public static], parameter[loader, config, resolveOptions]] begin[{]
return[call[.defaultOverrides, parameter[member[.loader]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Config] identifier[load] operator[SEP] identifier[ClassLoader] identifier[loader] , identifier[Config] identifier[config] , identifier[ConfigResolveOptions] identifier[resolveOptions] operator[SEP] {
Keyword[return] identifier[defaultOverrides] operator[SEP] identifier[loader] operator[SEP] operator[SEP] identifier[withFallback] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[withFallback] operator[SEP] identifier[defaultReference] operator[SEP] identifier[loader] operator[SEP] operator[SEP] operator[SEP] identifier[resolve] operator[SEP] identifier[resolveOptions] operator[SEP] operator[SEP]
}
|
@Bean
@ConditionalOnMissingBean
@UIScope
EventPushStrategy eventPushStrategy(final ConfigurableApplicationContext applicationContext,
final ScheduledExecutorService executorService, final UIEventBus eventBus,
final UIEventProvider eventProvider, final UiProperties uiProperties) {
final DelayedEventBusPushStrategy delayedEventBusPushStrategy = new DelayedEventBusPushStrategy(executorService,
eventBus, eventProvider, uiProperties.getEvent().getPush().getDelay());
applicationContext.addApplicationListener(delayedEventBusPushStrategy);
return delayedEventBusPushStrategy;
} | class class_name[name] begin[{]
method[eventPushStrategy, return_type[type[EventPushStrategy]], modifier[default], parameter[applicationContext, executorService, eventBus, eventProvider, uiProperties]] begin[{]
local_variable[type[DelayedEventBusPushStrategy], delayedEventBusPushStrategy]
call[applicationContext.addApplicationListener, parameter[member[.delayedEventBusPushStrategy]]]
return[member[.delayedEventBusPushStrategy]]
end[}]
END[}] | annotation[@] identifier[Bean] annotation[@] identifier[ConditionalOnMissingBean] annotation[@] identifier[UIScope] identifier[EventPushStrategy] identifier[eventPushStrategy] operator[SEP] Keyword[final] identifier[ConfigurableApplicationContext] identifier[applicationContext] , Keyword[final] identifier[ScheduledExecutorService] identifier[executorService] , Keyword[final] identifier[UIEventBus] identifier[eventBus] , Keyword[final] identifier[UIEventProvider] identifier[eventProvider] , Keyword[final] identifier[UiProperties] identifier[uiProperties] operator[SEP] {
Keyword[final] identifier[DelayedEventBusPushStrategy] identifier[delayedEventBusPushStrategy] operator[=] Keyword[new] identifier[DelayedEventBusPushStrategy] operator[SEP] identifier[executorService] , identifier[eventBus] , identifier[eventProvider] , identifier[uiProperties] operator[SEP] identifier[getEvent] operator[SEP] operator[SEP] operator[SEP] identifier[getPush] operator[SEP] operator[SEP] operator[SEP] identifier[getDelay] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[applicationContext] operator[SEP] identifier[addApplicationListener] operator[SEP] identifier[delayedEventBusPushStrategy] operator[SEP] operator[SEP] Keyword[return] identifier[delayedEventBusPushStrategy] operator[SEP]
}
|
public Boolean exists(H key, HK field, HK name, HV value) {
final byte[] rawKey = rawKey(key);
final byte[] rawHashKey = rawHashKey(field);
final byte[] rawElementName = rawHashKey(name);
final byte[] rawElementValue = rawHashValue(value);
return execute(new RedisCallback<Boolean>() {
public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
return ((RedisClusterConnection) connection).slExists(rawKey, rawHashKey, rawElementName,
rawElementValue);
}
}, true);
} | class class_name[name] begin[{]
method[exists, return_type[type[Boolean]], modifier[public], parameter[key, field, name, value]] begin[{]
local_variable[type[byte], rawKey]
local_variable[type[byte], rawHashKey]
local_variable[type[byte], rawElementName]
local_variable[type[byte], rawElementValue]
return[call[.execute, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=Cast(expression=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=RedisClusterConnection, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=doInRedis, parameters=[FormalParameter(annotations=[], modifiers=set(), name=connection, type=ReferenceType(arguments=None, dimensions=[], name=RedisConnection, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None), throws=['DataAccessException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], dimensions=None, name=RedisCallback, sub_type=None)), literal[true]]]]
end[}]
END[}] | Keyword[public] identifier[Boolean] identifier[exists] operator[SEP] identifier[H] identifier[key] , identifier[HK] identifier[field] , identifier[HK] identifier[name] , identifier[HV] identifier[value] operator[SEP] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[rawKey] operator[=] identifier[rawKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[rawHashKey] operator[=] identifier[rawHashKey] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[rawElementName] operator[=] identifier[rawHashKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[rawElementValue] operator[=] identifier[rawHashValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[execute] operator[SEP] Keyword[new] identifier[RedisCallback] operator[<] identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
Keyword[public] identifier[Boolean] identifier[doInRedis] operator[SEP] identifier[RedisConnection] identifier[connection] operator[SEP] Keyword[throws] identifier[DataAccessException] {
Keyword[return] operator[SEP] operator[SEP] identifier[RedisClusterConnection] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[slExists] operator[SEP] identifier[rawKey] , identifier[rawHashKey] , identifier[rawElementName] , identifier[rawElementValue] operator[SEP] operator[SEP]
}
} , literal[boolean] operator[SEP] operator[SEP]
}
|
public static DepIoChart insideOutsideSingleRoot(double[] fracRoot, double[][] fracChild) {
final boolean singleRoot = true;
return insideOutside(fracRoot, fracChild, singleRoot);
} | class class_name[name] begin[{]
method[insideOutsideSingleRoot, return_type[type[DepIoChart]], modifier[public static], parameter[fracRoot, fracChild]] begin[{]
local_variable[type[boolean], singleRoot]
return[call[.insideOutside, parameter[member[.fracRoot], member[.fracChild], member[.singleRoot]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DepIoChart] identifier[insideOutsideSingleRoot] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[fracRoot] , Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[fracChild] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[singleRoot] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[insideOutside] operator[SEP] identifier[fracRoot] , identifier[fracChild] , identifier[singleRoot] operator[SEP] operator[SEP]
}
|
public static VariableSet findVariableSet(final String input, final char startDelim, final char endDelim, final int startPos) {
final int startIndex = StringUtilities.indexOf(input, startDelim, startPos);
int endIndex = StringUtilities.indexOf(input, endDelim, startIndex == -1 ? startPos : startIndex);
int nextStartIndex = startIndex == -1 ? -1 : StringUtilities.indexOf(input, startDelim, startIndex + 1);
/*
* Find the ending delimiter that matches the start delimiter. This is done
* by checking to see if the next start delimiter is before the current end
* delimiter. If that is the case then there is a nested set so look for the
* next end delimiter.
*/
while (nextStartIndex < endIndex && nextStartIndex != -1 && endIndex != -1) {
final int prevEndIndex = endIndex;
endIndex = StringUtilities.indexOf(input, endDelim, endIndex + 1);
nextStartIndex = StringUtilities.indexOf(input, startDelim, prevEndIndex + 1);
}
// Build the resulting set object
final VariableSet set = new VariableSet();
if (endIndex == -1 && startIndex != -1) {
set.setContents(input.substring(startIndex));
set.setEndPos(null);
set.setStartPos(startIndex);
} else if (startIndex != -1) {
if (endIndex == -1) {
set.setContents(input.substring(startIndex));
} else {
set.setContents(input.substring(startIndex, endIndex + 1));
}
set.setEndPos(endIndex);
set.setStartPos(startIndex);
} else if (endIndex != -1) {
set.setContents(input.substring(startPos, endIndex + 1));
set.setEndPos(endIndex);
set.setStartPos(null);
} else {
String remainingData = input.substring(startPos);
if (!remainingData.trim().isEmpty()) {
set.setContents(remainingData);
set.setEndPos(input.length() - 1);
} else {
set.setContents(null);
set.setEndPos(null);
}
set.setStartPos(null);
}
return set;
} | class class_name[name] begin[{]
method[findVariableSet, return_type[type[VariableSet]], modifier[public static], parameter[input, startDelim, endDelim, startPos]] begin[{]
local_variable[type[int], startIndex]
local_variable[type[int], endIndex]
local_variable[type[int], nextStartIndex]
while[binary_operation[binary_operation[binary_operation[member[.nextStartIndex], <, member[.endIndex]], &&, binary_operation[member[.nextStartIndex], !=, literal[1]]], &&, binary_operation[member[.endIndex], !=, literal[1]]]] begin[{]
local_variable[type[int], prevEndIndex]
assign[member[.endIndex], call[StringUtilities.indexOf, parameter[member[.input], member[.endDelim], binary_operation[member[.endIndex], +, literal[1]]]]]
assign[member[.nextStartIndex], call[StringUtilities.indexOf, parameter[member[.input], member[.startDelim], binary_operation[member[.prevEndIndex], +, literal[1]]]]]
end[}]
local_variable[type[VariableSet], set]
if[binary_operation[binary_operation[member[.endIndex], ==, literal[1]], &&, binary_operation[member[.startIndex], !=, literal[1]]]] begin[{]
call[set.setContents, parameter[call[input.substring, parameter[member[.startIndex]]]]]
call[set.setEndPos, parameter[literal[null]]]
call[set.setStartPos, parameter[member[.startIndex]]]
else begin[{]
if[binary_operation[member[.startIndex], !=, literal[1]]] begin[{]
if[binary_operation[member[.endIndex], ==, literal[1]]] begin[{]
call[set.setContents, parameter[call[input.substring, parameter[member[.startIndex]]]]]
else begin[{]
call[set.setContents, parameter[call[input.substring, parameter[member[.startIndex], binary_operation[member[.endIndex], +, literal[1]]]]]]
end[}]
call[set.setEndPos, parameter[member[.endIndex]]]
call[set.setStartPos, parameter[member[.startIndex]]]
else begin[{]
if[binary_operation[member[.endIndex], !=, literal[1]]] begin[{]
call[set.setContents, parameter[call[input.substring, parameter[member[.startPos], binary_operation[member[.endIndex], +, literal[1]]]]]]
call[set.setEndPos, parameter[member[.endIndex]]]
call[set.setStartPos, parameter[literal[null]]]
else begin[{]
local_variable[type[String], remainingData]
if[call[remainingData.trim, parameter[]]] begin[{]
call[set.setContents, parameter[member[.remainingData]]]
call[set.setEndPos, parameter[binary_operation[call[input.length, parameter[]], -, literal[1]]]]
else begin[{]
call[set.setContents, parameter[literal[null]]]
call[set.setEndPos, parameter[literal[null]]]
end[}]
call[set.setStartPos, parameter[literal[null]]]
end[}]
end[}]
end[}]
return[member[.set]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[VariableSet] identifier[findVariableSet] operator[SEP] Keyword[final] identifier[String] identifier[input] , Keyword[final] Keyword[char] identifier[startDelim] , Keyword[final] Keyword[char] identifier[endDelim] , Keyword[final] Keyword[int] identifier[startPos] operator[SEP] {
Keyword[final] Keyword[int] identifier[startIndex] operator[=] identifier[StringUtilities] operator[SEP] identifier[indexOf] operator[SEP] identifier[input] , identifier[startDelim] , identifier[startPos] operator[SEP] operator[SEP] Keyword[int] identifier[endIndex] operator[=] identifier[StringUtilities] operator[SEP] identifier[indexOf] operator[SEP] identifier[input] , identifier[endDelim] , identifier[startIndex] operator[==] operator[-] Other[1] operator[?] identifier[startPos] operator[:] identifier[startIndex] operator[SEP] operator[SEP] Keyword[int] identifier[nextStartIndex] operator[=] identifier[startIndex] operator[==] operator[-] Other[1] operator[?] operator[-] Other[1] operator[:] identifier[StringUtilities] operator[SEP] identifier[indexOf] operator[SEP] identifier[input] , identifier[startDelim] , identifier[startIndex] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[nextStartIndex] operator[<] identifier[endIndex] operator[&&] identifier[nextStartIndex] operator[!=] operator[-] Other[1] operator[&&] identifier[endIndex] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[final] Keyword[int] identifier[prevEndIndex] operator[=] identifier[endIndex] operator[SEP] identifier[endIndex] operator[=] identifier[StringUtilities] operator[SEP] identifier[indexOf] operator[SEP] identifier[input] , identifier[endDelim] , identifier[endIndex] operator[+] Other[1] operator[SEP] operator[SEP] identifier[nextStartIndex] operator[=] identifier[StringUtilities] operator[SEP] identifier[indexOf] operator[SEP] identifier[input] , identifier[startDelim] , identifier[prevEndIndex] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[final] identifier[VariableSet] identifier[set] operator[=] Keyword[new] identifier[VariableSet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[endIndex] operator[==] operator[-] Other[1] operator[&&] identifier[startIndex] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] identifier[input] operator[SEP] identifier[substring] operator[SEP] identifier[startIndex] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setEndPos] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setStartPos] operator[SEP] identifier[startIndex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[startIndex] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[endIndex] operator[==] operator[-] Other[1] operator[SEP] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] identifier[input] operator[SEP] identifier[substring] operator[SEP] identifier[startIndex] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] identifier[input] operator[SEP] identifier[substring] operator[SEP] identifier[startIndex] , identifier[endIndex] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[set] operator[SEP] identifier[setEndPos] operator[SEP] identifier[endIndex] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setStartPos] operator[SEP] identifier[startIndex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[endIndex] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] identifier[input] operator[SEP] identifier[substring] operator[SEP] identifier[startPos] , identifier[endIndex] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setEndPos] operator[SEP] identifier[endIndex] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setStartPos] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[remainingData] operator[=] identifier[input] operator[SEP] identifier[substring] operator[SEP] identifier[startPos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[remainingData] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] identifier[remainingData] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setEndPos] operator[SEP] identifier[input] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[set] operator[SEP] identifier[setContents] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[setEndPos] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[set] operator[SEP] identifier[setStartPos] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[return] identifier[set] operator[SEP]
}
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
ButterKnife.bind(this);
mCacheId = getIntent().getStringExtra(EXTRA_ID_CACHE);
mDiskCacheSize = getIntent().getIntExtra(EXTRA_DISK_CACHE_SIZE, 100);
mRamCacheSize = getIntent().getIntExtra(EXTRA_RAM_CACHE_SIZE, 50);
CacheSerializer<String> jsonSerializer = new JsonSerializer<>(String.class);
mCache = new Builder<String>(mCacheId, 1)
.enableLog()
.useSerializerInRam(mRamCacheSize, jsonSerializer)
.useSerializerInDisk(mDiskCacheSize, true, jsonSerializer, getApplicationContext())
.build();
mHandler = new Handler();
mHandler.post(new Runnable() {
@Override
public void run() {
refreshCacheSize();
mHandler.postDelayed(this, 500);
}
});
mButtonAddObjectA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mCache.put("a", "objectA");
}
});
mButtonAddObjectB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mCache.put("b", "objectB");
}
});
mButtonAddRandomObject.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mCache.put(UUID.randomUUID().toString(), UUID.randomUUID().toString());
}
});
mButtonDisplayObjectB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
long start = System.currentTimeMillis();
String result = mCache.get("b");
long end = System.currentTimeMillis();
long time = end - start;
if (result != null) {
Toast.makeText(DemoActivity.this, result, Toast.LENGTH_SHORT).show();
}
mTextViewDataTime.setText("Last access time : " + time + " ms");
}
});
mButtonDisplayObjectA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
long start = System.currentTimeMillis();
String result = mCache.get("a");
long end = System.currentTimeMillis();
long time = end - start;
if (result != null) {
Toast.makeText(DemoActivity.this, result, Toast.LENGTH_SHORT).show();
}
mTextViewDataTime.setText("Last access time : " + time + " ms");
}
});
mButtonInvalidateCache.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mCache.invalidate();
}
});
} | class class_name[name] begin[{]
method[onCreate, return_type[void], modifier[protected], parameter[savedInstanceState]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=savedInstanceState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onCreate, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.setContentView, parameter[member[R.layout.activity_demo]]]
call[ButterKnife.bind, parameter[THIS[]]]
assign[member[.mCacheId], call[.getIntent, parameter[]]]
assign[member[.mDiskCacheSize], call[.getIntent, parameter[]]]
assign[member[.mRamCacheSize], call[.getIntent, parameter[]]]
local_variable[type[CacheSerializer], jsonSerializer]
assign[member[.mCache], ClassCreator(arguments=[MemberReference(member=mCacheId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=enableLog, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=mRamCacheSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jsonSerializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=useSerializerInRam, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=mDiskCacheSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=jsonSerializer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getApplicationContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=useSerializerInDisk, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Builder, sub_type=None))]
assign[member[.mHandler], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Handler, sub_type=None))]
call[mHandler.post, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=refreshCacheSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500)], member=postDelayed, postfix_operators=[], prefix_operators=[], qualifier=mHandler, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Runnable, sub_type=None))]]
call[mButtonAddObjectA.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="a"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="objectA")], member=put, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
call[mButtonAddObjectB.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="b"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="objectB")], member=put, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
call[mButtonAddRandomObject.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=randomUUID, postfix_operators=[], prefix_operators=[], qualifier=UUID, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=randomUUID, postfix_operators=[], prefix_operators=[], qualifier=UUID, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
call[mButtonDisplayObjectB.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=start)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="b")], member=get, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=end)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=time)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, 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=[This(postfix_operators=[], prefix_operators=[], qualifier=DemoActivity, selectors=[]), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=LENGTH_SHORT, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[])], member=makeText, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[MethodInvocation(arguments=[], member=show, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Last access time : "), operandr=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ms"), operator=+)], member=setText, postfix_operators=[], prefix_operators=[], qualifier=mTextViewDataTime, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
call[mButtonDisplayObjectA.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=start)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="a")], member=get, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=end)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=time)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, 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=[This(postfix_operators=[], prefix_operators=[], qualifier=DemoActivity, selectors=[]), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=LENGTH_SHORT, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[])], member=makeText, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[MethodInvocation(arguments=[], member=show, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Last access time : "), operandr=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ms"), operator=+)], member=setText, postfix_operators=[], prefix_operators=[], qualifier=mTextViewDataTime, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
call[mButtonInvalidateCache.setOnClickListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=invalidate, postfix_operators=[], prefix_operators=[], qualifier=mCache, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=view, type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=View, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnClickListener, sub_type=None)))]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[onCreate] operator[SEP] identifier[Bundle] identifier[savedInstanceState] operator[SEP] {
Keyword[super] operator[SEP] identifier[onCreate] operator[SEP] identifier[savedInstanceState] operator[SEP] operator[SEP] identifier[setContentView] operator[SEP] identifier[R] operator[SEP] identifier[layout] operator[SEP] identifier[activity_demo] operator[SEP] operator[SEP] identifier[ButterKnife] operator[SEP] identifier[bind] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[mCacheId] operator[=] identifier[getIntent] operator[SEP] operator[SEP] operator[SEP] identifier[getStringExtra] operator[SEP] identifier[EXTRA_ID_CACHE] operator[SEP] operator[SEP] identifier[mDiskCacheSize] operator[=] identifier[getIntent] operator[SEP] operator[SEP] operator[SEP] identifier[getIntExtra] operator[SEP] identifier[EXTRA_DISK_CACHE_SIZE] , Other[100] operator[SEP] operator[SEP] identifier[mRamCacheSize] operator[=] identifier[getIntent] operator[SEP] operator[SEP] operator[SEP] identifier[getIntExtra] operator[SEP] identifier[EXTRA_RAM_CACHE_SIZE] , Other[50] operator[SEP] operator[SEP] identifier[CacheSerializer] operator[<] identifier[String] operator[>] identifier[jsonSerializer] operator[=] Keyword[new] identifier[JsonSerializer] operator[<] operator[>] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[mCache] operator[=] Keyword[new] identifier[Builder] operator[<] identifier[String] operator[>] operator[SEP] identifier[mCacheId] , Other[1] operator[SEP] operator[SEP] identifier[enableLog] operator[SEP] operator[SEP] operator[SEP] identifier[useSerializerInRam] operator[SEP] identifier[mRamCacheSize] , identifier[jsonSerializer] operator[SEP] operator[SEP] identifier[useSerializerInDisk] operator[SEP] identifier[mDiskCacheSize] , literal[boolean] , identifier[jsonSerializer] , identifier[getApplicationContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[mHandler] operator[=] Keyword[new] identifier[Handler] operator[SEP] operator[SEP] operator[SEP] identifier[mHandler] operator[SEP] identifier[post] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[refreshCacheSize] operator[SEP] operator[SEP] operator[SEP] identifier[mHandler] operator[SEP] identifier[postDelayed] operator[SEP] Keyword[this] , Other[500] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonAddObjectA] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
identifier[mCache] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonAddObjectB] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
identifier[mCache] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonAddRandomObject] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
identifier[mCache] operator[SEP] identifier[put] operator[SEP] identifier[UUID] operator[SEP] identifier[randomUUID] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[UUID] operator[SEP] identifier[randomUUID] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonDisplayObjectB] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[result] operator[=] identifier[mCache] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[end] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[time] operator[=] identifier[end] operator[-] identifier[start] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
identifier[Toast] operator[SEP] identifier[makeText] operator[SEP] identifier[DemoActivity] operator[SEP] Keyword[this] , identifier[result] , identifier[Toast] operator[SEP] identifier[LENGTH_SHORT] operator[SEP] operator[SEP] identifier[show] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mTextViewDataTime] operator[SEP] identifier[setText] operator[SEP] literal[String] operator[+] identifier[time] operator[+] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonDisplayObjectA] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[result] operator[=] identifier[mCache] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[end] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[time] operator[=] identifier[end] operator[-] identifier[start] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
identifier[Toast] operator[SEP] identifier[makeText] operator[SEP] identifier[DemoActivity] operator[SEP] Keyword[this] , identifier[result] , identifier[Toast] operator[SEP] identifier[LENGTH_SHORT] operator[SEP] operator[SEP] identifier[show] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mTextViewDataTime] operator[SEP] identifier[setText] operator[SEP] literal[String] operator[+] identifier[time] operator[+] literal[String] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mButtonInvalidateCache] operator[SEP] identifier[setOnClickListener] operator[SEP] Keyword[new] identifier[View] operator[SEP] identifier[OnClickListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onClick] operator[SEP] identifier[View] identifier[view] operator[SEP] {
identifier[mCache] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
{
checkParameterBounds(parameterIndex);
throw SQLError.noSupport();
} | class class_name[name] begin[{]
method[setNCharacterStream, return_type[void], modifier[public], parameter[parameterIndex, value]] begin[{]
call[.checkParameterBounds, parameter[member[.parameterIndex]]]
ThrowStatement(expression=MethodInvocation(arguments=[], member=noSupport, postfix_operators=[], prefix_operators=[], qualifier=SQLError, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setNCharacterStream] operator[SEP] Keyword[int] identifier[parameterIndex] , identifier[Reader] identifier[value] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkParameterBounds] operator[SEP] identifier[parameterIndex] operator[SEP] operator[SEP] Keyword[throw] identifier[SQLError] operator[SEP] identifier[noSupport] operator[SEP] operator[SEP] operator[SEP]
}
|
public CurrencyDateCalculatorBuilder<E> currencyPair(final String ccy1, final String ccy2, final SpotLag spotLag) {
this.ccy1 = ccy1;
this.ccy2 = ccy2;
this.spotLag = spotLag;
return this;
} | class class_name[name] begin[{]
method[currencyPair, return_type[type[CurrencyDateCalculatorBuilder]], modifier[public], parameter[ccy1, ccy2, spotLag]] begin[{]
assign[THIS[member[None.ccy1]], member[.ccy1]]
assign[THIS[member[None.ccy2]], member[.ccy2]]
assign[THIS[member[None.spotLag]], member[.spotLag]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CurrencyDateCalculatorBuilder] operator[<] identifier[E] operator[>] identifier[currencyPair] operator[SEP] Keyword[final] identifier[String] identifier[ccy1] , Keyword[final] identifier[String] identifier[ccy2] , Keyword[final] identifier[SpotLag] identifier[spotLag] operator[SEP] {
Keyword[this] operator[SEP] identifier[ccy1] operator[=] identifier[ccy1] operator[SEP] Keyword[this] operator[SEP] identifier[ccy2] operator[=] identifier[ccy2] operator[SEP] Keyword[this] operator[SEP] identifier[spotLag] operator[=] identifier[spotLag] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public void setBcc(Object bcc) throws ApplicationException {
if (StringUtil.isEmpty(bcc)) return;
try {
smtp.addBCC(bcc);
}
catch (Exception e) {
throw new ApplicationException("attribute [bcc] of the tag [mail] is invalid", e.getMessage());
}
} | class class_name[name] begin[{]
method[setBcc, return_type[void], modifier[public], parameter[bcc]] begin[{]
if[call[StringUtil.isEmpty, parameter[member[.bcc]]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bcc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addBCC, postfix_operators=[], prefix_operators=[], qualifier=smtp, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attribute [bcc] of the tag [mail] is invalid"), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApplicationException, 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[setBcc] operator[SEP] identifier[Object] identifier[bcc] operator[SEP] Keyword[throws] identifier[ApplicationException] {
Keyword[if] operator[SEP] identifier[StringUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[bcc] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[try] {
identifier[smtp] operator[SEP] identifier[addBCC] operator[SEP] identifier[bcc] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ApplicationException] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.