public Object clone() {
   FigForkState figClone = (FigForkState) super.clone();
   Vector v = figClone.getFigs();
   figClone._bigPort = (FigRect) v.elementAt(0);
   figClone._head = (FigRect) v.elementAt(1);
   return figClone;
 }
 public Object clone() {
   FigShallowHistoryState figClone = (FigShallowHistoryState) super.clone();
   Vector v = figClone.getFigs();
   figClone._bigPort = (FigCircle) v.elementAt(0);
   figClone._head = (FigCircle) v.elementAt(1);
   figClone._name = (FigText) v.elementAt(2);
   return figClone;
 }
Exemple #3
0
 public Object clone() {
   FigUseCase figClone = (FigUseCase) super.clone();
   Vector v = figClone.getFigs();
   figClone._bigPort = (FigCircle) v.elementAt(0);
   figClone._cover = (FigCircle) v.elementAt(1);
   figClone._name = (FigText) v.elementAt(2);
   return figClone;
 }
 public void setNode(Vector figures) {
   int size = figures.size();
   if (figures != null && (size > 0)) {
     for (int i = 0; i < size; i++) {
       Object o = figures.elementAt(i);
       if (o instanceof FigComponentInstance) {
         FigComponentInstance figcomp = (FigComponentInstance) o;
         figcomp.setEnclosingFig(this);
       }
     }
   }
 }
 public Vector rowObjectsFor(Object t) {
   if (!(t instanceof UMLDeploymentDiagram)) return new Vector();
   UMLDeploymentDiagram d = (UMLDeploymentDiagram) t;
   Vector edges = d.getEdges();
   Vector res = new Vector();
   int size = edges.size();
   for (int i = 0; i < size; i++) {
     Object edge = edges.elementAt(i);
     if (edge instanceof MDependencyImpl) res.addElement(edge);
   }
   return res;
 }
 public java.util.Enumeration gen(Object o) {
   MClass c = (MClass) o;
   Vector specs = new Vector(c.getSpecializations());
   if (specs == null) {
     return EnumerationEmpty.theInstance();
   }
   // TODO: it would be nice to have a EnumerationXform
   // and a Functor object in uci.util
   Vector specClasses = new Vector(specs.size());
   java.util.Enumeration enum = specs.elements();
   while (enum.hasMoreElements()) {
     MGeneralization g = (MGeneralization) enum.nextElement();
     MGeneralizableElement ge = g.getChild();
     // assert: ge != null
     if (ge != null) specClasses.addElement(ge);
   }
   return specClasses.elements();
 }
  public Enumeration gen(Object o) {
      Vector res = new Vector();
    if (!(o instanceof MClassifier)) return res.elements();
    MClassifier cls = (MClassifier) o;
    Vector ends = new Vector(cls.getAssociationEnds());
    if (ends == null) return res.elements();
    Iterator enum = ends.iterator();
    while (enum.hasNext()) {
      MAssociationEnd ae = (MAssociationEnd) enum.next();
      if (MAggregationKind.COMPOSITE.equals(ae.getAggregation())) {
	MAssociation asc = ae.getAssociation();
	List conn = asc.getConnections();
	if (conn == null || conn.size() != 2) continue;
	Object otherEnd = (ae == conn.get(0)) ?
	  conn.get(1) : conn.get(0);
	MClassifier componentClass = ((MAssociationEnd)otherEnd).getType();
	res.add(componentClass);
      }
    }
    return res.elements();
  }
 public Object clone() {
   FigActor figClone = (FigActor) super.clone();
   Vector v = figClone.getFigs();
   figClone._bigPort = (FigCircle) v.elementAt(0);
   figClone._head = (FigCircle) v.elementAt(1);
   figClone._body = (FigLine) v.elementAt(2);
   figClone._arms = (FigLine) v.elementAt(3);
   figClone._leftLeg = (FigLine) v.elementAt(4);
   figClone._rightLeg = (FigLine) v.elementAt(5);
   figClone._name = (FigText) v.elementAt(6);
   return figClone;
 }
  public Object clone() {
    FigComponentInstance figClone = (FigComponentInstance) super.clone();
    Vector v = figClone.getFigs();
    figClone._bigPort = (FigRect) v.elementAt(0);
    figClone._cover = (FigRect) v.elementAt(1);
    figClone._stereo = (FigText) v.elementAt(2);
    figClone._name = (FigText) v.elementAt(3);
    figClone._upperRect = (FigRect) v.elementAt(4);
    figClone._lowerRect = (FigRect) v.elementAt(5);

    return figClone;
  }
  public Vector getChildren(Object parent) {
    if (!(parent instanceof MClass)) return null;
    Vector res = new Vector();
    Vector ends = new Vector(((MClass)parent).getAssociationEnds());
    if (ends == null) return null;
    java.util.Enumeration enum = ends.elements();
    while (enum.hasMoreElements()) {
      MAssociationEnd ae = (MAssociationEnd) enum.nextElement();
      MAssociation asc = ae.getAssociation();
      Vector allEnds = new Vector( asc.getConnections());
      MAssociationEnd otherEnd = null;
      if (ae == allEnds.elementAt(0))
	otherEnd = (MAssociationEnd) allEnds.elementAt(1);
      if (ae == allEnds.elementAt(1))
	otherEnd = (MAssociationEnd) allEnds.elementAt(0);
      if (otherEnd == null) continue;
      if (!otherEnd.isNavigable()) continue;
      if (res.contains(otherEnd.getType())) continue;
      res.addElement(otherEnd.getType());
      // needs-more-work: handle n-way Associations
    }
    return res;
  }
 public Vector getPrereqs() {
   Vector pros = new Vector();
   pros.addElement(MClassifier.class);
   return pros;
 }
 public int getIndexOfChild(Object parent, Object child) {
   Vector children = getChildren(parent);
   if (children != null && children.contains(child))
     return children.indexOf(child);
   return -1;
 }
 public int getChildCount(Object parent) {
   Vector children = getChildren(parent);
   if (children != null) return children.size();
   return 0;
 }
 public Object getChild(Object parent, int index) {
   Vector children = getChildren(parent);
   if (children != null) return children.elementAt(index);
   System.out.println("getChild should never be get here GoClassToNavigableClass");
   return null;
 }
  public void setEnclosingFig(Fig encloser) {

    if (encloser != null && encloser.getOwner() instanceof MNodeInstance && getOwner() != null) {
      MNodeInstance node = (MNodeInstance) encloser.getOwner();
      MComponentInstance comp = (MComponentInstance) getOwner();
      if (comp.getNodeInstance() != node) {
        comp.setNodeInstance(node);
      }
      super.setEnclosingFig(encloser);

      Vector figures = getEnclosedFigs();

      if (getLayer() != null) {
        // elementOrdering(figures);
        Vector contents = getLayer().getContents();
        int contentsSize = contents.size();
        for (int j = 0; j < contentsSize; j++) {
          Object o = contents.elementAt(j);
          if (o instanceof FigEdgeModelElement) {
            FigEdgeModelElement figedge = (FigEdgeModelElement) o;
            figedge.getLayer().bringToFront(figedge);
          }
        }
      }
    } else if (encloser == null && getEnclosingFig() != null) {
      if (getEnclosingFig() instanceof FigNodeModelElement)
        ((FigNodeModelElement) getEnclosingFig()).getEnclosedFigs().removeElement(this);
      _encloser = null;
    }
    /*
    super.setEnclosingFig(encloser);

    Vector figures = getEnclosedFigs();

    if (getLayer() != null) {
      // elementOrdering(figures);
      Vector contents = getLayer().getContents();
      int contentsSize = contents.size();
      for (int j=0; j<contentsSize; j++) {
        Object o = contents.elementAt(j);
        if (o instanceof FigEdgeModelElement) {
          FigEdgeModelElement figedge = (FigEdgeModelElement) o;
          figedge.getLayer().bringToFront(figedge);
        }
      }
    }

    if (!(getOwner() instanceof MModelElement)) return;
    if (getOwner() instanceof MComponentInstance) {
      MComponentInstance me = (MComponentInstance) getOwner();
      MNodeInstance mnode = null;

      if (encloser != null && (encloser.getOwner() instanceof MNodeInstance)) {
        mnode = (MNodeInstance) encloser.getOwner();
      }
      if (encloser != null && (encloser.getOwner() instanceof MComponentInstance)) {
        MComponentInstance comp = (MComponentInstance) encloser.getOwner();
        mnode = (MNodeInstance) comp.getNodeInstance();
      }
      try {
        if(mnode != null) {
          me.setNodeInstance(mnode);
        }
        else {
          if (me.getNodeInstance() != null) {
            me.setNodeInstance(null);
          }
        }
        setNode(figures);
      }
      catch (Exception e) {
        cat.error("could not set package", e);

      }
    }
    */
  }