001: package example.nz.org.take.compiler.userv.generated;
002:
003: import nz.org.take.rt.*;
004:
005: /**
006: * Class generated by the take compiler.
007: * @version Mon Feb 11 13:49:17 NZDT 2008
008: */
009: @SuppressWarnings("unchecked")
010: class KBFragement_specialLocation_1 {
011: /**
012: * Method generated for query /specialLocation[in]
013: * @param slot1 input parameter generated from slot 0
014: * @return an iterator for instances of specialLocation
015: */
016: public static ResultSet<specialLocation> specialLocation_1(
017: final example.nz.org.take.compiler.userv.domainmodel.Driver slot1) {
018: DerivationController _derivation = new DefaultDerivationController();
019: ResultSet<specialLocation> _result = new ResultSet(
020: KBFragement_specialLocation_1.specialLocation_1(slot1,
021: _derivation), _derivation);
022:
023: return _result;
024: }
025:
026: /**
027: * Method generated for query /specialLocation[in]
028: * @param slot1 input parameter generated from slot 0
029: * @return an iterator for instances of specialLocation
030: */
031: static ResourceIterator<specialLocation> specialLocation_1(
032: final example.nz.org.take.compiler.userv.domainmodel.Driver slot1,
033: final DerivationController _derivation) {
034: final int _derivationlevel = _derivation.getDepth();
035: ResourceIterator<specialLocation> result = new IteratorChain<specialLocation>(
036: 3) {
037: public Object getIteratorOrObject(int pos) {
038: switch (pos) {
039: // DP_00a IF equals(getLocation(<driver>),CA) THEN /specialLocation(<driver>)
040: case 0:
041: return specialLocation_1_0(slot1, _derivation
042: .reset(_derivationlevel));
043:
044: // DP_00b IF equals(getLocation(<driver>),NY) THEN /specialLocation(<driver>)
045: case 1:
046: return specialLocation_1_1(slot1, _derivation
047: .reset(_derivationlevel));
048:
049: // DP_00c IF equals(getLocation(<driver>),VA) THEN /specialLocation(<driver>)
050: case 2:
051: return specialLocation_1_2(slot1, _derivation
052: .reset(_derivationlevel));
053:
054: default:
055: return EmptyIterator.DEFAULT;
056: } // switch(pos)
057: } // getIterator()
058:
059: public String getRuleRef(int pos) {
060: switch (pos) {
061: // DP_00a IF equals(getLocation(<driver>),CA) THEN /specialLocation(<driver>)
062: case 0:
063: return "DP_00a";
064:
065: // DP_00b IF equals(getLocation(<driver>),NY) THEN /specialLocation(<driver>)
066: case 1:
067: return "DP_00b";
068:
069: // DP_00c IF equals(getLocation(<driver>),VA) THEN /specialLocation(<driver>)
070: case 2:
071: return "DP_00c";
072:
073: default:
074: return "";
075: } // switch(pos)
076: } // getRuleRef()
077: };
078:
079: return result;
080: }
081:
082: /**
083: * Method generated for query /specialLocation[in]
084: * @param slot1 input parameter generated from slot 0
085: * @return an iterator for instances of specialLocation
086: */
087: private static ResourceIterator<specialLocation> specialLocation_1_0(
088: final example.nz.org.take.compiler.userv.domainmodel.Driver slot1,
089: final DerivationController _derivation) {
090: _derivation.log("DP_00a", DerivationController.RULE, slot1);
091:
092: // Variable bindings in rule: IF equals(getLocation(<driver>),CA) THEN /specialLocation(<driver>)
093: class bindingsInRule66 {
094: // Property generated for term "<driver>"
095: example.nz.org.take.compiler.userv.domainmodel.Driver p1;
096:
097: // Property generated for term "CA"
098: java.lang.String p2;
099:
100: // Property generated for term "getLocation(<driver>)"
101: java.lang.String p3;
102: }
103: ;
104:
105: final bindingsInRule66 bindings = new bindingsInRule66();
106: bindings.p1 = slot1;
107: bindings.p2 = "CA";
108: bindings.p3 = slot1.getLocation();
109:
110: // code for prereq equals(getLocation(<driver>),CA)
111: final ResourceIterator<equals> iterator1 = KBFragement_equals_11
112: .equals_11(bindings.p3, "CA", _derivation
113: .increaseDepth());
114:
115: // code for prereq /specialLocation(<driver>)
116: final ResourceIterator<specialLocation> iterator2 = new NestedIterator<equals, specialLocation>(
117: iterator1) {
118: public ResourceIterator<specialLocation> getNextIterator(
119: equals object) {
120: bindings.p3 = object.slot1;
121: bindings.p2 = (java.lang.String) "CA";
122:
123: return new SingletonIterator(new specialLocation(
124: bindings.p1));
125: }
126: };
127:
128: return iterator2;
129: }
130:
131: /**
132: * Method generated for query /specialLocation[in]
133: * @param slot1 input parameter generated from slot 0
134: * @return an iterator for instances of specialLocation
135: */
136: private static ResourceIterator<specialLocation> specialLocation_1_1(
137: final example.nz.org.take.compiler.userv.domainmodel.Driver slot1,
138: final DerivationController _derivation) {
139: _derivation.log("DP_00b", DerivationController.RULE, slot1);
140:
141: // Variable bindings in rule: IF equals(getLocation(<driver>),NY) THEN /specialLocation(<driver>)
142: class bindingsInRule67 {
143: // Property generated for term "<driver>"
144: example.nz.org.take.compiler.userv.domainmodel.Driver p1;
145:
146: // Property generated for term "NY"
147: java.lang.String p2;
148:
149: // Property generated for term "getLocation(<driver>)"
150: java.lang.String p3;
151: }
152: ;
153:
154: final bindingsInRule67 bindings = new bindingsInRule67();
155: bindings.p1 = slot1;
156: bindings.p2 = "NY";
157: bindings.p3 = slot1.getLocation();
158:
159: // code for prereq equals(getLocation(<driver>),NY)
160: final ResourceIterator<equals> iterator1 = KBFragement_equals_11
161: .equals_11(bindings.p3, "NY", _derivation
162: .increaseDepth());
163:
164: // code for prereq /specialLocation(<driver>)
165: final ResourceIterator<specialLocation> iterator2 = new NestedIterator<equals, specialLocation>(
166: iterator1) {
167: public ResourceIterator<specialLocation> getNextIterator(
168: equals object) {
169: bindings.p3 = object.slot1;
170: bindings.p2 = (java.lang.String) "NY";
171:
172: return new SingletonIterator(new specialLocation(
173: bindings.p1));
174: }
175: };
176:
177: return iterator2;
178: }
179:
180: /**
181: * Method generated for query /specialLocation[in]
182: * @param slot1 input parameter generated from slot 0
183: * @return an iterator for instances of specialLocation
184: */
185: private static ResourceIterator<specialLocation> specialLocation_1_2(
186: final example.nz.org.take.compiler.userv.domainmodel.Driver slot1,
187: final DerivationController _derivation) {
188: _derivation.log("DP_00c", DerivationController.RULE, slot1);
189:
190: // Variable bindings in rule: IF equals(getLocation(<driver>),VA) THEN /specialLocation(<driver>)
191: class bindingsInRule68 {
192: // Property generated for term "<driver>"
193: example.nz.org.take.compiler.userv.domainmodel.Driver p1;
194:
195: // Property generated for term "VA"
196: java.lang.String p2;
197:
198: // Property generated for term "getLocation(<driver>)"
199: java.lang.String p3;
200: }
201: ;
202:
203: final bindingsInRule68 bindings = new bindingsInRule68();
204: bindings.p1 = slot1;
205: bindings.p2 = "VA";
206: bindings.p3 = slot1.getLocation();
207:
208: // code for prereq equals(getLocation(<driver>),VA)
209: final ResourceIterator<equals> iterator1 = KBFragement_equals_11
210: .equals_11(bindings.p3, "VA", _derivation
211: .increaseDepth());
212:
213: // code for prereq /specialLocation(<driver>)
214: final ResourceIterator<specialLocation> iterator2 = new NestedIterator<equals, specialLocation>(
215: iterator1) {
216: public ResourceIterator<specialLocation> getNextIterator(
217: equals object) {
218: bindings.p3 = object.slot1;
219: bindings.p2 = (java.lang.String) "VA";
220:
221: return new SingletonIterator(new specialLocation(
222: bindings.p1));
223: }
224: };
225:
226: return iterator2;
227: }
228: }
|