Class PlanitDemandsReader
- java.lang.Object
-
- org.goplanit.converter.BaseReaderImpl<Demands>
-
- org.goplanit.io.converter.demands.PlanitDemandsReader
-
- All Implemented Interfaces:
ConverterEntity
,ConverterReader<Demands>
,DemandsReader
public class PlanitDemandsReader extends BaseReaderImpl<Demands> implements DemandsReader
Reader to parse PLANit demands from native XML format- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEMAND_XSD_FILE
Reference to demand schema location TODO: move to properties fileprotected Demands
demands
the demands to populateprotected PlanitDemandsReaderSettings
settings
settings for the zoning reader-
Fields inherited from class org.goplanit.converter.BaseReaderImpl
sourceIdTrackerMap
-
-
Constructor Summary
Constructors Constructor Description PlanitDemandsReader(String pathDirectory, String xmlFileExtension, Demands demands)
ConstructorPlanitDemandsReader(org.goplanit.xml.generated.XMLElementMacroscopicDemand xmlMacroscopicDemands, MacroscopicNetwork 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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlanitDemandsReaderSettings
getSettings()
any settings to configure the reader can be configured by collecting these settingsprotected void
populateDemandConfiguration()
Sets up all the configuration data from the XML demands fileprotected void
populateDemandContents()
Parses the demand contents of the XMLDemands
read()
Parse the XMLand populate the demands memory modelvoid
reset()
reset the reader to allow for marking unnecessary resources for garbage collectionprotected void
setDemands(Demands demands)
Set the demands to populate-
Methods inherited from class org.goplanit.converter.BaseReaderImpl
getBySourceId, getSourceIdContainer, initialiseSourceIdMap, initialiseSourceIdMap, registerBySourceId, registerBySourceId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.converter.demands.DemandsReader
getTypeDescription
-
-
-
-
Field Detail
-
settings
protected final PlanitDemandsReaderSettings settings
settings for the zoning reader
-
demands
protected Demands demands
the demands to populate
-
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(String pathDirectory, String xmlFileExtension, Demands demands) throws PlanItException
Constructor- Parameters:
pathDirectory
- to usexmlFileExtension
- to usedemands
- to populate- Throws:
PlanItException
- thrown if error
-
PlanitDemandsReader
public PlanitDemandsReader(org.goplanit.xml.generated.XMLElementMacroscopicDemand xmlMacroscopicDemands, MacroscopicNetwork network, Zoning zoning, Demands demandsToPopulate) throws PlanItException
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 fromnetwork
- reference network for the demands to readzoning
- reference zoning for the demands to readdemandsToPopulate
- to populate- Throws:
PlanItException
- thrown if error
-
-
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
-
read
public Demands read() throws PlanItException
Parse the XMLand populate the demands memory model- Specified by:
read
in interfaceConverterReader<Demands>
- Returns:
- parsed network
- Throws:
PlanItException
- thrown if error
-
getSettings
public PlanitDemandsReaderSettings getSettings()
any settings to configure the reader can be configured by collecting these settings- Specified by:
getSettings
in interfaceConverterReader<Demands>
- Returns:
- the settings to configrue the reader
-
reset
public void reset()
reset the reader to allow for marking unnecessary resources for garbage collection- Specified by:
reset
in interfaceConverterEntity
-
-