01: package com.teamkonzept.lib;
02:
03: public class TKStandardPluginIterator implements TKListIterator {
04:
05: TKListIterator oldIterator;
06: TKHashtableIteratorPlugin hash;
07: TKVectorIteratorPlugin vec;
08:
09: public TKStandardPluginIterator(String listName, String itemName,
10: TKHashtable hash, boolean doSort, TKListIterator oldIterator) {
11:
12: this .oldIterator = oldIterator;
13: this .hash = new TKHashtableIteratorPlugin(listName, itemName,
14: hash, doSort);
15: this .vec = null;
16: }
17:
18: public TKStandardPluginIterator(String listName, String itemName,
19: TKVector vec, boolean doSort, TKListIterator oldIterator) {
20:
21: this .oldIterator = oldIterator;
22: this .vec = new TKVectorIteratorPlugin(listName, itemName, vec,
23: doSort);
24: this .hash = null;
25: }
26:
27: public boolean apply(TKTemplate template, int i, String currListName) {
28:
29: if ((vec != null) && vec.apply(template, i, currListName, null))
30: return true;
31: else if ((hash != null)
32: && hash.apply(template, i, currListName, null))
33: return true;
34: else if (oldIterator != null)
35: return oldIterator.apply(template, i, currListName);
36: else
37: return false;
38: }
39: }
|