[Nextobjects-devel] nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models ConceptualMo
Status: Alpha
Brought to you by:
eflorent
From: <efl...@us...> - 2003-05-31 11:52:22
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models In directory sc8-pr-cvs1:/tmp/cvs-serv10548/src/org/devaki/nextobjects/workspace/models Modified Files: ConceptualModel.java Log Message: Buffered graphics Index: ConceptualModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/ConceptualModel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConceptualModel.java 24 May 2003 18:50:47 -0000 1.4 --- ConceptualModel.java 31 May 2003 11:48:34 -0000 1.5 *************** *** 30,235 **** import org.devaki.nextobjects.workspace.models.objects.Entity; ! public class ConceptualModel extends BaseModel implements Serializable { ! /** Variables **/ ! // Lists of objects in the model ! private Vector entities = new Vector(); ! private Vector associations = new Vector(); ! private Vector associationLinks = new Vector(); ! ! // Different cards ! // for association links ! public final static int _01_ = 0; ! public final static int _11_ = 1; ! public final static int _0N_ = 2; ! public final static int _1N_ = 3; ! // for a model ! public final static int _NM_ = 4; // ! ! // Graphical View ! private ConceptualView myConceptualView; ! /** ! * Construct a new 'ConceptualModel' object ! * @param pName Name of the model ! */ ! public ConceptualModel(String pName) ! { ! super(pName); ! } ! /* ! /** ! * Return the best possible filename for save ! * @return ! */ ! public String getBestFilename() ! { ! if (this.getFileForSave() == null) ! { ! return (new StringBuffer().append(this.getCode()) ! .append(".cdm")) ! .toString(); ! } ! else ! { ! return this.getFileForSave(); ! } ! } ! /* ! * Conveniency method wich return all the links to draw ! * in this models. ! */ ! public LineView[] getModelLinks() { ! LineView[] links=new LineView[ associationLinks.size() ! +getInheritanceLinks().size()]; ! for (int i = 0; i < associationLinks.size(); i++) ! { ! links[i]=(LineView)getAssociationLinkAt(i).getObjectView(); ! } ! for ( int j=associationLinks.size(); ! j<getInheritanceLinks().size()+associationLinks.size();j++) ! { ! links[j]=(LineView) getInheritanceLinkAt(j-associationLinks.size()) ! .getObjectView(); ! } ! return links; ! } ! /* ! * Conveniency method wich return all the objects in the models ! * in this models. -- OPTIMIZABLE, SUPPRESIBLE ! */ ! public BaseObject[] getModel0bjects() { ! BaseObject[] baseObjects=new BaseObject[ associationLinks.size() ! +getInheritanceLinks().size() ! + entities.size() ! + associations.size() ! ]; ! int offset=0; ! for (int i = 0; i < associationLinks.size(); i++) ! { ! baseObjects[offset]=getAssociationLinkAt(i); ! offset++; ! } ! for (int i=0; i<getInheritanceLinks().size();i++) ! { ! baseObjects[offset]=getInheritanceLinkAt(i); ! offset++; ! } ! for (int i=0; i<associations.size();i++) ! { ! baseObjects[offset]=getAssociationAt(i); ! offset++; ! } ! for (int i=0; i<entities.size();i++) ! { ! baseObjects[offset]=getEntityAt(i); ! offset++; ! } ! return baseObjects; ! } ! /** ! * Return the graphics view of the model ! * @return ! */ ! public ConceptualView getConceptualView() { return this.myConceptualView; } ! /** ! * Return the associations of the model ! * @return ! */ ! public Vector getAssociations() { return this.associations; } ! /** ! * Return the entities of the model ! * @return ! */ ! public Vector getEntities() { return this.entities; } ! /** ! * Return the association links of the model ! * @return ! */ ! public Vector getAssociationLinks() { return this.associationLinks; } ! /** ! * Return the association identified by the parameter in the list ! * of associations. ! * @param at ! * @return ! */ ! public Association getAssociationAt(int at) ! { ! return (Association)this.associations.elementAt(at); ! } ! /** ! * Return the entity identified by the parameter in the list ! * of entities. ! * @param at ! * @return ! */ ! public Entity getEntityAt(int at) ! { ! return (Entity)this.entities.elementAt(at); ! } ! public Entity getEntity(String pString) ! { ! Entity tmp=null; ! for (int i=0;i<entities.size();i++) { ! if (((Entity)this.entities.elementAt(i)).getCode().equals(pString)) { ! tmp=(Entity)this.entities.elementAt(i); ! } ! } ! return tmp; ! } ! /** ! * Return the association link identified by the parameter in the list ! * of entities. ! * @param at ! * @return ! */ ! public AssociationLink getAssociationLinkAt(int at) ! { ! return (AssociationLink)this.associationLinks.elementAt(at); ! } ! /** ! * Set the conceptual view of the model ! * @param pConceptualView ! */ ! public void setConceptualView(ConceptualView pConceptualView) ! { ! this.myConceptualView = pConceptualView; ! } ! /** ! * Return the number of entities in the model ! * @return ! */ ! public int countEntity () { return this.entities.size(); } ! /** ! * Return the number of associations in the model ! * @return ! */ ! public int countAssociation () { return this.associations.size(); } ! /** ! * Return the number of association links in the model ! * @return ! */ ! public int countAssociationLinks () { return this.associationLinks.size(); } } --- 30,291 ---- import org.devaki.nextobjects.workspace.models.objects.Entity; ! /** ! * The Conceptual Data Model ! * @author efl...@de... ! */ public class ConceptualModel extends BaseModel implements Serializable { ! /** ! * The entities ! */ ! private Vector entities = new Vector(); ! /** ! * The associations ! */ ! private Vector associations = new Vector(); ! /** ! * The association links ! */ ! private Vector associationLinks = new Vector(); + /** + * cards + */ + public final static int _01_ = 0; + /** + * cards + */ + public final static int _11_ = 1; + /** + * cards + */ + public final static int _0N_ = 2; + /** + * cards + */ + public final static int _1N_ = 3; + /** + * cards (for a model only) + */ + public final static int _NM_ = 4; // ! /** ! * Graphical View ! */ ! private ConceptualView myConceptualView; ! /** ! * Construct a new 'ConceptualModel' object ! * @param pName Name of the model ! */ ! public ConceptualModel(String pName) ! { ! super(pName); ! } ! /** ! * Return the best possible filename for save ! * @return the best filename ! */ ! public String getBestFilename() ! { ! if (this.getFileForSave() == null) ! { ! return (new StringBuffer().append(this.getCode()).append(".cdm")) ! .toString(); ! } else ! { ! return this.getFileForSave(); ! } ! } ! /** ! * Conveniency method wich return all the links to draw ! * in this models. ! * @return the line views ! */ ! public LineView[] getModelLinks() ! { ! LineView[] links = ! new LineView[associationLinks.size() ! + getInheritanceLinks().size()]; ! for (int i = 0; i < associationLinks.size(); i++) ! { ! links[i] = (LineView) getAssociationLinkAt(i).getObjectView(); ! } ! for (int j = associationLinks.size(); ! j < getInheritanceLinks().size() + associationLinks.size(); ! j++) ! { ! links[j] = ! (LineView) getInheritanceLinkAt(j - associationLinks.size()) ! .getObjectView(); ! } ! return links; ! } ! /** ! * Conveniency method wich return all the objects in the models ! * in this models. ! * @return the base objects ! */ ! public BaseObject[] getModel0bjects() ! { ! BaseObject[] baseObjects = ! new BaseObject[associationLinks.size() ! + getInheritanceLinks().size() ! + entities.size() ! + associations.size()]; ! int offset = 0; ! for (int i = 0; i < associationLinks.size(); i++) ! { ! baseObjects[offset] = getAssociationLinkAt(i); ! offset++; ! } ! for (int i = 0; i < getInheritanceLinks().size(); i++) ! { ! baseObjects[offset] = getInheritanceLinkAt(i); ! offset++; ! } ! for (int i = 0; i < associations.size(); i++) ! { ! baseObjects[offset] = getAssociationAt(i); ! offset++; ! } ! for (int i = 0; i < entities.size(); i++) ! { ! baseObjects[offset] = getEntityAt(i); ! offset++; ! } ! return baseObjects; ! } ! /** ! * Return the graphics view of the model ! * @return the graphic view ! */ ! public ConceptualView getConceptualView() ! { ! return this.myConceptualView; ! } + /** + * Return the associations of the model + * @return the associations + */ + public Vector getAssociations() + { + return this.associations; + } + /** + * Return the entities of the model + * @return the entities + */ + public Vector getEntities() + { + return this.entities; + } ! /** ! * Return the association links of the model ! * @return the associations links ! */ ! public Vector getAssociationLinks() ! { ! return this.associationLinks; ! } ! /** ! * Return the association identified by the parameter in the list ! * of associations. ! * @param at index ! * @return the association ! */ ! public Association getAssociationAt(int at) ! { ! return (Association) this.associations.elementAt(at); ! } ! /** ! * Return the entity identified by the parameter in the list ! * of entities. ! * @param at the index ! * @return entity ! */ ! public Entity getEntityAt(int at) ! { ! return (Entity) this.entities.elementAt(at); ! } ! /** ! * Return a entity for code ! * @param pString the string ! * @return the entity ! */ ! public Entity getEntity(String pString) ! { ! Entity tmp = null; ! for (int i = 0; i < entities.size(); i++) ! { ! if (((Entity) this.entities.elementAt(i)) ! .getCode() ! .equals(pString)) ! { ! tmp = (Entity) this.entities.elementAt(i); ! } ! } ! return tmp; ! } ! /** ! * Return the association link identified by the parameter in the list ! * of entities. ! * @param at index ! * @return the association link ! */ ! public AssociationLink getAssociationLinkAt(int at) ! { ! return (AssociationLink) this.associationLinks.elementAt(at); ! } ! /** ! * Set the conceptual view of the model ! * @param pConceptualView the graphics view ! */ ! public void setConceptualView(ConceptualView pConceptualView) ! { ! this.myConceptualView = pConceptualView; ! } ! /** ! * Return the number of entities in the model ! * @return the count ! */ ! public int countEntities() ! { ! return this.entities.size(); ! } ! /** ! * Return the number of associations in the model ! * @return the count ! */ ! public int countAssociation() ! { ! return this.associations.size(); ! } ! /** ! * Return the number of association links in the model ! * @return the count ! */ ! public int countAssociationLinks() ! { ! return this.associationLinks.size(); ! } } |