Package org.planit.io.input
Class PlanItInputBuilder
- java.lang.Object
-
- org.planit.input.InputBuilderListener
-
- org.planit.io.input.PlanItInputBuilder
-
- All Implemented Interfaces:
Serializable
,EventListener
,org.djutils.event.EventListenerInterface
public class PlanItInputBuilder extends InputBuilderListener
Class which reads inputs from XML input files- Author:
- gman6028
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SEPARATOR
The default separator that is assumed when no separator is provided-
Fields inherited from class org.planit.input.InputBuilderListener
DEFAULT_ERROR_ON_DUPLICATE_SOURCE_ID, sourceIdConnectoidMap, sourceIdLinkSegmentMap, sourceIdLinkSegmentTypeMap, sourceIdModeMap, sourceIdNodeMap, sourceIdTimePeriodMap, sourceIdTravelerTypeMap, sourceIdUserClassMap, sourceIdZoneMap
-
-
Constructor Summary
Constructors Constructor Description PlanItInputBuilder(String projectPath)
Constructor which generates the input objects from files in a specified directory, using the default extension ".xml"PlanItInputBuilder(String projectPath, String xmlFileExtension)
Constructor which generates the input objects from files in a specified directory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
notify(org.djutils.event.EventInterface event)
Whenever a project component is created this method will be invokedprotected void
populateDemands(Demands demands, Object parameter1, Object parameter2)
Populates the Demands object from the input fileprotected void
populateInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost, Object parameter1, Object parameter2)
Populate the initial link segment cost from a CSV fileprotected void
populateMacroscopicNetwork(MacroscopicNetwork network)
Creates the macroscopic network object from the data in the input fileprotected void
populateZoning(Zoning zoning, MacroscopicNetwork network)
Creates the Zoning object and connectoids from the data in the input filestatic boolean
validateXmlInputFile(File xmlFileLocation, String schemaFileLocation)
Validates an input XML file against an XSD file-
Methods inherited from class org.planit.input.InputBuilderListener
addConnectoidToSourceIdMap, addLinkSegmentToSourceIdMap, addLinkSegmentTypeToSourceIdMap, addModeToSourceIdMap, addNodeToSourceIdMap, addTimePeriodToSourceIdMap, addTravelerTypeToSourceIdMap, addUserClassToSourceIdMap, addZoneToSourceIdMap, getAllModesBySourceId, getConnectoidBySourceId, getLinkSegmentByExternalId, getLinkSegmentByXmlId, getLinkSegmentTypeBySourceId, getModeBySourceId, getNodeByXmlId, getNumberOfRegisteredTimePeriods, getTimePeriodBySourceId, getTimePeriodSourceIds, getTravelerTypeBySourceId, getUserClassBySourceId, getZoneBySourceId, isTimePeriodSourceIdRegistered
-
-
-
-
Field Detail
-
DEFAULT_SEPARATOR
public static final String DEFAULT_SEPARATOR
The default separator that is assumed when no separator is provided- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PlanItInputBuilder
public PlanItInputBuilder(String projectPath) throws PlanItException
Constructor which generates the input objects from files in a specified directory, using the default extension ".xml"- Parameters:
projectPath
- the location of the input file directory- Throws:
PlanItException
- thrown if one of the input required input files cannot be found, or if there is an error reading one of them
-
PlanItInputBuilder
public PlanItInputBuilder(String projectPath, String xmlFileExtension) throws PlanItException
Constructor which generates the input objects from files in a specified directory- Parameters:
projectPath
- the location of the input file directoryxmlFileExtension
- the extension of the data files to be searched through- Throws:
PlanItException
- thrown if one of the input required input files cannot be found, or if there is an error reading one of them
-
-
Method Detail
-
populateMacroscopicNetwork
protected void populateMacroscopicNetwork(MacroscopicNetwork network) throws PlanItException
Creates the macroscopic network object from the data in the input file- Parameters:
network
- the infrastructure network object to be populated from the input data- Throws:
PlanItException
- thrown if there is an error reading the input file
-
populateZoning
protected void populateZoning(Zoning zoning, MacroscopicNetwork network) throws PlanItException
Creates the Zoning object and connectoids from the data in the input file- Parameters:
zoning
- the Zoning object to be populated from the input datanetwork
- PhysicalNetwork object previously defined- Throws:
PlanItException
- thrown if there is an error reading the input file
-
populateDemands
protected void populateDemands(Demands demands, Object parameter1, Object parameter2) throws PlanItException
Populates the Demands object from the input file- Parameters:
demands
- the Demands object to be populated from the input dataparameter1
- Zoning object previously definedparameter2
- PhysicalNetwork object previously defined- Throws:
PlanItException
- thrown if there is an error reading the input file
-
populateInitialLinkSegmentCost
protected void populateInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost, Object parameter1, Object parameter2) throws PlanItException
Populate the initial link segment cost from a CSV file- Parameters:
initialLinkSegmentCost
- InitialLinkSegmentCost object to be populatedparameter1
- previously created network objectparameter2
- CSV file containing the initial link segment cost values- Throws:
PlanItException
- thrown if error
-
validateXmlInputFile
public static boolean validateXmlInputFile(File xmlFileLocation, String schemaFileLocation)
Validates an input XML file against an XSD file- Parameters:
xmlFileLocation
- input XML fileschemaFileLocation
- XSD file to validate XML file against- Returns:
- true if the file is valid, false otherwise
-
notify
public void notify(org.djutils.event.EventInterface event) throws RemoteException
Whenever a project component is created this method will be invoked- Parameters:
event
- event containing the created (and empty) project component- Throws:
RemoteException
- thrown if there is an error
-
-