Class CarLoads

    • Method Detail

      • addType

        public void addType​(java.lang.String type)
        Add a car type with specific loads
        Parameters:
        type - car type
      • replaceType

        public void replaceType​(java.lang.String oldType,
                                java.lang.String newType)
        Replace a car type. Transfers load type, priority, isHardous, drop and load comments.
        Parameters:
        oldType - old car type
        newType - new car type
      • getSelectComboBox

        public javax.swing.JComboBox<java.lang.String> getSelectComboBox​(java.lang.String type)
        Gets the appropriate car loads for the car's type.
        Parameters:
        type - Car type
        Returns:
        JComboBox with car loads starting with empty string.
      • getComboBox

        public javax.swing.JComboBox<java.lang.String> getComboBox​(java.lang.String type)
        Gets the appropriate car loads for the car's type.
        Parameters:
        type - Car type
        Returns:
        JComboBox with car loads.
      • getPriorityComboBox

        public javax.swing.JComboBox<java.lang.String> getPriorityComboBox()
        Gets a ComboBox with the available priorities
        Returns:
        JComboBox with car priorities.
      • getLoadTypesComboBox

        public javax.swing.JComboBox<java.lang.String> getLoadTypesComboBox()
        Gets a ComboBox with the available load types: empty and load
        Returns:
        JComboBox with load types: LOAD_TYPE_EMPTY and LOAD_TYPE_LOAD
      • getNames

        public java.util.List<java.lang.String> getNames​(java.lang.String type)
        Gets a sorted list of load names for a given car type
        Parameters:
        type - car type
        Returns:
        list of load names
      • addName

        public void addName​(java.lang.String type,
                            java.lang.String name)
        Add a load name for the car type.
        Parameters:
        type - car type.
        name - load name.
      • deleteName

        public void deleteName​(java.lang.String type,
                               java.lang.String name)
      • containsName

        public boolean containsName​(java.lang.String type,
                                    java.lang.String name)
        Determines if a car type can have a specific load name.
        Parameters:
        type - car type.
        name - load name.
        Returns:
        true if car can have this load name.
      • updateComboBox

        public void updateComboBox​(java.lang.String type,
                                   javax.swing.JComboBox<java.lang.String> box)
      • updateComboBox

        public void updateComboBox​(javax.swing.JComboBox<java.lang.String> box)
        Update a JComboBox with all load names for every type of car.
        Overrides:
        updateComboBox in class RollingStockAttribute
        Parameters:
        box - the combo box to update
      • updateRweComboBox

        public void updateRweComboBox​(java.lang.String type,
                                      javax.swing.JComboBox<java.lang.String> box)
      • updateRwlComboBox

        public void updateRwlComboBox​(java.lang.String type,
                                      javax.swing.JComboBox<java.lang.String> box)
      • replaceName

        public void replaceName​(java.lang.String type,
                                java.lang.String oldName,
                                java.lang.String newName)
      • setLoadType

        public void setLoadType​(java.lang.String type,
                                java.lang.String name,
                                java.lang.String loadType)
        Sets the load type, empty or load.
        Parameters:
        type - car type.
        name - load name.
        loadType - load type: LOAD_TYPE_EMPTY or LOAD_TYPE_LOAD.
      • getLoadType

        public java.lang.String getLoadType​(java.lang.String type,
                                            java.lang.String name)
        Get the load type, empty or load.
        Parameters:
        type - car type.
        name - load name.
        Returns:
        load type, LOAD_TYPE_EMPTY or LOAD_TYPE_LOAD.
      • setPriority

        public void setPriority​(java.lang.String type,
                                java.lang.String name,
                                java.lang.String priority)
        Sets a loads priority.
        Parameters:
        type - car type.
        name - load name.
        priority - load priority, PRIORITY_LOW, PRIORITY_MEDIUM or PRIORITY_HIGH.
      • getPriority

        public java.lang.String getPriority​(java.lang.String type,
                                            java.lang.String name)
        Get's a load's priority.
        Parameters:
        type - car type.
        name - load name.
        Returns:
        load priority, PRIORITY_LOW, PRIORITY_MEDIUM or PRIORITY_HIGH.
      • setHazardous

        public void setHazardous​(java.lang.String type,
                                 java.lang.String name,
                                 boolean isHazardous)
      • isHazardous

        public boolean isHazardous​(java.lang.String type,
                                   java.lang.String name)
      • setPickupComment

        public void setPickupComment​(java.lang.String type,
                                     java.lang.String name,
                                     java.lang.String comment)
        Sets the comment for a car type's load
        Parameters:
        type - the car type
        name - the load name
        comment - the comment
      • getPickupComment

        public java.lang.String getPickupComment​(java.lang.String type,
                                                 java.lang.String name)
      • setDropComment

        public void setDropComment​(java.lang.String type,
                                   java.lang.String name,
                                   java.lang.String comment)
      • getDropComment

        public java.lang.String getDropComment​(java.lang.String type,
                                               java.lang.String name)
      • getList

        public java.util.Hashtable<java.lang.String,​java.util.List<CarLoad>> getList()
      • store

        public void store​(org.jdom2.Element root)
        Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-cars.dtd.
        Parameters:
        root - The common Element for operations-cars.dtd.
      • load

        public void load​(org.jdom2.Element e)
      • setDirtyAndFirePropertyChange

        protected void setDirtyAndFirePropertyChange​(java.lang.String p,
                                                     java.lang.Object old,
                                                     java.lang.Object n)