Package hec.lang

Class RdcField

java.lang.Object
hec.lang.RdcField

public class RdcField extends Object
Title: RdcField Class contains parameters for a field that is a sub-string of a string containing multiple fields. It is used in conjunction with RdcDelim. Description: Company:
  • Constructor Details

    • RdcField

      public RdcField()
      Create new instance with no contents in the field.
  • Method Details

    • reset

      public void reset()
      Reset the current instance so that the contents are blank of zero length.
    • setBeginCol

      public void setBeginCol(int beginCol)
      Set the position of the first non-blank character in the field.
    • setEndCol

      public void setEndCol(int endCol)
      Set the position of the last non-blank character in the field.
    • setLength

      public void setLength(int numCol)
      Set the number of characters in the field.
    • setSeparator

      public void setSeparator(char separator)
      Set the separator that was found for this field when parsing the record.
      Parameters:
      separator - The field separator found when parsing this field from the next.
    • getSeparator

      public char getSeparator()
      Returns the separator that was found for this field when parsing the record.
      Returns:
      The field separator found when parsing this field from the next.
    • setFieldContent

      public void setFieldContent(StringBuffer fieldContent)
      Set the character string for the content of this field.
    • getBeginCol

      public int getBeginCol()
      Returns the position of the first character in this field.
    • getEndCol

      public int getEndCol()
      Returns the position of the last character in this field.
    • getLength

      public int getLength()
      Returns the number of characters in this field.
    • computeLength

      public int computeLength()
      Computes the number of characters in this field.
    • storeFieldContent

      public StringBuffer storeFieldContent(String theString)
      Set the character string for the content of this field. The position of the characters must have already been computed by RdcDelim
    • getFieldContent

      public StringBuffer getFieldContent()
      Returns the string contents of this Field.
    • getFieldContent

      public StringBuffer getFieldContent(String theString)
      Stores and Returns the string contents of this field.
    • printField

      public void printField(int j)
      Prints the field parameters for field j to the standard output device.
    • setPattern

      public void setPattern(String pattern)
    • getPattern

      public String getPattern()
    • getDecimalFormat

      public DecimalFormat getDecimalFormat()
    • setUseCommas

      public void setUseCommas(boolean useComma)
    • setUseCommas

      public void setUseCommas()
    • useCommas

      public boolean useCommas()
    • setFieldWidthPrint

      public void setFieldWidthPrint(int numCharsInField)
    • getFieldWidthPrint

      public int getFieldWidthPrint()
    • setJustify

      public char setJustify(char justify)
    • getJustify

      public char getJustify()
    • isRightJustified

      public boolean isRightJustified()
    • isLeftJustified

      public boolean isLeftJustified()
    • setNumDigits2RightOfDecimal

      public void setNumDigits2RightOfDecimal(int numDigits)
    • getNumDigits2RightOfDecimal

      public int getNumDigits2RightOfDecimal()
    • computePatternDouble

      public String computePatternDouble(boolean useComma, int numCharField, int numDecimal)
    • computePatternDouble

      public String computePatternDouble(int numCharField, int numDecimal)
    • computePatternDouble

      public String computePatternDouble(int numDecimal)
    • printString

      public StringBuffer printString(char justify, int sinOutWidth, String sin)
    • printInteger

      public StringBuffer printInteger(char justify, int sinOutWidth, int sin)
    • printDouble

      public String printDouble(double doubleToPrint)
      Returns String containing justified and formatted double number using previously stored pattern and DecimalFormat, justification, and fieldwidth. Normal procedure is to setJustify, setFieldWidthPrint, and computePatternDouble
      Parameters:
      doubleToPrint - double
      Returns:
      String
    • printDouble

      public String printDouble(char justify, double doubleToPrint)
    • printDouble

      public String printDouble(char justify, int fieldWidth, double doubleToPrint)
      Returns String containing justified and formatted double number using previously stored pattern and DecimalFormat. Before calling this routine, call setUsesComma(x) (optionally), and computePatternDouble (required).
      Parameters:
      justify -
      fieldWidth -
      doubleToPrint -
      Returns:
    • printStringStatic

      public static StringBuffer printStringStatic(char justify, int sinOutWidth, String sin)
      Returns justified String within desired field width.
      Parameters:
      justify -
      sinOutWidth -
      sin -
      Returns:
    • printIntegerStatic

      public static StringBuffer printIntegerStatic(char justify, int sinOutWidth, int sin)
      Returns justified integer within field width.
      Parameters:
      justify -
      sinOutWidth -
      sin -
      Returns:
    • printDouble

      public static StringBuffer printDouble(char justify, int fieldWidth, int numDigitRightDecimal, double doubleToPrint)
      Format a double number for printing.
      Parameters:
      fieldWidth - Width of output string.
      numDigitRightDecimal - Number of digits to the right of the decimal point.
      doubleToPrint - The double number that will be formatted and returned as a StringBuffer.
      Returns:
    • computePatternDoubleStatic

      public static String computePatternDoubleStatic(int fieldWidth, int numDigitRightDecimal, boolean useCommas)
      Compute pattern for decimal format
      Parameters:
      fieldWidth -
      numDigitRightDecimal -
      Returns:
    • computePatternDoubleStatic

      public static String computePatternDoubleStatic(int fieldWidth, int numDigitRightDecimal)
    • main

      public static void main(String[] args)