finished basic account add
[Bookkeeping.git] / src / com / interrupt / bookkeeping / cc / executor / VisitorCollectTokenLiterals.java
blobb77f96a5d6b5e55142a546d9f4560767ded12d94
1 package com.interrupt.bookkeeping.cc.executor;
3 import java.util.ArrayList;
4 import java.util.List;
6 import com.interrupt.bob.base.Bob;
7 import com.interrupt.bob.base.IBob;
8 import com.interrupt.bookkeeping.cc.analysis.DepthFirstAdapter;
9 import com.interrupt.bookkeeping.cc.bkell.command.CreateCommand;
10 import com.interrupt.bookkeeping.cc.bkell.command.IResult;
11 import com.interrupt.bookkeeping.cc.bkell.command.LoadCommand;
12 import com.interrupt.bookkeeping.cc.node.AIlist;
13 import com.interrupt.bookkeeping.cc.node.AIlistpart;
14 import com.interrupt.bookkeeping.cc.node.AOptsCommandInput;
15 import com.interrupt.bookkeeping.cc.node.AXmlCommandInput;
16 import com.interrupt.bookkeeping.cc.node.PCommandInput;
17 import com.interrupt.bookkeeping.cc.node.PIlistpart;
18 import com.interrupt.bookkeeping.users.IUser;
20 public class VisitorCollectTokenLiterals extends DepthFirstAdapter {
23 private List reversors = null;
24 private IUser user = null;
26 public VisitorCollectTokenLiterals() {
28 reversors = new ArrayList();
31 public List getReversors() {
32 return reversors;
34 public void setReversors(List reversors) {
35 this.reversors = reversors;
37 public IUser getUser() {
38 return this.user;
40 public void setUser(IUser user) {
41 this.user = user;
45 public void caseAIlist(AIlist node) {
47 inAIlist(node);
48 if(node.getCommandInput() != null) {
51 node.getCommandInput().apply(this);
54 LoadCommand loadCommand = (com.interrupt.bookkeeping.cc.bkell.command.LoadCommand)
55 Bob.make( "com.interrupt.bookkeeping.cc.bkell.command.LoadCommand" );
57 CreateCommand createCommand = (com.interrupt.bookkeeping.cc.bkell.command.CreateCommand)
58 Bob.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
61 PCommandInput cinput = node.getCommandInput();
62 IResult result = null;
63 IBob resultBob = null;
64 if(cinput instanceof AXmlCommandInput) {
66 result = CreateHelper.execute(user, createCommand, (AXmlCommandInput)cinput);
67 resultBob = (IBob)result.allChildren().get(0);
68 reversors.add(resultBob);
71 else if(cinput instanceof AOptsCommandInput) {
73 result = LoadHelper.execute(user, loadCommand, (AOptsCommandInput)cinput);
74 resultBob = (IBob)result.allChildren().get(0);
75 reversors.add(resultBob);
81 List<PIlistpart> copy = new ArrayList<PIlistpart>(node.getIlistpart());
82 for(PIlistpart e : copy) {
83 e.apply(this);
86 outAIlist(node);
89 public void caseAIlistpart(AIlistpart node) {
91 inAIlistpart(node);
92 if(node.getListdelimiter() != null) {
93 node.getListdelimiter().apply(this);
95 if(node.getCommandInput() != null) {
97 node.getCommandInput().apply(this);
99 LoadCommand loadCommand = (com.interrupt.bookkeeping.cc.bkell.command.LoadCommand)
100 Bob.make( "com.interrupt.bookkeeping.cc.bkell.command.LoadCommand" );
102 CreateCommand createCommand = (com.interrupt.bookkeeping.cc.bkell.command.CreateCommand)
103 Bob.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
106 PCommandInput cinput = node.getCommandInput();
107 IResult result = null;
108 IBob resultBob = null;
109 if(cinput instanceof AXmlCommandInput) {
111 result = CreateHelper.execute(user, createCommand, (AXmlCommandInput)cinput);
112 resultBob = (IBob)result.allChildren().get(0);
113 reversors.add(resultBob);
116 else if(cinput instanceof AOptsCommandInput) {
118 result = LoadHelper.execute(user, loadCommand, (AOptsCommandInput)cinput);
119 resultBob = (IBob)result.allChildren().get(0);
120 reversors.add(resultBob);
125 outAIlistpart(node);