Package hec.lang
Class RdcField
java.lang.Object
hec.lang.RdcField
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintComputes the number of characters in this field.computePatternDouble(boolean useComma, int numCharField, int numDecimal) computePatternDouble(int numDecimal) computePatternDouble(int numCharField, int numDecimal) static StringcomputePatternDoubleStatic(int fieldWidth, int numDigitRightDecimal) static StringcomputePatternDoubleStatic(int fieldWidth, int numDigitRightDecimal, boolean useCommas) Compute pattern for decimal formatintReturns the position of the first character in this field.intReturns the position of the last character in this field.Returns the string contents of this Field.getFieldContent(String theString) Stores and Returns the string contents of this field.intcharintReturns the number of characters in this field.intcharReturns the separator that was found for this field when parsing the record.booleanbooleanstatic voidprintDouble(char justify, double doubleToPrint) printDouble(char justify, int fieldWidth, double doubleToPrint) Returns String containing justified and formatted double number using previously stored pattern and DecimalFormat.static StringBufferprintDouble(char justify, int fieldWidth, int numDigitRightDecimal, double doubleToPrint) Format a double number for printing.printDouble(double doubleToPrint) Returns String containing justified and formatted double number using previously stored pattern and DecimalFormat, justification, and fieldwidth.voidprintField(int j) Prints the field parameters for field j to the standard output device.printInteger(char justify, int sinOutWidth, int sin) static StringBufferprintIntegerStatic(char justify, int sinOutWidth, int sin) Returns justified integer within field width.printString(char justify, int sinOutWidth, String sin) static StringBufferprintStringStatic(char justify, int sinOutWidth, String sin) Returns justified String within desired field width.voidreset()Reset the current instance so that the contents are blank of zero length.voidsetBeginCol(int beginCol) Set the position of the first non-blank character in the field.voidsetEndCol(int endCol) Set the position of the last non-blank character in the field.voidsetFieldContent(StringBuffer fieldContent) Set the character string for the content of this field.voidsetFieldWidthPrint(int numCharsInField) charsetJustify(char justify) voidsetLength(int numCol) Set the number of characters in the field.voidsetNumDigits2RightOfDecimal(int numDigits) voidsetPattern(String pattern) voidsetSeparator(char separator) Set the separator that was found for this field when parsing the record.voidvoidsetUseCommas(boolean useComma) storeFieldContent(String theString) Set the character string for the content of this field.boolean
-
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
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
Set the character string for the content of this field. The position of the characters must have already been computed by RdcDelim -
getFieldContent
Returns the string contents of this Field. -
getFieldContent
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
-
getPattern
-
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
-
computePatternDouble
-
computePatternDouble
-
printString
-
printInteger
-
printDouble
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
-
printDouble
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
Returns justified String within desired field width.- Parameters:
justify-sinOutWidth-sin-- Returns:
-
printIntegerStatic
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
-
main
-