Class JabaModel

java.lang.Object
jaba.JabaModel
All Implemented Interfaces:
JabaConstants

public class JabaModel extends Object implements JabaConstants
An object grouping all the data describing a system.

WARNING: ACCESS TO THIS OBJECT MUST BE IMPLEMENTED IN A TRANSACTION-LIKE SYNCHRONIZED WAY!
Author:
alyf (Andrea Conti), Stefano Omini, Bertoli Marco
  • Constructor Details

    • JabaModel

      public JabaModel()
      make an object with default values
    • JabaModel

      public JabaModel(JabaModel e)
      copy constructor
  • Method Details

    • discardResults

      public void discardResults()
      Clears all the results
    • setResults

      public void setResults(JabaResults jabaResults)
      sets all the result data for this model.
    • getResults

      public JabaResults getResults()
    • setDefaults

      public void setDefaults()
      Initialize the object with defaults: 1 closed class, 1 LI station, 0 customers, all visits to one, all service times to zero, no results
    • getDescription

      public String getDescription()
      Gets the model description
      Returns:
      the model description
    • setDescription

      public void setDescription(String description)
      Sets the model description
      Parameters:
      description - the model description
    • isSingleClass

      public boolean isSingleClass()
      Returns:
      true if this object describes a single class system
    • isMultiClass

      public boolean isMultiClass()
      Returns:
      true if this object describes a multiclass system
    • isClosed

      public boolean isClosed()
      Returns:
      true if this object describes a closed system
    • isOpen

      public boolean isOpen()
      Returns:
      true if this object describes an open system
    • isMixed

      public boolean isMixed()
      Returns:
      true if this object describes a mixed system
    • isLd

      public boolean isLd()
      Returns:
      true if this object describes a system containing LD stations
    • getStations

      public int getStations()
      Returns:
      number of service centers
    • getClasses

      public int getClasses()
      Returns:
      number of classes
    • getTotalPop

      public int getTotalPop()
      Returns:
      total population
    • getStationNames

      public String[] getStationNames()
      Returns:
      names of the service centers
    • setStationNames

      public void setStationNames(String[] stationNames)
      sets the names of the service centers.
      Parameters:
      stationNames - the names of the service centers
      Throws:
      IllegalArgumentException - if the array is not of the correct size
    • getClassNames

      public String[] getClassNames()
      Returns:
      names of the classes
    • setClassNames

      public void setClassNames(String[] classNames)
      sets the names of the classes.
      Parameters:
      classNames - the names of the classes
      Throws:
      IllegalArgumentException - if the array is not of the correct size
    • getClassData

      public double[] getClassData()
      Returns:
      data for the classes.
    • setClassData

      public void setClassData(double[] classData)
      sets the data for the classes
      Parameters:
      classData - the data for the classes
      Throws:
      IllegalArgumentException - if the array is not of the correct size
    • getClassTypes

      public int[] getClassTypes()
      Returns:
      type of the classes
    • setClassTypes

      public void setClassTypes(int[] classTypes)
      sets the type of the classes
      Parameters:
      classTypes - the type of the classes
      Throws:
      IllegalArgumentException - if the array is not of the correct size
    • getStationTypes

      public int[] getStationTypes()
      Returns:
      type of the stations
    • setStationTypes

      public void setStationTypes(int[] stationTypes)
      sets the type of the stations
      Parameters:
      stationTypes - the type of the stations
      Throws:
      IllegalArgumentException - if the array is not of the correct size
    • getVisits

      public double[][] getVisits()
      Returns:
      the matrix of visits
    • areVisitsSet

      public boolean areVisitsSet()
      This method tells if visits were set or are all unitary (or zero if corresponding service time is zero). This is used to show correct panel layout upon loading
      Returns:
      true iff visits were not set
    • setVisits

      public void setVisits(double[][] visits)
      sets the matrix of visits
      Parameters:
      visits - the matrix of visits
      Throws:
      IllegalArgumentException - if the matrix is not of the correct size
    • getServiceTimes

      public double[][][] getServiceTimes()
      Returns:
      the matrix of service times
    • setServiceTimes

      public void setServiceTimes(double[][][] serviceTimes)
      sets the matrix of service times
      Parameters:
      serviceTimes - the matrix of service times
      Throws:
      IllegalArgumentException - if the matrix is not of the correct size
    • resize

      public void resize(int stations, int classes)
      Resizes the data structures according to specified parameters. Data is preserved as far as possible
    • getQueueLen

      public double[][] getQueueLen()
      Returns:
      queue lengths
    • getResTimes

      public double[][] getResTimes()
      Returns:
      response times
    • getThroughput

      public double[][] getThroughput()
      Returns:
      throughputs
    • getUtilization

      public double[][] getUtilization()
      Returns:
      utilizations
    • removeLD

      public void removeLD()
      Removes all LD stations, converting them into LI stations
    • toString

      public String toString()
      Warning: Calling this on large systems *will* result in OutOfMemory errors. You have been warned.
      Overrides:
      toString in class Object
      Returns:
      a String representation of the parameters of this object
    • deleteClass

      public void deleteClass(int i)
      Deletes a class
      Parameters:
      i - the index of the class
    • deleteStation

      public void deleteStation(int i)
      Deletes a station
      Parameters:
      i - the index of the station
    • isChanged

      public boolean isChanged()
      Returns:
      true if the model has been changed
    • resetChanged

      public void resetChanged()
      resets the changed flag.
      WARNING: this enables change checking on parameter setting, which can be quite time-consuming.
    • setChanged

      public void setChanged()
      flags the model as changed. There is no need to call this, except to disable time-consuming change checking if you're not interested in it
    • hasResults

      public boolean hasResults()
      Returns:
      true if results are available
    • areResultsOK

      public boolean areResultsOK()
      Returns:
      true if results are valid
    • createDocument

      public Document createDocument()
      Creates a DOM representation of this object
      Returns:
      a DOM representation of this object
    • loadDocument

      public boolean loadDocument(Document doc)
      load the state of this object from the Document.
      Returns:
      true if the operation was successful. WARNING: If the operation fails the object is left in an incorrect state and should be discarded.
    • loadDescription

      public boolean loadDescription(Element desc)
    • loadClasses

      public boolean loadClasses(Node classNode)
    • loadStations

      public boolean loadStations(Node stationNode)
    • loadSolution

      public boolean loadSolution(Element sol)
    • loadResultsMatrix

      public double[][] loadResultsMatrix(Element base, int len1, int len2, String res)
    • getPerClassX

      public double[] getPerClassX()
      Returns per-class aggregate for throughput
    • getPerStationX

      public double[] getPerStationX()
      Returns per-station aggregate for throughput
    • getGlobalX

      public double getGlobalX()
      Returns global aggregate for throughput
    • getPerClassQ

      public double[] getPerClassQ()
      Returns per-class aggregate for queue length
    • getPerStationQ

      public double[] getPerStationQ()
      Returns per-station aggregate for queue length
    • getGlobalQ

      public double getGlobalQ()
      Returns global aggregate for queue length
    • getPerClassR

      public double[] getPerClassR()
      Returns per-class aggregate for residence times
    • getPerStationR

      public double[] getPerStationR()
      Returns per-station aggregate for residence times
    • getGlobalR

      public double getGlobalR()
      Returns system response time
    • getPerClassU

      public double[] getPerClassU()
      Returns per-class aggregate for utilization
    • getPerStationU

      public double[] getPerStationU()
      Returns per-station aggregate for utilization
    • getGlobalU

      public double getGlobalU()
      Returns global aggregate for utilization
    • randomizeModelData

      public void randomizeModelData()
      Randomizes model's service times and visits.
      Modified by Bertoli Marco to limit service times to two decimal
    • createUnitaryVisits

      public double[][] createUnitaryVisits()
    • getVertices3D

      public Vector<Vertex> getVertices3D()
    • getHullVertices

      public HashSet<HullVertex> getHullVertices()