Class PlanitDemandsReader

    • Field Detail

      • demands

        protected Demands demands
        the demands to populate
      • referenceNetwork

        protected LayeredNetwork<?,​?> referenceNetwork
        Reference network to use when demand relate to network entities
      • referenceZoning

        protected Zoning referenceZoning
        Reference zoning to use when demands relate to zoning entities
      • zoningReader

        protected final PlanitZoningReader zoningReader
        zoning reader provides alternative way to obtain reference zoning and reference network in case not available upon construction. When using a reader, reference zoning and network are expected to remain null.
      • DEMAND_XSD_FILE

        public static final String DEMAND_XSD_FILE
        Reference to demand schema location TODO: move to properties file
        See Also:
        Constant Field Values
    • Constructor Detail

      • PlanitDemandsReader

        public PlanitDemandsReader​(org.goplanit.xml.generated.XMLElementMacroscopicDemand xmlMacroscopicDemands,
                                   LayeredNetwork<?,​?> network,
                                   Zoning zoning,
                                   Demands demandsToPopulate)
        Constructor where file has already been parsed and we only need to convert from raw XML objects to PLANit memory model
        Parameters:
        xmlMacroscopicDemands - to extract from
        network - reference network for the demands to read
        zoning - reference zoning for the demands to read
        demandsToPopulate - to populate
      • PlanitDemandsReader

        public PlanitDemandsReader​(PlanitDemandsReaderSettings demandsSettings,
                                   LayeredNetwork<?,​?> network,
                                   Zoning zoning,
                                   Demands demandsToPopulate)
        Constructor where parsing will be based upon the settings and already present compatible network and zoning
        Parameters:
        demandsSettings - to use
        network - reference network for the demands to read
        zoning - reference zoning for the demands to read
        demandsToPopulate - to populate
      • PlanitDemandsReader

        public PlanitDemandsReader​(PlanitDemandsReaderSettings demandsSettings,
                                   PlanitZoningReader zoningReader)
        Constructor where parsing will be based upon the settings and zoning reader provides zoning (and network)
        Parameters:
        demandsSettings - to use
        zoningReader - to construct zoning (and network) from
    • Method Detail

      • setDemands

        protected void setDemands​(Demands demands)
        Set the demands to populate
        Parameters:
        demands - to populate
      • populateDemandConfiguration

        protected void populateDemandConfiguration()
                                            throws PlanItException
        Sets up all the configuration data from the XML demands file
        Throws:
        PlanItException - thrown if there is a duplicate XML Id found for any component
      • populateDemandContents

        protected void populateDemandContents()
                                       throws PlanItException
        Parses the demand contents of the XML
        Throws:
        PlanItException - thrown if error
      • getReferenceZoning

        public Zoning getReferenceZoning()
        each demands reader is expected to ensure that its demand relates to a zoning this reference zoning can be obtained (after reading is complete). the converter uses this to avoid the user having to manually transfer this zoning to the writer which also requires this same zoning consistency This is what this method enables
        Specified by:
        getReferenceZoning in interface DemandsReader
        Returns:
        referenceZoning to supply demands writer with (after invoking ConverterReader.read()
      • getReferenceNetwork

        public LayeredNetwork<?,​?> getReferenceNetwork()
        Collect reference network used
        Returns:
        reference network
      • setReferenceNetwork

        public void setReferenceNetwork​(MacroscopicNetwork referenceNetwork)
        Set reference network to use
        Parameters:
        referenceNetwork - to use
      • setReferenceZoning

        public void setReferenceZoning​(Zoning referenceZoning)
        Set reference zoning to use
        Parameters:
        referenceZoning - to use