code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
protected final Body statements(Data data) throws TemplateException {
ScriptBody body = new ScriptBody(data.factory);
statements(data, body, true);
return body;
} | class class_name[name] begin[{]
method[statements, return_type[type[Body]], modifier[final protected], parameter[data]] begin[{]
local_variable[type[ScriptBody], body]
call[.statements, parameter[member[.data], member[.body], literal[true]]]
return[member[.body]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[Body] identifier[statements] operator[SEP] identifier[Data] identifier[data] operator[SEP] Keyword[throws] identifier[TemplateException] {
identifier[ScriptBody] identifier[body] operator[=] Keyword[new] identifier[ScriptBody] operator[SEP] identifier[data] operator[SEP] identifier[factory] operator[SEP] operator[SEP] identifier[statements] operator[SEP] identifier[data] , identifier[body] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[body] operator[SEP]
}
|
@Override
public Appendable append(CharSequence csq, int start, int end) {
final int otherLen = end - start;
grow(this.len + otherLen);
for (int pos = start; pos < end; pos++) {
this.value[this.len + pos] = csq.charAt(pos);
}
this.len += otherLen;
return this;
} | class class_name[name] begin[{]
method[append, return_type[type[Appendable]], modifier[public], parameter[csq, start, end]] begin[{]
local_variable[type[int], otherLen]
call[.grow, parameter[binary_operation[THIS[member[None.len]], +, member[.otherLen]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=value, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=len, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), type==, value=MethodInvocation(arguments=[MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=csq, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=pos)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=pos, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[THIS[member[None.len]], member[.otherLen]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Appendable] identifier[append] operator[SEP] identifier[CharSequence] identifier[csq] , Keyword[int] identifier[start] , Keyword[int] identifier[end] operator[SEP] {
Keyword[final] Keyword[int] identifier[otherLen] operator[=] identifier[end] operator[-] identifier[start] operator[SEP] identifier[grow] operator[SEP] Keyword[this] operator[SEP] identifier[len] operator[+] identifier[otherLen] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[pos] operator[=] identifier[start] operator[SEP] identifier[pos] operator[<] identifier[end] operator[SEP] identifier[pos] operator[++] operator[SEP] {
Keyword[this] operator[SEP] identifier[value] operator[SEP] Keyword[this] operator[SEP] identifier[len] operator[+] identifier[pos] operator[SEP] operator[=] identifier[csq] operator[SEP] identifier[charAt] operator[SEP] identifier[pos] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[len] operator[+=] identifier[otherLen] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session,
Long adGroupId) throws RemoteException {
// Build a new ProductPartitionTree using the ad group's current set of criteria.
ProductPartitionTree partitionTree =
ProductPartitionTree.createAdGroupTree(adWordsServices, session, adGroupId);
System.out.printf("Original tree:%n%s%n", partitionTree);
// Clear out any existing criteria.
ProductPartitionNode rootNode = partitionTree.getRoot().removeAllChildren();
// Make the root node a subdivision.
rootNode = rootNode.asSubdivision();
// Add a unit node for condition = NEW.
rootNode.addChild(
ProductDimensions.createCanonicalCondition(ProductCanonicalConditionCondition.NEW))
.asBiddableUnit().setBid(200000L);
// Add a unit node for condition = USED.
rootNode.addChild(
ProductDimensions.createCanonicalCondition(ProductCanonicalConditionCondition.USED))
.asBiddableUnit().setBid(100000L);
// Add a subdivision node for condition = null (everything else).
ProductPartitionNode otherConditionNode =
rootNode.addChild(ProductDimensions.createCanonicalCondition(null)).asSubdivision();
// Add a unit node under condition = null for brand = "CoolBrand".
otherConditionNode.addChild(ProductDimensions.createBrand("CoolBrand")).asBiddableUnit()
.setBid(900000L);
// Add a unit node under condition = null for brand = "CheapBrand".
otherConditionNode.addChild(ProductDimensions.createBrand("CheapBrand")).asBiddableUnit()
.setBid(10000L);
// Add a subdivision node under condition = null for brand = null (everything else).
ProductPartitionNode otherBrandNode =
otherConditionNode.addChild(ProductDimensions.createBrand(null)).asSubdivision();
// Add unit nodes under condition = null/brand = null.
// The value for each bidding category is a fixed ID for a specific
// category. You can retrieve IDs for categories from the ConstantDataService.
// See the 'GetProductCategoryTaxonomy' example for more details.
// Add a unit node under condition = null/brand = null for product type
// level 1 = 'Luggage & Bags'.
otherBrandNode.addChild(ProductDimensions.createBiddingCategory(
ProductDimensionType.BIDDING_CATEGORY_L1, -5914235892932915235L)).asBiddableUnit()
.setBid(750000L);
// Add a unit node under condition = null/brand = null for product type
// level 1 = null (everything else).
otherBrandNode.addChild(
ProductDimensions.createBiddingCategory(ProductDimensionType.BIDDING_CATEGORY_L1, null))
.asBiddableUnit().setBid(110000L);
// Get the ad group criterion service.
AdGroupCriterionServiceInterface adGroupCriterionService =
adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
// Make the mutate request, using the operations returned by the ProductPartitionTree.
List<AdGroupCriterionOperation> mutateOperations = partitionTree.getMutateOperations();
if (mutateOperations.isEmpty()) {
System.out.println("Skipping the mutate call because the original tree and the current tree "
+ "are logically identical.");
} else {
adGroupCriterionService.mutate(mutateOperations.toArray(new AdGroupCriterionOperation[0]));
}
// The request was successful, so create a new ProductPartitionTree based on the updated state
// of the ad group.
partitionTree = ProductPartitionTree.createAdGroupTree(adWordsServices, session, adGroupId);
// Show the tree
System.out.printf("Updated tree:%n%s%n", partitionTree);
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adWordsServices, session, adGroupId]] begin[{]
local_variable[type[ProductPartitionTree], partitionTree]
call[System.out.printf, parameter[literal["Original tree:%n%s%n"], member[.partitionTree]]]
local_variable[type[ProductPartitionNode], rootNode]
assign[member[.rootNode], call[rootNode.asSubdivision, parameter[]]]
call[rootNode.addChild, parameter[call[ProductDimensions.createCanonicalCondition, parameter[member[ProductCanonicalConditionCondition.NEW]]]]]
call[rootNode.addChild, parameter[call[ProductDimensions.createCanonicalCondition, parameter[member[ProductCanonicalConditionCondition.USED]]]]]
local_variable[type[ProductPartitionNode], otherConditionNode]
call[otherConditionNode.addChild, parameter[call[ProductDimensions.createBrand, parameter[literal["CoolBrand"]]]]]
call[otherConditionNode.addChild, parameter[call[ProductDimensions.createBrand, parameter[literal["CheapBrand"]]]]]
local_variable[type[ProductPartitionNode], otherBrandNode]
call[otherBrandNode.addChild, parameter[call[ProductDimensions.createBiddingCategory, parameter[member[ProductDimensionType.BIDDING_CATEGORY_L1], literal[5914235892932915235L]]]]]
call[otherBrandNode.addChild, parameter[call[ProductDimensions.createBiddingCategory, parameter[member[ProductDimensionType.BIDDING_CATEGORY_L1], literal[null]]]]]
local_variable[type[AdGroupCriterionServiceInterface], adGroupCriterionService]
local_variable[type[List], mutateOperations]
if[call[mutateOperations.isEmpty, parameter[]]] begin[{]
call[System.out.println, parameter[binary_operation[literal["Skipping the mutate call because the original tree and the current tree "], +, literal["are logically identical."]]]]
else begin[{]
call[adGroupCriterionService.mutate, parameter[call[mutateOperations.toArray, parameter[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AdGroupCriterionOperation, sub_type=None))]]]]
end[}]
assign[member[.partitionTree], call[ProductPartitionTree.createAdGroupTree, parameter[member[.adWordsServices], member[.session], member[.adGroupId]]]]
call[System.out.printf, parameter[literal["Updated tree:%n%s%n"], member[.partitionTree]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] , identifier[Long] identifier[adGroupId] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[ProductPartitionTree] identifier[partitionTree] operator[=] identifier[ProductPartitionTree] operator[SEP] identifier[createAdGroupTree] operator[SEP] identifier[adWordsServices] , identifier[session] , identifier[adGroupId] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[partitionTree] operator[SEP] operator[SEP] identifier[ProductPartitionNode] identifier[rootNode] operator[=] identifier[partitionTree] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[SEP] identifier[removeAllChildren] operator[SEP] operator[SEP] operator[SEP] identifier[rootNode] operator[=] identifier[rootNode] operator[SEP] identifier[asSubdivision] operator[SEP] operator[SEP] operator[SEP] identifier[rootNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createCanonicalCondition] operator[SEP] identifier[ProductCanonicalConditionCondition] operator[SEP] identifier[NEW] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[200000L] operator[SEP] operator[SEP] identifier[rootNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createCanonicalCondition] operator[SEP] identifier[ProductCanonicalConditionCondition] operator[SEP] identifier[USED] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[100000L] operator[SEP] operator[SEP] identifier[ProductPartitionNode] identifier[otherConditionNode] operator[=] identifier[rootNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createCanonicalCondition] operator[SEP] Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[asSubdivision] operator[SEP] operator[SEP] operator[SEP] identifier[otherConditionNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createBrand] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[900000L] operator[SEP] operator[SEP] identifier[otherConditionNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createBrand] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[10000L] operator[SEP] operator[SEP] identifier[ProductPartitionNode] identifier[otherBrandNode] operator[=] identifier[otherConditionNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createBrand] operator[SEP] Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[asSubdivision] operator[SEP] operator[SEP] operator[SEP] identifier[otherBrandNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createBiddingCategory] operator[SEP] identifier[ProductDimensionType] operator[SEP] identifier[BIDDING_CATEGORY_L1] , operator[-] Other[5914235892932915235L] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[750000L] operator[SEP] operator[SEP] identifier[otherBrandNode] operator[SEP] identifier[addChild] operator[SEP] identifier[ProductDimensions] operator[SEP] identifier[createBiddingCategory] operator[SEP] identifier[ProductDimensionType] operator[SEP] identifier[BIDDING_CATEGORY_L1] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[asBiddableUnit] operator[SEP] operator[SEP] operator[SEP] identifier[setBid] operator[SEP] Other[110000L] operator[SEP] operator[SEP] identifier[AdGroupCriterionServiceInterface] identifier[adGroupCriterionService] operator[=] identifier[adWordsServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[AdGroupCriterionServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[AdGroupCriterionOperation] operator[>] identifier[mutateOperations] operator[=] identifier[partitionTree] operator[SEP] identifier[getMutateOperations] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mutateOperations] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[adGroupCriterionService] operator[SEP] identifier[mutate] operator[SEP] identifier[mutateOperations] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[AdGroupCriterionOperation] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[partitionTree] operator[=] identifier[ProductPartitionTree] operator[SEP] identifier[createAdGroupTree] operator[SEP] identifier[adWordsServices] , identifier[session] , identifier[adGroupId] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[partitionTree] operator[SEP] operator[SEP]
}
|
public static JComponent createButtonBar(Object[] groupMembers) {
CommandGroupFactoryBean commandGroupFactoryBean = new CommandGroupFactoryBean(
null, groupMembers);
// CommandGroup dialogCommandGroup =
// CommandGroup.createCommandGroup(null,
// groupMembers);
CommandGroup dialogCommandGroup = commandGroupFactoryBean
.getCommandGroup();
JComponent buttonBar = dialogCommandGroup.createButtonBar();
GuiStandardUtils.attachDialogBorder(buttonBar);
return buttonBar;
} | class class_name[name] begin[{]
method[createButtonBar, return_type[type[JComponent]], modifier[public static], parameter[groupMembers]] begin[{]
local_variable[type[CommandGroupFactoryBean], commandGroupFactoryBean]
local_variable[type[CommandGroup], dialogCommandGroup]
local_variable[type[JComponent], buttonBar]
call[GuiStandardUtils.attachDialogBorder, parameter[member[.buttonBar]]]
return[member[.buttonBar]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JComponent] identifier[createButtonBar] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[groupMembers] operator[SEP] {
identifier[CommandGroupFactoryBean] identifier[commandGroupFactoryBean] operator[=] Keyword[new] identifier[CommandGroupFactoryBean] operator[SEP] Other[null] , identifier[groupMembers] operator[SEP] operator[SEP] identifier[CommandGroup] identifier[dialogCommandGroup] operator[=] identifier[commandGroupFactoryBean] operator[SEP] identifier[getCommandGroup] operator[SEP] operator[SEP] operator[SEP] identifier[JComponent] identifier[buttonBar] operator[=] identifier[dialogCommandGroup] operator[SEP] identifier[createButtonBar] operator[SEP] operator[SEP] operator[SEP] identifier[GuiStandardUtils] operator[SEP] identifier[attachDialogBorder] operator[SEP] identifier[buttonBar] operator[SEP] operator[SEP] Keyword[return] identifier[buttonBar] operator[SEP]
}
|
public void start() throws Throwable
{
if (!running.get())
{
InetSocketAddress address = new InetSocketAddress(bindAddress, bindPort);
ss = new ServerSocket();
ss.bind(address);
executorService = Executors.newCachedThreadPool();
running.set(true);
executorService.submit(this);
}
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
if[call[running.get, parameter[]]] begin[{]
local_variable[type[InetSocketAddress], address]
assign[member[.ss], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServerSocket, sub_type=None))]
call[ss.bind, parameter[member[.address]]]
assign[member[.executorService], call[Executors.newCachedThreadPool, parameter[]]]
call[running.set, parameter[literal[true]]]
call[executorService.submit, parameter[THIS[]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] Keyword[throws] identifier[Throwable] {
Keyword[if] operator[SEP] operator[!] identifier[running] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
identifier[InetSocketAddress] identifier[address] operator[=] Keyword[new] identifier[InetSocketAddress] operator[SEP] identifier[bindAddress] , identifier[bindPort] operator[SEP] operator[SEP] identifier[ss] operator[=] Keyword[new] identifier[ServerSocket] operator[SEP] operator[SEP] operator[SEP] identifier[ss] operator[SEP] identifier[bind] operator[SEP] identifier[address] operator[SEP] operator[SEP] identifier[executorService] operator[=] identifier[Executors] operator[SEP] identifier[newCachedThreadPool] operator[SEP] operator[SEP] operator[SEP] identifier[running] operator[SEP] identifier[set] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[executorService] operator[SEP] identifier[submit] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
}
|
public String decryptStr(byte[] bytes, Charset charset) {
return StrUtil.str(decrypt(bytes), charset);
} | class class_name[name] begin[{]
method[decryptStr, return_type[type[String]], modifier[public], parameter[bytes, charset]] begin[{]
return[call[StrUtil.str, parameter[call[.decrypt, parameter[member[.bytes]]], member[.charset]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[decryptStr] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] , identifier[Charset] identifier[charset] operator[SEP] {
Keyword[return] identifier[StrUtil] operator[SEP] identifier[str] operator[SEP] identifier[decrypt] operator[SEP] identifier[bytes] operator[SEP] , identifier[charset] operator[SEP] operator[SEP]
}
|
public static Version parseVersion(ModelNode modelNode) {
if (modelNode.hasDefined(MANAGEMENT_MAJOR_VERSION) &&
modelNode.hasDefined(MANAGEMENT_MINOR_VERSION) &&
modelNode.hasDefined(MANAGEMENT_MICRO_VERSION)) {
int major = modelNode.get(MANAGEMENT_MAJOR_VERSION).asInt();
int minor = modelNode.get(MANAGEMENT_MINOR_VERSION).asInt();
int micro = modelNode.get(MANAGEMENT_MICRO_VERSION).asInt();
return Version.forIntegers(major, minor, micro);
}
return Version.UNDEFINED;
} | class class_name[name] begin[{]
method[parseVersion, return_type[type[Version]], modifier[public static], parameter[modelNode]] begin[{]
if[binary_operation[binary_operation[call[modelNode.hasDefined, parameter[member[.MANAGEMENT_MAJOR_VERSION]]], &&, call[modelNode.hasDefined, parameter[member[.MANAGEMENT_MINOR_VERSION]]]], &&, call[modelNode.hasDefined, parameter[member[.MANAGEMENT_MICRO_VERSION]]]]] begin[{]
local_variable[type[int], major]
local_variable[type[int], minor]
local_variable[type[int], micro]
return[call[Version.forIntegers, parameter[member[.major], member[.minor], member[.micro]]]]
else begin[{]
None
end[}]
return[member[Version.UNDEFINED]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Version] identifier[parseVersion] operator[SEP] identifier[ModelNode] identifier[modelNode] operator[SEP] {
Keyword[if] operator[SEP] identifier[modelNode] operator[SEP] identifier[hasDefined] operator[SEP] identifier[MANAGEMENT_MAJOR_VERSION] operator[SEP] operator[&&] identifier[modelNode] operator[SEP] identifier[hasDefined] operator[SEP] identifier[MANAGEMENT_MINOR_VERSION] operator[SEP] operator[&&] identifier[modelNode] operator[SEP] identifier[hasDefined] operator[SEP] identifier[MANAGEMENT_MICRO_VERSION] operator[SEP] operator[SEP] {
Keyword[int] identifier[major] operator[=] identifier[modelNode] operator[SEP] identifier[get] operator[SEP] identifier[MANAGEMENT_MAJOR_VERSION] operator[SEP] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[minor] operator[=] identifier[modelNode] operator[SEP] identifier[get] operator[SEP] identifier[MANAGEMENT_MINOR_VERSION] operator[SEP] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[micro] operator[=] identifier[modelNode] operator[SEP] identifier[get] operator[SEP] identifier[MANAGEMENT_MICRO_VERSION] operator[SEP] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Version] operator[SEP] identifier[forIntegers] operator[SEP] identifier[major] , identifier[minor] , identifier[micro] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Version] operator[SEP] identifier[UNDEFINED] operator[SEP]
}
|
public static PrimitiveIterator.OfInt iterator(Spliterator.OfInt spliterator) {
Objects.requireNonNull(spliterator);
class Adapter implements PrimitiveIterator.OfInt, IntConsumer {
boolean valueReady = false;
int nextElement;
@Override
public void accept(int t) {
valueReady = true;
nextElement = t;
}
@Override
public boolean hasNext() {
if (!valueReady)
spliterator.tryAdvance(this);
return valueReady;
}
@Override
public int nextInt() {
if (!valueReady && !hasNext())
throw new NoSuchElementException();
else {
valueReady = false;
return nextElement;
}
}
}
return new Adapter();
} | class class_name[name] begin[{]
method[iterator, return_type[type[PrimitiveIterator]], modifier[public static], parameter[spliterator]] begin[{]
call[Objects.requireNonNull, parameter[member[.spliterator]]]
class class_name[Adapter] begin[{]
type[boolean] field[valueReady]
type[int] field[nextElement]
method[accept, return_type[void], modifier[public], parameter[t]] begin[{]
assign[member[.valueReady], literal[true]]
assign[member[.nextElement], member[.t]]
end[}]
method[hasNext, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[member[.valueReady]] begin[{]
call[spliterator.tryAdvance, parameter[THIS[]]]
else begin[{]
None
end[}]
return[member[.valueReady]]
end[}]
method[nextInt, return_type[type[int]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.valueReady], &&, call[.hasNext, parameter[]]]] 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=NoSuchElementException, sub_type=None)), label=None)
else begin[{]
assign[member[.valueReady], literal[false]]
return[member[.nextElement]]
end[}]
end[}]
END[}]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Adapter, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PrimitiveIterator] operator[SEP] identifier[OfInt] identifier[iterator] operator[SEP] identifier[Spliterator] operator[SEP] identifier[OfInt] identifier[spliterator] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[spliterator] operator[SEP] operator[SEP] Keyword[class] identifier[Adapter] Keyword[implements] identifier[PrimitiveIterator] operator[SEP] identifier[OfInt] , identifier[IntConsumer] {
Keyword[boolean] identifier[valueReady] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[nextElement] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[accept] operator[SEP] Keyword[int] identifier[t] operator[SEP] {
identifier[valueReady] operator[=] literal[boolean] operator[SEP] identifier[nextElement] operator[=] identifier[t] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[valueReady] operator[SEP] identifier[spliterator] operator[SEP] identifier[tryAdvance] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[valueReady] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[nextInt] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[valueReady] operator[&&] operator[!] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP] Keyword[else] {
identifier[valueReady] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[nextElement] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[Adapter] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Method bestMatchingMethod(Collection<Method> methods, String methodName, Class[] types) {
if (methods == null || StringUtils.isNullOrBlank(methodName) || types == null) {
return null;
}
for (Method method : methods) {
if (method.getName().equals(methodName) && typesMatch(method.getParameterTypes(), types)) {
return method;
}
}
return null;
} | class class_name[name] begin[{]
method[bestMatchingMethod, return_type[type[Method]], modifier[public static], parameter[methods, methodName, types]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.methods], ==, literal[null]], ||, call[StringUtils.isNullOrBlank, parameter[member[.methodName]]]], ||, binary_operation[member[.types], ==, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=typesMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=methods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Method] identifier[bestMatchingMethod] operator[SEP] identifier[Collection] operator[<] identifier[Method] operator[>] identifier[methods] , identifier[String] identifier[methodName] , identifier[Class] operator[SEP] operator[SEP] identifier[types] operator[SEP] {
Keyword[if] operator[SEP] identifier[methods] operator[==] Other[null] operator[||] identifier[StringUtils] operator[SEP] identifier[isNullOrBlank] operator[SEP] identifier[methodName] operator[SEP] operator[||] identifier[types] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[methods] operator[SEP] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[methodName] operator[SEP] operator[&&] identifier[typesMatch] operator[SEP] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] , identifier[types] operator[SEP] operator[SEP] {
Keyword[return] identifier[method] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <R> Fallback<R> ofAsync(CheckedFunction<ExecutionAttemptedEvent<? extends R>, ? extends R> fallback) {
return new Fallback<>(Assert.notNull((CheckedFunction) fallback, "fallback"), true);
} | class class_name[name] begin[{]
method[ofAsync, return_type[type[Fallback]], modifier[public static], parameter[fallback]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=fallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CheckedFunction, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="fallback")], member=notNull, postfix_operators=[], prefix_operators=[], qualifier=Assert, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Fallback, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[R] operator[>] identifier[Fallback] operator[<] identifier[R] operator[>] identifier[ofAsync] operator[SEP] identifier[CheckedFunction] operator[<] identifier[ExecutionAttemptedEvent] operator[<] operator[?] Keyword[extends] identifier[R] operator[>] , operator[?] Keyword[extends] identifier[R] operator[>] identifier[fallback] operator[SEP] {
Keyword[return] Keyword[new] identifier[Fallback] operator[<] operator[>] operator[SEP] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] operator[SEP] identifier[CheckedFunction] operator[SEP] identifier[fallback] , literal[String] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
|
public OutputStream decorateLogger(@Nonnull Computer computer, OutputStream logger) throws IOException, InterruptedException {
return logger; // by default no-op
} | class class_name[name] begin[{]
method[decorateLogger, return_type[type[OutputStream]], modifier[public], parameter[computer, logger]] begin[{]
return[member[.logger]]
end[}]
END[}] | Keyword[public] identifier[OutputStream] identifier[decorateLogger] operator[SEP] annotation[@] identifier[Nonnull] identifier[Computer] identifier[computer] , identifier[OutputStream] identifier[logger] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
Keyword[return] identifier[logger] operator[SEP]
}
|
private static <T> void putArray(CacheMap<T> cache, T array, int size) {
// Small arrays aren't cached.
if (size < CACHEABLE_SIZE_MIN)
return;
CyclicStack<Reference<T>> stack;
synchronized(cache) {
// Get a stack that holds arrays of T[size]. If no such stack
// exists, allocate a new one. If the cache already had STACKS_MAX
// number of stacks, the least recently used stack is removed by
// cache.put (it calls removeEldestEntry).
stack = cache.get(size);
if (stack == null) {
stack = new CyclicStack<Reference<T>>();
cache.put(size, stack);
}
}
stack.push(new SoftReference<T>(array));
} | class class_name[name] begin[{]
method[putArray, return_type[void], modifier[private static], parameter[cache, array, size]] begin[{]
if[binary_operation[member[.size], <, member[.CACHEABLE_SIZE_MIN]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[CyclicStack], stack]
SYNCHRONIZED[member[.cache]] BEGIN[{]
assign[member[.stack], call[cache.get, parameter[member[.size]]]]
if[binary_operation[member[.stack], ==, literal[null]]] begin[{]
assign[member[.stack], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Reference, sub_type=None))], dimensions=None, name=CyclicStack, sub_type=None))]
call[cache.put, parameter[member[.size], member[.stack]]]
else begin[{]
None
end[}]
END[}]
call[stack.push, parameter[ClassCreator(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=SoftReference, sub_type=None))]]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[putArray] operator[SEP] identifier[CacheMap] operator[<] identifier[T] operator[>] identifier[cache] , identifier[T] identifier[array] , Keyword[int] identifier[size] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[<] identifier[CACHEABLE_SIZE_MIN] operator[SEP] Keyword[return] operator[SEP] identifier[CyclicStack] operator[<] identifier[Reference] operator[<] identifier[T] operator[>] operator[>] identifier[stack] operator[SEP] Keyword[synchronized] operator[SEP] identifier[cache] operator[SEP] {
identifier[stack] operator[=] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[size] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stack] operator[==] Other[null] operator[SEP] {
identifier[stack] operator[=] Keyword[new] identifier[CyclicStack] operator[<] identifier[Reference] operator[<] identifier[T] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[cache] operator[SEP] identifier[put] operator[SEP] identifier[size] , identifier[stack] operator[SEP] operator[SEP]
}
}
identifier[stack] operator[SEP] identifier[push] operator[SEP] Keyword[new] identifier[SoftReference] operator[<] identifier[T] operator[>] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
private void setupSubjects(List<Subject> subjects) throws ParsingException {
// make sure that there is at least one Subject
if (subjects.size() == 0)
throw new ParsingException("Request must a contain subject");
// now go through the subject attributes
Iterator<Subject> it = subjects.iterator();
while (it.hasNext()) {
Subject subject = it.next();
URI category = subject.getCategory();
Map<String, List<Attribute>> categoryMap = null;
// see if we've already got a map for the category
if (subjectMap.containsKey(category)) {
categoryMap = subjectMap.get(category);
} else {
categoryMap = new HashMap<String, List<Attribute>>();
subjectMap.put(category, categoryMap);
}
// iterate over the set of attributes
Iterator attrIterator = subject.getAttributesAsList().iterator();
while (attrIterator.hasNext()) {
Attribute attr = (Attribute)(attrIterator.next());
String id = attr.getId().toString();
if (categoryMap.containsKey(id)) {
// add to the existing set of Attributes w/this id
List existingIds = (List)(categoryMap.get(id));
existingIds.add(attr);
} else {
// this is the first Attr w/this id
List newIds = new ArrayList();
newIds.add(attr);
categoryMap.put(id, newIds);
}
}
}
} | class class_name[name] begin[{]
method[setupSubjects, return_type[void], modifier[private], parameter[subjects]] begin[{]
if[binary_operation[call[subjects.size, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Request must a contain subject")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParsingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[Subject], subject]
local_variable[type[URI], category]
local_variable[type[Map], categoryMap]
if[call[subjectMap.containsKey, parameter[member[.category]]]] begin[{]
assign[member[.categoryMap], call[subjectMap.get, parameter[member[.category]]]]
else begin[{]
assign[member[.categoryMap], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
call[subjectMap.put, parameter[member[.category], member[.categoryMap]]]
end[}]
local_variable[type[Iterator], attrIterator]
while[call[attrIterator.hasNext, parameter[]]] begin[{]
local_variable[type[Attribute], attr]
local_variable[type[String], id]
if[call[categoryMap.containsKey, parameter[member[.id]]]] begin[{]
local_variable[type[List], existingIds]
call[existingIds.add, parameter[member[.attr]]]
else begin[{]
local_variable[type[List], newIds]
call[newIds.add, parameter[member[.attr]]]
call[categoryMap.put, parameter[member[.id], member[.newIds]]]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setupSubjects] operator[SEP] identifier[List] operator[<] identifier[Subject] operator[>] identifier[subjects] operator[SEP] Keyword[throws] identifier[ParsingException] {
Keyword[if] operator[SEP] identifier[subjects] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[ParsingException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Subject] operator[>] identifier[it] operator[=] identifier[subjects] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Subject] identifier[subject] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[URI] identifier[category] operator[=] identifier[subject] operator[SEP] identifier[getCategory] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[Attribute] operator[>] operator[>] identifier[categoryMap] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[subjectMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[category] operator[SEP] operator[SEP] {
identifier[categoryMap] operator[=] identifier[subjectMap] operator[SEP] identifier[get] operator[SEP] identifier[category] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[categoryMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[List] operator[<] identifier[Attribute] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[subjectMap] operator[SEP] identifier[put] operator[SEP] identifier[category] , identifier[categoryMap] operator[SEP] operator[SEP]
}
identifier[Iterator] identifier[attrIterator] operator[=] identifier[subject] operator[SEP] identifier[getAttributesAsList] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[attrIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Attribute] identifier[attr] operator[=] operator[SEP] identifier[Attribute] operator[SEP] operator[SEP] identifier[attrIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[id] operator[=] identifier[attr] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[categoryMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[id] operator[SEP] operator[SEP] {
identifier[List] identifier[existingIds] operator[=] operator[SEP] identifier[List] operator[SEP] operator[SEP] identifier[categoryMap] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] identifier[existingIds] operator[SEP] identifier[add] operator[SEP] identifier[attr] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] identifier[newIds] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[newIds] operator[SEP] identifier[add] operator[SEP] identifier[attr] operator[SEP] operator[SEP] identifier[categoryMap] operator[SEP] identifier[put] operator[SEP] identifier[id] , identifier[newIds] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public <NV extends NumberVector> NV projectRelativeScaledToDataSpace(double[] v, NumberVector.Factory<NV> prototype) {
final int dim = v.length;
double[] vec = new double[dim];
for(int d = 0; d < dim; d++) {
vec[d] = scales[d].getRelativeUnscaled(v[d]);
}
return prototype.newNumberVector(vec);
} | class class_name[name] begin[{]
method[projectRelativeScaledToDataSpace, return_type[type[NV]], modifier[public], parameter[v, prototype]] begin[{]
local_variable[type[int], dim]
local_variable[type[double], vec]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=vec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=scales, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getRelativeUnscaled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dim, 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=d)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=d, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[prototype.newNumberVector, parameter[member[.vec]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[NV] Keyword[extends] identifier[NumberVector] operator[>] identifier[NV] identifier[projectRelativeScaledToDataSpace] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[v] , identifier[NumberVector] operator[SEP] identifier[Factory] operator[<] identifier[NV] operator[>] identifier[prototype] operator[SEP] {
Keyword[final] Keyword[int] identifier[dim] operator[=] identifier[v] operator[SEP] identifier[length] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[vec] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[dim] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[d] operator[=] Other[0] operator[SEP] identifier[d] operator[<] identifier[dim] operator[SEP] identifier[d] operator[++] operator[SEP] {
identifier[vec] operator[SEP] identifier[d] operator[SEP] operator[=] identifier[scales] operator[SEP] identifier[d] operator[SEP] operator[SEP] identifier[getRelativeUnscaled] operator[SEP] identifier[v] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[prototype] operator[SEP] identifier[newNumberVector] operator[SEP] identifier[vec] operator[SEP] operator[SEP]
}
|
private NavigationCase createNavigationCase(String fromViewId, String outcome, String toViewId)
{
return new NavigationCase(fromViewId, null, outcome, null, toViewId, null, false, false);
} | class class_name[name] begin[{]
method[createNavigationCase, return_type[type[NavigationCase]], modifier[private], parameter[fromViewId, outcome, toViewId]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=fromViewId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=outcome, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=toViewId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NavigationCase, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[NavigationCase] identifier[createNavigationCase] operator[SEP] identifier[String] identifier[fromViewId] , identifier[String] identifier[outcome] , identifier[String] identifier[toViewId] operator[SEP] {
Keyword[return] Keyword[new] identifier[NavigationCase] operator[SEP] identifier[fromViewId] , Other[null] , identifier[outcome] , Other[null] , identifier[toViewId] , Other[null] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
public CloudhopperBuilder interfaceVersion(String... version) {
for (String v : version) {
if (v != null) {
interfaceVersions.add(v);
}
}
return this;
} | class class_name[name] begin[{]
method[interfaceVersion, return_type[type[CloudhopperBuilder]], modifier[public], parameter[version]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=v, 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=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=interfaceVersions, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CloudhopperBuilder] identifier[interfaceVersion] operator[SEP] identifier[String] operator[...] identifier[version] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[v] operator[:] identifier[version] operator[SEP] {
Keyword[if] operator[SEP] identifier[v] operator[!=] Other[null] operator[SEP] {
identifier[interfaceVersions] operator[SEP] identifier[add] operator[SEP] identifier[v] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public boolean setSection(String sectionName)
{
if(sectionNames == null) {
System.err.println(errMsg);
return (false);
}
int sectionIndex = 0;
Enumeration e = sectionNames.elements();
boolean done = false;
while(!done && e.hasMoreElements()) {
String thisName = (String) e.nextElement();
if(sectionName.equalsIgnoreCase(thisName))
done = true;
else
sectionIndex++;
}
if(!done)
return (false);
currentSection = sectionIndex;
return (true);
} | class class_name[name] begin[{]
method[setSection, return_type[type[boolean]], modifier[public], parameter[sectionName]] begin[{]
if[binary_operation[member[.sectionNames], ==, literal[null]]] begin[{]
call[System.err.println, parameter[member[.errMsg]]]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], sectionIndex]
local_variable[type[Enumeration], e]
local_variable[type[boolean], done]
while[binary_operation[member[.done], &&, call[e.hasMoreElements, parameter[]]]] begin[{]
local_variable[type[String], thisName]
if[call[sectionName.equalsIgnoreCase, parameter[member[.thisName]]]] begin[{]
assign[member[.done], literal[true]]
else begin[{]
member[.sectionIndex]
end[}]
end[}]
if[member[.done]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.currentSection], member[.sectionIndex]]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[setSection] operator[SEP] identifier[String] identifier[sectionName] operator[SEP] {
Keyword[if] operator[SEP] identifier[sectionNames] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[errMsg] operator[SEP] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[int] identifier[sectionIndex] operator[=] Other[0] operator[SEP] identifier[Enumeration] identifier[e] operator[=] identifier[sectionNames] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[done] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[done] operator[&&] identifier[e] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[thisName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[e] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sectionName] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[thisName] operator[SEP] operator[SEP] identifier[done] operator[=] literal[boolean] operator[SEP] Keyword[else] identifier[sectionIndex] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[done] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[currentSection] operator[=] identifier[sectionIndex] operator[SEP] Keyword[return] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public static String getDigest(String oid) {
String ret = (String)digestNames.get(oid);
if (ret == null)
return oid;
else
return ret;
} | class class_name[name] begin[{]
method[getDigest, return_type[type[String]], modifier[public static], parameter[oid]] begin[{]
local_variable[type[String], ret]
if[binary_operation[member[.ret], ==, literal[null]]] begin[{]
return[member[.oid]]
else begin[{]
return[member[.ret]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getDigest] operator[SEP] identifier[String] identifier[oid] operator[SEP] {
identifier[String] identifier[ret] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[digestNames] operator[SEP] identifier[get] operator[SEP] identifier[oid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] operator[==] Other[null] operator[SEP] Keyword[return] identifier[oid] operator[SEP] Keyword[else] Keyword[return] identifier[ret] operator[SEP]
}
|
public Matrix4x3d mul(Matrix4x3dc right, Matrix4x3d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.set(right);
else if ((right.properties() & PROPERTY_IDENTITY) != 0)
return dest.set(this);
else if ((properties & PROPERTY_TRANSLATION) != 0)
return mulTranslation(right, dest);
return mulGeneric(right, dest);
} | class class_name[name] begin[{]
method[mul, return_type[type[Matrix4x3d]], modifier[public], parameter[right, dest]] begin[{]
if[binary_operation[binary_operation[member[.properties], &, member[.PROPERTY_IDENTITY]], !=, literal[0]]] begin[{]
return[call[dest.set, parameter[member[.right]]]]
else begin[{]
if[binary_operation[binary_operation[call[right.properties, parameter[]], &, member[.PROPERTY_IDENTITY]], !=, literal[0]]] begin[{]
return[call[dest.set, parameter[THIS[]]]]
else begin[{]
if[binary_operation[binary_operation[member[.properties], &, member[.PROPERTY_TRANSLATION]], !=, literal[0]]] begin[{]
return[call[.mulTranslation, parameter[member[.right], member[.dest]]]]
else begin[{]
None
end[}]
end[}]
end[}]
return[call[.mulGeneric, parameter[member[.right], member[.dest]]]]
end[}]
END[}] | Keyword[public] identifier[Matrix4x3d] identifier[mul] operator[SEP] identifier[Matrix4x3dc] identifier[right] , identifier[Matrix4x3d] identifier[dest] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[properties] operator[&] identifier[PROPERTY_IDENTITY] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[return] identifier[dest] operator[SEP] identifier[set] operator[SEP] identifier[right] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[right] operator[SEP] identifier[properties] operator[SEP] operator[SEP] operator[&] identifier[PROPERTY_IDENTITY] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[return] identifier[dest] operator[SEP] identifier[set] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[properties] operator[&] identifier[PROPERTY_TRANSLATION] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[return] identifier[mulTranslation] operator[SEP] identifier[right] , identifier[dest] operator[SEP] operator[SEP] Keyword[return] identifier[mulGeneric] operator[SEP] identifier[right] , identifier[dest] operator[SEP] operator[SEP]
}
|
protected void renderAccessibilityAttributes(FacesContext context, UIInput component) throws IOException {
renderAccessibilityAttributes(context, component, isDisabled(component), isReadOnly(component));
} | class class_name[name] begin[{]
method[renderAccessibilityAttributes, return_type[void], modifier[protected], parameter[context, component]] begin[{]
call[.renderAccessibilityAttributes, parameter[member[.context], member[.component], call[.isDisabled, parameter[member[.component]]], call[.isReadOnly, parameter[member[.component]]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[renderAccessibilityAttributes] operator[SEP] identifier[FacesContext] identifier[context] , identifier[UIInput] identifier[component] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[renderAccessibilityAttributes] operator[SEP] identifier[context] , identifier[component] , identifier[isDisabled] operator[SEP] identifier[component] operator[SEP] , identifier[isReadOnly] operator[SEP] identifier[component] operator[SEP] operator[SEP] operator[SEP]
}
|
public static TunnelingFeature newSet(final int channelId, final int seq, final InterfaceFeature featureId,
final byte... featureValue) {
return new TunnelingFeature(KNXnetIPHeader.TunnelingFeatureSet, channelId, seq, featureId, Success, featureValue);
} | class class_name[name] begin[{]
method[newSet, return_type[type[TunnelingFeature]], modifier[public static], parameter[channelId, seq, featureId, featureValue]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=TunnelingFeatureSet, postfix_operators=[], prefix_operators=[], qualifier=KNXnetIPHeader, selectors=[]), MemberReference(member=channelId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=Success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureValue, 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=TunnelingFeature, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TunnelingFeature] identifier[newSet] operator[SEP] Keyword[final] Keyword[int] identifier[channelId] , Keyword[final] Keyword[int] identifier[seq] , Keyword[final] identifier[InterfaceFeature] identifier[featureId] , Keyword[final] Keyword[byte] operator[...] identifier[featureValue] operator[SEP] {
Keyword[return] Keyword[new] identifier[TunnelingFeature] operator[SEP] identifier[KNXnetIPHeader] operator[SEP] identifier[TunnelingFeatureSet] , identifier[channelId] , identifier[seq] , identifier[featureId] , identifier[Success] , identifier[featureValue] operator[SEP] operator[SEP]
}
|
public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException {
final List<String> list = readLines(self);
T result = null;
for (String line : list) {
List vals = Arrays.asList(pattern.split(line));
result = closure.call(vals);
}
return result;
} | class class_name[name] begin[{]
method[splitEachLine, return_type[type[T]], modifier[public static], parameter[self, pattern, closure]] begin[{]
local_variable[type[List], list]
local_variable[type[T], result]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), name=vals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=vals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=call, postfix_operators=[], prefix_operators=[], qualifier=closure, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[splitEachLine] operator[SEP] identifier[CharSequence] identifier[self] , identifier[Pattern] identifier[pattern] , annotation[@] identifier[ClosureParams] operator[SEP] identifier[value] operator[=] identifier[FromString] operator[SEP] Keyword[class] , identifier[options] operator[=] literal[String] operator[SEP] identifier[Closure] operator[<] identifier[T] operator[>] identifier[closure] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[list] operator[=] identifier[readLines] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[T] identifier[result] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[line] operator[:] identifier[list] operator[SEP] {
identifier[List] identifier[vals] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[pattern] operator[SEP] identifier[split] operator[SEP] identifier[line] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[closure] operator[SEP] identifier[call] operator[SEP] identifier[vals] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public <T extends Annotation> boolean isAnnotationPresentOnSetter( Class<T> annotation ) {
return CreatorUtils.isAnnotationPresent( annotation, setters );
} | class class_name[name] begin[{]
method[isAnnotationPresentOnSetter, return_type[type[boolean]], modifier[public], parameter[annotation]] begin[{]
return[call[CreatorUtils.isAnnotationPresent, parameter[member[.annotation], member[.setters]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Annotation] operator[>] Keyword[boolean] identifier[isAnnotationPresentOnSetter] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[annotation] operator[SEP] {
Keyword[return] identifier[CreatorUtils] operator[SEP] identifier[isAnnotationPresent] operator[SEP] identifier[annotation] , identifier[setters] operator[SEP] operator[SEP]
}
|
@Override
public void serviceRequest(final Request request) {
// Get expected step count
UIContext uic = UIContextHolder.getCurrent();
int expected = uic.getEnvironment().getStep();
// Get step count from the request
int got = StepCountUtil.getRequestStep(request);
// Match (first time, both are zero)
// or no Step count and processing a GET
if (expected == got || (!StepCountUtil.isStepOnRequest(request) && "GET".equals(request.
getMethod()))) {
// Process Service Request
getBackingComponent().serviceRequest(request);
} else { // Invalid step
LOG.warn(
"SERVER: Wrong step detected. Expected step " + expected + " but got step " + got);
// Redirect to error page
if (StepCountUtil.isErrorRedirect()) {
String url = StepCountUtil.getErrorUrl();
LOG.warn("User will be redirected to an error page. URL: " + url);
try {
getResponse().sendRedirect(url);
} catch (IOException e) {
LOG.warn("Error trying to redirect for wrong step indicator.");
}
// Make sure the render phase is not processed
throw new ActionEscape();
} else { // Warp to the future
// Call handle step error
WComponent application = getUI();
if (application instanceof WApplication) {
LOG.warn("The handleStepError method will be called on WApplication.");
((WApplication) application).handleStepError();
}
LOG.warn("The render phase will warp the user back to the future.");
}
}
} | class class_name[name] begin[{]
method[serviceRequest, return_type[void], modifier[public], parameter[request]] begin[{]
local_variable[type[UIContext], uic]
local_variable[type[int], expected]
local_variable[type[int], got]
if[binary_operation[binary_operation[member[.expected], ==, member[.got]], ||, binary_operation[call[StepCountUtil.isStepOnRequest, parameter[member[.request]]], &&, literal["GET"]]]] begin[{]
call[.getBackingComponent, parameter[]]
else begin[{]
call[LOG.warn, parameter[binary_operation[binary_operation[binary_operation[literal["SERVER: Wrong step detected. Expected step "], +, member[.expected]], +, literal[" but got step "]], +, member[.got]]]]
if[call[StepCountUtil.isErrorRedirect, parameter[]]] begin[{]
local_variable[type[String], url]
call[LOG.warn, parameter[binary_operation[literal["User will be redirected to an error page. URL: "], +, member[.url]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendRedirect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error trying to redirect for wrong step indicator.")], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ActionEscape, sub_type=None)), label=None)
else begin[{]
local_variable[type[WComponent], application]
if[binary_operation[member[.application], instanceof, type[WApplication]]] begin[{]
call[LOG.warn, parameter[literal["The handleStepError method will be called on WApplication."]]]
Cast(expression=MemberReference(member=application, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=WApplication, sub_type=None))
else begin[{]
None
end[}]
call[LOG.warn, parameter[literal["The render phase will warp the user back to the future."]]]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[serviceRequest] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
identifier[UIContext] identifier[uic] operator[=] identifier[UIContextHolder] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[expected] operator[=] identifier[uic] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[getStep] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[got] operator[=] identifier[StepCountUtil] operator[SEP] identifier[getRequestStep] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expected] operator[==] identifier[got] operator[||] operator[SEP] operator[!] identifier[StepCountUtil] operator[SEP] identifier[isStepOnRequest] operator[SEP] identifier[request] operator[SEP] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[request] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[getBackingComponent] operator[SEP] operator[SEP] operator[SEP] identifier[serviceRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[expected] operator[+] literal[String] operator[+] identifier[got] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StepCountUtil] operator[SEP] identifier[isErrorRedirect] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[url] operator[=] identifier[StepCountUtil] operator[SEP] identifier[getErrorUrl] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[url] operator[SEP] operator[SEP] Keyword[try] {
identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[sendRedirect] operator[SEP] identifier[url] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[ActionEscape] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[WComponent] identifier[application] operator[=] identifier[getUI] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[application] Keyword[instanceof] identifier[WApplication] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[WApplication] operator[SEP] identifier[application] operator[SEP] operator[SEP] identifier[handleStepError] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public void marshall(CreatePipelineRequest createPipelineRequest, ProtocolMarshaller protocolMarshaller) {
if (createPipelineRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createPipelineRequest.getPipeline(), PIPELINE_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[createPipelineRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.createPipelineRequest], ==, 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=getPipeline, postfix_operators=[], prefix_operators=[], qualifier=createPipelineRequest, selectors=[], type_arguments=None), MemberReference(member=PIPELINE_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[CreatePipelineRequest] identifier[createPipelineRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[createPipelineRequest] 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[createPipelineRequest] operator[SEP] identifier[getPipeline] operator[SEP] operator[SEP] , identifier[PIPELINE_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
protected void extractRemainingMetaData(Element element, ParserContext context, MutableBeanMetadata beanMetadata)
throws Exception {
addPropertyValueFromElement("applicationName", element, context, beanMetadata);
beanMetadata.addProperty("injectionSource",
createStringValue(context, PaxWicketBeanInjectionSource.INJECTION_SOURCE_BLUEPRINT));
} | class class_name[name] begin[{]
method[extractRemainingMetaData, return_type[void], modifier[protected], parameter[element, context, beanMetadata]] begin[{]
call[.addPropertyValueFromElement, parameter[literal["applicationName"], member[.element], member[.context], member[.beanMetadata]]]
call[beanMetadata.addProperty, parameter[literal["injectionSource"], call[.createStringValue, parameter[member[.context], member[PaxWicketBeanInjectionSource.INJECTION_SOURCE_BLUEPRINT]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[extractRemainingMetaData] operator[SEP] identifier[Element] identifier[element] , identifier[ParserContext] identifier[context] , identifier[MutableBeanMetadata] identifier[beanMetadata] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[addPropertyValueFromElement] operator[SEP] literal[String] , identifier[element] , identifier[context] , identifier[beanMetadata] operator[SEP] operator[SEP] identifier[beanMetadata] operator[SEP] identifier[addProperty] operator[SEP] literal[String] , identifier[createStringValue] operator[SEP] identifier[context] , identifier[PaxWicketBeanInjectionSource] operator[SEP] identifier[INJECTION_SOURCE_BLUEPRINT] operator[SEP] operator[SEP] operator[SEP]
}
|
public JSONObject batchSynonyms(List<JSONObject> objects, boolean forwardToReplicas, boolean replaceExistingSynonyms, RequestOptions requestOptions) throws AlgoliaException {
JSONArray array = new JSONArray();
for (JSONObject obj : objects) {
array.put(obj);
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/synonyms/batch?forwardToReplicas=" + forwardToReplicas + "&replaceExistingSynonyms=" + replaceExistingSynonyms, array.toString(), true, false, requestOptions);
} | class class_name[name] begin[{]
method[batchSynonyms, return_type[type[JSONObject]], modifier[public], parameter[objects, forwardToReplicas, replaceExistingSynonyms, requestOptions]] begin[{]
local_variable[type[JSONArray], array]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=objects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None))), label=None)
return[call[client.postRequest, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["/1/indexes/"], +, member[.encodedIndexName]], +, literal["/synonyms/batch?forwardToReplicas="]], +, member[.forwardToReplicas]], +, literal["&replaceExistingSynonyms="]], +, member[.replaceExistingSynonyms]], call[array.toString, parameter[]], literal[true], literal[false], member[.requestOptions]]]]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[batchSynonyms] operator[SEP] identifier[List] operator[<] identifier[JSONObject] operator[>] identifier[objects] , Keyword[boolean] identifier[forwardToReplicas] , Keyword[boolean] identifier[replaceExistingSynonyms] , identifier[RequestOptions] identifier[requestOptions] operator[SEP] Keyword[throws] identifier[AlgoliaException] {
identifier[JSONArray] identifier[array] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[JSONObject] identifier[obj] operator[:] identifier[objects] operator[SEP] {
identifier[array] operator[SEP] identifier[put] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
Keyword[return] identifier[client] operator[SEP] identifier[postRequest] operator[SEP] literal[String] operator[+] identifier[encodedIndexName] operator[+] literal[String] operator[+] identifier[forwardToReplicas] operator[+] literal[String] operator[+] identifier[replaceExistingSynonyms] , identifier[array] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[boolean] , literal[boolean] , identifier[requestOptions] operator[SEP] operator[SEP]
}
|
public Array readData(Variable v2, Section section) throws IOException, InvalidRangeException {
// subset
Object data;
Array outputData;
byte[] vdata = null;
NOWRadheader.Vinfo vinfo;
ByteBuffer bos;
List<Range> ranges = section.getRanges();
vinfo = (NOWRadheader.Vinfo) v2.getSPobject();
vdata = headerParser.getData((int) vinfo.hoff);
bos = ByteBuffer.wrap(vdata);
data = readOneScanData(bos, vinfo, v2.getShortName());
outputData = Array.factory(v2.getDataType(), v2.getShape(), data);
outputData = outputData.flip(1);
// outputData = outputData.flip(2);
return (outputData.sectionNoReduce(ranges).copy());
// return outputData;
} | class class_name[name] begin[{]
method[readData, return_type[type[Array]], modifier[public], parameter[v2, section]] begin[{]
local_variable[type[Object], data]
local_variable[type[Array], outputData]
local_variable[type[byte], vdata]
local_variable[type[NOWRadheader], vinfo]
local_variable[type[ByteBuffer], bos]
local_variable[type[List], ranges]
assign[member[.vinfo], Cast(expression=MethodInvocation(arguments=[], member=getSPobject, postfix_operators=[], prefix_operators=[], qualifier=v2, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=NOWRadheader, sub_type=ReferenceType(arguments=None, dimensions=None, name=Vinfo, sub_type=None)))]
assign[member[.vdata], call[headerParser.getData, parameter[Cast(expression=MemberReference(member=hoff, postfix_operators=[], prefix_operators=[], qualifier=vinfo, selectors=[]), type=BasicType(dimensions=[], name=int))]]]
assign[member[.bos], call[ByteBuffer.wrap, parameter[member[.vdata]]]]
assign[member[.data], call[.readOneScanData, parameter[member[.bos], member[.vinfo], call[v2.getShortName, parameter[]]]]]
assign[member[.outputData], call[Array.factory, parameter[call[v2.getDataType, parameter[]], call[v2.getShape, parameter[]], member[.data]]]]
assign[member[.outputData], call[outputData.flip, parameter[literal[1]]]]
return[call[outputData.sectionNoReduce, parameter[member[.ranges]]]]
end[}]
END[}] | Keyword[public] identifier[Array] identifier[readData] operator[SEP] identifier[Variable] identifier[v2] , identifier[Section] identifier[section] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InvalidRangeException] {
identifier[Object] identifier[data] operator[SEP] identifier[Array] identifier[outputData] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[vdata] operator[=] Other[null] operator[SEP] identifier[NOWRadheader] operator[SEP] identifier[Vinfo] identifier[vinfo] operator[SEP] identifier[ByteBuffer] identifier[bos] operator[SEP] identifier[List] operator[<] identifier[Range] operator[>] identifier[ranges] operator[=] identifier[section] operator[SEP] identifier[getRanges] operator[SEP] operator[SEP] operator[SEP] identifier[vinfo] operator[=] operator[SEP] identifier[NOWRadheader] operator[SEP] identifier[Vinfo] operator[SEP] identifier[v2] operator[SEP] identifier[getSPobject] operator[SEP] operator[SEP] operator[SEP] identifier[vdata] operator[=] identifier[headerParser] operator[SEP] identifier[getData] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[vinfo] operator[SEP] identifier[hoff] operator[SEP] operator[SEP] identifier[bos] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[vdata] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[readOneScanData] operator[SEP] identifier[bos] , identifier[vinfo] , identifier[v2] operator[SEP] identifier[getShortName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[outputData] operator[=] identifier[Array] operator[SEP] identifier[factory] operator[SEP] identifier[v2] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] , identifier[v2] operator[SEP] identifier[getShape] operator[SEP] operator[SEP] , identifier[data] operator[SEP] operator[SEP] identifier[outputData] operator[=] identifier[outputData] operator[SEP] identifier[flip] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[outputData] operator[SEP] identifier[sectionNoReduce] operator[SEP] identifier[ranges] operator[SEP] operator[SEP] identifier[copy] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean dispatch(TCPBaseRequestContext req, IOException ioe) {
if (req.blockedThread) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "dispatcher notifying waiting synch request ");
}
if (ioe != null) {
req.blockingIOError = ioe;
}
req.blockWait.simpleNotify();
return true;
}
// dispatch the async work
return dispatchWorker(new Worker(req, ioe));
} | class class_name[name] begin[{]
method[dispatch, return_type[type[boolean]], modifier[protected], parameter[req, ioe]] begin[{]
if[member[req.blockedThread]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["dispatcher notifying waiting synch request "]]]
else begin[{]
None
end[}]
if[binary_operation[member[.ioe], !=, literal[null]]] begin[{]
assign[member[req.blockingIOError], member[.ioe]]
else begin[{]
None
end[}]
call[req.blockWait.simpleNotify, parameter[]]
return[literal[true]]
else begin[{]
None
end[}]
return[call[.dispatchWorker, parameter[ClassCreator(arguments=[MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ioe, 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=Worker, sub_type=None))]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[dispatch] operator[SEP] identifier[TCPBaseRequestContext] identifier[req] , identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[if] operator[SEP] identifier[req] operator[SEP] identifier[blockedThread] 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[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ioe] operator[!=] Other[null] operator[SEP] {
identifier[req] operator[SEP] identifier[blockingIOError] operator[=] identifier[ioe] operator[SEP]
}
identifier[req] operator[SEP] identifier[blockWait] operator[SEP] identifier[simpleNotify] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[dispatchWorker] operator[SEP] Keyword[new] identifier[Worker] operator[SEP] identifier[req] , identifier[ioe] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T extends FieldDescription> ElementMatcher.Junction<T> genericFieldType(Type fieldType) {
return genericFieldType(TypeDefinition.Sort.describe(fieldType));
} | class class_name[name] begin[{]
method[genericFieldType, return_type[type[ElementMatcher]], modifier[public static], parameter[fieldType]] begin[{]
return[call[.genericFieldType, parameter[call[TypeDefinition.Sort.describe, parameter[member[.fieldType]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[FieldDescription] operator[>] identifier[ElementMatcher] operator[SEP] identifier[Junction] operator[<] identifier[T] operator[>] identifier[genericFieldType] operator[SEP] identifier[Type] identifier[fieldType] operator[SEP] {
Keyword[return] identifier[genericFieldType] operator[SEP] identifier[TypeDefinition] operator[SEP] identifier[Sort] operator[SEP] identifier[describe] operator[SEP] identifier[fieldType] operator[SEP] operator[SEP] operator[SEP]
}
|
public JSONObject editJob(String key, HashMap<String, String> params) throws JSONException {
return oClient.put("/hr/v2/jobs/" + key, params);
} | class class_name[name] begin[{]
method[editJob, return_type[type[JSONObject]], modifier[public], parameter[key, params]] begin[{]
return[call[oClient.put, parameter[binary_operation[literal["/hr/v2/jobs/"], +, member[.key]], member[.params]]]]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[editJob] operator[SEP] identifier[String] identifier[key] , identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[return] identifier[oClient] operator[SEP] identifier[put] operator[SEP] literal[String] operator[+] identifier[key] , identifier[params] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponse<ImageList>> createWithServiceResponseAsync(String contentType, BodyModel bodyParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (bodyParameter == null) {
throw new IllegalArgumentException("Parameter bodyParameter is required and cannot be null.");
}
Validator.validate(bodyParameter);
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
return service.create(contentType, bodyParameter, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ImageList>>>() {
@Override
public Observable<ServiceResponse<ImageList>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ImageList> clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[createWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[contentType, bodyParameter]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.baseUrl, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.baseUrl() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.contentType], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter contentType is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.bodyParameter], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter bodyParameter is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Validator.validate, parameter[member[.bodyParameter]]]
local_variable[type[String], parameterizedHost]
return[call[service.create, parameter[member[.contentType], member[.bodyParameter], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], member[.parameterizedHost], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ImageList] operator[>] operator[>] identifier[createWithServiceResponseAsync] operator[SEP] identifier[String] identifier[contentType] , identifier[BodyModel] identifier[bodyParameter] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[baseUrl] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[contentType] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bodyParameter] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Validator] operator[SEP] identifier[validate] operator[SEP] identifier[bodyParameter] operator[SEP] operator[SEP] identifier[String] identifier[parameterizedHost] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[baseUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[create] operator[SEP] identifier[contentType] , identifier[bodyParameter] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , identifier[parameterizedHost] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ImageList] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ImageList] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[ImageList] operator[>] identifier[clientResponse] operator[=] identifier[createDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public static Object toPrimitiveBoolArray(List<?> values)
{
boolean[] array = new boolean[values.size()];
int cursor = 0;
for(Object o : values)
{
array[cursor] = (Boolean) o;
cursor ++;
}
return array;
} | class class_name[name] begin[{]
method[toPrimitiveBoolArray, return_type[type[Object]], modifier[public static], parameter[values]] begin[{]
local_variable[type[boolean], array]
local_variable[type[int], cursor]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=cursor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))), label=None), StatementExpression(expression=MemberReference(member=cursor, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.array]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[toPrimitiveBoolArray] operator[SEP] identifier[List] operator[<] operator[?] operator[>] identifier[values] operator[SEP] {
Keyword[boolean] operator[SEP] operator[SEP] identifier[array] operator[=] Keyword[new] Keyword[boolean] operator[SEP] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[cursor] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[values] operator[SEP] {
identifier[array] operator[SEP] identifier[cursor] operator[SEP] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[o] operator[SEP] identifier[cursor] operator[++] operator[SEP]
}
Keyword[return] identifier[array] operator[SEP]
}
|
public CellStyle getOrCreateCellStyle(int x, int y) {
final Cell cell = getOrCreateCell(x, y);
CellStyle cellStyle = cell.getCellStyle();
if (null == cellStyle) {
cellStyle = this.workbook.createCellStyle();
cell.setCellStyle(cellStyle);
}
return cellStyle;
} | class class_name[name] begin[{]
method[getOrCreateCellStyle, return_type[type[CellStyle]], modifier[public], parameter[x, y]] begin[{]
local_variable[type[Cell], cell]
local_variable[type[CellStyle], cellStyle]
if[binary_operation[literal[null], ==, member[.cellStyle]]] begin[{]
assign[member[.cellStyle], THIS[member[None.workbook]call[None.createCellStyle, parameter[]]]]
call[cell.setCellStyle, parameter[member[.cellStyle]]]
else begin[{]
None
end[}]
return[member[.cellStyle]]
end[}]
END[}] | Keyword[public] identifier[CellStyle] identifier[getOrCreateCellStyle] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[y] operator[SEP] {
Keyword[final] identifier[Cell] identifier[cell] operator[=] identifier[getOrCreateCell] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP] identifier[CellStyle] identifier[cellStyle] operator[=] identifier[cell] operator[SEP] identifier[getCellStyle] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[cellStyle] operator[SEP] {
identifier[cellStyle] operator[=] Keyword[this] operator[SEP] identifier[workbook] operator[SEP] identifier[createCellStyle] operator[SEP] operator[SEP] operator[SEP] identifier[cell] operator[SEP] identifier[setCellStyle] operator[SEP] identifier[cellStyle] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cellStyle] operator[SEP]
}
|
public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory)
{
if (mutationProbability.nextEvent(rng))
{
return treeFactory.generateRandomCandidate(rng);
}
else
{
Node newCondition = condition.mutate(rng, mutationProbability, treeFactory);
Node newThen = then.mutate(rng, mutationProbability, treeFactory);
Node newOtherwise = otherwise.mutate(rng, mutationProbability, treeFactory);
if (newCondition != condition || newThen != then || newOtherwise != otherwise)
{
return new IfThenElse(newCondition, newThen, newOtherwise);
}
else
{
// Tree has not changed.
return this;
}
}
} | class class_name[name] begin[{]
method[mutate, return_type[type[Node]], modifier[public], parameter[rng, mutationProbability, treeFactory]] begin[{]
if[call[mutationProbability.nextEvent, parameter[member[.rng]]]] begin[{]
return[call[treeFactory.generateRandomCandidate, parameter[member[.rng]]]]
else begin[{]
local_variable[type[Node], newCondition]
local_variable[type[Node], newThen]
local_variable[type[Node], newOtherwise]
if[binary_operation[binary_operation[binary_operation[member[.newCondition], !=, member[.condition]], ||, binary_operation[member[.newThen], !=, member[.then]]], ||, binary_operation[member[.newOtherwise], !=, member[.otherwise]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=newCondition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newThen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newOtherwise, 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=IfThenElse, sub_type=None))]
else begin[{]
return[THIS[]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[Node] identifier[mutate] operator[SEP] identifier[Random] identifier[rng] , identifier[Probability] identifier[mutationProbability] , identifier[TreeFactory] identifier[treeFactory] operator[SEP] {
Keyword[if] operator[SEP] identifier[mutationProbability] operator[SEP] identifier[nextEvent] operator[SEP] identifier[rng] operator[SEP] operator[SEP] {
Keyword[return] identifier[treeFactory] operator[SEP] identifier[generateRandomCandidate] operator[SEP] identifier[rng] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Node] identifier[newCondition] operator[=] identifier[condition] operator[SEP] identifier[mutate] operator[SEP] identifier[rng] , identifier[mutationProbability] , identifier[treeFactory] operator[SEP] operator[SEP] identifier[Node] identifier[newThen] operator[=] identifier[then] operator[SEP] identifier[mutate] operator[SEP] identifier[rng] , identifier[mutationProbability] , identifier[treeFactory] operator[SEP] operator[SEP] identifier[Node] identifier[newOtherwise] operator[=] identifier[otherwise] operator[SEP] identifier[mutate] operator[SEP] identifier[rng] , identifier[mutationProbability] , identifier[treeFactory] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newCondition] operator[!=] identifier[condition] operator[||] identifier[newThen] operator[!=] identifier[then] operator[||] identifier[newOtherwise] operator[!=] identifier[otherwise] operator[SEP] {
Keyword[return] Keyword[new] identifier[IfThenElse] operator[SEP] identifier[newCondition] , identifier[newThen] , identifier[newOtherwise] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP]
}
}
}
|
@Override
public RegisterTaskWithMaintenanceWindowResult registerTaskWithMaintenanceWindow(RegisterTaskWithMaintenanceWindowRequest request) {
request = beforeClientExecution(request);
return executeRegisterTaskWithMaintenanceWindow(request);
} | class class_name[name] begin[{]
method[registerTaskWithMaintenanceWindow, return_type[type[RegisterTaskWithMaintenanceWindowResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeRegisterTaskWithMaintenanceWindow, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RegisterTaskWithMaintenanceWindowResult] identifier[registerTaskWithMaintenanceWindow] operator[SEP] identifier[RegisterTaskWithMaintenanceWindowRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeRegisterTaskWithMaintenanceWindow] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void updateAt(int i, int j, MatrixFunction function) {
set(i, j, function.evaluate(i, j, get(i, j)));
} | class class_name[name] begin[{]
method[updateAt, return_type[void], modifier[public], parameter[i, j, function]] begin[{]
call[.set, parameter[member[.i], member[.j], call[function.evaluate, parameter[member[.i], member[.j], call[.get, parameter[member[.i], member[.j]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateAt] operator[SEP] Keyword[int] identifier[i] , Keyword[int] identifier[j] , identifier[MatrixFunction] identifier[function] operator[SEP] {
identifier[set] operator[SEP] identifier[i] , identifier[j] , identifier[function] operator[SEP] identifier[evaluate] operator[SEP] identifier[i] , identifier[j] , identifier[get] operator[SEP] identifier[i] , identifier[j] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (defaultType == null) throw new IllegalArgumentException("defaultType cannot be null.");
Property property = Beans.getProperty(type, propertyName, beanProperties, privateFields, this);
if (property == null)
throw new IllegalArgumentException("The class " + type.getName() + " does not have a property named: " + propertyName);
propertyToDefaultType.put(property, defaultType);
} | class class_name[name] begin[{]
method[setPropertyDefaultType, return_type[void], modifier[public], parameter[type, propertyName, defaultType]] begin[{]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.propertyName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="propertyName cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.defaultType], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="defaultType cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Property], property]
if[binary_operation[member[.property], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The class "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not have a property named: "), operator=+), operandr=MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[propertyToDefaultType.put, parameter[member[.property], member[.defaultType]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPropertyDefaultType] operator[SEP] identifier[Class] identifier[type] , identifier[String] identifier[propertyName] , identifier[Class] identifier[defaultType] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyName] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[defaultType] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Property] identifier[property] operator[=] identifier[Beans] operator[SEP] identifier[getProperty] operator[SEP] identifier[type] , identifier[propertyName] , identifier[beanProperties] , identifier[privateFields] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[propertyName] operator[SEP] operator[SEP] identifier[propertyToDefaultType] operator[SEP] identifier[put] operator[SEP] identifier[property] , identifier[defaultType] operator[SEP] operator[SEP]
}
|
public String getParameter(String name) {
String[] p = getParameterMap().get(name);
if (p != null) {
return p[0];
}
return null;
} | class class_name[name] begin[{]
method[getParameter, return_type[type[String]], modifier[public], parameter[name]] begin[{]
local_variable[type[String], p]
if[binary_operation[member[.p], !=, literal[null]]] begin[{]
return[member[.p]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getParameter] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[getParameterMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[p] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected void resize( VariableMatrix mat , int numRows , int numCols ) {
if( mat.isTemp() ) {
mat.matrix.reshape(numRows,numCols);
}
} | class class_name[name] begin[{]
method[resize, return_type[void], modifier[protected], parameter[mat, numRows, numCols]] begin[{]
if[call[mat.isTemp, parameter[]]] begin[{]
call[mat.matrix.reshape, parameter[member[.numRows], member[.numCols]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[resize] operator[SEP] identifier[VariableMatrix] identifier[mat] , Keyword[int] identifier[numRows] , Keyword[int] identifier[numCols] operator[SEP] {
Keyword[if] operator[SEP] identifier[mat] operator[SEP] identifier[isTemp] operator[SEP] operator[SEP] operator[SEP] {
identifier[mat] operator[SEP] identifier[matrix] operator[SEP] identifier[reshape] operator[SEP] identifier[numRows] , identifier[numCols] operator[SEP] operator[SEP]
}
}
|
@Override
public void addComment(SocializeSession session, Entity entity, String comment, CommentOptions commentOptions, CommentListener listener, SocialNetwork... networks) {
Comment c = new Comment();
c.setText(comment);
c.setEntitySafe(entity);
addComment(session, c, commentOptions, listener, networks);
} | class class_name[name] begin[{]
method[addComment, return_type[void], modifier[public], parameter[session, entity, comment, commentOptions, listener, networks]] begin[{]
local_variable[type[Comment], c]
call[c.setText, parameter[member[.comment]]]
call[c.setEntitySafe, parameter[member[.entity]]]
call[.addComment, parameter[member[.session], member[.c], member[.commentOptions], member[.listener], member[.networks]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addComment] operator[SEP] identifier[SocializeSession] identifier[session] , identifier[Entity] identifier[entity] , identifier[String] identifier[comment] , identifier[CommentOptions] identifier[commentOptions] , identifier[CommentListener] identifier[listener] , identifier[SocialNetwork] operator[...] identifier[networks] operator[SEP] {
identifier[Comment] identifier[c] operator[=] Keyword[new] identifier[Comment] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[setText] operator[SEP] identifier[comment] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[setEntitySafe] operator[SEP] identifier[entity] operator[SEP] operator[SEP] identifier[addComment] operator[SEP] identifier[session] , identifier[c] , identifier[commentOptions] , identifier[listener] , identifier[networks] operator[SEP] operator[SEP]
}
|
private SortKey toggle(SortKey key)
{
if (key.getSortOrder() == SortOrder.ASCENDING)
{
return new SortKey(key.getColumn(), SortOrder.DESCENDING);
}
return new SortKey(key.getColumn(), SortOrder.ASCENDING);
} | class class_name[name] begin[{]
method[toggle, return_type[type[SortKey]], modifier[private], parameter[key]] begin[{]
if[binary_operation[call[key.getSortOrder, parameter[]], ==, member[SortOrder.ASCENDING]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), MemberReference(member=DESCENDING, postfix_operators=[], prefix_operators=[], qualifier=SortOrder, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SortKey, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), MemberReference(member=ASCENDING, postfix_operators=[], prefix_operators=[], qualifier=SortOrder, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SortKey, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[SortKey] identifier[toggle] operator[SEP] identifier[SortKey] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[getSortOrder] operator[SEP] operator[SEP] operator[==] identifier[SortOrder] operator[SEP] identifier[ASCENDING] operator[SEP] {
Keyword[return] Keyword[new] identifier[SortKey] operator[SEP] identifier[key] operator[SEP] identifier[getColumn] operator[SEP] operator[SEP] , identifier[SortOrder] operator[SEP] identifier[DESCENDING] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[SortKey] operator[SEP] identifier[key] operator[SEP] identifier[getColumn] operator[SEP] operator[SEP] , identifier[SortOrder] operator[SEP] identifier[ASCENDING] operator[SEP] operator[SEP]
}
|
public Cubic[] calcNaturalCubic( int n, double[] x ) {
double[] w = new double[n + 1];
double[] v = new double[n + 1];
double[] y = new double[n + 1];
double[] D = new double[n + 1];
double z, F, G, H;
int k;
/* We solve the equation
[4 1 1] [D[0]] [3(x[1] - x[n]) ]
|1 4 1 | |D[1]| |3(x[2] - x[0]) |
| 1 4 1 | | . | = | . |
| ..... | | . | | . |
| 1 4 1| | . | |3(x[n] - x[n-2])|
[1 1 4] [D[n]] [3(x[0] - x[n-1])]
by decomposing the matrix into upper triangular and lower matrices
and then back sustitution. See Spath "Spline Algorithms for Curves
and Surfaces" pp 19--21. The D[i] are the derivatives at the knots.
*/
w[1] = v[1] = z = 1.0f / 4.0f;
y[0] = z * 3 * (x[1] - x[n]);
H = 4;
F = 3 * (x[0] - x[n - 1]);
G = 1;
for( k = 1; k < n; k++ ) {
v[k + 1] = z = 1 / (4 - v[k]);
w[k + 1] = -z * w[k];
y[k] = z * (3 * (x[k + 1] - x[k - 1]) - y[k - 1]);
H = H - G * w[k];
F = F - G * y[k - 1];
G = -v[k] * G;
}
H = H - (G + 1) * (v[n] + w[n]);
y[n] = F - (G + 1) * y[n - 1];
D[n] = y[n] / H;
D[n - 1] = y[n - 1] - (v[n] + w[n]) * D[n]; /* This equation is WRONG! in my copy of Spath */
for( k = n - 2; k >= 0; k-- ) {
D[k] = y[k] - v[k + 1] * D[k + 1] - w[k + 1] * D[n];
}
/* now compute the coefficients of the cubics */
Cubic[] C = new Cubic[n + 1];
for( k = 0; k < n; k++ ) {
C[k] = new Cubic((double) x[k], D[k], 3 * (x[k + 1] - x[k]) - 2 * D[k] - D[k + 1], 2 * (x[k] - x[k + 1]) + D[k]
+ D[k + 1]);
}
C[n] = new Cubic((double) x[n], D[n], 3 * (x[0] - x[n]) - 2 * D[n] - D[0], 2 * (x[n] - x[0]) + D[n] + D[0]);
return C;
} | class class_name[name] begin[{]
method[calcNaturalCubic, return_type[type[Cubic]], modifier[public], parameter[n, x]] begin[{]
local_variable[type[double], w]
local_variable[type[double], v]
local_variable[type[double], y]
local_variable[type[double], D]
local_variable[type[double], z]
local_variable[type[int], k]
assign[member[.w], assign[member[.v], assign[member[.z], binary_operation[literal[1.0f], /, literal[4.0f]]]]]
assign[member[.y], binary_operation[binary_operation[member[.z], *, literal[3]], *, binary_operation[member[.x], -, member[.x]]]]
assign[member[.H], literal[4]]
assign[member[.F], binary_operation[literal[3], *, binary_operation[member[.x], -, member[.x]]]]
assign[member[.G], literal[1]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), type==, value=Assignment(expressionl=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), operator=/))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), type==, value=BinaryOperation(operandl=MemberReference(member=z, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), operandr=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=-), operator=*), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=-), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=H, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=H, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=G, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=F, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=F, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=G, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operator=*), operator=-)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=G, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=G, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))], update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.H], binary_operation[member[.H], -, binary_operation[binary_operation[member[.G], +, literal[1]], *, binary_operation[member[.v], +, member[.w]]]]]
assign[member[.y], binary_operation[member[.F], -, binary_operation[binary_operation[member[.G], +, literal[1]], *, member[.y]]]]
assign[member[.D], binary_operation[member[.y], /, member[.H]]]
assign[member[.D], binary_operation[member[.y], -, binary_operation[binary_operation[member[.v], +, member[.w]], *, member[.D]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=*), operator=-), operandr=BinaryOperation(operandl=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=-)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=[Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-))], update=[MemberReference(member=k, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[Cubic], C]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=C, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[Cast(expression=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=BasicType(dimensions=[], name=double)), MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), operator=*), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=-), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=-), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=-), operator=*), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Cubic, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=k, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.C], ClassCreator(arguments=[Cast(expression=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=BasicType(dimensions=[], name=double)), MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), operator=*), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=-), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=-), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=-), operator=*), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+), operandr=MemberReference(member=D, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Cubic, sub_type=None))]
return[member[.C]]
end[}]
END[}] | Keyword[public] identifier[Cubic] operator[SEP] operator[SEP] identifier[calcNaturalCubic] operator[SEP] Keyword[int] identifier[n] , Keyword[double] operator[SEP] operator[SEP] identifier[x] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[w] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[v] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[y] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[D] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[double] identifier[z] , identifier[F] , identifier[G] , identifier[H] operator[SEP] Keyword[int] identifier[k] operator[SEP] identifier[w] operator[SEP] Other[1] operator[SEP] operator[=] identifier[v] operator[SEP] Other[1] operator[SEP] operator[=] identifier[z] operator[=] literal[Float] operator[/] literal[Float] operator[SEP] identifier[y] operator[SEP] Other[0] operator[SEP] operator[=] identifier[z] operator[*] Other[3] operator[*] operator[SEP] identifier[x] operator[SEP] Other[1] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] identifier[H] operator[=] Other[4] operator[SEP] identifier[F] operator[=] Other[3] operator[*] operator[SEP] identifier[x] operator[SEP] Other[0] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[n] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[G] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[k] operator[=] Other[1] operator[SEP] identifier[k] operator[<] identifier[n] operator[SEP] identifier[k] operator[++] operator[SEP] {
identifier[v] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[=] identifier[z] operator[=] Other[1] operator[/] operator[SEP] Other[4] operator[-] identifier[v] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[SEP] identifier[w] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[=] operator[-] identifier[z] operator[*] identifier[w] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[y] operator[SEP] identifier[k] operator[SEP] operator[=] identifier[z] operator[*] operator[SEP] Other[3] operator[*] operator[SEP] identifier[x] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[k] operator[-] Other[1] operator[SEP] operator[SEP] operator[-] identifier[y] operator[SEP] identifier[k] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[H] operator[=] identifier[H] operator[-] identifier[G] operator[*] identifier[w] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[F] operator[=] identifier[F] operator[-] identifier[G] operator[*] identifier[y] operator[SEP] identifier[k] operator[-] Other[1] operator[SEP] operator[SEP] identifier[G] operator[=] operator[-] identifier[v] operator[SEP] identifier[k] operator[SEP] operator[*] identifier[G] operator[SEP]
}
identifier[H] operator[=] identifier[H] operator[-] operator[SEP] identifier[G] operator[+] Other[1] operator[SEP] operator[*] operator[SEP] identifier[v] operator[SEP] identifier[n] operator[SEP] operator[+] identifier[w] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] identifier[y] operator[SEP] identifier[n] operator[SEP] operator[=] identifier[F] operator[-] operator[SEP] identifier[G] operator[+] Other[1] operator[SEP] operator[*] identifier[y] operator[SEP] identifier[n] operator[-] Other[1] operator[SEP] operator[SEP] identifier[D] operator[SEP] identifier[n] operator[SEP] operator[=] identifier[y] operator[SEP] identifier[n] operator[SEP] operator[/] identifier[H] operator[SEP] identifier[D] operator[SEP] identifier[n] operator[-] Other[1] operator[SEP] operator[=] identifier[y] operator[SEP] identifier[n] operator[-] Other[1] operator[SEP] operator[-] operator[SEP] identifier[v] operator[SEP] identifier[n] operator[SEP] operator[+] identifier[w] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[*] identifier[D] operator[SEP] identifier[n] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[k] operator[=] identifier[n] operator[-] Other[2] operator[SEP] identifier[k] operator[>=] Other[0] operator[SEP] identifier[k] operator[--] operator[SEP] {
identifier[D] operator[SEP] identifier[k] operator[SEP] operator[=] identifier[y] operator[SEP] identifier[k] operator[SEP] operator[-] identifier[v] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[*] identifier[D] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[-] identifier[w] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[*] identifier[D] operator[SEP] identifier[n] operator[SEP] operator[SEP]
}
identifier[Cubic] operator[SEP] operator[SEP] identifier[C] operator[=] Keyword[new] identifier[Cubic] operator[SEP] identifier[n] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[k] operator[=] Other[0] operator[SEP] identifier[k] operator[<] identifier[n] operator[SEP] identifier[k] operator[++] operator[SEP] {
identifier[C] operator[SEP] identifier[k] operator[SEP] operator[=] Keyword[new] identifier[Cubic] operator[SEP] operator[SEP] Keyword[double] operator[SEP] identifier[x] operator[SEP] identifier[k] operator[SEP] , identifier[D] operator[SEP] identifier[k] operator[SEP] , Other[3] operator[*] operator[SEP] identifier[x] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[k] operator[SEP] operator[SEP] operator[-] Other[2] operator[*] identifier[D] operator[SEP] identifier[k] operator[SEP] operator[-] identifier[D] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] , Other[2] operator[*] operator[SEP] identifier[x] operator[SEP] identifier[k] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[SEP] operator[+] identifier[D] operator[SEP] identifier[k] operator[SEP] operator[+] identifier[D] operator[SEP] identifier[k] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[C] operator[SEP] identifier[n] operator[SEP] operator[=] Keyword[new] identifier[Cubic] operator[SEP] operator[SEP] Keyword[double] operator[SEP] identifier[x] operator[SEP] identifier[n] operator[SEP] , identifier[D] operator[SEP] identifier[n] operator[SEP] , Other[3] operator[*] operator[SEP] identifier[x] operator[SEP] Other[0] operator[SEP] operator[-] identifier[x] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[-] Other[2] operator[*] identifier[D] operator[SEP] identifier[n] operator[SEP] operator[-] identifier[D] operator[SEP] Other[0] operator[SEP] , Other[2] operator[*] operator[SEP] identifier[x] operator[SEP] identifier[n] operator[SEP] operator[-] identifier[x] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[+] identifier[D] operator[SEP] identifier[n] operator[SEP] operator[+] identifier[D] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[C] operator[SEP]
}
|
public static boolean containsAll(Iterable self, Object[] items) {
return asCollection(self).containsAll(Arrays.asList(items));
} | class class_name[name] begin[{]
method[containsAll, return_type[type[boolean]], modifier[public static], parameter[self, items]] begin[{]
return[call[.asCollection, parameter[member[.self]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[containsAll] operator[SEP] identifier[Iterable] identifier[self] , identifier[Object] operator[SEP] operator[SEP] identifier[items] operator[SEP] {
Keyword[return] identifier[asCollection] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[containsAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[items] operator[SEP] operator[SEP] operator[SEP]
}
|
void adjustLeft(float newValue) {
Object[] o = (Object[])attributes.get(Chunk.TAB);
if (o != null) {
attributes.put(Chunk.TAB, new Object[]{o[0], o[1], o[2], new Float(newValue)});
}
} | class class_name[name] begin[{]
method[adjustLeft, return_type[void], modifier[default], parameter[newValue]] begin[{]
local_variable[type[Object], o]
if[binary_operation[member[.o], !=, literal[null]]] begin[{]
call[attributes.put, parameter[member[Chunk.TAB], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), ClassCreator(arguments=[MemberReference(member=newValue, 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=Float, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[adjustLeft] operator[SEP] Keyword[float] identifier[newValue] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[o] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[Chunk] operator[SEP] identifier[TAB] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[!=] Other[null] operator[SEP] {
identifier[attributes] operator[SEP] identifier[put] operator[SEP] identifier[Chunk] operator[SEP] identifier[TAB] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[o] operator[SEP] Other[0] operator[SEP] , identifier[o] operator[SEP] Other[1] operator[SEP] , identifier[o] operator[SEP] Other[2] operator[SEP] , Keyword[new] identifier[Float] operator[SEP] identifier[newValue] operator[SEP]
} operator[SEP] operator[SEP]
}
}
|
public static MozuUrl resendCreditCreatedEmailUrl(String code, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}");
formatter.formatUrl("code", code);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | class class_name[name] begin[{]
method[resendCreditCreatedEmailUrl, return_type[type[MozuUrl]], modifier[public static], parameter[code, userId]] begin[{]
local_variable[type[UrlFormatter], formatter]
call[formatter.formatUrl, parameter[literal["code"], member[.code]]]
call[formatter.formatUrl, parameter[literal["userId"], member[.userId]]]
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[resendCreditCreatedEmailUrl] operator[SEP] identifier[String] identifier[code] , identifier[String] identifier[userId] 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[code] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[userId] 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]
}
|
protected int readInteger(final String intString, final int min, final int max) {
return Math.max(Math.min(Integer.parseInt(intString), max), min);
} | class class_name[name] begin[{]
method[readInteger, return_type[type[int]], modifier[protected], parameter[intString, min, max]] begin[{]
return[call[Math.max, parameter[call[Math.min, parameter[call[Integer.parseInt, parameter[member[.intString]]], member[.max]]], member[.min]]]]
end[}]
END[}] | Keyword[protected] Keyword[int] identifier[readInteger] operator[SEP] Keyword[final] identifier[String] identifier[intString] , Keyword[final] Keyword[int] identifier[min] , Keyword[final] Keyword[int] identifier[max] operator[SEP] {
Keyword[return] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[intString] operator[SEP] , identifier[max] operator[SEP] , identifier[min] operator[SEP] operator[SEP]
}
|
@Override
public DeleteUserPoolClientResult deleteUserPoolClient(DeleteUserPoolClientRequest request) {
request = beforeClientExecution(request);
return executeDeleteUserPoolClient(request);
} | class class_name[name] begin[{]
method[deleteUserPoolClient, return_type[type[DeleteUserPoolClientResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteUserPoolClient, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteUserPoolClientResult] identifier[deleteUserPoolClient] operator[SEP] identifier[DeleteUserPoolClientRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteUserPoolClient] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@Deprecated
public BaasResult<JsonObject> restSync(int method, String endpoint, JsonArray body, boolean authenticate) {
return mRest.sync(RestImpl.methodFrom(method), endpoint, body, authenticate);
} | class class_name[name] begin[{]
method[restSync, return_type[type[BaasResult]], modifier[public], parameter[method, endpoint, body, authenticate]] begin[{]
return[call[mRest.sync, parameter[call[RestImpl.methodFrom, parameter[member[.method]]], member[.endpoint], member[.body], member[.authenticate]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] identifier[BaasResult] operator[<] identifier[JsonObject] operator[>] identifier[restSync] operator[SEP] Keyword[int] identifier[method] , identifier[String] identifier[endpoint] , identifier[JsonArray] identifier[body] , Keyword[boolean] identifier[authenticate] operator[SEP] {
Keyword[return] identifier[mRest] operator[SEP] identifier[sync] operator[SEP] identifier[RestImpl] operator[SEP] identifier[methodFrom] operator[SEP] identifier[method] operator[SEP] , identifier[endpoint] , identifier[body] , identifier[authenticate] operator[SEP] operator[SEP]
}
|
public void addTransition(QName name, ElementSelector<T> target) {
buildState().addTransition(new ElementEqualsConstraint(name),
target.buildState());
} | class class_name[name] begin[{]
method[addTransition, return_type[void], modifier[public], parameter[name, target]] begin[{]
call[.buildState, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addTransition] operator[SEP] identifier[QName] identifier[name] , identifier[ElementSelector] operator[<] identifier[T] operator[>] identifier[target] operator[SEP] {
identifier[buildState] operator[SEP] operator[SEP] operator[SEP] identifier[addTransition] operator[SEP] Keyword[new] identifier[ElementEqualsConstraint] operator[SEP] identifier[name] operator[SEP] , identifier[target] operator[SEP] identifier[buildState] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public long until(Temporal endExclusive, TemporalUnit unit) {
LocalDateTime end = LocalDateTime.from(endExclusive);
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
if (f.isTimeBased()) {
long daysUntil = date.daysUntil(end.date);
long timeUntil = end.time.toNanoOfDay() - time.toNanoOfDay();
if (daysUntil > 0 && timeUntil < 0) {
daysUntil--;
timeUntil += NANOS_PER_DAY;
} else if (daysUntil < 0 && timeUntil > 0) {
daysUntil++;
timeUntil -= NANOS_PER_DAY;
}
long amount = daysUntil;
switch (f) {
case NANOS:
amount = Jdk8Methods.safeMultiply(amount, NANOS_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil);
case MICROS:
amount = Jdk8Methods.safeMultiply(amount, MICROS_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil / 1000);
case MILLIS:
amount = Jdk8Methods.safeMultiply(amount, MILLIS_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil / 1000000);
case SECONDS:
amount = Jdk8Methods.safeMultiply(amount, SECONDS_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil / NANOS_PER_SECOND);
case MINUTES:
amount = Jdk8Methods.safeMultiply(amount, MINUTES_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil / NANOS_PER_MINUTE);
case HOURS:
amount = Jdk8Methods.safeMultiply(amount, HOURS_PER_DAY);
return Jdk8Methods.safeAdd(amount, timeUntil / NANOS_PER_HOUR);
case HALF_DAYS:
amount = Jdk8Methods.safeMultiply(amount, 2);
return Jdk8Methods.safeAdd(amount, timeUntil / (NANOS_PER_HOUR * 12));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
}
LocalDate endDate = end.date;
if (endDate.isAfter(date) && end.time.isBefore(time)) {
endDate = endDate.minusDays(1);
} else if (endDate.isBefore(date) && end.time.isAfter(time)) {
endDate = endDate.plusDays(1);
}
return date.until(endDate, unit);
}
return unit.between(this, end);
} | class class_name[name] begin[{]
method[until, return_type[type[long]], modifier[public], parameter[endExclusive, unit]] begin[{]
local_variable[type[LocalDateTime], end]
if[binary_operation[member[.unit], instanceof, type[ChronoUnit]]] begin[{]
local_variable[type[ChronoUnit], f]
if[call[f.isTimeBased, parameter[]]] begin[{]
local_variable[type[long], daysUntil]
local_variable[type[long], timeUntil]
if[binary_operation[binary_operation[member[.daysUntil], >, literal[0]], &&, binary_operation[member[.timeUntil], <, literal[0]]]] begin[{]
member[.daysUntil]
assign[member[.timeUntil], member[.NANOS_PER_DAY]]
else begin[{]
if[binary_operation[binary_operation[member[.daysUntil], <, literal[0]], &&, binary_operation[member[.timeUntil], >, literal[0]]]] begin[{]
member[.daysUntil]
assign[member[.timeUntil], member[.NANOS_PER_DAY]]
else begin[{]
None
end[}]
end[}]
local_variable[type[long], amount]
SwitchStatement(cases=[SwitchStatementCase(case=['NANOS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NANOS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['MICROS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MICROS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['MILLIS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLIS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000000), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['SECONDS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=SECONDS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NANOS_PER_SECOND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['MINUTES'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MINUTES_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NANOS_PER_MINUTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['HOURS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=HOURS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NANOS_PER_HOUR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['HALF_DAYS'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=amount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=timeUntil, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=NANOS_PER_HOUR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12), operator=*), operator=/)], member=safeAdd, postfix_operators=[], prefix_operators=[], qualifier=Jdk8Methods, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported unit: "), operandr=MemberReference(member=unit, 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=UnsupportedTemporalTypeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[LocalDate], endDate]
if[binary_operation[call[endDate.isAfter, parameter[member[.date]]], &&, call[end.time.isBefore, parameter[member[.time]]]]] begin[{]
assign[member[.endDate], call[endDate.minusDays, parameter[literal[1]]]]
else begin[{]
if[binary_operation[call[endDate.isBefore, parameter[member[.date]]], &&, call[end.time.isAfter, parameter[member[.time]]]]] begin[{]
assign[member[.endDate], call[endDate.plusDays, parameter[literal[1]]]]
else begin[{]
None
end[}]
end[}]
return[call[date.until, parameter[member[.endDate], member[.unit]]]]
else begin[{]
None
end[}]
return[call[unit.between, parameter[THIS[], member[.end]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[until] operator[SEP] identifier[Temporal] identifier[endExclusive] , identifier[TemporalUnit] identifier[unit] operator[SEP] {
identifier[LocalDateTime] identifier[end] operator[=] identifier[LocalDateTime] operator[SEP] identifier[from] operator[SEP] identifier[endExclusive] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[unit] Keyword[instanceof] identifier[ChronoUnit] operator[SEP] {
identifier[ChronoUnit] identifier[f] operator[=] operator[SEP] identifier[ChronoUnit] operator[SEP] identifier[unit] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[isTimeBased] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[daysUntil] operator[=] identifier[date] operator[SEP] identifier[daysUntil] operator[SEP] identifier[end] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[long] identifier[timeUntil] operator[=] identifier[end] operator[SEP] identifier[time] operator[SEP] identifier[toNanoOfDay] operator[SEP] operator[SEP] operator[-] identifier[time] operator[SEP] identifier[toNanoOfDay] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[daysUntil] operator[>] Other[0] operator[&&] identifier[timeUntil] operator[<] Other[0] operator[SEP] {
identifier[daysUntil] operator[--] operator[SEP] identifier[timeUntil] operator[+=] identifier[NANOS_PER_DAY] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[daysUntil] operator[<] Other[0] operator[&&] identifier[timeUntil] operator[>] Other[0] operator[SEP] {
identifier[daysUntil] operator[++] operator[SEP] identifier[timeUntil] operator[-=] identifier[NANOS_PER_DAY] operator[SEP]
}
Keyword[long] identifier[amount] operator[=] identifier[daysUntil] operator[SEP] Keyword[switch] operator[SEP] identifier[f] operator[SEP] {
Keyword[case] identifier[NANOS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[NANOS_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[SEP] operator[SEP] Keyword[case] identifier[MICROS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[MICROS_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] Other[1000] operator[SEP] operator[SEP] Keyword[case] identifier[MILLIS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[MILLIS_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] Other[1000000] operator[SEP] operator[SEP] Keyword[case] identifier[SECONDS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[SECONDS_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] identifier[NANOS_PER_SECOND] operator[SEP] operator[SEP] Keyword[case] identifier[MINUTES] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[MINUTES_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] identifier[NANOS_PER_MINUTE] operator[SEP] operator[SEP] Keyword[case] identifier[HOURS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , identifier[HOURS_PER_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] identifier[NANOS_PER_HOUR] operator[SEP] operator[SEP] Keyword[case] identifier[HALF_DAYS] operator[:] identifier[amount] operator[=] identifier[Jdk8Methods] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[amount] , Other[2] operator[SEP] operator[SEP] Keyword[return] identifier[Jdk8Methods] operator[SEP] identifier[safeAdd] operator[SEP] identifier[amount] , identifier[timeUntil] operator[/] operator[SEP] identifier[NANOS_PER_HOUR] operator[*] Other[12] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[UnsupportedTemporalTypeException] operator[SEP] literal[String] operator[+] identifier[unit] operator[SEP] operator[SEP]
}
identifier[LocalDate] identifier[endDate] operator[=] identifier[end] operator[SEP] identifier[date] operator[SEP] Keyword[if] operator[SEP] identifier[endDate] operator[SEP] identifier[isAfter] operator[SEP] identifier[date] operator[SEP] operator[&&] identifier[end] operator[SEP] identifier[time] operator[SEP] identifier[isBefore] operator[SEP] identifier[time] operator[SEP] operator[SEP] {
identifier[endDate] operator[=] identifier[endDate] operator[SEP] identifier[minusDays] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[endDate] operator[SEP] identifier[isBefore] operator[SEP] identifier[date] operator[SEP] operator[&&] identifier[end] operator[SEP] identifier[time] operator[SEP] identifier[isAfter] operator[SEP] identifier[time] operator[SEP] operator[SEP] {
identifier[endDate] operator[=] identifier[endDate] operator[SEP] identifier[plusDays] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[date] operator[SEP] identifier[until] operator[SEP] identifier[endDate] , identifier[unit] operator[SEP] operator[SEP]
}
Keyword[return] identifier[unit] operator[SEP] identifier[between] operator[SEP] Keyword[this] , identifier[end] operator[SEP] operator[SEP]
}
|
public boolean isUndefined() {
return StringUtils.isBlank(text) || StringUtils.isBlank(from) || StringUtils.isBlank(subject);
} | class class_name[name] begin[{]
method[isUndefined, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
return[binary_operation[binary_operation[call[StringUtils.isBlank, parameter[member[.text]]], ||, call[StringUtils.isBlank, parameter[member[.from]]]], ||, call[StringUtils.isBlank, parameter[member[.subject]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isUndefined] operator[SEP] operator[SEP] {
Keyword[return] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[text] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[from] operator[SEP] operator[||] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[subject] operator[SEP] operator[SEP]
}
|
public static ipset get(nitro_service service, String name) throws Exception{
ipset obj = new ipset();
obj.set_name(name);
ipset response = (ipset) obj.get_resource(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[ipset]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[ipset], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[ipset], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ipset] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ipset] identifier[obj] operator[=] Keyword[new] identifier[ipset] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[ipset] identifier[response] operator[=] operator[SEP] identifier[ipset] operator[SEP] identifier[obj] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public DescribeEventTopicsResult withEventTopics(EventTopic... eventTopics) {
if (this.eventTopics == null) {
setEventTopics(new com.amazonaws.internal.SdkInternalList<EventTopic>(eventTopics.length));
}
for (EventTopic ele : eventTopics) {
this.eventTopics.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withEventTopics, return_type[type[DescribeEventTopicsResult]], modifier[public], parameter[eventTopics]] begin[{]
if[binary_operation[THIS[member[None.eventTopics]], ==, literal[null]]] begin[{]
call[.setEventTopics, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=eventTopics, 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=EventTopic, 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=eventTopics, 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=eventTopics, 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=EventTopic, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DescribeEventTopicsResult] identifier[withEventTopics] operator[SEP] identifier[EventTopic] operator[...] identifier[eventTopics] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[eventTopics] operator[==] Other[null] operator[SEP] {
identifier[setEventTopics] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[EventTopic] operator[>] operator[SEP] identifier[eventTopics] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[EventTopic] identifier[ele] operator[:] identifier[eventTopics] operator[SEP] {
Keyword[this] operator[SEP] identifier[eventTopics] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public BackupChain findBackup(String backupId)
{
Iterator<BackupChain> it = currentBackups.iterator();
while (it.hasNext())
{
BackupChain chain = it.next();
if (backupId.equals(chain.getBackupId()))
{
return chain;
}
}
return null;
} | class class_name[name] begin[{]
method[findBackup, return_type[type[BackupChain]], modifier[public], parameter[backupId]] begin[{]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[BackupChain], chain]
if[call[backupId.equals, parameter[call[chain.getBackupId, parameter[]]]]] begin[{]
return[member[.chain]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[BackupChain] identifier[findBackup] operator[SEP] identifier[String] identifier[backupId] operator[SEP] {
identifier[Iterator] operator[<] identifier[BackupChain] operator[>] identifier[it] operator[=] identifier[currentBackups] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[BackupChain] identifier[chain] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[backupId] operator[SEP] identifier[equals] operator[SEP] identifier[chain] operator[SEP] identifier[getBackupId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[chain] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public final void mWS() throws RecognitionException {
try {
int _type = WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:274:9: ( ( ' ' | '\\t' | '\\f' )+ )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:274:17: ( ' ' | '\\t' | '\\f' )+
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:274:17: ( ' ' | '\\t' | '\\f' )+
int cnt1=0;
loop1:
while (true) {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0=='\t'||LA1_0=='\f'||LA1_0==' ') ) {
alt1=1;
}
switch (alt1) {
case 1 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:
{
if ( input.LA(1)=='\t'||input.LA(1)=='\f'||input.LA(1)==' ' ) {
input.consume();
state.failed=false;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt1 >= 1 ) break loop1;
if (state.backtracking>0) {state.failed=true; return;}
EarlyExitException eee = new EarlyExitException(1, input);
throw eee;
}
cnt1++;
}
if ( state.backtracking==0 ) { _channel=HIDDEN;}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} | class class_name[name] begin[{]
method[mWS, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=WS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=cnt1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=alt1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA1_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA1_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=LA1_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\f'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=LA1_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t'), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\f'), operator===), operator=||), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator===), operator=||), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cnt1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>=), else_statement=None, label=None, then_statement=BreakStatement(goto=loop1, label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EarlyExitException, sub_type=None)), name=eee)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EarlyExitException, sub_type=None)), ThrowStatement(expression=MemberReference(member=eee, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])], expression=MemberReference(member=alt1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MemberReference(member=cnt1, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=loop1), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=HIDDEN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[mWS] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[WS] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
Keyword[int] identifier[cnt1] operator[=] Other[0] operator[SEP] identifier[loop1] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[alt1] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA1_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA1_0] operator[==] literal[String] operator[||] identifier[LA1_0] operator[==] literal[String] operator[||] identifier[LA1_0] operator[==] literal[String] operator[SEP] operator[SEP] {
identifier[alt1] operator[=] Other[1] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt1] operator[SEP] {
Keyword[case] Other[1] operator[:] {
Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[==] literal[String] operator[||] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[==] literal[String] operator[||] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP] Keyword[return] operator[SEP]
}
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[cnt1] operator[>=] Other[1] operator[SEP] Keyword[break] identifier[loop1] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[state] operator[SEP] identifier[failed] operator[=] literal[boolean] operator[SEP] Keyword[return] operator[SEP]
}
identifier[EarlyExitException] identifier[eee] operator[=] Keyword[new] identifier[EarlyExitException] operator[SEP] Other[1] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[eee] operator[SEP]
}
identifier[cnt1] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[_channel] operator[=] identifier[HIDDEN] operator[SEP]
}
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public List<Row> postReconciliationProcessing(List<IndexExpression> clause, List<Row> rows)
{
return rows;
} | class class_name[name] begin[{]
method[postReconciliationProcessing, return_type[type[List]], modifier[public], parameter[clause, rows]] begin[{]
return[member[.rows]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Row] operator[>] identifier[postReconciliationProcessing] operator[SEP] identifier[List] operator[<] identifier[IndexExpression] operator[>] identifier[clause] , identifier[List] operator[<] identifier[Row] operator[>] identifier[rows] operator[SEP] {
Keyword[return] identifier[rows] operator[SEP]
}
|
private static void generateInsertForContentProvider(TypeSpec.Builder classBuilder, final SQLiteModelMethod method,
InsertType insertResultType) {
final SQLiteDaoDefinition daoDefinition = method.getParent();
final SQLiteEntity entity = method.getEntity();
final Set<String> columns = new LinkedHashSet<>();
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(method.contentProviderMethodName);
if (!method.getParent().hasSamePackageOfSchema()) {
methodBuilder.addModifiers(Modifier.PUBLIC);
}
ParameterSpec parameterSpec;
parameterSpec = ParameterSpec.builder(Uri.class, "uri").build();
methodBuilder.addParameter(parameterSpec);
parameterSpec = ParameterSpec.builder(ContentValues.class, "contentValues").build();
methodBuilder.addParameter(parameterSpec);
methodBuilder.returns(Long.TYPE);
SqlBuilderHelper.generateLogForContentProviderBeginning(method, methodBuilder);
// just detect which columns are admitted
JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {
@Override
public String onColumnName(String columnName) {
SQLProperty tempProperty = entity.get(columnName);
AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);
columns.add(tempProperty.columnName);
return tempProperty.columnName;
}
@Override
public String onColumnFullyQualifiedName(String tableName, String columnName) {
AssertKripton.fail("Inconsistent state");
return null;
}
});
// generate columnCheckSet
SqlBuilderHelper.generateColumnCheckSet(classBuilder, method, columns);
// retrieve content values
methodBuilder.addStatement("$T _contentValues=contentValuesForContentProvider(contentValues)",
KriptonContentValues.class);
// generate column check
SqlBuilderHelper.forEachColumnInContentValue(methodBuilder, method, "_contentValues.values().keySet()", true,
null);
methodBuilder.addCode("\n");
String rxIdGetter = "result";
// extract pathVariables
// generate get uri variables in content values
// every controls was done in constructor of SQLiteModelMethod
for (ContentUriPlaceHolder variable : method.contentProviderUriVariables) {
SQLProperty entityProperty = entity.get(variable.value);
if (entityProperty != null) {
methodBuilder.addCode("// Add parameter $L at path segment $L\n", variable.value,
variable.pathSegmentIndex);
TypeName entityPropertyType = entityProperty.getPropertyType().getTypeName();
if (TypeUtility.isString(entityPropertyType)) {
methodBuilder.addStatement("contentValues.put($S, uri.getPathSegments().get($L))",
entityProperty.columnName, variable.pathSegmentIndex);
} else {
methodBuilder.addStatement("contentValues.put($S, Long.valueOf(uri.getPathSegments().get($L)))",
entityProperty.columnName, variable.pathSegmentIndex);
}
}
if (entityProperty.isPrimaryKey()) {
rxIdGetter = PropertyUtility.getter(entityProperty);
}
}
// generate log for inser operation
SqlBuilderHelper.generateLogForContentValuesContentProvider(method, methodBuilder);
ConflictAlgorithmType conflictAlgorithmType = InsertBeanHelper.getConflictAlgorithmType(method);
String conflictString1 = "";
String conflictString2 = "";
if (conflictAlgorithmType != ConflictAlgorithmType.NONE) {
conflictString1 = "WithOnConflict";
conflictString2 = ", " + conflictAlgorithmType.getConflictAlgorithm();
methodBuilder.addCode("// conflict algorithm $L\n", method.jql.conflictAlgorithmType);
}
methodBuilder.addComment("insert operation");
methodBuilder.addStatement("long result = database().insert$L($S, null, _contentValues.values()$L)",
conflictString1, entity.getTableName(), conflictString2);
if (method.getParent().getParent().generateRx) {
SQLProperty primaryKey = entity.getPrimaryKey();
if (primaryKey.columnType == ColumnType.PRIMARY_KEY) {
// long autogenerated
rxIdGetter = "result";
} else {
if (primaryKey.isType(String.class)) {
rxIdGetter = String.format("contentValues.getAsString(\"%s\")", primaryKey.columnName);
} else {
rxIdGetter = String.format("contentValues.getAsLong(\"%s\")", primaryKey.columnName);
}
}
GenericSQLHelper.generateSubjectNext(entity, methodBuilder, SubjectType.INSERT, rxIdGetter);
}
// support for livedata
if (daoDefinition.hasLiveData()) {
methodBuilder.addComment("support for livedata");
methodBuilder.addStatement(BindDaoBuilder.METHOD_NAME_REGISTRY_EVENT + "(result>0?1:0)");
}
methodBuilder.addStatement("return result");
// javadoc
// we add at last javadoc, because need info is built at last.
SqlBuilderHelper.generateJavaDocForContentProvider(method, methodBuilder);
methodBuilder.addJavadoc("@param uri $S\n", method.contentProviderUriTemplate.replace("*", "[*]"));
methodBuilder.addJavadoc("@param contentValues content values\n");
methodBuilder.addJavadoc("@return new row's id\n");
classBuilder.addMethod(methodBuilder.build());
} | class class_name[name] begin[{]
method[generateInsertForContentProvider, return_type[void], modifier[private static], parameter[classBuilder, method, insertResultType]] begin[{]
local_variable[type[SQLiteDaoDefinition], daoDefinition]
local_variable[type[SQLiteEntity], entity]
local_variable[type[Set], columns]
local_variable[type[MethodSpec], methodBuilder]
if[call[method.getParent, parameter[]]] begin[{]
call[methodBuilder.addModifiers, parameter[member[Modifier.PUBLIC]]]
else begin[{]
None
end[}]
local_variable[type[ParameterSpec], parameterSpec]
assign[member[.parameterSpec], call[ParameterSpec.builder, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Uri, sub_type=None)), literal["uri"]]]]
call[methodBuilder.addParameter, parameter[member[.parameterSpec]]]
assign[member[.parameterSpec], call[ParameterSpec.builder, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ContentValues, sub_type=None)), literal["contentValues"]]]]
call[methodBuilder.addParameter, parameter[member[.parameterSpec]]]
call[methodBuilder.returns, parameter[member[Long.TYPE]]]
call[SqlBuilderHelper.generateLogForContentProviderBeginning, parameter[member[.method], member[.methodBuilder]]]
call[JQLChecker.getInstance, parameter[]]
call[SqlBuilderHelper.generateColumnCheckSet, parameter[member[.classBuilder], member[.method], member[.columns]]]
call[methodBuilder.addStatement, parameter[literal["$T _contentValues=contentValuesForContentProvider(contentValues)"], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KriptonContentValues, sub_type=None))]]
call[SqlBuilderHelper.forEachColumnInContentValue, parameter[member[.methodBuilder], member[.method], literal["_contentValues.values().keySet()"], literal[true], literal[null]]]
call[methodBuilder.addCode, parameter[literal["\n"]]]
local_variable[type[String], rxIdGetter]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), name=entityProperty)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SQLProperty, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entityProperty, 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="// Add parameter $L at path segment $L\n"), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[]), MemberReference(member=pathSegmentIndex, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[])], member=addCode, postfix_operators=[], prefix_operators=[], qualifier=methodBuilder, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPropertyType, postfix_operators=[], prefix_operators=[], qualifier=entityProperty, selectors=[MethodInvocation(arguments=[], member=getTypeName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=entityPropertyType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeName, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=entityPropertyType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isString, postfix_operators=[], prefix_operators=[], qualifier=TypeUtility, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="contentValues.put($S, Long.valueOf(uri.getPathSegments().get($L)))"), MemberReference(member=columnName, postfix_operators=[], prefix_operators=[], qualifier=entityProperty, selectors=[]), MemberReference(member=pathSegmentIndex, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[])], member=addStatement, postfix_operators=[], prefix_operators=[], qualifier=methodBuilder, 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="contentValues.put($S, uri.getPathSegments().get($L))"), MemberReference(member=columnName, postfix_operators=[], prefix_operators=[], qualifier=entityProperty, selectors=[]), MemberReference(member=pathSegmentIndex, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[])], member=addStatement, postfix_operators=[], prefix_operators=[], qualifier=methodBuilder, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=MethodInvocation(arguments=[], member=isPrimaryKey, postfix_operators=[], prefix_operators=[], qualifier=entityProperty, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=rxIdGetter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=entityProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getter, postfix_operators=[], prefix_operators=[], qualifier=PropertyUtility, selectors=[], type_arguments=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=contentProviderUriVariables, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=variable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContentUriPlaceHolder, sub_type=None))), label=None)
call[SqlBuilderHelper.generateLogForContentValuesContentProvider, parameter[member[.method], member[.methodBuilder]]]
local_variable[type[ConflictAlgorithmType], conflictAlgorithmType]
local_variable[type[String], conflictString1]
local_variable[type[String], conflictString2]
if[binary_operation[member[.conflictAlgorithmType], !=, member[ConflictAlgorithmType.NONE]]] begin[{]
assign[member[.conflictString1], literal["WithOnConflict"]]
assign[member[.conflictString2], binary_operation[literal[", "], +, call[conflictAlgorithmType.getConflictAlgorithm, parameter[]]]]
call[methodBuilder.addCode, parameter[literal["// conflict algorithm $L\n"], member[method.jql.conflictAlgorithmType]]]
else begin[{]
None
end[}]
call[methodBuilder.addComment, parameter[literal["insert operation"]]]
call[methodBuilder.addStatement, parameter[literal["long result = database().insert$L($S, null, _contentValues.values()$L)"], member[.conflictString1], call[entity.getTableName, parameter[]], member[.conflictString2]]]
if[call[method.getParent, parameter[]]] begin[{]
local_variable[type[SQLProperty], primaryKey]
if[binary_operation[member[primaryKey.columnType], ==, member[ColumnType.PRIMARY_KEY]]] begin[{]
assign[member[.rxIdGetter], literal["result"]]
else begin[{]
if[call[primaryKey.isType, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]] begin[{]
assign[member[.rxIdGetter], call[String.format, parameter[literal["contentValues.getAsString(\"%s\")"], member[primaryKey.columnName]]]]
else begin[{]
assign[member[.rxIdGetter], call[String.format, parameter[literal["contentValues.getAsLong(\"%s\")"], member[primaryKey.columnName]]]]
end[}]
end[}]
call[GenericSQLHelper.generateSubjectNext, parameter[member[.entity], member[.methodBuilder], member[SubjectType.INSERT], member[.rxIdGetter]]]
else begin[{]
None
end[}]
if[call[daoDefinition.hasLiveData, parameter[]]] begin[{]
call[methodBuilder.addComment, parameter[literal["support for livedata"]]]
call[methodBuilder.addStatement, parameter[binary_operation[member[BindDaoBuilder.METHOD_NAME_REGISTRY_EVENT], +, literal["(result>0?1:0)"]]]]
else begin[{]
None
end[}]
call[methodBuilder.addStatement, parameter[literal["return result"]]]
call[SqlBuilderHelper.generateJavaDocForContentProvider, parameter[member[.method], member[.methodBuilder]]]
call[methodBuilder.addJavadoc, parameter[literal["@param uri $S\n"], call[method.contentProviderUriTemplate.replace, parameter[literal["*"], literal["[*]"]]]]]
call[methodBuilder.addJavadoc, parameter[literal["@param contentValues content values\n"]]]
call[methodBuilder.addJavadoc, parameter[literal["@return new row's id\n"]]]
call[classBuilder.addMethod, parameter[call[methodBuilder.build, parameter[]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[generateInsertForContentProvider] operator[SEP] identifier[TypeSpec] operator[SEP] identifier[Builder] identifier[classBuilder] , Keyword[final] identifier[SQLiteModelMethod] identifier[method] , identifier[InsertType] identifier[insertResultType] operator[SEP] {
Keyword[final] identifier[SQLiteDaoDefinition] identifier[daoDefinition] operator[=] identifier[method] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[SQLiteEntity] identifier[entity] operator[=] identifier[method] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[columns] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[MethodSpec] operator[SEP] identifier[Builder] identifier[methodBuilder] operator[=] identifier[MethodSpec] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[method] operator[SEP] identifier[contentProviderMethodName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[method] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[hasSamePackageOfSchema] operator[SEP] operator[SEP] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[addModifiers] operator[SEP] identifier[Modifier] operator[SEP] identifier[PUBLIC] operator[SEP] operator[SEP]
}
identifier[ParameterSpec] identifier[parameterSpec] operator[SEP] identifier[parameterSpec] operator[=] identifier[ParameterSpec] operator[SEP] identifier[builder] operator[SEP] identifier[Uri] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addParameter] operator[SEP] identifier[parameterSpec] operator[SEP] operator[SEP] identifier[parameterSpec] operator[=] identifier[ParameterSpec] operator[SEP] identifier[builder] operator[SEP] identifier[ContentValues] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addParameter] operator[SEP] identifier[parameterSpec] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[returns] operator[SEP] identifier[Long] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] identifier[SqlBuilderHelper] operator[SEP] identifier[generateLogForContentProviderBeginning] operator[SEP] identifier[method] , identifier[methodBuilder] operator[SEP] operator[SEP] identifier[JQLChecker] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[method] , identifier[method] operator[SEP] identifier[jql] , Keyword[new] identifier[JQLReplacerListenerImpl] operator[SEP] identifier[method] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[onColumnName] operator[SEP] identifier[String] identifier[columnName] operator[SEP] {
identifier[SQLProperty] identifier[tempProperty] operator[=] identifier[entity] operator[SEP] identifier[get] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] identifier[AssertKripton] operator[SEP] identifier[assertTrueOrUnknownPropertyInJQLException] operator[SEP] identifier[tempProperty] operator[!=] Other[null] , identifier[method] , identifier[columnName] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[add] operator[SEP] identifier[tempProperty] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] Keyword[return] identifier[tempProperty] operator[SEP] identifier[columnName] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[onColumnFullyQualifiedName] operator[SEP] identifier[String] identifier[tableName] , identifier[String] identifier[columnName] operator[SEP] {
identifier[AssertKripton] operator[SEP] identifier[fail] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[SqlBuilderHelper] operator[SEP] identifier[generateColumnCheckSet] operator[SEP] identifier[classBuilder] , identifier[method] , identifier[columns] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[KriptonContentValues] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[SqlBuilderHelper] operator[SEP] identifier[forEachColumnInContentValue] operator[SEP] identifier[methodBuilder] , identifier[method] , literal[String] , literal[boolean] , Other[null] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addCode] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[rxIdGetter] operator[=] literal[String] operator[SEP] Keyword[for] operator[SEP] identifier[ContentUriPlaceHolder] identifier[variable] operator[:] identifier[method] operator[SEP] identifier[contentProviderUriVariables] operator[SEP] {
identifier[SQLProperty] identifier[entityProperty] operator[=] identifier[entity] operator[SEP] identifier[get] operator[SEP] identifier[variable] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entityProperty] operator[!=] Other[null] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[addCode] operator[SEP] literal[String] , identifier[variable] operator[SEP] identifier[value] , identifier[variable] operator[SEP] identifier[pathSegmentIndex] operator[SEP] operator[SEP] identifier[TypeName] identifier[entityPropertyType] operator[=] identifier[entityProperty] operator[SEP] identifier[getPropertyType] operator[SEP] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isString] operator[SEP] identifier[entityPropertyType] operator[SEP] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[entityProperty] operator[SEP] identifier[columnName] , identifier[variable] operator[SEP] identifier[pathSegmentIndex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[entityProperty] operator[SEP] identifier[columnName] , identifier[variable] operator[SEP] identifier[pathSegmentIndex] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[entityProperty] operator[SEP] identifier[isPrimaryKey] operator[SEP] operator[SEP] operator[SEP] {
identifier[rxIdGetter] operator[=] identifier[PropertyUtility] operator[SEP] identifier[getter] operator[SEP] identifier[entityProperty] operator[SEP] operator[SEP]
}
}
identifier[SqlBuilderHelper] operator[SEP] identifier[generateLogForContentValuesContentProvider] operator[SEP] identifier[method] , identifier[methodBuilder] operator[SEP] operator[SEP] identifier[ConflictAlgorithmType] identifier[conflictAlgorithmType] operator[=] identifier[InsertBeanHelper] operator[SEP] identifier[getConflictAlgorithmType] operator[SEP] identifier[method] operator[SEP] operator[SEP] identifier[String] identifier[conflictString1] operator[=] literal[String] operator[SEP] identifier[String] identifier[conflictString2] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[conflictAlgorithmType] operator[!=] identifier[ConflictAlgorithmType] operator[SEP] identifier[NONE] operator[SEP] {
identifier[conflictString1] operator[=] literal[String] operator[SEP] identifier[conflictString2] operator[=] literal[String] operator[+] identifier[conflictAlgorithmType] operator[SEP] identifier[getConflictAlgorithm] operator[SEP] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addCode] operator[SEP] literal[String] , identifier[method] operator[SEP] identifier[jql] operator[SEP] identifier[conflictAlgorithmType] operator[SEP] operator[SEP]
}
identifier[methodBuilder] operator[SEP] identifier[addComment] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[conflictString1] , identifier[entity] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[conflictString2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[generateRx] operator[SEP] {
identifier[SQLProperty] identifier[primaryKey] operator[=] identifier[entity] operator[SEP] identifier[getPrimaryKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[primaryKey] operator[SEP] identifier[columnType] operator[==] identifier[ColumnType] operator[SEP] identifier[PRIMARY_KEY] operator[SEP] {
identifier[rxIdGetter] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[primaryKey] operator[SEP] identifier[isType] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[rxIdGetter] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[primaryKey] operator[SEP] identifier[columnName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rxIdGetter] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[primaryKey] operator[SEP] identifier[columnName] operator[SEP] operator[SEP]
}
}
identifier[GenericSQLHelper] operator[SEP] identifier[generateSubjectNext] operator[SEP] identifier[entity] , identifier[methodBuilder] , identifier[SubjectType] operator[SEP] identifier[INSERT] , identifier[rxIdGetter] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[daoDefinition] operator[SEP] identifier[hasLiveData] operator[SEP] operator[SEP] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[addComment] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] identifier[BindDaoBuilder] operator[SEP] identifier[METHOD_NAME_REGISTRY_EVENT] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SqlBuilderHelper] operator[SEP] identifier[generateJavaDocForContentProvider] operator[SEP] identifier[method] , identifier[methodBuilder] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addJavadoc] operator[SEP] literal[String] , identifier[method] operator[SEP] identifier[contentProviderUriTemplate] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addJavadoc] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[addJavadoc] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[classBuilder] operator[SEP] identifier[addMethod] operator[SEP] identifier[methodBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public MultipleVersionRange intersect(MultipleVersionRange intersection)
{
List<VersionRange> r1 = this.ranges;
List<VersionRange> r2 = intersection.ranges;
List<VersionRange> ranges;
if (r1.isEmpty() || r2.isEmpty())
{
ranges = Collections.emptyList();
}
else
{
ranges = intersection(r1, r2);
}
if (ranges.isEmpty())
{
throw new VersionException("Intersected incompatible version ranges");
}
return new MultipleVersionRange(ranges);
} | class class_name[name] begin[{]
method[intersect, return_type[type[MultipleVersionRange]], modifier[public], parameter[intersection]] begin[{]
local_variable[type[List], r1]
local_variable[type[List], r2]
local_variable[type[List], ranges]
if[binary_operation[call[r1.isEmpty, parameter[]], ||, call[r2.isEmpty, parameter[]]]] begin[{]
assign[member[.ranges], call[Collections.emptyList, parameter[]]]
else begin[{]
assign[member[.ranges], call[.intersection, parameter[member[.r1], member[.r2]]]]
end[}]
if[call[ranges.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Intersected incompatible version ranges")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VersionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=ranges, 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=MultipleVersionRange, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[MultipleVersionRange] identifier[intersect] operator[SEP] identifier[MultipleVersionRange] identifier[intersection] operator[SEP] {
identifier[List] operator[<] identifier[VersionRange] operator[>] identifier[r1] operator[=] Keyword[this] operator[SEP] identifier[ranges] operator[SEP] identifier[List] operator[<] identifier[VersionRange] operator[>] identifier[r2] operator[=] identifier[intersection] operator[SEP] identifier[ranges] operator[SEP] identifier[List] operator[<] identifier[VersionRange] operator[>] identifier[ranges] operator[SEP] Keyword[if] operator[SEP] identifier[r1] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] identifier[r2] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[ranges] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ranges] operator[=] identifier[intersection] operator[SEP] identifier[r1] , identifier[r2] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ranges] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[VersionException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[MultipleVersionRange] operator[SEP] identifier[ranges] operator[SEP] operator[SEP]
}
|
Downsampler downsampler(final long start_time,
final long end_time,
final long interval_ms,
final Aggregator downsampler,
final FillPolicy fill_policy) {
if (FillPolicy.NONE == fill_policy) {
// The default downsampler simply skips missing intervals, causing the
// span group to linearly interpolate.
return new Downsampler(spanIterator(), interval_ms, downsampler);
} else {
// Otherwise, we need to instantiate a downsampler that can fill missing
// intervals with special values.
return new FillingDownsampler(spanIterator(), start_time, end_time,
interval_ms, downsampler, fill_policy);
}
} | class class_name[name] begin[{]
method[downsampler, return_type[type[Downsampler]], modifier[default], parameter[start_time, end_time, interval_ms, downsampler, fill_policy]] begin[{]
if[binary_operation[member[FillPolicy.NONE], ==, member[.fill_policy]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=spanIterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=interval_ms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=downsampler, 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=Downsampler, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=spanIterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=start_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=end_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interval_ms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=downsampler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fill_policy, 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=FillingDownsampler, sub_type=None))]
end[}]
end[}]
END[}] | identifier[Downsampler] identifier[downsampler] operator[SEP] Keyword[final] Keyword[long] identifier[start_time] , Keyword[final] Keyword[long] identifier[end_time] , Keyword[final] Keyword[long] identifier[interval_ms] , Keyword[final] identifier[Aggregator] identifier[downsampler] , Keyword[final] identifier[FillPolicy] identifier[fill_policy] operator[SEP] {
Keyword[if] operator[SEP] identifier[FillPolicy] operator[SEP] identifier[NONE] operator[==] identifier[fill_policy] operator[SEP] {
Keyword[return] Keyword[new] identifier[Downsampler] operator[SEP] identifier[spanIterator] operator[SEP] operator[SEP] , identifier[interval_ms] , identifier[downsampler] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[FillingDownsampler] operator[SEP] identifier[spanIterator] operator[SEP] operator[SEP] , identifier[start_time] , identifier[end_time] , identifier[interval_ms] , identifier[downsampler] , identifier[fill_policy] operator[SEP] operator[SEP]
}
}
|
public static PlotCanvas plot(double[][] data, Line.Style style, Color color) {
return plot(null, data, style, color);
} | class class_name[name] begin[{]
method[plot, return_type[type[PlotCanvas]], modifier[public static], parameter[data, style, color]] begin[{]
return[call[.plot, parameter[literal[null], member[.data], member[.style], member[.color]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PlotCanvas] identifier[plot] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] , identifier[Line] operator[SEP] identifier[Style] identifier[style] , identifier[Color] identifier[color] operator[SEP] {
Keyword[return] identifier[plot] operator[SEP] Other[null] , identifier[data] , identifier[style] , identifier[color] operator[SEP] operator[SEP]
}
|
public static InfoPopup errorBelow (String message, Widget source)
{
return error(message, Position.BELOW, source);
} | class class_name[name] begin[{]
method[errorBelow, return_type[type[InfoPopup]], modifier[public static], parameter[message, source]] begin[{]
return[call[.error, parameter[member[.message], member[Position.BELOW], member[.source]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InfoPopup] identifier[errorBelow] operator[SEP] identifier[String] identifier[message] , identifier[Widget] identifier[source] operator[SEP] {
Keyword[return] identifier[error] operator[SEP] identifier[message] , identifier[Position] operator[SEP] identifier[BELOW] , identifier[source] operator[SEP] operator[SEP]
}
|
public static String convertClassName(String className, String stringToInsert)
{
return Util.convertClassName(className, stringToInsert, 2);
} | class class_name[name] begin[{]
method[convertClassName, return_type[type[String]], modifier[public static], parameter[className, stringToInsert]] begin[{]
return[call[Util.convertClassName, parameter[member[.className], member[.stringToInsert], literal[2]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[convertClassName] operator[SEP] identifier[String] identifier[className] , identifier[String] identifier[stringToInsert] operator[SEP] {
Keyword[return] identifier[Util] operator[SEP] identifier[convertClassName] operator[SEP] identifier[className] , identifier[stringToInsert] , Other[2] operator[SEP] operator[SEP]
}
|
private List<RuleEntry> getSortedEntries() {
List<RuleEntry> ruleEntries = new ArrayList<RuleEntry>(
methodRules.size() + testRules.size());
for (MethodRule rule : methodRules) {
ruleEntries.add(new RuleEntry(rule, RuleEntry.TYPE_METHOD_RULE, orderValues.get(rule)));
}
for (TestRule rule : testRules) {
ruleEntries.add(new RuleEntry(rule, RuleEntry.TYPE_TEST_RULE, orderValues.get(rule)));
}
Collections.sort(ruleEntries, ENTRY_COMPARATOR);
return ruleEntries;
} | class class_name[name] begin[{]
method[getSortedEntries, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[List], ruleEntries]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=TYPE_METHOD_RULE, postfix_operators=[], prefix_operators=[], qualifier=RuleEntry, selectors=[]), MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderValues, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleEntry, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=ruleEntries, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=methodRules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodRule, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=TYPE_TEST_RULE, postfix_operators=[], prefix_operators=[], qualifier=RuleEntry, selectors=[]), MethodInvocation(arguments=[MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=orderValues, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleEntry, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=ruleEntries, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=testRules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TestRule, sub_type=None))), label=None)
call[Collections.sort, parameter[member[.ruleEntries], member[.ENTRY_COMPARATOR]]]
return[member[.ruleEntries]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[RuleEntry] operator[>] identifier[getSortedEntries] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[RuleEntry] operator[>] identifier[ruleEntries] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[RuleEntry] operator[>] operator[SEP] identifier[methodRules] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[testRules] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MethodRule] identifier[rule] operator[:] identifier[methodRules] operator[SEP] {
identifier[ruleEntries] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RuleEntry] operator[SEP] identifier[rule] , identifier[RuleEntry] operator[SEP] identifier[TYPE_METHOD_RULE] , identifier[orderValues] operator[SEP] identifier[get] operator[SEP] identifier[rule] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[TestRule] identifier[rule] operator[:] identifier[testRules] operator[SEP] {
identifier[ruleEntries] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RuleEntry] operator[SEP] identifier[rule] , identifier[RuleEntry] operator[SEP] identifier[TYPE_TEST_RULE] , identifier[orderValues] operator[SEP] identifier[get] operator[SEP] identifier[rule] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[ruleEntries] , identifier[ENTRY_COMPARATOR] operator[SEP] operator[SEP] Keyword[return] identifier[ruleEntries] operator[SEP]
}
|
private static Pair<List<DimensionSpec>, List<DimensionSpec>> partitionDimensionList(
StorageAdapter adapter,
List<DimensionSpec> dimensions
)
{
final List<DimensionSpec> bitmapDims = new ArrayList<>();
final List<DimensionSpec> nonBitmapDims = new ArrayList<>();
final List<DimensionSpec> dimsToSearch = getDimsToSearch(
adapter.getAvailableDimensions(),
dimensions
);
for (DimensionSpec spec : dimsToSearch) {
ColumnCapabilities capabilities = adapter.getColumnCapabilities(spec.getDimension());
if (capabilities == null) {
continue;
}
if (capabilities.hasBitmapIndexes()) {
bitmapDims.add(spec);
} else {
nonBitmapDims.add(spec);
}
}
return new Pair<>(bitmapDims, nonBitmapDims);
} | class class_name[name] begin[{]
method[partitionDimensionList, return_type[type[Pair]], modifier[private static], parameter[adapter, dimensions]] begin[{]
local_variable[type[List], bitmapDims]
local_variable[type[List], nonBitmapDims]
local_variable[type[List], dimsToSearch]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDimension, postfix_operators=[], prefix_operators=[], qualifier=spec, selectors=[], type_arguments=None)], member=getColumnCapabilities, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), name=capabilities)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ColumnCapabilities, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=capabilities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=hasBitmapIndexes, postfix_operators=[], prefix_operators=[], qualifier=capabilities, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=spec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=nonBitmapDims, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=spec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=bitmapDims, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=dimsToSearch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=spec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DimensionSpec, sub_type=None))), label=None)
return[ClassCreator(arguments=[MemberReference(member=bitmapDims, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nonBitmapDims, 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=Pair, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Pair] operator[<] identifier[List] operator[<] identifier[DimensionSpec] operator[>] , identifier[List] operator[<] identifier[DimensionSpec] operator[>] operator[>] identifier[partitionDimensionList] operator[SEP] identifier[StorageAdapter] identifier[adapter] , identifier[List] operator[<] identifier[DimensionSpec] operator[>] identifier[dimensions] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[DimensionSpec] operator[>] identifier[bitmapDims] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[DimensionSpec] operator[>] identifier[nonBitmapDims] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[DimensionSpec] operator[>] identifier[dimsToSearch] operator[=] identifier[getDimsToSearch] operator[SEP] identifier[adapter] operator[SEP] identifier[getAvailableDimensions] operator[SEP] operator[SEP] , identifier[dimensions] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DimensionSpec] identifier[spec] operator[:] identifier[dimsToSearch] operator[SEP] {
identifier[ColumnCapabilities] identifier[capabilities] operator[=] identifier[adapter] operator[SEP] identifier[getColumnCapabilities] operator[SEP] identifier[spec] operator[SEP] identifier[getDimension] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[capabilities] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[capabilities] operator[SEP] identifier[hasBitmapIndexes] operator[SEP] operator[SEP] operator[SEP] {
identifier[bitmapDims] operator[SEP] identifier[add] operator[SEP] identifier[spec] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[nonBitmapDims] operator[SEP] identifier[add] operator[SEP] identifier[spec] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[Pair] operator[<] operator[>] operator[SEP] identifier[bitmapDims] , identifier[nonBitmapDims] operator[SEP] operator[SEP]
}
|
public final List<T> findByQuery(String query, Object... params) {
return this.findSortedByQuery(query, null, params);
} | class class_name[name] begin[{]
method[findByQuery, return_type[type[List]], modifier[final public], parameter[query, params]] begin[{]
return[THIS[call[None.findSortedByQuery, parameter[member[.query], literal[null], member[.params]]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[List] operator[<] identifier[T] operator[>] identifier[findByQuery] operator[SEP] identifier[String] identifier[query] , identifier[Object] operator[...] identifier[params] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[findSortedByQuery] operator[SEP] identifier[query] , Other[null] , identifier[params] operator[SEP] operator[SEP]
}
|
public static long sizeToLong(String size) {
size = size.trim();
if (Checker.isNotEmpty(size)) {
String num;
if (size.contains(ValueConsts.SPACE)) {
num = size.split(ValueConsts.SPACE)[0];
} else {
num = Utils.extractDigit(size);
}
double result;
if (size.contains(SIZE_TB)) {
result = stringToDouble(num) * ValueConsts.TB;
} else if (size.contains(SIZE_GB)) {
result = stringToDouble(num) * ValueConsts.GB;
} else if (size.contains(SIZE_MB)) {
result = stringToDouble(num) * ValueConsts.MB;
} else if (size.contains(SIZE_KB)) {
result = stringToDouble(num) * ValueConsts.KB;
} else {
result = stringToDouble(num);
}
return (long) result;
}
return -1;
} | class class_name[name] begin[{]
method[sizeToLong, return_type[type[long]], modifier[public static], parameter[size]] begin[{]
assign[member[.size], call[size.trim, parameter[]]]
if[call[Checker.isNotEmpty, parameter[member[.size]]]] begin[{]
local_variable[type[String], num]
if[call[size.contains, parameter[member[ValueConsts.SPACE]]]] begin[{]
assign[member[.num], call[size.split, parameter[member[ValueConsts.SPACE]]]]
else begin[{]
assign[member[.num], call[Utils.extractDigit, parameter[member[.size]]]]
end[}]
local_variable[type[double], result]
if[call[size.contains, parameter[member[.SIZE_TB]]]] begin[{]
assign[member[.result], binary_operation[call[.stringToDouble, parameter[member[.num]]], *, member[ValueConsts.TB]]]
else begin[{]
if[call[size.contains, parameter[member[.SIZE_GB]]]] begin[{]
assign[member[.result], binary_operation[call[.stringToDouble, parameter[member[.num]]], *, member[ValueConsts.GB]]]
else begin[{]
if[call[size.contains, parameter[member[.SIZE_MB]]]] begin[{]
assign[member[.result], binary_operation[call[.stringToDouble, parameter[member[.num]]], *, member[ValueConsts.MB]]]
else begin[{]
if[call[size.contains, parameter[member[.SIZE_KB]]]] begin[{]
assign[member[.result], binary_operation[call[.stringToDouble, parameter[member[.num]]], *, member[ValueConsts.KB]]]
else begin[{]
assign[member[.result], call[.stringToDouble, parameter[member[.num]]]]
end[}]
end[}]
end[}]
end[}]
return[Cast(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=long))]
else begin[{]
None
end[}]
return[literal[1]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[sizeToLong] operator[SEP] identifier[String] identifier[size] operator[SEP] {
identifier[size] operator[=] identifier[size] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Checker] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[size] operator[SEP] operator[SEP] {
identifier[String] identifier[num] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[contains] operator[SEP] identifier[ValueConsts] operator[SEP] identifier[SPACE] operator[SEP] operator[SEP] {
identifier[num] operator[=] identifier[size] operator[SEP] identifier[split] operator[SEP] identifier[ValueConsts] operator[SEP] identifier[SPACE] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[num] operator[=] identifier[Utils] operator[SEP] identifier[extractDigit] operator[SEP] identifier[size] operator[SEP] operator[SEP]
}
Keyword[double] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[contains] operator[SEP] identifier[SIZE_TB] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[stringToDouble] operator[SEP] identifier[num] operator[SEP] operator[*] identifier[ValueConsts] operator[SEP] identifier[TB] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[contains] operator[SEP] identifier[SIZE_GB] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[stringToDouble] operator[SEP] identifier[num] operator[SEP] operator[*] identifier[ValueConsts] operator[SEP] identifier[GB] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[contains] operator[SEP] identifier[SIZE_MB] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[stringToDouble] operator[SEP] identifier[num] operator[SEP] operator[*] identifier[ValueConsts] operator[SEP] identifier[MB] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[size] operator[SEP] identifier[contains] operator[SEP] identifier[SIZE_KB] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[stringToDouble] operator[SEP] identifier[num] operator[SEP] operator[*] identifier[ValueConsts] operator[SEP] identifier[KB] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] identifier[stringToDouble] operator[SEP] identifier[num] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] Keyword[long] operator[SEP] identifier[result] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public static String getLastShardId(
ClientConfiguration awsClientConfig,
KinesisConfigBean conf,
String streamName
) throws StageException {
AmazonKinesis kinesisClient = getKinesisClient(awsClientConfig, conf);
String lastShardId = null;
try {
StreamDescription description;
do {
if (lastShardId == null) {
description = kinesisClient.describeStream(streamName).getStreamDescription();
} else {
description = kinesisClient.describeStream(streamName, lastShardId).getStreamDescription();
}
int pageSize = description.getShards().size();
lastShardId = description.getShards().get(pageSize - 1).getShardId();
} while (description.getHasMoreShards());
return lastShardId;
} finally {
kinesisClient.shutdown();
}
} | class class_name[name] begin[{]
method[getLastShardId, return_type[type[String]], modifier[public static], parameter[awsClientConfig, conf, streamName]] begin[{]
local_variable[type[AmazonKinesis], kinesisClient]
local_variable[type[String], lastShardId]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=description)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StreamDescription, sub_type=None)), DoStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastShardId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=streamName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lastShardId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=describeStream, postfix_operators=[], prefix_operators=[], qualifier=kinesisClient, selectors=[MethodInvocation(arguments=[], member=getStreamDescription, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=streamName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=describeStream, postfix_operators=[], prefix_operators=[], qualifier=kinesisClient, selectors=[MethodInvocation(arguments=[], member=getStreamDescription, 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=getShards, postfix_operators=[], prefix_operators=[], qualifier=description, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=pageSize)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastShardId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getShards, postfix_operators=[], prefix_operators=[], qualifier=description, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=pageSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getShardId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), condition=MethodInvocation(arguments=[], member=getHasMoreShards, postfix_operators=[], prefix_operators=[], qualifier=description, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=lastShardId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdown, postfix_operators=[], prefix_operators=[], qualifier=kinesisClient, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getLastShardId] operator[SEP] identifier[ClientConfiguration] identifier[awsClientConfig] , identifier[KinesisConfigBean] identifier[conf] , identifier[String] identifier[streamName] operator[SEP] Keyword[throws] identifier[StageException] {
identifier[AmazonKinesis] identifier[kinesisClient] operator[=] identifier[getKinesisClient] operator[SEP] identifier[awsClientConfig] , identifier[conf] operator[SEP] operator[SEP] identifier[String] identifier[lastShardId] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[StreamDescription] identifier[description] operator[SEP] Keyword[do] {
Keyword[if] operator[SEP] identifier[lastShardId] operator[==] Other[null] operator[SEP] {
identifier[description] operator[=] identifier[kinesisClient] operator[SEP] identifier[describeStream] operator[SEP] identifier[streamName] operator[SEP] operator[SEP] identifier[getStreamDescription] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[description] operator[=] identifier[kinesisClient] operator[SEP] identifier[describeStream] operator[SEP] identifier[streamName] , identifier[lastShardId] operator[SEP] operator[SEP] identifier[getStreamDescription] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[pageSize] operator[=] identifier[description] operator[SEP] identifier[getShards] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[lastShardId] operator[=] identifier[description] operator[SEP] identifier[getShards] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[pageSize] operator[-] Other[1] operator[SEP] operator[SEP] identifier[getShardId] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[description] operator[SEP] identifier[getHasMoreShards] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[lastShardId] operator[SEP]
}
Keyword[finally] {
identifier[kinesisClient] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Object waitingGet(boolean interruptible) {
Signaller q = null;
boolean queued = false;
int spins = SPINS;
Object r;
while ((r = result) == null) {
if (spins > 0) {
if (ThreadLocalRandom.nextSecondarySeed() >= 0)
--spins;
}
else if (q == null)
q = new Signaller(interruptible, 0L, 0L);
else if (!queued)
queued = tryPushStack(q);
else {
try {
ForkJoinPool.managedBlock(q);
} catch (InterruptedException ie) { // currently cannot happen
q.interrupted = true;
}
if (q.interrupted && interruptible)
break;
}
}
if (q != null) {
q.thread = null;
if (q.interrupted) {
if (interruptible)
cleanStack();
else
Thread.currentThread().interrupt();
}
}
if (r != null)
postComplete();
return r;
} | class class_name[name] begin[{]
method[waitingGet, return_type[type[Object]], modifier[private], parameter[interruptible]] begin[{]
local_variable[type[Signaller], q]
local_variable[type[boolean], queued]
local_variable[type[int], spins]
local_variable[type[Object], r]
while[binary_operation[assign[member[.r], member[.result]], ==, literal[null]]] begin[{]
if[binary_operation[member[.spins], >, literal[0]]] begin[{]
if[binary_operation[call[ThreadLocalRandom.nextSecondarySeed, parameter[]], >=, literal[0]]] begin[{]
member[.spins]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.q], ==, literal[null]]] begin[{]
assign[member[.q], ClassCreator(arguments=[MemberReference(member=interruptible, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Signaller, sub_type=None))]
else begin[{]
if[member[.queued]] begin[{]
assign[member[.queued], call[.tryPushStack, parameter[member[.q]]]]
else begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=managedBlock, postfix_operators=[], prefix_operators=[], qualifier=ForkJoinPool, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=interrupted, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ie, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[q.interrupted], &&, member[.interruptible]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
if[binary_operation[member[.q], !=, literal[null]]] begin[{]
assign[member[q.thread], literal[null]]
if[member[q.interrupted]] begin[{]
if[member[.interruptible]] begin[{]
call[.cleanStack, parameter[]]
else begin[{]
call[Thread.currentThread, parameter[]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.r], !=, literal[null]]] begin[{]
call[.postComplete, parameter[]]
else begin[{]
None
end[}]
return[member[.r]]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[waitingGet] operator[SEP] Keyword[boolean] identifier[interruptible] operator[SEP] {
identifier[Signaller] identifier[q] operator[=] Other[null] operator[SEP] Keyword[boolean] identifier[queued] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[spins] operator[=] identifier[SPINS] operator[SEP] identifier[Object] identifier[r] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[r] operator[=] identifier[result] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[spins] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[ThreadLocalRandom] operator[SEP] identifier[nextSecondarySeed] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] operator[--] identifier[spins] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[q] operator[==] Other[null] operator[SEP] identifier[q] operator[=] Keyword[new] identifier[Signaller] operator[SEP] identifier[interruptible] , Other[0L] , Other[0L] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[queued] operator[SEP] identifier[queued] operator[=] identifier[tryPushStack] operator[SEP] identifier[q] operator[SEP] operator[SEP] Keyword[else] {
Keyword[try] {
identifier[ForkJoinPool] operator[SEP] identifier[managedBlock] operator[SEP] identifier[q] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[ie] operator[SEP] {
identifier[q] operator[SEP] identifier[interrupted] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[q] operator[SEP] identifier[interrupted] operator[&&] identifier[interruptible] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[q] operator[!=] Other[null] operator[SEP] {
identifier[q] operator[SEP] identifier[thread] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[q] operator[SEP] identifier[interrupted] operator[SEP] {
Keyword[if] operator[SEP] identifier[interruptible] operator[SEP] identifier[cleanStack] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[r] operator[!=] Other[null] operator[SEP] identifier[postComplete] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
|
public boolean isAllowedPackage(String packageName)
{
// No packages in set? Accept all packages.
if (packageSet.isEmpty())
{
return true;
}
// check all valid packages
for (String validPackage : packageSet)
{
// accept if package is a sub-package of a valid package
if (packageName.startsWith(validPackage))
{
return true;
}
}
// package noch accepted
return false;
} | class class_name[name] begin[{]
method[isAllowedPackage, return_type[type[boolean]], modifier[public], parameter[packageName]] begin[{]
if[call[packageSet.isEmpty, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=validPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=packageName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=packageSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=validPackage)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isAllowedPackage] operator[SEP] identifier[String] identifier[packageName] operator[SEP] {
Keyword[if] operator[SEP] identifier[packageSet] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[validPackage] operator[:] identifier[packageSet] operator[SEP] {
Keyword[if] operator[SEP] identifier[packageName] operator[SEP] identifier[startsWith] operator[SEP] identifier[validPackage] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public T[] asArray(Class<T> type) {
return Iterators.toArray(each().iterator(), type);
} | class class_name[name] begin[{]
method[asArray, return_type[type[T]], modifier[public], parameter[type]] begin[{]
return[call[Iterators.toArray, parameter[call[.each, parameter[]], member[.type]]]]
end[}]
END[}] | Keyword[public] identifier[T] operator[SEP] operator[SEP] identifier[asArray] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] operator[SEP] {
Keyword[return] identifier[Iterators] operator[SEP] identifier[toArray] operator[SEP] identifier[each] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] , identifier[type] operator[SEP] operator[SEP]
}
|
public String deleteByExample(MappedStatement ms) {
Class<?> entityClass = getEntityClass(ms);
StringBuilder sql = new StringBuilder();
if (isCheckExampleEntityClass()) {
sql.append(SqlHelper.exampleCheck(entityClass));
}
//如果设置了安全删除,就不允许执行不带查询条件的 delete 方法
if (getConfig().isSafeDelete()) {
sql.append(SqlHelper.exampleHasAtLeastOneCriteriaCheck("_parameter"));
}
if (SqlHelper.hasLogicDeleteColumn(entityClass)) {
sql.append(SqlHelper.updateTable(entityClass, tableName(entityClass)));
sql.append("<set>");
sql.append(SqlHelper.logicDeleteColumnEqualsValue(entityClass, true));
sql.append("</set>");
MetaObjectUtil.forObject(ms).setValue("sqlCommandType", SqlCommandType.UPDATE);
} else {
sql.append(SqlHelper.deleteFromTable(entityClass, tableName(entityClass)));
}
sql.append(SqlHelper.exampleWhereClause());
return sql.toString();
} | class class_name[name] begin[{]
method[deleteByExample, return_type[type[String]], modifier[public], parameter[ms]] begin[{]
local_variable[type[Class], entityClass]
local_variable[type[StringBuilder], sql]
if[call[.isCheckExampleEntityClass, parameter[]]] begin[{]
call[sql.append, parameter[call[SqlHelper.exampleCheck, parameter[member[.entityClass]]]]]
else begin[{]
None
end[}]
if[call[.getConfig, parameter[]]] begin[{]
call[sql.append, parameter[call[SqlHelper.exampleHasAtLeastOneCriteriaCheck, parameter[literal["_parameter"]]]]]
else begin[{]
None
end[}]
if[call[SqlHelper.hasLogicDeleteColumn, parameter[member[.entityClass]]]] begin[{]
call[sql.append, parameter[call[SqlHelper.updateTable, parameter[member[.entityClass], call[.tableName, parameter[member[.entityClass]]]]]]]
call[sql.append, parameter[literal["<set>"]]]
call[sql.append, parameter[call[SqlHelper.logicDeleteColumnEqualsValue, parameter[member[.entityClass], literal[true]]]]]
call[sql.append, parameter[literal["</set>"]]]
call[MetaObjectUtil.forObject, parameter[member[.ms]]]
else begin[{]
call[sql.append, parameter[call[SqlHelper.deleteFromTable, parameter[member[.entityClass], call[.tableName, parameter[member[.entityClass]]]]]]]
end[}]
call[sql.append, parameter[call[SqlHelper.exampleWhereClause, parameter[]]]]
return[call[sql.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[deleteByExample] operator[SEP] identifier[MappedStatement] identifier[ms] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[entityClass] operator[=] identifier[getEntityClass] operator[SEP] identifier[ms] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sql] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isCheckExampleEntityClass] operator[SEP] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[exampleCheck] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[isSafeDelete] operator[SEP] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[exampleHasAtLeastOneCriteriaCheck] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[hasLogicDeleteColumn] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[updateTable] operator[SEP] identifier[entityClass] , identifier[tableName] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[logicDeleteColumnEqualsValue] operator[SEP] identifier[entityClass] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[MetaObjectUtil] operator[SEP] identifier[forObject] operator[SEP] identifier[ms] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] literal[String] , identifier[SqlCommandType] operator[SEP] identifier[UPDATE] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[deleteFromTable] operator[SEP] identifier[entityClass] , identifier[tableName] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[SqlHelper] operator[SEP] identifier[exampleWhereClause] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[sql] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public final <V> Flux<V> flatMapDelayError(Function<? super T, ? extends Publisher<? extends V>> mapper,
int concurrency, int prefetch) {
return flatMap(mapper, true, concurrency, prefetch);
} | class class_name[name] begin[{]
method[flatMapDelayError, return_type[type[Flux]], modifier[final public], parameter[mapper, concurrency, prefetch]] begin[{]
return[call[.flatMap, parameter[member[.mapper], literal[true], member[.concurrency], member[.prefetch]]]]
end[}]
END[}] | Keyword[public] Keyword[final] operator[<] identifier[V] operator[>] identifier[Flux] operator[<] identifier[V] operator[>] identifier[flatMapDelayError] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[Publisher] operator[<] operator[?] Keyword[extends] identifier[V] operator[>] operator[>] identifier[mapper] , Keyword[int] identifier[concurrency] , Keyword[int] identifier[prefetch] operator[SEP] {
Keyword[return] identifier[flatMap] operator[SEP] identifier[mapper] , literal[boolean] , identifier[concurrency] , identifier[prefetch] operator[SEP] operator[SEP]
}
|
public void updateSendAllowed(boolean oldSendAllowed, boolean newSendAllowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc,
"updateSendAllowed",
new Object[] {Boolean.valueOf(oldSendAllowed), Boolean.valueOf(newSendAllowed)});
if(oldSendAllowed && !newSendAllowed)
setForeignBusSendAllowed(false);
else if(!oldSendAllowed && newSendAllowed)
setForeignBusSendAllowed(true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "updateSendAllowed");
} | class class_name[name] begin[{]
method[updateSendAllowed, return_type[void], modifier[public], parameter[oldSendAllowed, newSendAllowed]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["updateSendAllowed"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=oldSendAllowed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=newSendAllowed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, 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[binary_operation[member[.oldSendAllowed], &&, member[.newSendAllowed]]] begin[{]
call[.setForeignBusSendAllowed, parameter[literal[false]]]
else begin[{]
if[binary_operation[member[.oldSendAllowed], &&, member[.newSendAllowed]]] begin[{]
call[.setForeignBusSendAllowed, parameter[literal[true]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["updateSendAllowed"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateSendAllowed] operator[SEP] Keyword[boolean] identifier[oldSendAllowed] , Keyword[boolean] identifier[newSendAllowed] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[oldSendAllowed] operator[SEP] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[newSendAllowed] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldSendAllowed] operator[&&] operator[!] identifier[newSendAllowed] operator[SEP] identifier[setForeignBusSendAllowed] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[oldSendAllowed] operator[&&] identifier[newSendAllowed] operator[SEP] identifier[setForeignBusSendAllowed] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
private boolean checkDimensions(CLIQUEUnit other, int e) {
for(int i = 0, j = 0; i < e; i++, j += 2) {
if(dims[i] != other.dims[i] || bounds[j] != other.bounds[j] || bounds[j + 1] != bounds[j + 1]) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[checkDimensions, return_type[type[boolean]], modifier[private], parameter[other, e]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dims, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=dims, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=bounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=bounds, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=!=), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=bounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operandr=MemberReference(member=bounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), operator=!=), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=e, 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), VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[checkDimensions] operator[SEP] identifier[CLIQUEUnit] identifier[other] , Keyword[int] identifier[e] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[j] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[e] operator[SEP] identifier[i] operator[++] , identifier[j] operator[+=] Other[2] operator[SEP] {
Keyword[if] operator[SEP] identifier[dims] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[other] operator[SEP] identifier[dims] operator[SEP] identifier[i] operator[SEP] operator[||] identifier[bounds] operator[SEP] identifier[j] operator[SEP] operator[!=] identifier[other] operator[SEP] identifier[bounds] operator[SEP] identifier[j] operator[SEP] operator[||] identifier[bounds] operator[SEP] identifier[j] operator[+] Other[1] operator[SEP] operator[!=] identifier[bounds] operator[SEP] identifier[j] operator[+] Other[1] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void addCommands(Iterable<Command> commands) {
Assert.notNull(commands, "Commands must not be null");
for (Command command : commands) {
addCommand(command);
}
} | class class_name[name] begin[{]
method[addCommands, return_type[void], modifier[public], parameter[commands]] begin[{]
call[Assert.notNull, parameter[member[.commands], literal["Commands must not be null"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addCommand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=commands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=command)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Command, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addCommands] operator[SEP] identifier[Iterable] operator[<] identifier[Command] operator[>] identifier[commands] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[commands] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Command] identifier[command] operator[:] identifier[commands] operator[SEP] {
identifier[addCommand] operator[SEP] identifier[command] operator[SEP] operator[SEP]
}
}
|
public static final void assertProcessInActivity(final String processInstanceId, final String activityId) {
Validate.notNull(processInstanceId);
Validate.notNull(activityId);
apiCallback.debug(LogMessage.PROCESS_15, processInstanceId, activityId);
try {
getProcessInstanceAssertable().processIsInActivity(processInstanceId, activityId);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_6, processInstanceId, activityId);
}
} | class class_name[name] begin[{]
method[assertProcessInActivity, return_type[void], modifier[final public static], parameter[processInstanceId, activityId]] begin[{]
call[Validate.notNull, parameter[member[.processInstanceId]]]
call[Validate.notNull, parameter[member[.activityId]]]
call[apiCallback.debug, parameter[member[LogMessage.PROCESS_15], member[.processInstanceId], member[.activityId]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getProcessInstanceAssertable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=processInstanceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=activityId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processIsInActivity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ERROR_PROCESS_6, postfix_operators=[], prefix_operators=[], qualifier=LogMessage, selectors=[]), MemberReference(member=processInstanceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=activityId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fail, postfix_operators=[], prefix_operators=[], qualifier=apiCallback, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ae, types=['AssertionError']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[void] identifier[assertProcessInActivity] operator[SEP] Keyword[final] identifier[String] identifier[processInstanceId] , Keyword[final] identifier[String] identifier[activityId] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[processInstanceId] operator[SEP] operator[SEP] identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[activityId] operator[SEP] operator[SEP] identifier[apiCallback] operator[SEP] identifier[debug] operator[SEP] identifier[LogMessage] operator[SEP] identifier[PROCESS_15] , identifier[processInstanceId] , identifier[activityId] operator[SEP] operator[SEP] Keyword[try] {
identifier[getProcessInstanceAssertable] operator[SEP] operator[SEP] operator[SEP] identifier[processIsInActivity] operator[SEP] identifier[processInstanceId] , identifier[activityId] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[AssertionError] identifier[ae] operator[SEP] {
identifier[apiCallback] operator[SEP] identifier[fail] operator[SEP] identifier[ae] , identifier[LogMessage] operator[SEP] identifier[ERROR_PROCESS_6] , identifier[processInstanceId] , identifier[activityId] operator[SEP] operator[SEP]
}
}
|
public void seedUsingPcmAudio(byte[] data) {
byte[] key = new byte[64];
for (int i = 0; i < key.length; i++) {
int x = 0;
//Pick 4 random bytes from the PCM audio data, from each of the bytes
//take the two least significant bits and concatenate them to form
//the i-th byte in the seed key
for (int j = 0; j < 4; j++) {
x = (x << 2) | (3 & data[RandomSource.getInt(data.length)]);
}
key[i] = (byte) x;
}
seed(key);
initialized = true;
} | class class_name[name] begin[{]
method[seedUsingPcmAudio, return_type[void], modifier[public], parameter[data]] begin[{]
local_variable[type[byte], key]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=<<), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operandr=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MethodInvocation(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[])], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=RandomSource, selectors=[], type_arguments=None))]), operator=&), operator=|)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), 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=key, 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[.seed, parameter[member[.key]]]
assign[member[.initialized], literal[true]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[seedUsingPcmAudio] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[key] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[64] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[key] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[x] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] Other[4] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[x] operator[=] operator[SEP] identifier[x] operator[<<] Other[2] operator[SEP] operator[|] operator[SEP] Other[3] operator[&] identifier[data] operator[SEP] identifier[RandomSource] operator[SEP] identifier[getInt] operator[SEP] identifier[data] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[key] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[x] operator[SEP]
}
identifier[seed] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[initialized] operator[=] literal[boolean] operator[SEP]
}
|
public final void addAttribute(
String uri,
String local,
String qname,
String type,
String val)
{
int index = super.getLength();
super.addAttribute(uri, local, qname, type, val);
// (index + 1) is now the number of attributes
// so either compare (index+1) to MAX, or compare index to (MAX-1)
if (index < MAXMinus1)
{
return;
}
else if (index == MAXMinus1)
{
switchOverToHash(MAX);
}
else
{
/* add the key with the format of "prefix:localName" */
/* we have just added the attibute, its index is the old length */
Integer i = new Integer(index);
m_indexFromQName.put(qname, i);
/* now add with key of the format "{uri}localName" */
m_buff.setLength(0);
m_buff.append('{').append(uri).append('}').append(local);
String key = m_buff.toString();
m_indexFromQName.put(key, i);
}
return;
} | class class_name[name] begin[{]
method[addAttribute, return_type[void], modifier[final public], parameter[uri, local, qname, type, val]] begin[{]
local_variable[type[int], index]
SuperMethodInvocation(arguments=[MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=local, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=qname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAttribute, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[member[.index], <, member[.MAXMinus1]]] begin[{]
return[None]
else begin[{]
if[binary_operation[member[.index], ==, member[.MAXMinus1]]] begin[{]
call[.switchOverToHash, parameter[member[.MAX]]]
else begin[{]
local_variable[type[Integer], i]
call[m_indexFromQName.put, parameter[member[.qname], member[.i]]]
call[m_buff.setLength, parameter[literal[0]]]
call[m_buff.append, parameter[literal['{']]]
local_variable[type[String], key]
call[m_indexFromQName.put, parameter[member[.key], member[.i]]]
end[}]
end[}]
return[None]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addAttribute] operator[SEP] identifier[String] identifier[uri] , identifier[String] identifier[local] , identifier[String] identifier[qname] , identifier[String] identifier[type] , identifier[String] identifier[val] operator[SEP] {
Keyword[int] identifier[index] operator[=] Keyword[super] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[addAttribute] operator[SEP] identifier[uri] , identifier[local] , identifier[qname] , identifier[type] , identifier[val] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] identifier[MAXMinus1] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[index] operator[==] identifier[MAXMinus1] operator[SEP] {
identifier[switchOverToHash] operator[SEP] identifier[MAX] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Integer] identifier[i] operator[=] Keyword[new] identifier[Integer] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[m_indexFromQName] operator[SEP] identifier[put] operator[SEP] identifier[qname] , identifier[i] operator[SEP] operator[SEP] identifier[m_buff] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[m_buff] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[uri] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[local] operator[SEP] operator[SEP] identifier[String] identifier[key] operator[=] identifier[m_buff] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[m_indexFromQName] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
|
protected String getTaxonomy()
{
assert getRequest() != null : "this method can only be called during execute()";
String contextPath = getRequest().getContextPath();
assert contextPath.startsWith( "/" ) : contextPath;
return contextPath.substring( 1 ) + '.' + getClass().getName();
} | class class_name[name] begin[{]
method[getTaxonomy, return_type[type[String]], modifier[protected], parameter[]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="this method can only be called during execute()"))
local_variable[type[String], contextPath]
AssertStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=contextPath, selectors=[], type_arguments=None), label=None, value=MemberReference(member=contextPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))
return[binary_operation[binary_operation[call[contextPath.substring, parameter[literal[1]]], +, literal['.']], +, call[.getClass, parameter[]]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getTaxonomy] operator[SEP] operator[SEP] {
Keyword[assert] identifier[getRequest] operator[SEP] operator[SEP] operator[!=] Other[null] operator[:] literal[String] operator[SEP] identifier[String] identifier[contextPath] operator[=] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] identifier[contextPath] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[:] identifier[contextPath] operator[SEP] Keyword[return] identifier[contextPath] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[+] literal[String] operator[+] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
|
private static Datatype getDatatype(Long index, Datatype[] datatypes,
boolean useNullAsDefaultDatatype) throws EXIException {
if (index == null && useNullAsDefaultDatatype) {
return BuiltIn.getDefaultDatatype();
}
if (index == null || index >= datatypes.length || index < 0) {
throw new EXIException("Can't find datatype of index: " + index);
}
return datatypes[index.intValue()];
} | class class_name[name] begin[{]
method[getDatatype, return_type[type[Datatype]], modifier[private static], parameter[index, datatypes, useNullAsDefaultDatatype]] begin[{]
if[binary_operation[binary_operation[member[.index], ==, literal[null]], &&, member[.useNullAsDefaultDatatype]]] begin[{]
return[call[BuiltIn.getDefaultDatatype, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.index], ==, literal[null]], ||, binary_operation[member[.index], >=, member[datatypes.length]]], ||, binary_operation[member[.index], <, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't find datatype of index: "), operandr=MemberReference(member=index, 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=EXIException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.datatypes]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Datatype] identifier[getDatatype] operator[SEP] identifier[Long] identifier[index] , identifier[Datatype] operator[SEP] operator[SEP] identifier[datatypes] , Keyword[boolean] identifier[useNullAsDefaultDatatype] operator[SEP] Keyword[throws] identifier[EXIException] {
Keyword[if] operator[SEP] identifier[index] operator[==] Other[null] operator[&&] identifier[useNullAsDefaultDatatype] operator[SEP] {
Keyword[return] identifier[BuiltIn] operator[SEP] identifier[getDefaultDatatype] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[index] operator[==] Other[null] operator[||] identifier[index] operator[>=] identifier[datatypes] operator[SEP] identifier[length] operator[||] identifier[index] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EXIException] operator[SEP] literal[String] operator[+] identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] identifier[datatypes] operator[SEP] identifier[index] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addParameter(String name, String value)
{
addQueryParameter(name, value);
if(_queryParameters != null)
addParameterToMap(name, value);
} | class class_name[name] begin[{]
method[addParameter, return_type[void], modifier[public], parameter[name, value]] begin[{]
call[.addQueryParameter, parameter[member[.name], member[.value]]]
if[binary_operation[member[._queryParameters], !=, literal[null]]] begin[{]
call[.addParameterToMap, parameter[member[.name], member[.value]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addParameter] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] {
identifier[addQueryParameter] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_queryParameters] operator[!=] Other[null] operator[SEP] identifier[addParameterToMap] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public int getInt(int columnIndex) throws SQLException {
checkColumnBounds(columnIndex);
try {
Long longValue = getPrivateInteger(columnIndex);
if (longValue > Integer.MAX_VALUE || longValue < Integer.MIN_VALUE) {
throw new SQLException("Value out of int range");
}
return longValue.intValue();
} catch (Exception x) {
throw SQLError.get(x);
}
} | class class_name[name] begin[{]
method[getInt, return_type[type[int]], modifier[public], parameter[columnIndex]] begin[{]
call[.checkColumnBounds, parameter[member[.columnIndex]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPrivateInteger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=longValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=longValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator=>), operandr=BinaryOperation(operandl=MemberReference(member=longValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator=<), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Value out of int range")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=longValue, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=SQLError, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getInt] operator[SEP] Keyword[int] identifier[columnIndex] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkColumnBounds] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[try] {
identifier[Long] identifier[longValue] operator[=] identifier[getPrivateInteger] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[longValue] operator[>] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[||] identifier[longValue] operator[<] identifier[Integer] operator[SEP] identifier[MIN_VALUE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[longValue] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[x] operator[SEP] {
Keyword[throw] identifier[SQLError] operator[SEP] identifier[get] operator[SEP] identifier[x] operator[SEP] operator[SEP]
}
}
|
public static String getHttpServletRequestUserAgentFromRequestContext(final RequestContext context) {
val request = getHttpServletRequestFromExternalWebflowContext(context);
return getHttpServletRequestUserAgentFromRequestContext(request);
} | class class_name[name] begin[{]
method[getHttpServletRequestUserAgentFromRequestContext, return_type[type[String]], modifier[public static], parameter[context]] begin[{]
local_variable[type[val], request]
return[call[.getHttpServletRequestUserAgentFromRequestContext, parameter[member[.request]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getHttpServletRequestUserAgentFromRequestContext] operator[SEP] Keyword[final] identifier[RequestContext] identifier[context] operator[SEP] {
identifier[val] identifier[request] operator[=] identifier[getHttpServletRequestFromExternalWebflowContext] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[return] identifier[getHttpServletRequestUserAgentFromRequestContext] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
if (lineBasedDecoder != null) {
return lineBasedDecoder.decode(ctx, buffer);
}
// Try all delimiters and choose the delimiter which yields the shortest frame.
int minFrameLength = Integer.MAX_VALUE;
ByteBuf minDelim = null;
for (ByteBuf delim : delimiters) {
int frameLength = indexOf(buffer, delim);
if (frameLength >= 0 && frameLength < minFrameLength) {
minFrameLength = frameLength;
minDelim = delim;
}
}
if (minDelim != null) {
int minDelimLength = minDelim.capacity();
ByteBuf frame;
if (discardingTooLongFrame) {
// We've just finished discarding a very large frame.
// Go back to the initial state.
discardingTooLongFrame = false;
buffer.skipBytes(minFrameLength + minDelimLength);
int tooLongFrameLength = this.tooLongFrameLength;
this.tooLongFrameLength = 0;
if (!failFast) {
fail(tooLongFrameLength);
}
return null;
}
if (minFrameLength > maxFrameLength) {
// Discard read frame.
buffer.skipBytes(minFrameLength + minDelimLength);
fail(minFrameLength);
return null;
}
if (stripDelimiter) {
frame = buffer.readRetainedSlice(minFrameLength);
buffer.skipBytes(minDelimLength);
} else {
frame = buffer.readRetainedSlice(minFrameLength + minDelimLength);
}
return frame;
} else if (emitLastLineWithoutDelimiter && !ctx.channel().isActive()) {
minFrameLength = buffer.readableBytes();
ByteBuf frame;
if (discardingTooLongFrame) {
// We've just finished discarding a very large frame.
// Go back to the initial state.
discardingTooLongFrame = false;
buffer.skipBytes(minFrameLength);
int tooLongFrameLength = this.tooLongFrameLength;
this.tooLongFrameLength = 0;
if (!failFast) {
fail(tooLongFrameLength);
}
return null;
}
if (minFrameLength > maxFrameLength) {
// Discard read frame.
buffer.skipBytes(minFrameLength);
fail(minFrameLength);
return null;
}
frame = buffer.readRetainedSlice(minFrameLength);
return frame;
} else {
if (!discardingTooLongFrame) {
if (buffer.readableBytes() > maxFrameLength) {
// Discard the content of the buffer until a delimiter is found.
tooLongFrameLength = buffer.readableBytes();
buffer.skipBytes(buffer.readableBytes());
discardingTooLongFrame = true;
if (failFast) {
fail(tooLongFrameLength);
}
}
} else {
// Still discarding the buffer since a delimiter is not found.
tooLongFrameLength += buffer.readableBytes();
buffer.skipBytes(buffer.readableBytes());
}
return null;
}
} | class class_name[name] begin[{]
method[decode, return_type[type[Object]], modifier[protected], parameter[ctx, buffer]] begin[{]
if[binary_operation[member[.lineBasedDecoder], !=, literal[null]]] begin[{]
return[call[lineBasedDecoder.decode, parameter[member[.ctx], member[.buffer]]]]
else begin[{]
None
end[}]
local_variable[type[int], minFrameLength]
local_variable[type[ByteBuf], minDelim]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=delim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=frameLength)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=frameLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=frameLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=minFrameLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minFrameLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=frameLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDelim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=delim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=delimiters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=delim)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuf, sub_type=None))), label=None)
if[binary_operation[member[.minDelim], !=, literal[null]]] begin[{]
local_variable[type[int], minDelimLength]
local_variable[type[ByteBuf], frame]
if[member[.discardingTooLongFrame]] begin[{]
assign[member[.discardingTooLongFrame], literal[false]]
call[buffer.skipBytes, parameter[binary_operation[member[.minFrameLength], +, member[.minDelimLength]]]]
local_variable[type[int], tooLongFrameLength]
assign[THIS[member[None.tooLongFrameLength]], literal[0]]
if[member[.failFast]] begin[{]
call[.fail, parameter[member[.tooLongFrameLength]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.minFrameLength], >, member[.maxFrameLength]]] begin[{]
call[buffer.skipBytes, parameter[binary_operation[member[.minFrameLength], +, member[.minDelimLength]]]]
call[.fail, parameter[member[.minFrameLength]]]
return[literal[null]]
else begin[{]
None
end[}]
if[member[.stripDelimiter]] begin[{]
assign[member[.frame], call[buffer.readRetainedSlice, parameter[member[.minFrameLength]]]]
call[buffer.skipBytes, parameter[member[.minDelimLength]]]
else begin[{]
assign[member[.frame], call[buffer.readRetainedSlice, parameter[binary_operation[member[.minFrameLength], +, member[.minDelimLength]]]]]
end[}]
return[member[.frame]]
else begin[{]
if[binary_operation[member[.emitLastLineWithoutDelimiter], &&, call[ctx.channel, parameter[]]]] begin[{]
assign[member[.minFrameLength], call[buffer.readableBytes, parameter[]]]
local_variable[type[ByteBuf], frame]
if[member[.discardingTooLongFrame]] begin[{]
assign[member[.discardingTooLongFrame], literal[false]]
call[buffer.skipBytes, parameter[member[.minFrameLength]]]
local_variable[type[int], tooLongFrameLength]
assign[THIS[member[None.tooLongFrameLength]], literal[0]]
if[member[.failFast]] begin[{]
call[.fail, parameter[member[.tooLongFrameLength]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.minFrameLength], >, member[.maxFrameLength]]] begin[{]
call[buffer.skipBytes, parameter[member[.minFrameLength]]]
call[.fail, parameter[member[.minFrameLength]]]
return[literal[null]]
else begin[{]
None
end[}]
assign[member[.frame], call[buffer.readRetainedSlice, parameter[member[.minFrameLength]]]]
return[member[.frame]]
else begin[{]
if[member[.discardingTooLongFrame]] begin[{]
if[binary_operation[call[buffer.readableBytes, parameter[]], >, member[.maxFrameLength]]] begin[{]
assign[member[.tooLongFrameLength], call[buffer.readableBytes, parameter[]]]
call[buffer.skipBytes, parameter[call[buffer.readableBytes, parameter[]]]]
assign[member[.discardingTooLongFrame], literal[true]]
if[member[.failFast]] begin[{]
call[.fail, parameter[member[.tooLongFrameLength]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
assign[member[.tooLongFrameLength], call[buffer.readableBytes, parameter[]]]
call[buffer.skipBytes, parameter[call[buffer.readableBytes, parameter[]]]]
end[}]
return[literal[null]]
end[}]
end[}]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[decode] operator[SEP] identifier[ChannelHandlerContext] identifier[ctx] , identifier[ByteBuf] identifier[buffer] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[lineBasedDecoder] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[lineBasedDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[ctx] , identifier[buffer] operator[SEP] operator[SEP]
}
Keyword[int] identifier[minFrameLength] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] identifier[ByteBuf] identifier[minDelim] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[ByteBuf] identifier[delim] operator[:] identifier[delimiters] operator[SEP] {
Keyword[int] identifier[frameLength] operator[=] identifier[indexOf] operator[SEP] identifier[buffer] , identifier[delim] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[frameLength] operator[>=] Other[0] operator[&&] identifier[frameLength] operator[<] identifier[minFrameLength] operator[SEP] {
identifier[minFrameLength] operator[=] identifier[frameLength] operator[SEP] identifier[minDelim] operator[=] identifier[delim] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[minDelim] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[minDelimLength] operator[=] identifier[minDelim] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] operator[SEP] identifier[ByteBuf] identifier[frame] operator[SEP] Keyword[if] operator[SEP] identifier[discardingTooLongFrame] operator[SEP] {
identifier[discardingTooLongFrame] operator[=] literal[boolean] operator[SEP] identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[minFrameLength] operator[+] identifier[minDelimLength] operator[SEP] operator[SEP] Keyword[int] identifier[tooLongFrameLength] operator[=] Keyword[this] operator[SEP] identifier[tooLongFrameLength] operator[SEP] Keyword[this] operator[SEP] identifier[tooLongFrameLength] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[failFast] operator[SEP] {
identifier[fail] operator[SEP] identifier[tooLongFrameLength] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[minFrameLength] operator[>] identifier[maxFrameLength] operator[SEP] {
identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[minFrameLength] operator[+] identifier[minDelimLength] operator[SEP] operator[SEP] identifier[fail] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[stripDelimiter] operator[SEP] {
identifier[frame] operator[=] identifier[buffer] operator[SEP] identifier[readRetainedSlice] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[minDelimLength] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[frame] operator[=] identifier[buffer] operator[SEP] identifier[readRetainedSlice] operator[SEP] identifier[minFrameLength] operator[+] identifier[minDelimLength] operator[SEP] operator[SEP]
}
Keyword[return] identifier[frame] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[emitLastLineWithoutDelimiter] operator[&&] operator[!] identifier[ctx] operator[SEP] identifier[channel] operator[SEP] operator[SEP] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] {
identifier[minFrameLength] operator[=] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] identifier[ByteBuf] identifier[frame] operator[SEP] Keyword[if] operator[SEP] identifier[discardingTooLongFrame] operator[SEP] {
identifier[discardingTooLongFrame] operator[=] literal[boolean] operator[SEP] identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] Keyword[int] identifier[tooLongFrameLength] operator[=] Keyword[this] operator[SEP] identifier[tooLongFrameLength] operator[SEP] Keyword[this] operator[SEP] identifier[tooLongFrameLength] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[failFast] operator[SEP] {
identifier[fail] operator[SEP] identifier[tooLongFrameLength] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[minFrameLength] operator[>] identifier[maxFrameLength] operator[SEP] {
identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] identifier[fail] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[frame] operator[=] identifier[buffer] operator[SEP] identifier[readRetainedSlice] operator[SEP] identifier[minFrameLength] operator[SEP] operator[SEP] Keyword[return] identifier[frame] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[discardingTooLongFrame] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[>] identifier[maxFrameLength] operator[SEP] {
identifier[tooLongFrameLength] operator[=] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[discardingTooLongFrame] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[failFast] operator[SEP] {
identifier[fail] operator[SEP] identifier[tooLongFrameLength] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[tooLongFrameLength] operator[+=] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[skipBytes] operator[SEP] identifier[buffer] operator[SEP] identifier[readableBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
}
|
public void setAlert(final boolean ALERT) {
if (null == alert) {
_alert = ALERT;
fireTileEvent(ALERT_EVENT);
} else {
alert.set(ALERT);
}
} | class class_name[name] begin[{]
method[setAlert, return_type[void], modifier[public], parameter[ALERT]] begin[{]
if[binary_operation[literal[null], ==, member[.alert]]] begin[{]
assign[member[._alert], member[.ALERT]]
call[.fireTileEvent, parameter[member[.ALERT_EVENT]]]
else begin[{]
call[alert.set, parameter[member[.ALERT]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAlert] operator[SEP] Keyword[final] Keyword[boolean] identifier[ALERT] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[alert] operator[SEP] {
identifier[_alert] operator[=] identifier[ALERT] operator[SEP] identifier[fireTileEvent] operator[SEP] identifier[ALERT_EVENT] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[alert] operator[SEP] identifier[set] operator[SEP] identifier[ALERT] operator[SEP] operator[SEP]
}
}
|
public void add(String events, String...ids) {
for (String event : EventDrivenUpdatesMap.parseEvents(events)) {
Set<String> listenerIds = delegate.get(event);
if (listenerIds == null) {
listenerIds = new HashSet<>();
delegate.put(event, listenerIds);
}
listenerIds.addAll(Arrays.asList(ids));
}
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[events, ids]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), name=listenerIds)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=listenerIds, 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=listenerIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=listenerIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=ids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=listenerIds, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=events, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseEvents, postfix_operators=[], prefix_operators=[], qualifier=EventDrivenUpdatesMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=event)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[String] identifier[events] , identifier[String] operator[...] identifier[ids] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[event] operator[:] identifier[EventDrivenUpdatesMap] operator[SEP] identifier[parseEvents] operator[SEP] identifier[events] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[listenerIds] operator[=] identifier[delegate] operator[SEP] identifier[get] operator[SEP] identifier[event] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listenerIds] operator[==] Other[null] operator[SEP] {
identifier[listenerIds] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[delegate] operator[SEP] identifier[put] operator[SEP] identifier[event] , identifier[listenerIds] operator[SEP] operator[SEP]
}
identifier[listenerIds] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[ids] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
char[] rgchPassword = passwordField.getPassword();
char[] rgchRePassword = rePasswordField.getPassword();
if (new String(rgchPassword).length() > 0)
if (!new String(rgchPassword).equalsIgnoreCase(new String(rgchRePassword)))
{
userMessage.setText("Passwords do not match - try again");
return; // Try again
}
loginDialog.setPassword(new String(rgchPassword));
loginDialog.setUserName(userField.getText());
loginDialog.setSaveInfo(saveInfoCheckbox.isSelected());
returnStatus = LoginDialog.NEW_USER_OPTION;
doClose(LoginDialog.NEW_USER_OPTION);
} | class class_name[name] begin[{]
method[loginButtonActionPerformed, return_type[void], modifier[private], parameter[evt]] begin[{]
local_variable[type[char], rgchPassword]
local_variable[type[char], rgchRePassword]
if[binary_operation[ClassCreator(arguments=[MemberReference(member=rgchPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), >, literal[0]]] begin[{]
if[ClassCreator(arguments=[MemberReference(member=rgchPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=['!'], qualifier=None, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=rgchRePassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))] begin[{]
call[userMessage.setText, parameter[literal["Passwords do not match - try again"]]]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[loginDialog.setPassword, parameter[ClassCreator(arguments=[MemberReference(member=rgchPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]
call[loginDialog.setUserName, parameter[call[userField.getText, parameter[]]]]
call[loginDialog.setSaveInfo, parameter[call[saveInfoCheckbox.isSelected, parameter[]]]]
assign[member[.returnStatus], member[LoginDialog.NEW_USER_OPTION]]
call[.doClose, parameter[member[LoginDialog.NEW_USER_OPTION]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[loginButtonActionPerformed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[ActionEvent] identifier[evt] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[rgchPassword] operator[=] identifier[passwordField] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[rgchRePassword] operator[=] identifier[rePasswordField] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[rgchPassword] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[new] identifier[String] operator[SEP] identifier[rgchPassword] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[rgchRePassword] operator[SEP] operator[SEP] operator[SEP] {
identifier[userMessage] operator[SEP] identifier[setText] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[loginDialog] operator[SEP] identifier[setPassword] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[rgchPassword] operator[SEP] operator[SEP] operator[SEP] identifier[loginDialog] operator[SEP] identifier[setUserName] operator[SEP] identifier[userField] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[loginDialog] operator[SEP] identifier[setSaveInfo] operator[SEP] identifier[saveInfoCheckbox] operator[SEP] identifier[isSelected] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[returnStatus] operator[=] identifier[LoginDialog] operator[SEP] identifier[NEW_USER_OPTION] operator[SEP] identifier[doClose] operator[SEP] identifier[LoginDialog] operator[SEP] identifier[NEW_USER_OPTION] operator[SEP] operator[SEP]
}
|
@Override
public SqlContextFactory removeUpdateAutoParameterBinder(final Consumer<SqlContext> binder) {
updateAutoParameterBinders.remove(binder);
updateAutoParameterBinder = updateAutoParameterBinders.stream()
.reduce((first, second) -> first.andThen(second))
.orElse(null);
return this;
} | class class_name[name] begin[{]
method[removeUpdateAutoParameterBinder, return_type[type[SqlContextFactory]], modifier[public], parameter[binder]] begin[{]
call[updateAutoParameterBinders.remove, parameter[member[.binder]]]
assign[member[.updateAutoParameterBinder], call[updateAutoParameterBinders.stream, parameter[]]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SqlContextFactory] identifier[removeUpdateAutoParameterBinder] operator[SEP] Keyword[final] identifier[Consumer] operator[<] identifier[SqlContext] operator[>] identifier[binder] operator[SEP] {
identifier[updateAutoParameterBinders] operator[SEP] identifier[remove] operator[SEP] identifier[binder] operator[SEP] operator[SEP] identifier[updateAutoParameterBinder] operator[=] identifier[updateAutoParameterBinders] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[reduce] operator[SEP] operator[SEP] identifier[first] , identifier[second] operator[SEP] operator[->] identifier[first] operator[SEP] identifier[andThen] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
static void runTransformedLearner() {
// construct a (regular) simulator membership query oracle
MealyMembershipOracle<Integer, OutputAndLocalInputs<Integer, Character>> mqOracle =
new StateLocalInputSULOracle<>(SUL);
// construct L* instance
ExtensibleLStarMealy<Integer, OutputAndLocalInputs<Integer, Character>> lstar =
new ExtensibleLStarMealyBuilder<Integer, OutputAndLocalInputs<Integer, Character>>().withAlphabet(INPUTS)
.withOracle(mqOracle)
.withCexHandler(
ObservationTableCEXHandlers.RIVEST_SCHAPIRE)
.create();
// here, we simply use an equivalence check for the transformed automaton model
MealyEquivalenceOracle<Integer, OutputAndLocalInputs<Integer, Character>> eqOracle =
new MealySimulatorEQOracle<>(TRANSFORMED_TARGET);
// construct the experiment
MealyExperiment<Integer, OutputAndLocalInputs<Integer, Character>> experiment =
new MealyExperiment<>(lstar, eqOracle, INPUTS);
// run experiment
experiment.run();
// get learned model
MealyMachine<?, Integer, ?, OutputAndLocalInputs<Integer, Character>> result = experiment.getFinalHypothesis();
// report results
System.out.println("-------------------------------------------------------");
System.out.println("States: " + result.size());
System.out.println("Sigma: " + INPUTS.size());
System.out.println("-------------------------------------------------------");
System.out.println("Final observation table:");
new ObservationTableASCIIWriter<>().write(lstar.getObservationTable(), System.out);
} | class class_name[name] begin[{]
method[runTransformedLearner, return_type[void], modifier[static], parameter[]] begin[{]
local_variable[type[MealyMembershipOracle], mqOracle]
local_variable[type[ExtensibleLStarMealy], lstar]
local_variable[type[MealyEquivalenceOracle], eqOracle]
local_variable[type[MealyExperiment], experiment]
call[experiment.run, parameter[]]
local_variable[type[MealyMachine], result]
call[System.out.println, parameter[literal["-------------------------------------------------------"]]]
call[System.out.println, parameter[binary_operation[literal["States: "], +, call[result.size, parameter[]]]]]
call[System.out.println, parameter[binary_operation[literal["Sigma: "], +, call[INPUTS.size, parameter[]]]]]
call[System.out.println, parameter[literal["-------------------------------------------------------"]]]
call[System.out.println, parameter[literal["Final observation table:"]]]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getObservationTable, postfix_operators=[], prefix_operators=[], qualifier=lstar, selectors=[], type_arguments=None), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[], dimensions=None, name=ObservationTableASCIIWriter, sub_type=None))
end[}]
END[}] | Keyword[static] Keyword[void] identifier[runTransformedLearner] operator[SEP] operator[SEP] {
identifier[MealyMembershipOracle] operator[<] identifier[Integer] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] identifier[mqOracle] operator[=] Keyword[new] identifier[StateLocalInputSULOracle] operator[<] operator[>] operator[SEP] identifier[SUL] operator[SEP] operator[SEP] identifier[ExtensibleLStarMealy] operator[<] identifier[Integer] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] identifier[lstar] operator[=] Keyword[new] identifier[ExtensibleLStarMealyBuilder] operator[<] identifier[Integer] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[withAlphabet] operator[SEP] identifier[INPUTS] operator[SEP] operator[SEP] identifier[withOracle] operator[SEP] identifier[mqOracle] operator[SEP] operator[SEP] identifier[withCexHandler] operator[SEP] identifier[ObservationTableCEXHandlers] operator[SEP] identifier[RIVEST_SCHAPIRE] operator[SEP] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[MealyEquivalenceOracle] operator[<] identifier[Integer] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] identifier[eqOracle] operator[=] Keyword[new] identifier[MealySimulatorEQOracle] operator[<] operator[>] operator[SEP] identifier[TRANSFORMED_TARGET] operator[SEP] operator[SEP] identifier[MealyExperiment] operator[<] identifier[Integer] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] identifier[experiment] operator[=] Keyword[new] identifier[MealyExperiment] operator[<] operator[>] operator[SEP] identifier[lstar] , identifier[eqOracle] , identifier[INPUTS] operator[SEP] operator[SEP] identifier[experiment] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] identifier[MealyMachine] operator[<] operator[?] , identifier[Integer] , operator[?] , identifier[OutputAndLocalInputs] operator[<] identifier[Integer] , identifier[Character] operator[>] operator[>] identifier[result] operator[=] identifier[experiment] operator[SEP] identifier[getFinalHypothesis] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[INPUTS] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[new] identifier[ObservationTableASCIIWriter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[lstar] operator[SEP] identifier[getObservationTable] operator[SEP] operator[SEP] , identifier[System] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
|
private StringBuilder responseBodyTreatment(StringBuilder responseBody, int responseCode, HttpURLConnection connection) {
try {
if (responseCode >= 200 && responseCode < 299) {
responseBody = tools.readBody(connection.getInputStream());
}
if (responseCode == 401) {
throw new UnauthorizedException();
}
if (responseCode >= 400 && responseCode < 499) {
responseBody = tools.readBody(connection.getErrorStream());
LOGGER.debug("API ERROR {}", responseBody.toString());
Errors errors = new Errors();
try {
errors = tools.getGsonInstance().fromJson(responseBody.toString(), Errors.class);
} catch (Exception e) {
LOGGER.debug("There was not possible cast the JSON to object");
}
throw new ValidationException(responseCode, connection.getResponseMessage(), errors);
}
if (responseCode >= 500) {
throw new UnexpectedException();
}
} catch (IOException e) {
throw new MoipAPIException("Error occurred connecting to Moip API: " + e.getMessage(), e);
}
return responseBody;
} | class class_name[name] begin[{]
method[responseBodyTreatment, return_type[type[StringBuilder]], modifier[private], parameter[responseBody, responseCode, connection]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=299), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=responseBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], member=readBody, postfix_operators=[], prefix_operators=[], qualifier=tools, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=401), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnauthorizedException, sub_type=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=400), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=499), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=responseBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getErrorStream, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], member=readBody, postfix_operators=[], prefix_operators=[], qualifier=tools, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="API ERROR {}"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=responseBody, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Errors, sub_type=None)), name=errors)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Errors, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getGsonInstance, postfix_operators=[], prefix_operators=[], qualifier=tools, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=responseBody, selectors=[], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Errors, sub_type=None))], member=fromJson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There was not possible cast the JSON to object")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResponseMessage, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), MemberReference(member=errors, 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=ValidationException, sub_type=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=responseCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnexpectedException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error occurred connecting to Moip API: "), 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=MoipAPIException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.responseBody]]
end[}]
END[}] | Keyword[private] identifier[StringBuilder] identifier[responseBodyTreatment] operator[SEP] identifier[StringBuilder] identifier[responseBody] , Keyword[int] identifier[responseCode] , identifier[HttpURLConnection] identifier[connection] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[responseCode] operator[>=] Other[200] operator[&&] identifier[responseCode] operator[<] Other[299] operator[SEP] {
identifier[responseBody] operator[=] identifier[tools] operator[SEP] identifier[readBody] operator[SEP] identifier[connection] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[responseCode] operator[==] Other[401] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnauthorizedException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[responseCode] operator[>=] Other[400] operator[&&] identifier[responseCode] operator[<] Other[499] operator[SEP] {
identifier[responseBody] operator[=] identifier[tools] operator[SEP] identifier[readBody] operator[SEP] identifier[connection] operator[SEP] identifier[getErrorStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[responseBody] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Errors] identifier[errors] operator[=] Keyword[new] identifier[Errors] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[errors] operator[=] identifier[tools] operator[SEP] identifier[getGsonInstance] operator[SEP] operator[SEP] operator[SEP] identifier[fromJson] operator[SEP] identifier[responseBody] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[Errors] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[ValidationException] operator[SEP] identifier[responseCode] , identifier[connection] operator[SEP] identifier[getResponseMessage] operator[SEP] operator[SEP] , identifier[errors] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[responseCode] operator[>=] Other[500] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnexpectedException] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MoipAPIException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[responseBody] operator[SEP]
}
|
@Override
protected void append(ILoggingEvent eventObject)
{
Trace<ILoggingEvent> trace = traceManager.getTrace();
if(trace != null)
{
trace.addEvent(eventObject);
}
} | class class_name[name] begin[{]
method[append, return_type[void], modifier[protected], parameter[eventObject]] begin[{]
local_variable[type[Trace], trace]
if[binary_operation[member[.trace], !=, literal[null]]] begin[{]
call[trace.addEvent, parameter[member[.eventObject]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[append] operator[SEP] identifier[ILoggingEvent] identifier[eventObject] operator[SEP] {
identifier[Trace] operator[<] identifier[ILoggingEvent] operator[>] identifier[trace] operator[=] identifier[traceManager] operator[SEP] identifier[getTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[trace] operator[!=] Other[null] operator[SEP] {
identifier[trace] operator[SEP] identifier[addEvent] operator[SEP] identifier[eventObject] operator[SEP] operator[SEP]
}
}
|
public final KnowledgeBase getKnowledgeBase(String name) {
GetKnowledgeBaseRequest request = GetKnowledgeBaseRequest.newBuilder().setName(name).build();
return getKnowledgeBase(request);
} | class class_name[name] begin[{]
method[getKnowledgeBase, return_type[type[KnowledgeBase]], modifier[final public], parameter[name]] begin[{]
local_variable[type[GetKnowledgeBaseRequest], request]
return[call[.getKnowledgeBase, parameter[member[.request]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[KnowledgeBase] identifier[getKnowledgeBase] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[GetKnowledgeBaseRequest] identifier[request] operator[=] identifier[GetKnowledgeBaseRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getKnowledgeBase] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static filterpolicy get(nitro_service service, String name) throws Exception{
filterpolicy obj = new filterpolicy();
obj.set_name(name);
filterpolicy response = (filterpolicy) obj.get_resource(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[filterpolicy]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[filterpolicy], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[filterpolicy], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[filterpolicy] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[filterpolicy] identifier[obj] operator[=] Keyword[new] identifier[filterpolicy] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[filterpolicy] identifier[response] operator[=] operator[SEP] identifier[filterpolicy] operator[SEP] identifier[obj] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public void marshall(DeleteDiskSnapshotRequest deleteDiskSnapshotRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDiskSnapshotRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDiskSnapshotRequest.getDiskSnapshotName(), DISKSNAPSHOTNAME_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[deleteDiskSnapshotRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteDiskSnapshotRequest], ==, 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=getDiskSnapshotName, postfix_operators=[], prefix_operators=[], qualifier=deleteDiskSnapshotRequest, selectors=[], type_arguments=None), MemberReference(member=DISKSNAPSHOTNAME_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[DeleteDiskSnapshotRequest] identifier[deleteDiskSnapshotRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteDiskSnapshotRequest] 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[deleteDiskSnapshotRequest] operator[SEP] identifier[getDiskSnapshotName] operator[SEP] operator[SEP] , identifier[DISKSNAPSHOTNAME_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]
}
}
|
protected void initializeExtensionProcessors(List extensionFactories) {
// TODO: nameSpace preinvoke/postinvoke
if (extensionFactories == null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "No extension processors");
}
return;
}
// process the ExtensionFactories
for (int i = 0; i < extensionFactories.size(); i++) {
ExtensionFactory fac = (ExtensionFactory) extensionFactories.get(i);
ExtensionProcessor processor = null;
// Get the global patterns that this factory creates processors for
List patterns = fac.getPatternList();
// If extension processing is disabled ignore the factories which return a pattern list
// Do this before calling createExensionPorcessor so we do not incure the overhead of the creation
// unless needed.
if (getExtensionProcessingDisabled() && !patterns.isEmpty()) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Extension factory with patterns ignored : " + fac.getClass());
}
continue;
}
try {
processor = fac.createExtensionProcessor(this);
if (processor == null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Extension factory has no processor:" + fac.getClass());
}
// if the factory returns a null processor, it means
// that this factory doesn't want to be associated with
// this particular webapp.
continue;
}
} catch (Throwable e) {
// Extension processor failed to initialize
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, CLASS_NAME + ".initializeExtensionFactories", "883", this);
// e.printStackTrace(System.err); @283348D
// 435011
logger.logp(Level.SEVERE, CLASS_NAME, "initializeExtensionProcessors", "extension.processor.failed.to.initialize.in.factory",
new Object[] { fac, e }); /* 283348.1 */
continue;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Extension processor class =" + fac.getClass());
}
// Get the global patterns that this factory creates processors for
Iterator it = patterns.iterator();
StringBuffer mapStr = new StringBuffer(' ');
while (it.hasNext()) {
String mapping = (String) it.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Add factory mappings =" + mapping);
}
try {
requestMapper.addMapping(mapping, processor);
mapStr.append(mapping);
mapStr.append(' ');
} catch (Exception exc) {
// TODO:
// processor already exists for specified pattern
// pk435011
logger.logp(Level.SEVERE, CLASS_NAME, "initializeExtensionProcessors", "request.processor.already.present.for.mapping", mapping);
}
}
// Get the additional patterns that the specific extension processor
// might want to be associated with
patterns = processor.getPatternList();
if (getExtensionProcessingDisabled() &&!patterns.isEmpty()) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Extension processor with patterns ignored : " + processor.getClass());
}
} else {
it = patterns.iterator();
while (it.hasNext()) {
String mapping = (String) it.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "initializeExtensionProcessors", "Add processor mapping =" + mapping);
}
try {
requestMapper.addMapping(mapping, processor);
} catch (Exception exc) {
// TODO:
// processor already exists for specified pattern
// pk435011
// Alex TODO: This does not seem to me to be a problem, perhaps a timing artifact at
// worst. Will revisit.
// logger.logp(Level.SEVERE, CLASS_NAME, "initializeExtensionProcessors", "error.adding.servlet.mapping.for.servlet", new Object[] {
// mapping, getApplicationName(), exc });
}
}
}
}
} | class class_name[name] begin[{]
method[initializeExtensionProcessors, return_type[void], modifier[protected], parameter[extensionFactories]] begin[{]
if[binary_operation[member[.extensionFactories], ==, literal[null]]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[logger.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[logger.logp, parameter[member[Level.FINE], member[.CLASS_NAME], literal["initializeExtensionProcessors"], literal["No extension processors"]]]
else begin[{]
None
end[}]
return[None]
else begin[{]
None
end[}]
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=extensionFactories, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionFactory, sub_type=None)), name=fac)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionFactory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=processor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExtensionProcessor, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPatternList, postfix_operators=[], prefix_operators=[], qualifier=fac, selectors=[], type_arguments=None), name=patterns)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getExtensionProcessingDisabled, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=patterns, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Extension factory with patterns ignored : "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=fac, selectors=[], type_arguments=None), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), ContinueStatement(goto=None, label=None)])), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=createExtensionProcessor, postfix_operators=[], prefix_operators=[], qualifier=fac, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=processor, 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=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Extension factory has no processor:"), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=fac, selectors=[], type_arguments=None), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), ContinueStatement(goto=None, label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".initializeExtensionFactories"), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="883"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.wsspi.webcontainer.util.FFDCWrapper, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="extension.processor.failed.to.initialize.in.factory"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=fac, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Extension processor class ="), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=fac, selectors=[], type_arguments=None), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=patterns, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), name=mapStr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=mapping)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Add factory mappings ="), operandr=MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addMapping, postfix_operators=[], prefix_operators=[], qualifier=requestMapper, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=mapStr, 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=mapStr, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="request.processor.already.present.for.mapping"), MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['Exception']))], finally_block=None, label=None, resources=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=patterns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getPatternList, postfix_operators=[], prefix_operators=[], qualifier=processor, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getExtensionProcessingDisabled, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=patterns, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=it, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=patterns, selectors=[], type_arguments=None)), label=None), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=mapping)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Add processor mapping ="), operandr=MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addMapping, postfix_operators=[], prefix_operators=[], qualifier=requestMapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['Exception']))], finally_block=None, label=None, resources=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="initializeExtensionProcessors"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Extension processor with patterns ignored : "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=processor, selectors=[], type_arguments=None), operator=+)], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, 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=extensionFactories, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[initializeExtensionProcessors] operator[SEP] identifier[List] identifier[extensionFactories] operator[SEP] {
Keyword[if] operator[SEP] identifier[extensionFactories] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[extensionFactories] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ExtensionFactory] identifier[fac] operator[=] operator[SEP] identifier[ExtensionFactory] operator[SEP] identifier[extensionFactories] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[ExtensionProcessor] identifier[processor] operator[=] Other[null] operator[SEP] identifier[List] identifier[patterns] operator[=] identifier[fac] operator[SEP] identifier[getPatternList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getExtensionProcessingDisabled] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[patterns] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[fac] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[continue] operator[SEP]
}
Keyword[try] {
identifier[processor] operator[=] identifier[fac] operator[SEP] identifier[createExtensionProcessor] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[processor] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[fac] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[continue] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[wsspi] operator[SEP] identifier[webcontainer] operator[SEP] identifier[util] operator[SEP] identifier[FFDCWrapper] operator[SEP] identifier[processException] operator[SEP] identifier[e] , identifier[CLASS_NAME] operator[+] literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , identifier[CLASS_NAME] , literal[String] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[fac] , identifier[e]
} operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[fac] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Iterator] identifier[it] operator[=] identifier[patterns] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[mapStr] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[mapping] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[mapping] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[requestMapper] operator[SEP] identifier[addMapping] operator[SEP] identifier[mapping] , identifier[processor] operator[SEP] operator[SEP] identifier[mapStr] operator[SEP] identifier[append] operator[SEP] identifier[mapping] operator[SEP] operator[SEP] identifier[mapStr] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[exc] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , identifier[CLASS_NAME] , literal[String] , literal[String] , identifier[mapping] operator[SEP] operator[SEP]
}
}
identifier[patterns] operator[=] identifier[processor] operator[SEP] identifier[getPatternList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getExtensionProcessingDisabled] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[patterns] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[processor] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[it] operator[=] identifier[patterns] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[mapping] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] identifier[mapping] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[requestMapper] operator[SEP] identifier[addMapping] operator[SEP] identifier[mapping] , identifier[processor] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[exc] operator[SEP] {
}
}
}
}
}
|
public Observable<Void> enableMonitoringAsync(String resourceGroupName, String clusterName, ClusterMonitoringRequest parameters) {
return enableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[enableMonitoringAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, clusterName, parameters]] begin[{]
return[call[.enableMonitoringWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.clusterName], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Void] operator[>] identifier[enableMonitoringAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[clusterName] , identifier[ClusterMonitoringRequest] identifier[parameters] operator[SEP] {
Keyword[return] identifier[enableMonitoringWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[clusterName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] , identifier[Void] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected Apikey createFromMapInternal(@Nullable String user, long start, long duration, @Nullable Arr roles, Map<String, Object> nameAndValMap) {
return createFromMapWithFingerprint(user, start, duration, roles, nameAndValMap, randomFingerprint());
} | class class_name[name] begin[{]
method[createFromMapInternal, return_type[type[Apikey]], modifier[protected], parameter[user, start, duration, roles, nameAndValMap]] begin[{]
return[call[.createFromMapWithFingerprint, parameter[member[.user], member[.start], member[.duration], member[.roles], member[.nameAndValMap], call[.randomFingerprint, parameter[]]]]]
end[}]
END[}] | Keyword[protected] identifier[Apikey] identifier[createFromMapInternal] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[user] , Keyword[long] identifier[start] , Keyword[long] identifier[duration] , annotation[@] identifier[Nullable] identifier[Arr] identifier[roles] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[nameAndValMap] operator[SEP] {
Keyword[return] identifier[createFromMapWithFingerprint] operator[SEP] identifier[user] , identifier[start] , identifier[duration] , identifier[roles] , identifier[nameAndValMap] , identifier[randomFingerprint] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int[] getInt2DColumnSum(int[][] apsp) {
int[] colSum = new int[apsp.length];
int sum;
for (int i = 0; i < apsp.length; i++) {
sum = 0;
for (int j = 0; j < apsp.length; j++) {
sum += apsp[i][j];
}
colSum[i] = sum;
}
return colSum;
} | class class_name[name] begin[{]
method[getInt2DColumnSum, return_type[type[int]], modifier[public static], parameter[apsp]] begin[{]
local_variable[type[int], colSum]
local_variable[type[int], sum]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=apsp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=apsp, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=colSum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=apsp, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.colSum]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[getInt2DColumnSum] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[apsp] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[colSum] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[apsp] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[sum] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[apsp] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sum] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[apsp] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[sum] operator[+=] identifier[apsp] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
identifier[colSum] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[sum] operator[SEP]
}
Keyword[return] identifier[colSum] operator[SEP]
}
|
private void saveInheritanceGroup(CmsResource resource, CmsInheritanceContainer inheritanceContainer)
throws CmsException {
CmsObject cms = getCmsObject();
CmsFile file = cms.readFile(resource);
CmsXmlContent document = CmsXmlContentFactory.unmarshal(cms, file);
for (Locale docLocale : document.getLocales()) {
document.removeLocale(docLocale);
}
Locale locale = Locale.ENGLISH;
document.addLocale(cms, locale);
document.getValue("Title", locale).setStringValue(cms, inheritanceContainer.getTitle());
document.getValue("Description", locale).setStringValue(cms, inheritanceContainer.getDescription());
document.getValue("ConfigName", locale).setStringValue(cms, inheritanceContainer.getName());
byte[] content = document.marshal();
file.setContents(content);
cms.writeFile(file);
} | class class_name[name] begin[{]
method[saveInheritanceGroup, return_type[void], modifier[private], parameter[resource, inheritanceContainer]] begin[{]
local_variable[type[CmsObject], cms]
local_variable[type[CmsFile], file]
local_variable[type[CmsXmlContent], document]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=docLocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeLocale, postfix_operators=[], prefix_operators=[], qualifier=document, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getLocales, postfix_operators=[], prefix_operators=[], qualifier=document, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=docLocale)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Locale, sub_type=None))), label=None)
local_variable[type[Locale], locale]
call[document.addLocale, parameter[member[.cms], member[.locale]]]
call[document.getValue, parameter[literal["Title"], member[.locale]]]
call[document.getValue, parameter[literal["Description"], member[.locale]]]
call[document.getValue, parameter[literal["ConfigName"], member[.locale]]]
local_variable[type[byte], content]
call[file.setContents, parameter[member[.content]]]
call[cms.writeFile, parameter[member[.file]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[saveInheritanceGroup] operator[SEP] identifier[CmsResource] identifier[resource] , identifier[CmsInheritanceContainer] identifier[inheritanceContainer] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[CmsObject] identifier[cms] operator[=] identifier[getCmsObject] operator[SEP] operator[SEP] operator[SEP] identifier[CmsFile] identifier[file] operator[=] identifier[cms] operator[SEP] identifier[readFile] operator[SEP] identifier[resource] operator[SEP] operator[SEP] identifier[CmsXmlContent] identifier[document] operator[=] identifier[CmsXmlContentFactory] operator[SEP] identifier[unmarshal] operator[SEP] identifier[cms] , identifier[file] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Locale] identifier[docLocale] operator[:] identifier[document] operator[SEP] identifier[getLocales] operator[SEP] operator[SEP] operator[SEP] {
identifier[document] operator[SEP] identifier[removeLocale] operator[SEP] identifier[docLocale] operator[SEP] operator[SEP]
}
identifier[Locale] identifier[locale] operator[=] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] identifier[document] operator[SEP] identifier[addLocale] operator[SEP] identifier[cms] , identifier[locale] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[getValue] operator[SEP] literal[String] , identifier[locale] operator[SEP] operator[SEP] identifier[setStringValue] operator[SEP] identifier[cms] , identifier[inheritanceContainer] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[getValue] operator[SEP] literal[String] , identifier[locale] operator[SEP] operator[SEP] identifier[setStringValue] operator[SEP] identifier[cms] , identifier[inheritanceContainer] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[getValue] operator[SEP] literal[String] , identifier[locale] operator[SEP] operator[SEP] identifier[setStringValue] operator[SEP] identifier[cms] , identifier[inheritanceContainer] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[content] operator[=] identifier[document] operator[SEP] identifier[marshal] operator[SEP] operator[SEP] operator[SEP] identifier[file] operator[SEP] identifier[setContents] operator[SEP] identifier[content] operator[SEP] operator[SEP] identifier[cms] operator[SEP] identifier[writeFile] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.