Class OptimizationJSONImporter

java.lang.Object
com.dna.jopt.io.importing.json.OptimizationJSONImporter
All Implemented Interfaces:
IJOptImporter<IOptimization>, IOptimizationImporter

public class OptimizationJSONImporter extends Object implements IOptimizationImporter
This provides methods in order import an IOptimization as a JSON file.
Since:
04/10/2019
Version:
07/10/2019
Author:
DNA
  • Constructor Details

    • OptimizationJSONImporter

      public OptimizationJSONImporter()
  • Method Details

    • read

      public Optional<IOptimization> read(InputStream fis)
      Creates a new IOptimization object from the input stream with the given properties.
      Specified by:
      read in interface IJOptImporter<IOptimization>
      Specified by:
      read in interface IOptimizationImporter
      Parameters:
      fis - the inputStream
      Returns:
      the optional IOptimization from the file
    • update

      public boolean update(InputStream fis, IOptimization existingOpti)
      Updates an existing IOptimization with the given properties in the JSON file.
      Specified by:
      update in interface IOptimizationImporter
      Parameters:
      fis - the inputStream
      existingOpti - 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 interface IOptimizationImporter
      Parameters:
      fis - the fis
      existingOpti - the existing opti
      isIgnoreExistingSolution - 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 existing IOptimization optionally with already existing INodeEdgeConnector and properties.

      If the boolean is true, only the given properties are being overwritten. If false the rest of the parameters are set to default.

      Specified by:
      update in interface IOptimizationImporter
      Parameters:
      fis - the InputStream
      existingOpti - the existing iOptimization
      existingNodeConnector - an existing node connector
      existingProperties - the existing properties
      isOnlyPropertyUpdate - 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 existing IOptimization optionally with already existing INodeEdgeConnector and properties.

      If the boolean is true, only the given properties are being overwritten. If false the rest of the parameters are set to default.

      Specified by:
      update in interface IOptimizationImporter
      Parameters:
      fis - the InputStream
      existingOpti - the existing iOptimization
      existingNodeConnector - an existing node connector
      existingProperties - the existing properties
      isOnlyPropertyUpdate - the boolean whether the IOptimization is only to be updated and no other parameters reset
      isIgnoreExistingSolution - the is ignore existing solution
      Returns:
      true if the settings were accepted