public void test_can_add_instance_to_diagnostic_isntance_set() {

    MockSimulatedClass room = new MockSimulatedClass("Room");
    SimulatedInstance room_1 = room.createInstance();
    SimulatedInstance room_2 = room.createInstance();

    InstanceSetDiagnostics dis = new InstanceSetDiagnostics();
    Assert.assertEquals(false, dis.hasDiagnosticsForInstance(room_1.getIdentifier()));
    Assert.assertEquals(false, dis.hasDiagnosticsForInstance(room_2.getIdentifier()));
    dis.addInstance(room_1);
    Assert.assertEquals(true, dis.hasDiagnosticsForInstance(room_1.getIdentifier()));
  }
  @Override
  public void simulate() {
    SimulatedRelationship relationship =
        this._simulator.getRelationshipWithName(this._specificSyntax.get_Relation());
    SimulatedInstance instance1 = this.getInstanceWithName(this._specificSyntax.get_Instance2());
    SimulatedInstance instance2 = this.getInstanceWithName(this._specificSyntax.get_Instance3());

    SimulatedInstanceIdentifier associationIdentifier =
        ((NonReflexiveRelationshipStorage) relationship.getRelationshipStorage())
            .getAssociationInstance(instance1.getIdentifier(), instance2.getIdentifier());

    SimulatedInstance association = null;

    if (associationIdentifier != null) {
      association = this._simulator.getInstanceFromIdentifier(associationIdentifier);
    } else {
      association = new NullSimulatedInstance(relationship.getAssociationClass());
    }

    this._simulator
        .getSimulatingState()
        .registerInstance(this._specificSyntax.get_Instance1(), association);
  }
Esempio n. 3
0
 public void putInstance(SimulatedInstance theInstance) {
   SimulatedClass simulatedClass = theInstance.getSimulatedClass();
   theInstance.setWeave(this);
   this._instances.put(simulatedClass, theInstance);
 }