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

LexiconImpl.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.Storable;
00069 import superwaba.ext.xplat.io.DataStream;
00070 
00071 import com.arcle.rmt.superwaba.model.imp.*;
00072 import com.arcle.rmt.rqml.*;
00073 
00079 public class LexiconImpl extends RQMLFirstClassImpl implements Lexicon {
00080     public GenericMemento createMemento() {
00081         return new Memento(this);
00082     }
00083 
00084 
00085     public Definition getDefinition() {
00086         if (definition == null) {
00087             definition = createDefinitionImpl();
00088         }
00089         return definition;
00090     }
00091 
00092 
00093     public void setDefinition(Definition def) {
00094         definition = (DefinitionImpl) def;
00095     }
00096 
00097     protected DefinitionImpl  createDefinitionImpl() {
00098         return new DefinitionImpl();
00099     }
00100 
00101 
00102     private DefinitionImpl definition = null;
00103 
00104     //-----------------------------------------------------------------------
00105     // Inner Classes
00106 
00107     protected static class Memento extends RQMLFirstClassImpl.Memento {
00108         public Memento(LexiconImpl originator) {
00109             super(originator);
00110         }
00111 
00112         public Storable getInstance() {
00113             // This memento is not directly stored in the Catalog as an
00114             // object, so this factory method is not required.
00115             return null;
00116         }
00117 
00118         public byte getID() {
00119             return DocumentImpl.LEXICON_ID;
00120         }
00121 
00122 
00123         public void saveState(DataStream data) {
00124             final LexiconImpl org = (LexiconImpl) getOriginator();
00125             super.saveState(data);
00126             saveMementoable(org.definition, data);
00127         }
00128 
00129         public void loadState(DataStream data) {
00130             final LexiconImpl org = (LexiconImpl) getOriginator();
00131             super.loadState(data);
00132             org.definition = (DefinitionImpl) loadMementoable(data, new MementoableFactory() {
00133                 public Mementoable createOriginator()  {
00134                     return org.createDefinitionImpl();
00135                 }
00136             });
00137         }
00138     }
00139 }

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