Package com.dna.jopt.io.importing.json
Class OptimizationJSONImporter
java.lang.Object
com.dna.jopt.io.importing.json.OptimizationJSONImporter
- All Implemented Interfaces:
IJOptImporter<IOptimization>
,IOptimizationImporter
This provides methods in order import an
IOptimization
as a JSON file
.- Since:
- 04/10/2019
- Version:
- 07/10/2019
- Author:
- DNA
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionread
(InputStream fis) boolean
update
(InputStream fis, IOptimization existingOpti) boolean
update
(InputStream fis, IOptimization existingOpti, boolean isIgnoreExistingSolution) Update.boolean
update
(InputStream fis, IOptimization existingOpti, Optional<INodeEdgeConnector> existingNodeConnector, Properties existingProperties, boolean isOnlyPropertyUpdate) Updates an existingIOptimization
optionally with already existingINodeEdgeConnector
andproperties
.boolean
update
(InputStream fis, IOptimization existingOpti, Optional<INodeEdgeConnector> existingNodeConnector, Properties existingProperties, boolean isOnlyPropertyUpdate, boolean isIgnoreExistingSolution) Updates an existingIOptimization
optionally with already existingINodeEdgeConnector
andproperties
.
-
Constructor Details
-
OptimizationJSONImporter
public OptimizationJSONImporter()
-
-
Method Details
-
read
- Specified by:
read
in interfaceIJOptImporter<IOptimization>
- Specified by:
read
in interfaceIOptimizationImporter
- Parameters:
fis
- the inputStream- Returns:
- the optional IOptimization from the file
-
update
- Specified by:
update
in interfaceIOptimizationImporter
- Parameters:
fis
- the inputStreamexistingOpti
- the iOptimization to be updated- Returns:
- true if the settings were accepted
-
update
public boolean update(InputStream fis, IOptimization existingOpti, boolean isIgnoreExistingSolution) Update.- Specified by:
update
in interfaceIOptimizationImporter
- Parameters:
fis
- the fisexistingOpti
- the existing optiisIgnoreExistingSolution
- the is ignore existing solution- Returns:
- true, if successful
-
update
public boolean update(InputStream fis, IOptimization existingOpti, Optional<INodeEdgeConnector> existingNodeConnector, Properties existingProperties, boolean isOnlyPropertyUpdate) Updates an existingIOptimization
optionally with already existingINodeEdgeConnector
andproperties
.If the
boolean
istrue
, only the givenproperties
are being overwritten. Iffalse
the rest of theparameters
are set todefault
.- Specified by:
update
in interfaceIOptimizationImporter
- Parameters:
fis
- the InputStreamexistingOpti
- the existing iOptimizationexistingNodeConnector
- an existing node connectorexistingProperties
- the existing propertiesisOnlyPropertyUpdate
- the boolean whether the IOptimization is only to be updated and no other parameters reset- Returns:
- true if the settings were accepted
-
update
public boolean update(InputStream fis, IOptimization existingOpti, Optional<INodeEdgeConnector> existingNodeConnector, Properties existingProperties, boolean isOnlyPropertyUpdate, boolean isIgnoreExistingSolution) Updates an existingIOptimization
optionally with already existingINodeEdgeConnector
andproperties
.If the
boolean
istrue
, only the givenproperties
are being overwritten. Iffalse
the rest of theparameters
are set todefault
.- Specified by:
update
in interfaceIOptimizationImporter
- Parameters:
fis
- the InputStreamexistingOpti
- the existing iOptimizationexistingNodeConnector
- an existing node connectorexistingProperties
- the existing propertiesisOnlyPropertyUpdate
- the boolean whether the IOptimization is only to be updated and no other parameters resetisIgnoreExistingSolution
- the is ignore existing solution- Returns:
- true if the settings were accepted
-