Class FileData

java.lang.Object
net.simplace.sim.io.FileData

public class FileData extends Object
Author:
Andreas Enders
  • Constructor Details

    • FileData

      public FileData(String aPathname, String aContent, FWSimSession aActiveInSession, String aDivider, String aProjectID)
      Parameters:
      aPathname -
      aActiveInSession -
      aDivider -
      aProjectID -
      aLinesToRead -
    • FileData

      public FileData(String aPathname, String aContent, FWSimSession aActiveInSession)
      Parameters:
      aPathname -
      aActiveInSession -
      aLinesToRead -
  • Method Details

    • setCache

      public void setCache(FileData aFileData, boolean aWasUpdated)
      Parameters:
      aFileData -
      aWasUpdated -
    • getDataCache

      public String[][] getDataCache(Integer[] aLinesToRead, Integer aSkipHeaderLines) throws IOException
      If filename has changed or accessed for the first time the lines of the file are read from file system. If not they are just returned without reading again.
      Parameters:
      aLinesToRead -
      aSkipHeaderLines -
      Returns:
      Vector of lines in the file in the given order
      Throws:
      IOException
    • getRootElement

      public org.jdom2.Element getRootElement() throws IOException
      If filename has changed or accessed for the first time the root element of the file are read from file system. If not it is just returned without reading again.
      Returns:
      root element from xml file
      Throws:
      IOException
    • writeStringsToFile

      public void writeStringsToFile(Collection<String> aCollection)
      writes all strings to a file with given divider as one new line to the end of the opened file.
      Parameters:
      aCollection -
    • writeObjectsToFile

      public void writeObjectsToFile(Collection<Object> aCollection, LinkedHashMap<String,FWSimVariable<?>> aHeaderVariables, CSVInterface.DATA_MODE aDataMode)
      writes all objects to a file with given divider as one new line to the end of the opened file. For a null object the String "NULL" is written or 12.2363452 ==> 12.24
      Parameters:
      aCollection -
      aHeaderVariables -
    • writeToFile

      public void writeToFile(String aLine)
      writes all strings to a file with given divider as one new line to the end of the opened file.
      Parameters:
      aLine -
    • getSession

      public FWSimSession getSession()
      Returns:
      the activeInSession
    • closeFile

      public void closeFile()
      closes the file at the end of the writing or reading process. reset is called resetting the writer.
    • setUpdated

      public void setUpdated(boolean aIsUpdated)
    • isUpdated

      public boolean isUpdated()
    • getFile

      public File getFile()
    • getUniqueID

      public String getUniqueID()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object