Class JSimGraphModel

java.lang.Object
common.definitions.CommonModel
jsimgraph.definitions.JSimGraphModel
All Implemented Interfaces:
CommonConstants, BlockingRegionDefinition, ClassDefinition, GraphRefreshable, SimulationDefinition, StationDefinition, JmodelBlockingRegionDefinition, JmodelClassDefinition, JmodelStationDefinition, JSimGraphConstants, EngineNodeConstants

Title: JMODEL-Model

Description: Main data structure used to store model definition data, to save and load model and to compile xml files for the simulator and as a bridge to connect JMODEL with JSIM and JMVA

Author:
Bertoli Marco Date: 2-giu-2005 Time: 10.27.54 Modified by Francesco D'Aquino 11/11/2005
  • Field Details

  • Constructor Details

    • JSimGraphModel

      public JSimGraphModel(Mediator mediator)
      Default constructor, creates a new instance of JMODELModel.
      Parameters:
      mediator - reference to mediator.
  • Method Details

    • addClass

      public Object addClass()
      Adds a new class to the model and sets all the parameters by default.
      Specified by:
      addClass in interface JmodelClassDefinition
      Returns:
      search key for the new class.
    • addClass

      public Object addClass(String name, int type, Integer priority, Double softDeadline, Integer population, Object distribution)
      Adds a new class to the model and sets all the parameters at once.
      Specified by:
      addClass in interface ClassDefinition
      Specified by:
      addClass in interface JmodelClassDefinition
      Overrides:
      addClass in class CommonModel
      Parameters:
      name - name of the new class.
      type - type of the new class.
      priority - priority of the new class.
      softDeadline - soft deadline of the new class.
      population - population of the new class.
      distribution - inter-arrival time distribution of the new class.
      Returns:
      search key for the new class.
    • deleteClass

      public void deleteClass(Object key)
      Deletes a class from the model, given the search key.
      Specified by:
      deleteClass in interface ClassDefinition
      Specified by:
      deleteClass in interface JmodelClassDefinition
      Overrides:
      deleteClass in class CommonModel
    • setClassType

      public void setClassType(Object key, int type)
      Sets type of the class, given the search key.
      Specified by:
      setClassType in interface ClassDefinition
      Overrides:
      setClassType in class CommonModel
    • getClassColor

      public Color getClassColor(Object key)
      Returns color of the class, given the search key.
      Specified by:
      getClassColor in interface JmodelClassDefinition
    • setClassColor

      public void setClassColor(Object key, Color color)
      Sets color of the class, given the search key.
      Specified by:
      setClassColor in interface JmodelClassDefinition
    • getNewColor

      public Color getNewColor()
      Returns a new color.
    • serializeClass

      public Object serializeClass(Object key)
      Returns serialized form of a class.
      Specified by:
      serializeClass in interface JmodelClassDefinition
      Parameters:
      key - search key for the class.
      Returns:
      serialized form of the class.
    • deserializeClass

      public Object deserializeClass(Object Class)
      Inserts a new class according to its serialized form.
      Specified by:
      deserializeClass in interface JmodelClassDefinition
      Parameters:
      Class - serialized form of the new class.
      Returns:
      search key for the new class.
    • addStation

      public Object addStation(String type)
      Adds a new station to the model, given the station type.
      Specified by:
      addStation in interface JmodelStationDefinition
      Parameters:
      type - type of the new station.
      Returns:
      search key for the new station.
    • deleteStation

      public void deleteStation(Object key)
      Deletes a station from the model, given the search key.
      Specified by:
      deleteStation in interface JmodelStationDefinition
      Specified by:
      deleteStation in interface StationDefinition
      Overrides:
      deleteStation in class CommonModel
    • previewStationName

      public String previewStationName(String type)
      Returns name of the next station, given the station type.
      Specified by:
      previewStationName in interface JmodelStationDefinition
    • setStationPosition

      public void setStationPosition(Object key, JMTPoint position)
      Sets position of the station, given the search key.
      Specified by:
      setStationPosition in interface JmodelStationDefinition
    • getStationPosition

      public JMTPoint getStationPosition(Object key)
      Returns position of the station, given the search key.
      Specified by:
      getStationPosition in interface JmodelStationDefinition
    • setConnectionShape

      public void setConnectionShape(Object sourceKey, Object targetKey, JMTPath path)
      Sets shape of a connection, given the source and target keys.
    • deleteConnectionShape

      public void deleteConnectionShape(Object sourceKey, Object targetKey)
      Delete shape of a connection, given the source and target keys.
    • getConnectionShape

      public JMTPath getConnectionShape(Object sourceKey, Object targetKey)
      Returns shape of a connection, given the source and target keys.
    • getConnectionShapesFromSource

      public HashMap<Object,JMTPath> getConnectionShapesFromSource(Object sourceKey)
      Returns shapes of connections, given the source key.
    • getConnectionShapesFromTarget

      public HashMap<Object,JMTPath> getConnectionShapesFromTarget(Object targetKey)
      Returns shapes of connections, given the target key.
    • hasConnectionShape

      public boolean hasConnectionShape(Object sourceKey, Object targetKey)
      Returns true if a connection shape exists, given the source and target keys.
    • hasConnectionShape

      public boolean hasConnectionShape()
      Returns true if a connection shape is defined in the model.
    • getStationIcon

      public String getStationIcon(Object key)
      Gets the icon of a station, given the search key.
      Specified by:
      getStationIcon in interface GraphRefreshable
    • setStationIcon

      public void setStationIcon(Object key, String icon)
      Sets the icon of a transition, given the search key.
      Specified by:
      setStationIcon in interface GraphRefreshable
    • getConnectionEnd

      public int getConnectionEnd(Object sourceKey, Object targetKey)
      Gets the end of a connection, given the source and target keys.
      Specified by:
      getConnectionEnd in interface GraphRefreshable
    • setConnectionEnd

      public void setConnectionEnd(Object sourceKey, Object targetKey, int end)
      Sets the end of a connection, given the source and target keys.
      Specified by:
      setConnectionEnd in interface GraphRefreshable
    • refreshGraph

      public void refreshGraph()
      Refreshes the graph component.
      Specified by:
      refreshGraph in interface GraphRefreshable
    • serializeStation

      public Object serializeStation(Object key)
      Returns serialized form of a station.
      Specified by:
      serializeStation in interface JmodelStationDefinition
      Parameters:
      key - search key for the station.
      Returns:
      serialized form of the station.
    • addStation

      public Object addStation(Object station)
      Adds a new station with name and type from its serialized form.
      Specified by:
      addStation in interface JmodelStationDefinition
      Parameters:
      station - serialized form of the new station.
      Returns:
      search key for the new station.
    • LoadStation

      public void LoadStation(Object station, Object key, Map<Object,Object> classes, Map<Object,Object> stationKeyMap)
      Loads parameters of a station from its serialized form.
      Specified by:
      LoadStation in interface JmodelStationDefinition
      Parameters:
      station - serialized form of the station.
      key - search key for the station.
      classes - map of serialized forms of classes.
      stationKeyMap - map of search keys for stations.
    • addBlockingRegion

      public Object addBlockingRegion()
      Adds a new blocking region to the model.
      Specified by:
      addBlockingRegion in interface JmodelBlockingRegionDefinition
      Returns:
      search key for the new region.
    • serializeBlockingRegion

      public Object serializeBlockingRegion(Object key)
      Returns serialized form of a blocking region.
      Specified by:
      serializeBlockingRegion in interface JmodelBlockingRegionDefinition
      Parameters:
      key - search key for the region.
      Returns:
      serialized form of the region.
    • deserializeBlockingRegion

      public Object deserializeBlockingRegion(Object region, Map<Object,Object> classes)
      Inserts a new blocking region according to its serialized form.
      Specified by:
      deserializeBlockingRegion in interface JmodelBlockingRegionDefinition
      Parameters:
      region - serialized form of the new region.
      classes - map of serialized forms of classes.
      Returns:
      search key for the new region.
    • isAnimationEnabled

      public boolean isAnimationEnabled()
      Tells if queue animation is enabled
      Specified by:
      isAnimationEnabled in interface SimulationDefinition
      Overrides:
      isAnimationEnabled in class CommonModel
      Returns:
      true if the animation is enabled
    • setAnimationEnabled

      public void setAnimationEnabled(boolean enabled)
      Enable / disable queue animation
      Specified by:
      setAnimationEnabled in interface SimulationDefinition
      Overrides:
      setAnimationEnabled in class CommonModel
      Parameters:
      enabled - - set it to true to enable queue animation
    • setAbsoluteControlPoints

      public void setAbsoluteControlPoints(Object sourceKey, Object targetKey, ArrayList<Point2D> points)
      Sets absolute value of a connection, given the search key.
    • deleteAbsoluteControlPoints

      public void deleteAbsoluteControlPoints(Object sourceKey, Object targetKey)
      Delete absolute value of a connection, given the search key.
    • getAbsoluteControlPoints

      public List getAbsoluteControlPoints(Object sourceKey, Object targetKey)
      Returns shape of a connection, given the search key.