Example #1
0
  /**
   * Adds object instance o to this state.
   *
   * @param o the object instance to be added to this state.
   */
  public void addObject(ObjectInstance o) {

    String oname = o.getName();

    if (objectMap.containsKey(oname)) {
      return; // don't add an object that conflicts with another object of the same name
    }

    objectMap.put(oname, o);

    if (o.getObjectClass().hidden) {
      hiddenObjectInstances.add(o);
    } else {
      objectInstances.add(o);
    }

    this.addObjectClassIndexing(o);
  }
Example #2
0
  /**
   * Removes the object instance o from this state.
   *
   * @param o the object instance to remove from this state.
   */
  public void removeObject(ObjectInstance o) {
    if (o == null) {
      return;
    }

    String oname = o.getName();

    if (!objectMap.containsKey(oname)) {
      return; // make sure we're removing something that actually exists in this state!
    }

    if (o.getObjectClass().hidden) {
      hiddenObjectInstances.remove(o);
    } else {
      objectInstances.remove(o);
    }

    objectMap.remove(oname);

    this.removeObjectClassIndexing(o);
  }