01: package org.enhydra.shark.xpdl.elements;
02:
03: import org.enhydra.shark.xpdl.XMLAttribute;
04: import org.enhydra.shark.xpdl.XMLCollectionElement;
05: import org.enhydra.shark.xpdl.XPDLConstants;
06:
07: /**
08: * Represents coresponding element from XPDL schema.
09: *
10: * @author Sasa Bojanic
11: */
12: public class FormalParameter extends XMLCollectionElement {
13:
14: public FormalParameter(FormalParameters fps) {
15: super (fps, true);
16: }
17:
18: protected void fillStructure() {
19: DataType refDataType = new DataType(this );
20: Description refDescription = new Description(this ); // min=0
21: XMLAttribute attrIndex = new XMLAttribute(this , "Index", false);
22: // default="IN"
23: XMLAttribute attrMode = new XMLAttribute(this , "Mode", true,
24: new String[] { XPDLConstants.FORMAL_PARAMETER_MODE_IN,
25: XPDLConstants.FORMAL_PARAMETER_MODE_OUT,
26: XPDLConstants.FORMAL_PARAMETER_MODE_INOUT }, 0);
27:
28: super .fillStructure();
29: add(attrIndex);
30: add(attrMode);
31: add(refDataType);
32: add(refDescription);
33: }
34:
35: public DataType getDataType() {
36: return (DataType) get("DataType");
37: }
38:
39: public String getDescription() {
40: return get("Description").toValue();
41: }
42:
43: public void setDescription(String description) {
44: set("Description", description);
45: }
46:
47: public String getIndex() {
48: return get("Index").toValue();
49: }
50:
51: public void setIndex(String index) {
52: set("Index", index);
53: }
54:
55: public XMLAttribute getModeAttribute() {
56: return (XMLAttribute) get("Mode");
57: }
58:
59: public String getMode() {
60: return getModeAttribute().toValue();
61: }
62:
63: public void setModeIN() {
64: getModeAttribute().setValue(
65: XPDLConstants.FORMAL_PARAMETER_MODE_IN);
66: }
67:
68: public void setModeOUT() {
69: getModeAttribute().setValue(
70: XPDLConstants.FORMAL_PARAMETER_MODE_OUT);
71: }
72:
73: public void setModeINOUT() {
74: getModeAttribute().setValue(
75: XPDLConstants.FORMAL_PARAMETER_MODE_INOUT);
76: }
77:
78: }
|