From 0868e0abe8008dd3f5b237581386d44ac38c1125 Mon Sep 17 00:00:00 2001 From: Aren Babikian Date: Thu, 14 Jan 2021 09:20:51 -0500 Subject: Adjust simpleScenario MM and add constraints --- .../ecore-gen/simpleScenario/Actor.java | 43 ++- .../ecore-gen/simpleScenario/Lane.java | 26 +- .../simpleScenario/SeperationDistance.java | 23 -- .../ecore-gen/simpleScenario/SimpleScenario.java | 23 ++ .../simpleScenario/SimpleScenarioPackage.java | 148 +++++--- .../ecore-gen/simpleScenario/VisionBlocked.java | 2 +- .../ecore-gen/simpleScenario/impl/ActorImpl.java | 102 ++++-- .../ecore-gen/simpleScenario/impl/LaneImpl.java | 64 ++-- .../impl/SeperationDistanceImpl.java | 56 --- .../simpleScenario/impl/SimpleScenarioImpl.java | 56 +++ .../impl/SimpleScenarioPackageImpl.java | 52 +-- .../inputs/simpleScenarioGen.vsconfig | 2 +- Domains/simpleScenario/model/simpleScenario.aird | 117 +++--- Domains/simpleScenario/model/simpleScenario.ecore | 20 +- .../simpleScenario/model/simpleScenario.genmodel | 11 +- Domains/simpleScenario/plugin.xml | 13 +- .../queries/simpleScenarioQueries.vql | 392 +++++++++++++++++++-- 17 files changed, 825 insertions(+), 325 deletions(-) diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/Actor.java b/Domains/simpleScenario/ecore-gen/simpleScenario/Actor.java index 996d349c..92c0ee3f 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/Actor.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/Actor.java @@ -19,9 +19,10 @@ import org.eclipse.emf.ecore.EObject; *
  • {@link simpleScenario.Actor#getYPos YPos}
  • *
  • {@link simpleScenario.Actor#getLength Length}
  • *
  • {@link simpleScenario.Actor#getWidth Width}
  • - *
  • {@link simpleScenario.Actor#getSpeed Speed}
  • + *
  • {@link simpleScenario.Actor#getXSpeed XSpeed}
  • *
  • {@link simpleScenario.Actor#getRelations Relations}
  • *
  • {@link simpleScenario.Actor#getPlacedOn Placed On}
  • + *
  • {@link simpleScenario.Actor#getYSpeed YSpeed}
  • * * * @see simpleScenario.SimpleScenarioPackage#getActor() @@ -119,27 +120,27 @@ public interface Actor extends EObject { void setWidth(double value); /** - * Returns the value of the 'Speed' attribute. + * Returns the value of the 'XSpeed' attribute. * The default value is "0.0". * * - * @return the value of the 'Speed' attribute. - * @see #setSpeed(double) - * @see simpleScenario.SimpleScenarioPackage#getActor_Speed() + * @return the value of the 'XSpeed' attribute. + * @see #setXSpeed(double) + * @see simpleScenario.SimpleScenarioPackage#getActor_XSpeed() * @model default="0.0" required="true" * @generated */ - double getSpeed(); + double getXSpeed(); /** - * Sets the value of the '{@link simpleScenario.Actor#getSpeed Speed}' attribute. + * Sets the value of the '{@link simpleScenario.Actor#getXSpeed XSpeed}' attribute. * * - * @param value the new value of the 'Speed' attribute. - * @see #getSpeed() + * @param value the new value of the 'XSpeed' attribute. + * @see #getXSpeed() * @generated */ - void setSpeed(double value); + void setXSpeed(double value); /** * Returns the value of the 'Relations' containment reference list. @@ -177,4 +178,26 @@ public interface Actor extends EObject { */ void setPlacedOn(Lane value); + /** + * Returns the value of the 'YSpeed' attribute. + * + * + * @return the value of the 'YSpeed' attribute. + * @see #setYSpeed(double) + * @see simpleScenario.SimpleScenarioPackage#getActor_YSpeed() + * @model required="true" + * @generated + */ + double getYSpeed(); + + /** + * Sets the value of the '{@link simpleScenario.Actor#getYSpeed YSpeed}' attribute. + * + * + * @param value the new value of the 'YSpeed' attribute. + * @see #getYSpeed() + * @generated + */ + void setYSpeed(double value); + } // Actor diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/Lane.java b/Domains/simpleScenario/ecore-gen/simpleScenario/Lane.java index 9532cd64..376117d0 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/Lane.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/Lane.java @@ -18,7 +18,7 @@ import org.eclipse.emf.ecore.EObject; *
  • {@link simpleScenario.Lane#getOrientation Orientation}
  • *
  • {@link simpleScenario.Lane#getWidth Width}
  • *
  • {@link simpleScenario.Lane#getReferenceCoord Reference Coord}
  • - *
  • {@link simpleScenario.Lane#getAdjacent Adjacent}
  • + *
  • {@link simpleScenario.Lane#getPrevLane Prev Lane}
  • *
  • {@link simpleScenario.Lane#getActors Actors}
  • *
  • {@link simpleScenario.Lane#getNumWidth Num Width}
  • * @@ -101,16 +101,26 @@ public interface Lane extends EObject { void setReferenceCoord(double value); /** - * Returns the value of the 'Adjacent' reference list. - * The list contents are of type {@link simpleScenario.Lane}. + * Returns the value of the 'Prev Lane' reference. * * - * @return the value of the 'Adjacent' reference list. - * @see simpleScenario.SimpleScenarioPackage#getLane_Adjacent() - * @model upper="2" + * @return the value of the 'Prev Lane' reference. + * @see #setPrevLane(Lane) + * @see simpleScenario.SimpleScenarioPackage#getLane_PrevLane() + * @model * @generated */ - EList getAdjacent(); + Lane getPrevLane(); + + /** + * Sets the value of the '{@link simpleScenario.Lane#getPrevLane Prev Lane}' reference. + * + * + * @param value the new value of the 'Prev Lane' reference. + * @see #getPrevLane() + * @generated + */ + void setPrevLane(Lane value); /** * Returns the value of the 'Actors' reference list. @@ -134,7 +144,7 @@ public interface Lane extends EObject { * @return the value of the 'Num Width' attribute. * @see #setNumWidth(double) * @see simpleScenario.SimpleScenarioPackage#getLane_NumWidth() - * @model default="0.0" required="true" derived="true" + * @model default="0.0" required="true" * @generated */ double getNumWidth(); diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/SeperationDistance.java b/Domains/simpleScenario/ecore-gen/simpleScenario/SeperationDistance.java index 140b4e4b..8af1f25e 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/SeperationDistance.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/SeperationDistance.java @@ -13,7 +13,6 @@ package simpleScenario; *

    * * * @see simpleScenario.SimpleScenarioPackage#getSeperationDistance() @@ -46,26 +45,4 @@ public interface SeperationDistance extends SpatialRelation { */ void setDistance(Distance value); - /** - * Returns the value of the 'Num Distance' attribute. - * - * - * @return the value of the 'Num Distance' attribute. - * @see #setNumDistance(double) - * @see simpleScenario.SimpleScenarioPackage#getSeperationDistance_NumDistance() - * @model required="true" derived="true" - * @generated - */ - double getNumDistance(); - - /** - * Sets the value of the '{@link simpleScenario.SeperationDistance#getNumDistance Num Distance}' attribute. - * - * - * @param value the new value of the 'Num Distance' attribute. - * @see #getNumDistance() - * @generated - */ - void setNumDistance(double value); - } // SeperationDistance diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenario.java b/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenario.java index bc92c51c..718d5bea 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenario.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenario.java @@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.EObject; *
  • {@link simpleScenario.SimpleScenario#getYSize YSize}
  • *
  • {@link simpleScenario.SimpleScenario#getActors Actors}
  • *
  • {@link simpleScenario.SimpleScenario#getLanes Lanes}
  • + *
  • {@link simpleScenario.SimpleScenario#getMaxTime Max Time}
  • * * * @see simpleScenario.SimpleScenarioPackage#getSimpleScenario() @@ -94,4 +95,26 @@ public interface SimpleScenario extends EObject { */ EList getLanes(); + /** + * Returns the value of the 'Max Time' attribute. + * + * + * @return the value of the 'Max Time' attribute. + * @see #setMaxTime(double) + * @see simpleScenario.SimpleScenarioPackage#getSimpleScenario_MaxTime() + * @model + * @generated + */ + double getMaxTime(); + + /** + * Sets the value of the '{@link simpleScenario.SimpleScenario#getMaxTime Max Time}' attribute. + * + * + * @param value the new value of the 'Max Time' attribute. + * @see #getMaxTime() + * @generated + */ + void setMaxTime(double value); + } // SimpleScenario diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenarioPackage.java b/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenarioPackage.java index 3458d7c7..897d4653 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenarioPackage.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/SimpleScenarioPackage.java @@ -103,6 +103,15 @@ public interface SimpleScenarioPackage extends EPackage { */ int SIMPLE_SCENARIO__LANES = 3; + /** + * The feature id for the 'Max Time' attribute. + * + * + * @generated + * @ordered + */ + int SIMPLE_SCENARIO__MAX_TIME = 4; + /** * The number of structural features of the 'Simple Scenario' class. * @@ -110,7 +119,7 @@ public interface SimpleScenarioPackage extends EPackage { * @generated * @ordered */ - int SIMPLE_SCENARIO_FEATURE_COUNT = 4; + int SIMPLE_SCENARIO_FEATURE_COUNT = 5; /** * The number of operations of the 'Simple Scenario' class. @@ -159,13 +168,13 @@ public interface SimpleScenarioPackage extends EPackage { int LANE__REFERENCE_COORD = 2; /** - * The feature id for the 'Adjacent' reference list. + * The feature id for the 'Prev Lane' reference. * * * @generated * @ordered */ - int LANE__ADJACENT = 3; + int LANE__PREV_LANE = 3; /** * The feature id for the 'Actors' reference list. @@ -250,13 +259,13 @@ public interface SimpleScenarioPackage extends EPackage { int ACTOR__WIDTH = 3; /** - * The feature id for the 'Speed' attribute. + * The feature id for the 'XSpeed' attribute. * * * @generated * @ordered */ - int ACTOR__SPEED = 4; + int ACTOR__XSPEED = 4; /** * The feature id for the 'Relations' containment reference list. @@ -276,6 +285,15 @@ public interface SimpleScenarioPackage extends EPackage { */ int ACTOR__PLACED_ON = 6; + /** + * The feature id for the 'YSpeed' attribute. + * + * + * @generated + * @ordered + */ + int ACTOR__YSPEED = 7; + /** * The number of structural features of the 'Actor' class. * @@ -283,7 +301,7 @@ public interface SimpleScenarioPackage extends EPackage { * @generated * @ordered */ - int ACTOR_FEATURE_COUNT = 7; + int ACTOR_FEATURE_COUNT = 8; /** * The number of operations of the 'Actor' class. @@ -479,15 +497,6 @@ public interface SimpleScenarioPackage extends EPackage { */ int SEPERATION_DISTANCE__DISTANCE = SPATIAL_RELATION_FEATURE_COUNT + 0; - /** - * The feature id for the 'Num Distance' attribute. - * - * - * @generated - * @ordered - */ - int SEPERATION_DISTANCE__NUM_DISTANCE = SPATIAL_RELATION_FEATURE_COUNT + 1; - /** * The number of structural features of the 'Seperation Distance' class. * @@ -495,7 +504,7 @@ public interface SimpleScenarioPackage extends EPackage { * @generated * @ordered */ - int SEPERATION_DISTANCE_FEATURE_COUNT = SPATIAL_RELATION_FEATURE_COUNT + 2; + int SEPERATION_DISTANCE_FEATURE_COUNT = SPATIAL_RELATION_FEATURE_COUNT + 1; /** * The number of operations of the 'Seperation Distance' class. @@ -636,13 +645,13 @@ public interface SimpleScenarioPackage extends EPackage { int PEDESTRIAN__WIDTH = ACTOR__WIDTH; /** - * The feature id for the 'Speed' attribute. + * The feature id for the 'XSpeed' attribute. * * * @generated * @ordered */ - int PEDESTRIAN__SPEED = ACTOR__SPEED; + int PEDESTRIAN__XSPEED = ACTOR__XSPEED; /** * The feature id for the 'Relations' containment reference list. @@ -662,6 +671,15 @@ public interface SimpleScenarioPackage extends EPackage { */ int PEDESTRIAN__PLACED_ON = ACTOR__PLACED_ON; + /** + * The feature id for the 'YSpeed' attribute. + * + * + * @generated + * @ordered + */ + int PEDESTRIAN__YSPEED = ACTOR__YSPEED; + /** * The number of structural features of the 'Pedestrian' class. * @@ -727,13 +745,13 @@ public interface SimpleScenarioPackage extends EPackage { int VEHICLE__WIDTH = ACTOR__WIDTH; /** - * The feature id for the 'Speed' attribute. + * The feature id for the 'XSpeed' attribute. * * * @generated * @ordered */ - int VEHICLE__SPEED = ACTOR__SPEED; + int VEHICLE__XSPEED = ACTOR__XSPEED; /** * The feature id for the 'Relations' containment reference list. @@ -753,6 +771,15 @@ public interface SimpleScenarioPackage extends EPackage { */ int VEHICLE__PLACED_ON = ACTOR__PLACED_ON; + /** + * The feature id for the 'YSpeed' attribute. + * + * + * @generated + * @ordered + */ + int VEHICLE__YSPEED = ACTOR__YSPEED; + /** * The number of structural features of the 'Vehicle' class. * @@ -855,6 +882,17 @@ public interface SimpleScenarioPackage extends EPackage { */ EReference getSimpleScenario_Lanes(); + /** + * Returns the meta object for the attribute '{@link simpleScenario.SimpleScenario#getMaxTime Max Time}'. + * + * + * @return the meta object for the attribute 'Max Time'. + * @see simpleScenario.SimpleScenario#getMaxTime() + * @see #getSimpleScenario() + * @generated + */ + EAttribute getSimpleScenario_MaxTime(); + /** * Returns the meta object for class '{@link simpleScenario.Lane Lane}'. * @@ -899,15 +937,15 @@ public interface SimpleScenarioPackage extends EPackage { EAttribute getLane_ReferenceCoord(); /** - * Returns the meta object for the reference list '{@link simpleScenario.Lane#getAdjacent Adjacent}'. + * Returns the meta object for the reference '{@link simpleScenario.Lane#getPrevLane Prev Lane}'. * * - * @return the meta object for the reference list 'Adjacent'. - * @see simpleScenario.Lane#getAdjacent() + * @return the meta object for the reference 'Prev Lane'. + * @see simpleScenario.Lane#getPrevLane() * @see #getLane() * @generated */ - EReference getLane_Adjacent(); + EReference getLane_PrevLane(); /** * Returns the meta object for the reference list '{@link simpleScenario.Lane#getActors Actors}'. @@ -986,15 +1024,15 @@ public interface SimpleScenarioPackage extends EPackage { EAttribute getActor_Width(); /** - * Returns the meta object for the attribute '{@link simpleScenario.Actor#getSpeed Speed}'. + * Returns the meta object for the attribute '{@link simpleScenario.Actor#getXSpeed XSpeed}'. * * - * @return the meta object for the attribute 'Speed'. - * @see simpleScenario.Actor#getSpeed() + * @return the meta object for the attribute 'XSpeed'. + * @see simpleScenario.Actor#getXSpeed() * @see #getActor() * @generated */ - EAttribute getActor_Speed(); + EAttribute getActor_XSpeed(); /** * Returns the meta object for the containment reference list '{@link simpleScenario.Actor#getRelations Relations}'. @@ -1018,6 +1056,17 @@ public interface SimpleScenarioPackage extends EPackage { */ EReference getActor_PlacedOn(); + /** + * Returns the meta object for the attribute '{@link simpleScenario.Actor#getYSpeed YSpeed}'. + * + * + * @return the meta object for the attribute 'YSpeed'. + * @see simpleScenario.Actor#getYSpeed() + * @see #getActor() + * @generated + */ + EAttribute getActor_YSpeed(); + /** * Returns the meta object for class '{@link simpleScenario.Relation Relation}'. * @@ -1101,17 +1150,6 @@ public interface SimpleScenarioPackage extends EPackage { */ EAttribute getSeperationDistance_Distance(); - /** - * Returns the meta object for the attribute '{@link simpleScenario.SeperationDistance#getNumDistance Num Distance}'. - * - * - * @return the meta object for the attribute 'Num Distance'. - * @see simpleScenario.SeperationDistance#getNumDistance() - * @see #getSeperationDistance() - * @generated - */ - EAttribute getSeperationDistance_NumDistance(); - /** * Returns the meta object for class '{@link simpleScenario.CollisionExists Collision Exists}'. * @@ -1258,6 +1296,14 @@ public interface SimpleScenarioPackage extends EPackage { */ EReference SIMPLE_SCENARIO__LANES = eINSTANCE.getSimpleScenario_Lanes(); + /** + * The meta object literal for the 'Max Time' attribute feature. + * + * + * @generated + */ + EAttribute SIMPLE_SCENARIO__MAX_TIME = eINSTANCE.getSimpleScenario_MaxTime(); + /** * The meta object literal for the '{@link simpleScenario.impl.LaneImpl Lane}' class. * @@ -1293,12 +1339,12 @@ public interface SimpleScenarioPackage extends EPackage { EAttribute LANE__REFERENCE_COORD = eINSTANCE.getLane_ReferenceCoord(); /** - * The meta object literal for the 'Adjacent' reference list feature. + * The meta object literal for the 'Prev Lane' reference feature. * * * @generated */ - EReference LANE__ADJACENT = eINSTANCE.getLane_Adjacent(); + EReference LANE__PREV_LANE = eINSTANCE.getLane_PrevLane(); /** * The meta object literal for the 'Actors' reference list feature. @@ -1359,12 +1405,12 @@ public interface SimpleScenarioPackage extends EPackage { EAttribute ACTOR__WIDTH = eINSTANCE.getActor_Width(); /** - * The meta object literal for the 'Speed' attribute feature. + * The meta object literal for the 'XSpeed' attribute feature. * * * @generated */ - EAttribute ACTOR__SPEED = eINSTANCE.getActor_Speed(); + EAttribute ACTOR__XSPEED = eINSTANCE.getActor_XSpeed(); /** * The meta object literal for the 'Relations' containment reference list feature. @@ -1382,6 +1428,14 @@ public interface SimpleScenarioPackage extends EPackage { */ EReference ACTOR__PLACED_ON = eINSTANCE.getActor_PlacedOn(); + /** + * The meta object literal for the 'YSpeed' attribute feature. + * + * + * @generated + */ + EAttribute ACTOR__YSPEED = eINSTANCE.getActor_YSpeed(); + /** * The meta object literal for the '{@link simpleScenario.impl.RelationImpl Relation}' class. * @@ -1456,14 +1510,6 @@ public interface SimpleScenarioPackage extends EPackage { */ EAttribute SEPERATION_DISTANCE__DISTANCE = eINSTANCE.getSeperationDistance_Distance(); - /** - * The meta object literal for the 'Num Distance' attribute feature. - * - * - * @generated - */ - EAttribute SEPERATION_DISTANCE__NUM_DISTANCE = eINSTANCE.getSeperationDistance_NumDistance(); - /** * The meta object literal for the '{@link simpleScenario.impl.CollisionExistsImpl Collision Exists}' class. * diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/VisionBlocked.java b/Domains/simpleScenario/ecore-gen/simpleScenario/VisionBlocked.java index c461d323..cdf5a074 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/VisionBlocked.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/VisionBlocked.java @@ -27,7 +27,7 @@ public interface VisionBlocked extends SpatialRelation { * @return the value of the 'Blocked By' reference. * @see #setBlockedBy(Actor) * @see simpleScenario.SimpleScenarioPackage#getVisionBlocked_BlockedBy() - * @model + * @model required="true" * @generated */ Actor getBlockedBy(); diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/ActorImpl.java b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/ActorImpl.java index ffd19846..780cd305 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/ActorImpl.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/ActorImpl.java @@ -35,9 +35,10 @@ import simpleScenario.SimpleScenarioPackage; *
  • {@link simpleScenario.impl.ActorImpl#getYPos YPos}
  • *
  • {@link simpleScenario.impl.ActorImpl#getLength Length}
  • *
  • {@link simpleScenario.impl.ActorImpl#getWidth Width}
  • - *
  • {@link simpleScenario.impl.ActorImpl#getSpeed Speed}
  • + *
  • {@link simpleScenario.impl.ActorImpl#getXSpeed XSpeed}
  • *
  • {@link simpleScenario.impl.ActorImpl#getRelations Relations}
  • *
  • {@link simpleScenario.impl.ActorImpl#getPlacedOn Placed On}
  • + *
  • {@link simpleScenario.impl.ActorImpl#getYSpeed YSpeed}
  • * * * @generated @@ -124,24 +125,24 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements protected double width = WIDTH_EDEFAULT; /** - * The default value of the '{@link #getSpeed() Speed}' attribute. + * The default value of the '{@link #getXSpeed() XSpeed}' attribute. * * - * @see #getSpeed() + * @see #getXSpeed() * @generated * @ordered */ - protected static final double SPEED_EDEFAULT = 0.0; + protected static final double XSPEED_EDEFAULT = 0.0; /** - * The cached value of the '{@link #getSpeed() Speed}' attribute. + * The cached value of the '{@link #getXSpeed() XSpeed}' attribute. * * - * @see #getSpeed() + * @see #getXSpeed() * @generated * @ordered */ - protected double speed = SPEED_EDEFAULT; + protected double xSpeed = XSPEED_EDEFAULT; /** * The cached value of the '{@link #getRelations() Relations}' containment reference list. @@ -163,6 +164,26 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements */ protected Lane placedOn; + /** + * The default value of the '{@link #getYSpeed() YSpeed}' attribute. + * + * + * @see #getYSpeed() + * @generated + * @ordered + */ + protected static final double YSPEED_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getYSpeed() YSpeed}' attribute. + * + * + * @see #getYSpeed() + * @generated + * @ordered + */ + protected double ySpeed = YSPEED_EDEFAULT; + /** * * @@ -280,8 +301,8 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements * @generated */ @Override - public double getSpeed() { - return speed; + public double getXSpeed() { + return xSpeed; } /** @@ -290,11 +311,11 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements * @generated */ @Override - public void setSpeed(double newSpeed) { - double oldSpeed = speed; - speed = newSpeed; + public void setXSpeed(double newXSpeed) { + double oldXSpeed = xSpeed; + xSpeed = newXSpeed; if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.ACTOR__SPEED, oldSpeed, speed)); + eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.ACTOR__XSPEED, oldXSpeed, xSpeed)); } /** @@ -372,6 +393,29 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.ACTOR__PLACED_ON, newPlacedOn, newPlacedOn)); } + /** + * + * + * @generated + */ + @Override + public double getYSpeed() { + return ySpeed; + } + + /** + * + * + * @generated + */ + @Override + public void setYSpeed(double newYSpeed) { + double oldYSpeed = ySpeed; + ySpeed = newYSpeed; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.ACTOR__YSPEED, oldYSpeed, ySpeed)); + } + /** * * @@ -420,13 +464,15 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements return getLength(); case SimpleScenarioPackage.ACTOR__WIDTH: return getWidth(); - case SimpleScenarioPackage.ACTOR__SPEED: - return getSpeed(); + case SimpleScenarioPackage.ACTOR__XSPEED: + return getXSpeed(); case SimpleScenarioPackage.ACTOR__RELATIONS: return getRelations(); case SimpleScenarioPackage.ACTOR__PLACED_ON: if (resolve) return getPlacedOn(); return basicGetPlacedOn(); + case SimpleScenarioPackage.ACTOR__YSPEED: + return getYSpeed(); } return super.eGet(featureID, resolve, coreType); } @@ -452,8 +498,8 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements case SimpleScenarioPackage.ACTOR__WIDTH: setWidth((Double)newValue); return; - case SimpleScenarioPackage.ACTOR__SPEED: - setSpeed((Double)newValue); + case SimpleScenarioPackage.ACTOR__XSPEED: + setXSpeed((Double)newValue); return; case SimpleScenarioPackage.ACTOR__RELATIONS: getRelations().clear(); @@ -462,6 +508,9 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements case SimpleScenarioPackage.ACTOR__PLACED_ON: setPlacedOn((Lane)newValue); return; + case SimpleScenarioPackage.ACTOR__YSPEED: + setYSpeed((Double)newValue); + return; } super.eSet(featureID, newValue); } @@ -486,8 +535,8 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements case SimpleScenarioPackage.ACTOR__WIDTH: setWidth(WIDTH_EDEFAULT); return; - case SimpleScenarioPackage.ACTOR__SPEED: - setSpeed(SPEED_EDEFAULT); + case SimpleScenarioPackage.ACTOR__XSPEED: + setXSpeed(XSPEED_EDEFAULT); return; case SimpleScenarioPackage.ACTOR__RELATIONS: getRelations().clear(); @@ -495,6 +544,9 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements case SimpleScenarioPackage.ACTOR__PLACED_ON: setPlacedOn((Lane)null); return; + case SimpleScenarioPackage.ACTOR__YSPEED: + setYSpeed(YSPEED_EDEFAULT); + return; } super.eUnset(featureID); } @@ -515,12 +567,14 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements return length != LENGTH_EDEFAULT; case SimpleScenarioPackage.ACTOR__WIDTH: return width != WIDTH_EDEFAULT; - case SimpleScenarioPackage.ACTOR__SPEED: - return speed != SPEED_EDEFAULT; + case SimpleScenarioPackage.ACTOR__XSPEED: + return xSpeed != XSPEED_EDEFAULT; case SimpleScenarioPackage.ACTOR__RELATIONS: return relations != null && !relations.isEmpty(); case SimpleScenarioPackage.ACTOR__PLACED_ON: return placedOn != null; + case SimpleScenarioPackage.ACTOR__YSPEED: + return ySpeed != YSPEED_EDEFAULT; } return super.eIsSet(featureID); } @@ -543,8 +597,10 @@ public abstract class ActorImpl extends MinimalEObjectImpl.Container implements result.append(length); result.append(", width: "); result.append(width); - result.append(", speed: "); - result.append(speed); + result.append(", xSpeed: "); + result.append(xSpeed); + result.append(", ySpeed: "); + result.append(ySpeed); result.append(')'); return result.toString(); } diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/LaneImpl.java b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/LaneImpl.java index fa250be8..929f8d9c 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/LaneImpl.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/LaneImpl.java @@ -3,7 +3,6 @@ package simpleScenario.impl; import java.util.Collection; - import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; @@ -14,8 +13,6 @@ import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; @@ -36,7 +33,7 @@ import simpleScenario.Size; *
  • {@link simpleScenario.impl.LaneImpl#getOrientation Orientation}
  • *
  • {@link simpleScenario.impl.LaneImpl#getWidth Width}
  • *
  • {@link simpleScenario.impl.LaneImpl#getReferenceCoord Reference Coord}
  • - *
  • {@link simpleScenario.impl.LaneImpl#getAdjacent Adjacent}
  • + *
  • {@link simpleScenario.impl.LaneImpl#getPrevLane Prev Lane}
  • *
  • {@link simpleScenario.impl.LaneImpl#getActors Actors}
  • *
  • {@link simpleScenario.impl.LaneImpl#getNumWidth Num Width}
  • * @@ -105,14 +102,14 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { protected double referenceCoord = REFERENCE_COORD_EDEFAULT; /** - * The cached value of the '{@link #getAdjacent() Adjacent}' reference list. + * The cached value of the '{@link #getPrevLane() Prev Lane}' reference. * * - * @see #getAdjacent() + * @see #getPrevLane() * @generated * @ordered */ - protected EList adjacent; + protected Lane prevLane; /** * The cached value of the '{@link #getActors() Actors}' reference list. @@ -238,11 +235,38 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { * @generated */ @Override - public EList getAdjacent() { - if (adjacent == null) { - adjacent = new EObjectResolvingEList(Lane.class, this, SimpleScenarioPackage.LANE__ADJACENT); + public Lane getPrevLane() { + if (prevLane != null && prevLane.eIsProxy()) { + InternalEObject oldPrevLane = (InternalEObject)prevLane; + prevLane = (Lane)eResolveProxy(oldPrevLane); + if (prevLane != oldPrevLane) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimpleScenarioPackage.LANE__PREV_LANE, oldPrevLane, prevLane)); + } } - return adjacent; + return prevLane; + } + + /** + * + * + * @generated + */ + public Lane basicGetPrevLane() { + return prevLane; + } + + /** + * + * + * @generated + */ + @Override + public void setPrevLane(Lane newPrevLane) { + Lane oldPrevLane = prevLane; + prevLane = newPrevLane; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.LANE__PREV_LANE, oldPrevLane, prevLane)); } /** @@ -324,8 +348,9 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { return getWidth(); case SimpleScenarioPackage.LANE__REFERENCE_COORD: return getReferenceCoord(); - case SimpleScenarioPackage.LANE__ADJACENT: - return getAdjacent(); + case SimpleScenarioPackage.LANE__PREV_LANE: + if (resolve) return getPrevLane(); + return basicGetPrevLane(); case SimpleScenarioPackage.LANE__ACTORS: return getActors(); case SimpleScenarioPackage.LANE__NUM_WIDTH: @@ -352,9 +377,8 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { case SimpleScenarioPackage.LANE__REFERENCE_COORD: setReferenceCoord((Double)newValue); return; - case SimpleScenarioPackage.LANE__ADJACENT: - getAdjacent().clear(); - getAdjacent().addAll((Collection)newValue); + case SimpleScenarioPackage.LANE__PREV_LANE: + setPrevLane((Lane)newValue); return; case SimpleScenarioPackage.LANE__ACTORS: getActors().clear(); @@ -384,8 +408,8 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { case SimpleScenarioPackage.LANE__REFERENCE_COORD: setReferenceCoord(REFERENCE_COORD_EDEFAULT); return; - case SimpleScenarioPackage.LANE__ADJACENT: - getAdjacent().clear(); + case SimpleScenarioPackage.LANE__PREV_LANE: + setPrevLane((Lane)null); return; case SimpleScenarioPackage.LANE__ACTORS: getActors().clear(); @@ -411,8 +435,8 @@ public class LaneImpl extends MinimalEObjectImpl.Container implements Lane { return width != WIDTH_EDEFAULT; case SimpleScenarioPackage.LANE__REFERENCE_COORD: return referenceCoord != REFERENCE_COORD_EDEFAULT; - case SimpleScenarioPackage.LANE__ADJACENT: - return adjacent != null && !adjacent.isEmpty(); + case SimpleScenarioPackage.LANE__PREV_LANE: + return prevLane != null; case SimpleScenarioPackage.LANE__ACTORS: return actors != null && !actors.isEmpty(); case SimpleScenarioPackage.LANE__NUM_WIDTH: diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SeperationDistanceImpl.java b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SeperationDistanceImpl.java index d0f6f231..dfa19427 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SeperationDistanceImpl.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SeperationDistanceImpl.java @@ -21,7 +21,6 @@ import simpleScenario.SimpleScenarioPackage; *

    *
      *
    • {@link simpleScenario.impl.SeperationDistanceImpl#getDistance Distance}
    • - *
    • {@link simpleScenario.impl.SeperationDistanceImpl#getNumDistance Num Distance}
    • *
    * * @generated @@ -47,26 +46,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper */ protected Distance distance = DISTANCE_EDEFAULT; - /** - * The default value of the '{@link #getNumDistance() Num Distance}' attribute. - * - * - * @see #getNumDistance() - * @generated - * @ordered - */ - protected static final double NUM_DISTANCE_EDEFAULT = 0.0; - - /** - * The cached value of the '{@link #getNumDistance() Num Distance}' attribute. - * - * - * @see #getNumDistance() - * @generated - * @ordered - */ - protected double numDistance = NUM_DISTANCE_EDEFAULT; - /** * * @@ -109,29 +88,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.SEPERATION_DISTANCE__DISTANCE, oldDistance, distance)); } - /** - * - * - * @generated - */ - @Override - public double getNumDistance() { - return numDistance; - } - - /** - * - * - * @generated - */ - @Override - public void setNumDistance(double newNumDistance) { - double oldNumDistance = numDistance; - numDistance = newNumDistance; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.SEPERATION_DISTANCE__NUM_DISTANCE, oldNumDistance, numDistance)); - } - /** * * @@ -142,8 +98,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper switch (featureID) { case SimpleScenarioPackage.SEPERATION_DISTANCE__DISTANCE: return getDistance(); - case SimpleScenarioPackage.SEPERATION_DISTANCE__NUM_DISTANCE: - return getNumDistance(); } return super.eGet(featureID, resolve, coreType); } @@ -159,9 +113,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper case SimpleScenarioPackage.SEPERATION_DISTANCE__DISTANCE: setDistance((Distance)newValue); return; - case SimpleScenarioPackage.SEPERATION_DISTANCE__NUM_DISTANCE: - setNumDistance((Double)newValue); - return; } super.eSet(featureID, newValue); } @@ -177,9 +128,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper case SimpleScenarioPackage.SEPERATION_DISTANCE__DISTANCE: setDistance(DISTANCE_EDEFAULT); return; - case SimpleScenarioPackage.SEPERATION_DISTANCE__NUM_DISTANCE: - setNumDistance(NUM_DISTANCE_EDEFAULT); - return; } super.eUnset(featureID); } @@ -194,8 +142,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper switch (featureID) { case SimpleScenarioPackage.SEPERATION_DISTANCE__DISTANCE: return distance != DISTANCE_EDEFAULT; - case SimpleScenarioPackage.SEPERATION_DISTANCE__NUM_DISTANCE: - return numDistance != NUM_DISTANCE_EDEFAULT; } return super.eIsSet(featureID); } @@ -212,8 +158,6 @@ public class SeperationDistanceImpl extends SpatialRelationImpl implements Seper StringBuilder result = new StringBuilder(super.toString()); result.append(" (distance: "); result.append(distance); - result.append(", numDistance: "); - result.append(numDistance); result.append(')'); return result.toString(); } diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioImpl.java b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioImpl.java index 9d542c65..e027c457 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioImpl.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioImpl.java @@ -35,6 +35,7 @@ import simpleScenario.SimpleScenarioPackage; *
  • {@link simpleScenario.impl.SimpleScenarioImpl#getYSize YSize}
  • *
  • {@link simpleScenario.impl.SimpleScenarioImpl#getActors Actors}
  • *
  • {@link simpleScenario.impl.SimpleScenarioImpl#getLanes Lanes}
  • + *
  • {@link simpleScenario.impl.SimpleScenarioImpl#getMaxTime Max Time}
  • * * * @generated @@ -100,6 +101,26 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements */ protected EList lanes; + /** + * The default value of the '{@link #getMaxTime() Max Time}' attribute. + * + * + * @see #getMaxTime() + * @generated + * @ordered + */ + protected static final double MAX_TIME_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getMaxTime() Max Time}' attribute. + * + * + * @see #getMaxTime() + * @generated + * @ordered + */ + protected double maxTime = MAX_TIME_EDEFAULT; + /** * * @@ -191,6 +212,29 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements return lanes; } + /** + * + * + * @generated + */ + @Override + public double getMaxTime() { + return maxTime; + } + + /** + * + * + * @generated + */ + @Override + public void setMaxTime(double newMaxTime) { + double oldMaxTime = maxTime; + maxTime = newMaxTime; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimpleScenarioPackage.SIMPLE_SCENARIO__MAX_TIME, oldMaxTime, maxTime)); + } + /** * * @@ -223,6 +267,8 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements return getActors(); case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES: return getLanes(); + case SimpleScenarioPackage.SIMPLE_SCENARIO__MAX_TIME: + return getMaxTime(); } return super.eGet(featureID, resolve, coreType); } @@ -250,6 +296,9 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements getLanes().clear(); getLanes().addAll((Collection)newValue); return; + case SimpleScenarioPackage.SIMPLE_SCENARIO__MAX_TIME: + setMaxTime((Double)newValue); + return; } super.eSet(featureID, newValue); } @@ -274,6 +323,9 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES: getLanes().clear(); return; + case SimpleScenarioPackage.SIMPLE_SCENARIO__MAX_TIME: + setMaxTime(MAX_TIME_EDEFAULT); + return; } super.eUnset(featureID); } @@ -294,6 +346,8 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements return actors != null && !actors.isEmpty(); case SimpleScenarioPackage.SIMPLE_SCENARIO__LANES: return lanes != null && !lanes.isEmpty(); + case SimpleScenarioPackage.SIMPLE_SCENARIO__MAX_TIME: + return maxTime != MAX_TIME_EDEFAULT; } return super.eIsSet(featureID); } @@ -312,6 +366,8 @@ public class SimpleScenarioImpl extends MinimalEObjectImpl.Container implements result.append(xSize); result.append(", ySize: "); result.append(ySize); + result.append(", maxTime: "); + result.append(maxTime); result.append(')'); return result.toString(); } diff --git a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioPackageImpl.java b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioPackageImpl.java index 837e0d0d..d68c10c9 100644 --- a/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioPackageImpl.java +++ b/Domains/simpleScenario/ecore-gen/simpleScenario/impl/SimpleScenarioPackageImpl.java @@ -251,6 +251,16 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce return (EReference)simpleScenarioEClass.getEStructuralFeatures().get(3); } + /** + * + * + * @generated + */ + @Override + public EAttribute getSimpleScenario_MaxTime() { + return (EAttribute)simpleScenarioEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -297,7 +307,7 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce * @generated */ @Override - public EReference getLane_Adjacent() { + public EReference getLane_PrevLane() { return (EReference)laneEClass.getEStructuralFeatures().get(3); } @@ -377,7 +387,7 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce * @generated */ @Override - public EAttribute getActor_Speed() { + public EAttribute getActor_XSpeed() { return (EAttribute)actorEClass.getEStructuralFeatures().get(4); } @@ -401,6 +411,16 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce return (EReference)actorEClass.getEStructuralFeatures().get(6); } + /** + * + * + * @generated + */ + @Override + public EAttribute getActor_YSpeed() { + return (EAttribute)actorEClass.getEStructuralFeatures().get(7); + } + /** * * @@ -481,16 +501,6 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce return (EAttribute)seperationDistanceEClass.getEStructuralFeatures().get(0); } - /** - * - * - * @generated - */ - @Override - public EAttribute getSeperationDistance_NumDistance() { - return (EAttribute)seperationDistanceEClass.getEStructuralFeatures().get(1); - } - /** * * @@ -605,12 +615,13 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce createEAttribute(simpleScenarioEClass, SIMPLE_SCENARIO__YSIZE); createEReference(simpleScenarioEClass, SIMPLE_SCENARIO__ACTORS); createEReference(simpleScenarioEClass, SIMPLE_SCENARIO__LANES); + createEAttribute(simpleScenarioEClass, SIMPLE_SCENARIO__MAX_TIME); laneEClass = createEClass(LANE); createEAttribute(laneEClass, LANE__ORIENTATION); createEAttribute(laneEClass, LANE__WIDTH); createEAttribute(laneEClass, LANE__REFERENCE_COORD); - createEReference(laneEClass, LANE__ADJACENT); + createEReference(laneEClass, LANE__PREV_LANE); createEReference(laneEClass, LANE__ACTORS); createEAttribute(laneEClass, LANE__NUM_WIDTH); @@ -619,9 +630,10 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce createEAttribute(actorEClass, ACTOR__YPOS); createEAttribute(actorEClass, ACTOR__LENGTH); createEAttribute(actorEClass, ACTOR__WIDTH); - createEAttribute(actorEClass, ACTOR__SPEED); + createEAttribute(actorEClass, ACTOR__XSPEED); createEReference(actorEClass, ACTOR__RELATIONS); createEReference(actorEClass, ACTOR__PLACED_ON); + createEAttribute(actorEClass, ACTOR__YSPEED); relationEClass = createEClass(RELATION); createEReference(relationEClass, RELATION__TARGET); @@ -635,7 +647,6 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce seperationDistanceEClass = createEClass(SEPERATION_DISTANCE); createEAttribute(seperationDistanceEClass, SEPERATION_DISTANCE__DISTANCE); - createEAttribute(seperationDistanceEClass, SEPERATION_DISTANCE__NUM_DISTANCE); collisionExistsEClass = createEClass(COLLISION_EXISTS); createEAttribute(collisionExistsEClass, COLLISION_EXISTS__COLLISION_TIME); @@ -695,23 +706,25 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce initEAttribute(getSimpleScenario_YSize(), ecorePackage.getEDouble(), "ySize", null, 0, 1, SimpleScenario.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getSimpleScenario_Actors(), this.getActor(), null, "actors", null, 0, -1, SimpleScenario.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getSimpleScenario_Lanes(), this.getLane(), null, "lanes", null, 0, -1, SimpleScenario.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getSimpleScenario_MaxTime(), ecorePackage.getEDouble(), "maxTime", null, 0, 1, SimpleScenario.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(laneEClass, Lane.class, "Lane", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getLane_Orientation(), this.getOrientation(), "orientation", null, 1, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getLane_Width(), this.getSize(), "width", null, 1, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getLane_ReferenceCoord(), ecorePackage.getEDouble(), "referenceCoord", null, 1, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getLane_Adjacent(), this.getLane(), null, "adjacent", null, 0, 2, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getLane_PrevLane(), this.getLane(), null, "prevLane", null, 0, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getLane_Actors(), this.getActor(), this.getActor_PlacedOn(), "actors", null, 0, -1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getLane_NumWidth(), ecorePackage.getEDouble(), "numWidth", "0.0", 1, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEAttribute(getLane_NumWidth(), ecorePackage.getEDouble(), "numWidth", "0.0", 1, 1, Lane.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(actorEClass, Actor.class, "Actor", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getActor_XPos(), ecorePackage.getEDouble(), "xPos", null, 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getActor_YPos(), ecorePackage.getEDouble(), "yPos", null, 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getActor_Length(), ecorePackage.getEDouble(), "length", "0.0", 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEAttribute(getActor_Width(), ecorePackage.getEDouble(), "width", null, 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - initEAttribute(getActor_Speed(), ecorePackage.getEDouble(), "speed", "0.0", 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getActor_XSpeed(), ecorePackage.getEDouble(), "xSpeed", "0.0", 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getActor_Relations(), this.getRelation(), null, "relations", null, 0, -1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getActor_PlacedOn(), this.getLane(), this.getLane_Actors(), "placedOn", null, 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getActor_YSpeed(), ecorePackage.getEDouble(), "ySpeed", null, 1, 1, Actor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(relationEClass, Relation.class, "Relation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getRelation_Target(), this.getActor(), null, "target", null, 1, 1, Relation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -721,11 +734,10 @@ public class SimpleScenarioPackageImpl extends EPackageImpl implements SimpleSce initEClass(temporalRelationEClass, TemporalRelation.class, "TemporalRelation", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(visionBlockedEClass, VisionBlocked.class, "VisionBlocked", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getVisionBlocked_BlockedBy(), this.getActor(), null, "blockedBy", null, 0, 1, VisionBlocked.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getVisionBlocked_BlockedBy(), this.getActor(), null, "blockedBy", null, 1, 1, VisionBlocked.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(seperationDistanceEClass, SeperationDistance.class, "SeperationDistance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getSeperationDistance_Distance(), this.getDistance(), "distance", null, 1, 1, SeperationDistance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getSeperationDistance_NumDistance(), ecorePackage.getEDouble(), "numDistance", null, 1, 1, SeperationDistance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEClass(collisionExistsEClass, CollisionExists.class, "CollisionExists", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getCollisionExists_CollisionTime(), ecorePackage.getEDouble(), "collisionTime", null, 1, 1, CollisionExists.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); diff --git a/Domains/simpleScenario/inputs/simpleScenarioGen.vsconfig b/Domains/simpleScenario/inputs/simpleScenarioGen.vsconfig index 14e0fbbd..a411d968 100644 --- a/Domains/simpleScenario/inputs/simpleScenarioGen.vsconfig +++ b/Domains/simpleScenario/inputs/simpleScenarioGen.vsconfig @@ -9,7 +9,7 @@ generate { scope = { #node = 10..30, #int = {}, - # = 1 + # = 1 } config = { diff --git a/Domains/simpleScenario/model/simpleScenario.aird b/Domains/simpleScenario/model/simpleScenario.aird index e338345d..ed02351d 100644 --- a/Domains/simpleScenario/model/simpleScenario.aird +++ b/Domains/simpleScenario/model/simpleScenario.aird @@ -5,7 +5,7 @@ simpleScenario.genmodel - + @@ -69,11 +69,15 @@ + + + + - + @@ -161,11 +165,15 @@ + + + + - + @@ -210,15 +218,11 @@ - - - - - + @@ -287,7 +291,7 @@ - +
    @@ -317,7 +321,7 @@ - +
    @@ -330,7 +334,7 @@ - + @@ -390,7 +394,7 @@ - + @@ -399,7 +403,7 @@ - + @@ -528,7 +532,7 @@ - + @@ -543,7 +547,7 @@ - + @@ -560,7 +564,7 @@ - + @@ -583,7 +587,7 @@ - + @@ -599,7 +603,7 @@ - + @@ -640,7 +644,7 @@ - + @@ -679,7 +683,7 @@ - + @@ -695,7 +699,7 @@ - + @@ -713,7 +717,7 @@ KEEP_LOCATION KEEP_SIZE KEEP_RATIO - + @@ -733,6 +737,14 @@ + + + + + + + + @@ -768,10 +780,10 @@ - + - + bold @@ -845,7 +857,7 @@ KEEP_LOCATION KEEP_SIZE KEEP_RATIO - + italic @@ -882,14 +894,22 @@ - - - + + + bold + + + + + bold + + + @@ -938,9 +958,9 @@ - - - + + + KEEP_LOCATION KEEP_SIZE KEEP_RATIO @@ -949,21 +969,13 @@ - - + + bold - - - - - bold - - - @@ -1020,8 +1032,8 @@ - - + + @@ -1087,17 +1099,14 @@ - + - - - - labelSize + + + bold - - labelSize - + @@ -1127,9 +1136,9 @@ - - - + + + diff --git a/Domains/simpleScenario/model/simpleScenario.ecore b/Domains/simpleScenario/model/simpleScenario.ecore index c164b048..f167e615 100644 --- a/Domains/simpleScenario/model/simpleScenario.ecore +++ b/Domains/simpleScenario/model/simpleScenario.ecore @@ -9,6 +9,7 @@ eType="#//Actor" containment="true"/> + - + + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble" defaultValueLiteral="0.0"/> @@ -41,12 +40,14 @@ derived="true"/> - + + - + - + - + - + @@ -39,9 +40,10 @@ - + + @@ -51,9 +53,8 @@ - - - + + diff --git a/Domains/simpleScenario/plugin.xml b/Domains/simpleScenario/plugin.xml index bf0ea47c..cc83fbc6 100644 --- a/Domains/simpleScenario/plugin.xml +++ b/Domains/simpleScenario/plugin.xml @@ -1,10 +1,7 @@ - - - - - + + + + + diff --git a/Domains/simpleScenario/queries/simpleScenarioQueries.vql b/Domains/simpleScenario/queries/simpleScenarioQueries.vql index a59715c7..735abdc5 100644 --- a/Domains/simpleScenario/queries/simpleScenarioQueries.vql +++ b/Domains/simpleScenario/queries/simpleScenarioQueries.vql @@ -1,11 +1,87 @@ package queries import "http://www.example.com/simpleScenario" +import "http://www.eclipse.org/emf/2002/Ecore" +//Minimal Failing Example +@Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") +pattern patterThatOnlyWorksWithInt(l : Lane) { + Lane.referenceCoord(l, w); + check(w <= 2.0); +} + +////////////// +//Lane +////////////// + +/////////width, numWidth +@Constraint(severity="error", key={l}, message="x") +pattern define_numWidth_small(l : Lane) { + Lane.width(l, Size::Small); + Lane.numWidth(l, nw); + check(nw <= 5); +} or { + Lane.width(l, Size::Small); + Lane.numWidth(l, nw); + check(nw >= 10); +} + +@Constraint(severity="error", key={l}, message="x") +pattern define_numWidth_medium(l : Lane) { + Lane.width(l, Size::Medium); + Lane.numWidth(l, nw); + check(nw <= 10); +} or { + Lane.width(l, Size::Medium); + Lane.numWidth(l, nw); + check(nw >= 15); +} + +@Constraint(severity="error", key={l}, message="x") +pattern define_numWidth_large(l : Lane) { + Lane.width(l, Size::Large); + Lane.numWidth(l, nw); + check(nw <= 15); +} or { + Lane.width(l, Size::Large); + Lane.numWidth(l, nw); + check(nw >= 20); +} + +/////////referenceCoord +@Constraint(severity="error", key={l}, message="x") +pattern define_referenceCoord_horizontalAtOrigin(l:Lane) { + 1 == count find find_horizontalLaneAtOrigin(l); +} + +private pattern find_horizontalLaneAtOrigin(l:Lane){ + Lane.orientation(l, Orientation::Horizontal); + Lane.referenceCoord(l, rc); + Lane.prevLane(l, prev); + rc != 0.0; +} + +@Constraint(severity="error", key={l}, message="x") +pattern define_referenceCoord_verticalAtOrigin(l:Lane) { + 1 == count find find_verticalLaneAtOrigin(l); +} + +private pattern find_verticalLaneAtOrigin(l:Lane){ + Lane.orientation(l, Orientation::Vertical); + Lane.referenceCoord(l, rc); + rc == 0.0; +} -//lanes and lane+widths are in simpleScenarioBoundingBox +pattern define_referenceCoord_VerticalifMultipleLanes(l1:Lane, l2:Lane) { + //calculated risk??? + Lane.orientation(l1, Orientation::Vertical); + Lane.orientation(l2, Orientation::Vertical); + Lane.referenceCoord(l1, rc1); + Lane.numWidth(l1, nw1); + Lane.referenceCoord(l2, rc2); + check(rc2 == rc1 + nw1); +} -// actor coords within simpleScenarioBoundingBox //@Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation for vertical lanes") //pattern actorOnVerticalLane(a : Actor) { @@ -19,7 +95,7 @@ import "http://www.example.com/simpleScenario" // Lane.orientation(l, Orientation::Vertical); // Actor.xPos(a, x); // Lane.referenceCoord(l, r); -// Lane.widthNum(l, w); +// Lane.numWidth(l, w); // check(x >= (r + w)); //} // @@ -35,44 +111,290 @@ import "http://www.example.com/simpleScenario" // Lane.orientation(l, Orientation::Horizontal); // Actor.yPos(a, y); // Lane.referenceCoord(l, r); -// Lane.widthNum(l, w); +// Lane.numWidth(l, w); // check(y >= (r + w)); //} -@Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation") -pattern actorOnLane(a : Actor) { - find actorOnVerticalLane(a); -// neg find actorOnHorizontalLane(a); +//@Constraint(severity = "error", key = {a}, message = "this defines the placedOn relation") +//pattern actorOnLane(a : Actor) { +// find actorOnVerticalLane(a); +//// neg find actorOnHorizontalLane(a); +//} +// +//private pattern actorOnVerticalLane(a : Actor) { +// Actor.placedOn(a, l); +// Lane.orientation(l, Orientation::Vertical); +// Actor.xPos(a, x); +// Lane.referenceCoord(l, r); +// Lane.numWidth(l, w); +// check(x >= r); +// check(x <= (r + w)); +//} + +//@Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") +//pattern widthSpec(l : Lane) { +// Lane.numWidth(l, w); +// check(w != 5); +//} + +//private pattern actorOnHorizontalLane(a : Actor) { +// Actor.placedOn(a, l); +// Lane.orientation(l, Orientation::Vertical); +// Actor.yPos(a, y); +// Lane.referenceCoord(l, r); +// Lane.widthNum(l, w); +// check(y >= r); +// check(y <= (r + w)); +//} + +////////////// +//CollisionExists +////////////// + +@Constraint(severity="error", key={c}, message="x") +pattern collisionExists_timeWithinBound(ss:SimpleScenario, c:CollisionExists) { + SimpleScenario.actors.relations(ss, c); + SimpleScenario.maxTime(ss, maxTime); + CollisionExists. collisionTime(c, cTime); + check(cTime >= maxTime);} + +@Constraint(severity="error", key={c}, message="x") +pattern collisionExists_timeNotNegative(c:CollisionExists) { + CollisionExists. collisionTime(c, cTime); + check(cTime <= 0);} + +@Constraint(severity="error", key={a1, c}, message="x") +pattern collisionExists_defineCollision_y1(a1:Actor, a2:Actor, c:CollisionExists) { + Actor.relations(a1, c); + CollisionExists.target(c, a2); + + Actor.length(a1, l1); + Actor.yPos(a1, yPos1); + Actor.ySpeed(a1, ySpeed1); + Actor.length(a2, l2); + Actor.yPos(a2, yPos2); + Actor.ySpeed(a2, ySpeed2); + CollisionExists. collisionTime(c, cTime); + //check(y_1_bottom > y_2_top + check((yPos1 + (ySpeed1 * cTime)) - (l1/2) > (yPos2 + (ySpeed2 * cTime)) + (l2/2)); } -private pattern actorOnVerticalLane(a : Actor) { - Actor.placedOn(a, l); - Lane.orientation(l, Orientation::Vertical); - Actor.xPos(a, x); - Lane.referenceCoord(l, r); - Lane.widthNum(l, w); - check(x >= r); - check(x <= (r + w)); +@Constraint(severity="error", key={a1, c}, message="x") +pattern collisionExists_defineCollision_y2(a1:Actor, a2:Actor, c:CollisionExists) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, c); + CollisionExists.target(c, a2); + + Actor.length(a1, l1); + Actor.yPos(a1, yPos1); + Actor.ySpeed(a1, ySpeed1); + Actor.length(a2, l2); + Actor.yPos(a2, yPos2); + Actor.ySpeed(a2, ySpeed2); + CollisionExists. collisionTime(c, cTime); + //check(y_1_top < y_2_bottom) + check((yPos1 + (ySpeed1 * cTime)) + (l1/2) < (yPos2 + (ySpeed2 * cTime)) - (l2/2)); } -@Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") -pattern widthSpec(l : Lane) { - Lane.widthNum(l, w); - check(w != 5); +@Constraint(severity="error", key={a1, c}, message="x") +pattern collisionExists_defineCollision_x1(a1:Actor, a2:Actor, c:CollisionExists) { + Actor.relations(a1, c); + CollisionExists.target(c, a2); + + Actor.width(a1, w1); + Actor.xPos(a1, xPos1); + Actor.xSpeed(a1, xSpeed1); + Actor.width(a2, w2); + Actor.xPos(a2, xPos2); + Actor.xSpeed(a2, xSpeed2); + CollisionExists. collisionTime(c, cTime); + //check(x_1_left > x_2_right) + check((xPos1 + (xSpeed1 * cTime)) - (w1/2) > (xPos2 + (xSpeed2 * cTime)) + (w2/2)); } -@Constraint(severity = "error", key = {l}, message = "this defines the placedOn relation") -pattern refSpec(l : Lane) { - Lane.referenceCoord(l, w); - check(w != 2); -} - -private pattern actorOnHorizontalLane(a : Actor) { - Actor.placedOn(a, l); - Lane.orientation(l, Orientation::Vertical); - Actor.yPos(a, y); - Lane.referenceCoord(l, r); - Lane.widthNum(l, w); - check(y >= r); - check(y <= (r + w)); -} \ No newline at end of file +@Constraint(severity="error", key={a1, c}, message="x") +pattern collisionExists_defineCollision_x2(a1:Actor, a2:Actor, c:CollisionExists) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, c); + CollisionExists.target(c, a2); + + Actor.width(a1, w1); + Actor.xPos(a1, xPos1); + Actor.xSpeed(a1, xSpeed1); + Actor.width(a2, w2); + Actor.xPos(a2, xPos2); + Actor.xSpeed(a2, xSpeed2); + CollisionExists. collisionTime(c, cTime); + //check(x_1_right < x_2_left) + check((xPos1 + (xSpeed1 * cTime)) + (w1/2) < (xPos2 + (xSpeed2 * cTime)) - (w2/2)); +} + +////////////// +//SeparationDistance +////////////// +@Constraint(severity="error", key={a1, c}, message="x") +pattern SeparationDistance_near_lb(a1:Actor, a2:Actor, sd:SeparationDistance) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, sd); + SeparationDistance.target(sd, a2); + SeparationDistance.distance(sd, Distance::Near); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + //check(dx^2 + dy^2 < 5^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) < 5*5); +} + +@Constraint(severity="error", key={a1, c}, message="x") +pattern SeparationDistance_near_ub(a1:Actor, a2:Actor, sd:SeparationDistance) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, sd); + SeparationDistance.target(sd, a2); + SeparationDistance.distance(sd, Distance::Near); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + //check(dx^2 + dy^2 > 10^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) > 10*10); +} + +@Constraint(severity="error", key={a1, c}, message="x") +pattern SeparationDistance_medium_lb(a1:Actor, a2:Actor, sd:SeparationDistance) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, sd); + SeparationDistance.target(sd, a2); + SeparationDistance.distance(sd, Distance::Medium); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + //check(dx^2 + dy^2 < 10^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) < 10*10); +} + +@Constraint(severity="error", key={a1, c}, message="x") +pattern SeparationDistance_medium_ub(a1:Actor, a2:Actor, sd:SeparationDistance) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, sd); + SeparationDistance.target(sd, a2); + SeparationDistance.distance(sd, Distance::Medium); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + //check(dx^2 + dy^2 > 1^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) > 15*15); +} + +@Constraint(severity="error", key={a1, c}, message="x") +pattern SeparationDistance_far_lb(a1:Actor, a2:Actor, sd:SeparationDistance) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, sd); + SeparationDistance.target(sd, a2); + SeparationDistance.distance(sd, Distance::Far); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + //check(dx^2 + dy^2 < 15^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) < 15*15); +} + +////////////// +//CollisionDoesNotExist +////////////// + +@Constraint(severity="error", key={a1, c}, message="x") +pattern collisionDoesNotExist(a1:Actor, a2:Actor, ss:SimpleScenario, cdne:CollisionDoesNotExist) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + + SimpleScenario.actors(ss, a1); + SimpleScenario.actors(ss, a2); + Actor.relations(a1, cdne); + CollisionDoesNotExist.target(cdne, a2); + SimpleScenario.maxTime(ss, maxTime); + + Actor.width(a1, w1); + Actor.length(a1, l1); + Actor.xPos(a1, xPos1); + Actor.yPos(a1, yPos1); + Actor.xSpeed(a1, xSpeed1); + Actor.ySpeed(a1, ySpeed1); + + Actor.width(a2, w2); + Actor.length(a2, l2); + Actor.xPos(a2, xPos2); + Actor.yPos(a2, yPos2); + Actor.xSpeed(a2, xSpeed2); + Actor.ySpeed(a2, ySpeed2); + //check(dx^2 + dy^2 < 15^2) + check((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) < 15*15); +} + +////////////// +//VisionBlocked +////////////// + +//OPTIONS 1: everything is from a single check expression containing ITEs +//Currently unhandled bygenerator +pattern visionBlocked_ites_top(a1:Actor, a2:Actor, vb:VisionBlocked) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, vb); + VisionBlocked.target(vb, a2); + VisionBlocked.blockedBy(vb, aBlocker); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + Actor.xPos(aBlocker, xBlocker); + Actor.yPos(aBlocker, yBlocker); + Actor.length(aBlocker, lenBlocker); + Actor.width(aBlocker, widBlocker); + + //check(slope of a1-to-BlockerTop < slope of a1-to-a2) + check( + ( yBlocker - y1 + (if(xBlocker > x1){lenBlocker/2}else{0-lenBlocker/2})) / + ( xBlocker - x1 + (if(yBlocker > y1){0-widBlocker/2}else{widBlocker/2})) + < ((y1-y2)/(x1-x2))); +} + +pattern visionBlocked_ites_bottom(a1:Actor, a2:Actor, vb:VisionBlocked) { + //This second one is required because we do not want to enforce both a1->c->a2 and a2->c->a1 + Actor.relations(a1, vb); + VisionBlocked.target(vb, a2); + VisionBlocked.blockedBy(vb, aBlocker); + + Actor.xPos(a1, x1); + Actor.yPos(a1, y1); + Actor.xPos(a2, x2); + Actor.yPos(a2, y2); + Actor.xPos(aBlocker, xBlocker); + Actor.yPos(aBlocker, yBlocker); + Actor.length(aBlocker, lenBlocker); + Actor.width(aBlocker, widBlocker); + + //check(slope of a1-to-BlockerBottom > slope of a1-to-a2) + check( + ( yBlocker - y1 + (if(xBlocker > x1){0-lenBlocker/2}else{lenBlocker/2})) / + ( xBlocker - x1 + (if(yBlocker > y1){widBlocker/2}else{0-widBlocker/2})) + > ((y1-y2)/(x1-x2))); +} + +//OPTION 2: +//we handle ITE by seperating the constraints + +//This will involve 1 constarint for each decision path, but will require multiple check expressions within the same pattern + +//OPTION 3: +//If this is nott working still, we will have to add some strctural components to the MM +//to differentiate the different cases and reduce the requirements of if, then, else + +//This will involve more patterns, and some that are pstructural as well. \ No newline at end of file -- cgit v1.2.3-54-g00ecf