Module simpa.core

Enum Class OutputFileFormat

java.lang.Object
java.lang.Enum<OutputFileFormat>
simpa.core.api.OutputFileFormat
All Implemented Interfaces:
Serializable, Comparable<OutputFileFormat>, Constable

public enum OutputFileFormat extends Enum<OutputFileFormat>
Enum for some output files. These files are usually taken as an input for some electromagnetic field calculation software like Opera or COMSOL, etc. as input file to get out the field values at the specified points.
  • Enum Constant Details

    • PLAINTEXT

      public static final OutputFileFormat PLAINTEXT
      An enum to categorize a plaintext file.
    • OPERA3D

      public static final OutputFileFormat OPERA3D
      An enum to categorize an Opera3D file.
  • Method Details

    • values

      public static OutputFileFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OutputFileFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getOpera3DHeader

      public static String getOpera3DHeader(int nPoints, LengthUnit lengthUnit)
      Gets a header specific for use of a file in Opera3D.
      Parameters:
      nPoints - The number of points.
      lengthUnit - The length unit.
      Returns:
      The generated header as a String.
    • stripOpera3DHeader

      public static String stripOpera3DHeader(String content)
      Strips the Opera3D header from a full Opera table file content and returns only the table data (everything after the header). The Opera3D header used by this project ends with a line that contains a single zero ("0"). This method finds the first line that is exactly "0" (ignoring surrounding whitespace) and returns the substring of the original content that follows that line, preserving all remaining characters and line separators unchanged. If the input is null, null is returned. If no terminating "0" line is found, the original content is returned unchanged.
      Parameters:
      content - full file content of an Opera3D table file
      Returns:
      the table data portion (content after the Opera header) or the original content when the header cannot be identified
    • parse

      public static OutputFileFormat parse(String s)
      Parses the string to the correct enum.
      Parameters:
      s - string version of the output format
      Returns:
      the enum for the output format