Пример #1
0
  public static ElementInMove_c resolveInstance(
      ModelRoot modelRoot,
      java.util.UUID p_m_elementid,
      java.util.UUID p_m_diagramid,
      float p_m_startingx,
      float p_m_startingy) {
    InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
    ElementInMove_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid, p_m_diagramid};
      source = (ElementInMove_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
        source.m_startingx = p_m_startingx;
        source.m_startingy = p_m_startingy;

        return source;
      }
    }
    // there is no instance matching the id
    ElementInMove_c new_inst =
        new ElementInMove_c(modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
    return new_inst;
  }
Пример #2
0
 public static void clearInstances(ModelRoot modelRoot) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     for (int i = instances.size() - 1; i >= 0; i--) {
       ((NonRootModelElement) instances.get(i)).delete_unchecked();
     }
   }
 }
Пример #3
0
 public static void batchRelateAll(
     ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     Iterator<NonRootModelElement> cursor = instances.iterator();
     while (cursor.hasNext()) {
       final Graphnode_c inst = (Graphnode_c) cursor.next();
       inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots);
     }
   }
 }
Пример #4
0
 private static Graphnode_c findGraphnodeInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       Graphnode_c x = (Graphnode_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         return x;
       }
     }
   }
   return null;
 }
Пример #5
0
 public static ElementInMove_c createProxy(
     ModelRoot modelRoot,
     java.util.UUID p_m_elementid,
     java.util.UUID p_m_diagramid,
     float p_m_startingx,
     float p_m_startingy,
     String p_contentPath,
     IPath p_localPath) {
   ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath);
   // if a model root was not resolved it is most likely
   // due to a missing file of the proxy, defualt back to
   // the original model root
   if (resolvedModelRoot != null) modelRoot = resolvedModelRoot;
   InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
   ElementInMove_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_elementid, p_m_diagramid};
     new_inst = (ElementInMove_c) instances.get(key);
   }
   String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath));
   if (modelRoot.isNewCompareRoot()) {
     // for comparisons we do not want to change
     // the content path
     contentPath = p_contentPath;
   }
   if (new_inst != null && !modelRoot.isCompareRoot()) {
     PersistableModelComponent pmc = new_inst.getPersistableComponent();
     if (pmc == null) {
       // dangling reference, redo this instance
       new_inst.batchUnrelate();
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
       new_inst.m_startingx = p_m_startingx;
       new_inst.m_startingy = p_m_startingy;
     }
   }
   if (new_inst == null) {
     // there is no instance matching the id, create a proxy
     // if the resource doesn't exist then this will be a dangling reference
     new_inst =
         new ElementInMove_c(
             modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
Пример #6
0
 public static Graphnode_c[] GraphnodeInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       Graphnode_c x = (Graphnode_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         matches.add(x);
       }
     }
     if (matches.size() > 0) {
       Graphnode_c[] ret_set = new Graphnode_c[matches.size()];
       matches.copyInto(ret_set);
       return ret_set;
     } else {
       return new Graphnode_c[0];
     }
   }
 }
Пример #7
0
  public static Graphnode_c resolveInstance(
      ModelRoot modelRoot, float p_m_width, float p_m_height, java.util.UUID p_m_elementid) {
    InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
    Graphnode_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid};
      source = (Graphnode_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        source.m_width = p_m_width;
        source.m_height = p_m_height;
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);

        return source;
      }
    }
    // there is no instance matching the id
    Graphnode_c new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid);
    return new_inst;
  }