Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

RQMLFirstClassImpl.java

Go to the documentation of this file.
00001 
00066 package com.arcle.rmt.superwaba.model.imp.rqml;
00067 
00068 import superwaba.ext.xplat.io.DataStream;
00069 import superwaba.ext.xplat.io.Storable;
00070 
00071 import com.arcle.rmt.rqml.*;
00072 import com.arcle.rmt.superwaba.model.imp.*;
00073 
00080 public abstract class RQMLFirstClassImpl extends RQMLSecondClassImpl
00081     implements RQMLFirstClass {
00082 
00083     //-----------------------------------------------------------------------
00084     // RQMLFirstClass implementation
00085 
00086     public int getPriority() {
00087         return priority;
00088     }
00089 
00090 
00091     public int getDifficulty() {
00092         return difficulty;
00093     }
00094 
00095     public int getStatus() {
00096         return status;
00097     }
00098 
00099 
00100     public int getStability() {
00101         return stability;
00102     }
00103 
00104 
00105     public Name getName() {
00106         if (name == null) {
00107             name = createName();
00108         }
00109         return name;
00110     }
00111 
00112 
00113     public String getVersion() {
00114         return version;
00115     }
00116 
00117 
00118     public Description getDescription() {
00119         if (description == null) {
00120             description = createDescription();
00121         }
00122         return description;
00123     }
00124 
00125 
00126     public Rationale getRationale() {
00127         if (rationale == null) {
00128             rationale = createRationale();
00129         }
00130         return rationale;
00131     }
00132 
00133 
00134     public void setName(Name NAME) {
00135         name = (NameImpl) NAME;
00136     }
00137 
00138 
00139     public void setDescription(Description DESC) {
00140         description = (DescriptionImpl) DESC;
00141     }
00142 
00143 
00144     public void setRationale(Rationale RATIONALE) {
00145         rationale = (RationaleImpl) RATIONALE;
00146     }
00147 
00148 
00149     public void setPriority(int p) {
00150         if (PRIORITY_LOW <= p && p <= PRIORITY_HIGH) {
00151             priority = p;
00152         }
00153     }
00154 
00155 
00156     public void setDifficulty(int d) {
00157         if (DIFFICULTY_LOW <= d && d <= DIFFICULTY_HIGH) {
00158             difficulty = d;
00159         }
00160     }
00161 
00162     public void setStatus(int s) {
00163         if (STATUS_PROPOSED <= s && s <= STATUS_VALIDATED) {
00164             status = s;
00165         }
00166     }
00167 
00168 
00169     public void setVersion(String VERSION) {
00170         version = VERSION;
00171     }
00172 
00173     public void setStability(int s) {
00174         if (STABILITY_LOW <= s && s <= STABILITY_HIGH) {
00175            stability = s;
00176         }
00177     }
00178 
00179     //-----------------------------------------------------------------------
00180     // Factory Methods
00181 
00182     protected DescriptionImpl createDescription() {
00183         return new DescriptionImpl();
00184     }
00185 
00186     protected RationaleImpl createRationale() {
00187         return new RationaleImpl();
00188     }
00189 
00190     protected NameImpl createName() {
00191         return new NameImpl();
00192     }
00193 
00194    //-----------------------------------------------------------------------
00195    // Member Variables
00196 
00197     private int priority     = 0;
00198     private int difficulty   = 0;
00199     private int status       = 0;
00200     private int stability    = 0;
00201     private String version = "";
00202 
00203     private DescriptionImpl description = null;
00204     private RationaleImpl rationale = null;
00205     private NameImpl name = null;
00206 
00207     //-----------------------------------------------------------------------
00208     // Inner Classes
00209 
00210     protected static abstract class Memento extends RQMLSecondClassImpl.Memento {
00211         public Memento(RQMLFirstClassImpl originator) {
00212             super(originator);
00213         }
00214 
00215         //-------------------------------------------------------------------
00216         // Still-Abstract methods
00217 
00218         public abstract byte getID();
00219 
00220 
00221         //-------------------------------------------------------------------
00222         // GenericMemento implementation
00223 
00224         public void saveState(DataStream data) {
00225             super.saveState(data);
00226             final RQMLFirstClassImpl org = (RQMLFirstClassImpl) getOriginator();
00227 
00228             data.writeInt(org.priority);
00229             data.writeInt(org.difficulty);
00230             data.writeInt(org.status);
00231             data.writeInt(org.stability);
00232             data.writeString(org.version);
00233 
00234             saveMementoable(org.description, data);
00235             saveMementoable(org.rationale, data);
00236             saveMementoable(org.name, data);
00237         }
00238 
00239 
00240         public void loadState(DataStream data) {
00241             super.loadState(data);
00242             final RQMLFirstClassImpl org = (RQMLFirstClassImpl) getOriginator();
00243 
00244             org.priority = data.readInt();
00245             org.difficulty = data.readInt();
00246             org.status = data.readInt();
00247             org.stability = data.readInt();
00248             org.version = data.readString();
00249 
00250             org.description = (DescriptionImpl) loadMementoable(data, new MementoableFactory() {
00251                 public Mementoable createOriginator() {
00252                     return org.createDescription();
00253                 }
00254             });
00255             org.rationale = (RationaleImpl) loadMementoable(data, new MementoableFactory() {
00256                 public Mementoable createOriginator() {
00257                     return org.createRationale();
00258                 }
00259             });
00260             org.name = (NameImpl) loadMementoable(data, new MementoableFactory() {
00261                 public Mementoable createOriginator()  {
00262                     return org.createName();
00263                 }
00264             });
00265         }
00266     }
00267 }

Generated on Fri Jun 18 19:51:25 2004 for Arcle Rambutan by doxygen 1.3.5