01: /*
02: * Created on Mar 10, 2004
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.xssl.text;
08:
09: import java.util.HashMap;
10:
11: import org.xdev.base.xssl.XSSLAction;
12: import org.xdev.base.xssl.XSSLActionIterator;
13: import org.xdev.base.xssl.XSSLReturn;
14:
15: /**
16: * @author AYegorov
17: *
18: * To change the template for this generated type comment go to
19: * Window>Preferences>Java>Code Generation>Code and Comments
20: */
21: public class TextDecode extends XSSLActionIterator {
22: private int counter = 0;
23:
24: private boolean exists = false;
25:
26: private Object source = null;
27: private Object returnValue = null;
28:
29: /**
30: * @param id
31: */
32: public TextDecode(String id) {
33: super (id);
34: // XXX Auto-generated constructor stub
35: }
36:
37: /**
38: * @param id
39: * @param properties
40: */
41: public TextDecode(String id, HashMap properties) {
42: super (id, properties);
43: // XXX Auto-generated constructor stub
44: }
45:
46: /* (non-Javadoc)
47: * @see org.xdev.base.xssl.XSSLActionIterator#invoke(org.xdev.base.xssl.XSSLAction)
48: */
49: protected void invoke(XSSLAction component) throws Exception {
50: counter++;
51:
52: if (counter % 2 == 0 && this .exists) {
53: this .returnValue = ((XSSLReturn) component)
54: .getObjectValue();
55:
56: this .exists = false;
57:
58: this .breakIteration();
59:
60: } else {
61:
62: Object obj = ((XSSLReturn) component).getObjectValue();
63:
64: this .logDebug("Decoding " + source + " against " + obj);
65:
66: if ((source == null && obj == null)
67: || this .source.equals(obj)) {
68: this .exists = true;
69: }
70: }
71: }
72:
73: /* (non-Javadoc)
74: * @see org.xdev.base.xssl.XSSLAction#set()
75: */
76: protected void set() throws Exception {
77: this .source = this .getEvaluatedReference();
78: }
79:
80: public Object getObjectValue() {
81: return this.returnValue;
82: }
83: }
|