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 TypeMethodDescriptionint
Computes the number of characters in this field.computePatternDouble
(boolean useComma, int numCharField, int numDecimal) computePatternDouble
(int numDecimal) computePatternDouble
(int numCharField, int numDecimal) static String
computePatternDoubleStatic
(int fieldWidth, int numDigitRightDecimal) static String
computePatternDoubleStatic
(int fieldWidth, int numDigitRightDecimal, boolean useCommas) Compute pattern for decimal formatint
Returns the position of the first character in this field.int
Returns 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.int
char
int
Returns the number of characters in this field.int
char
Returns the separator that was found for this field when parsing the record.boolean
boolean
static void
printDouble
(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 StringBuffer
printDouble
(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.void
printField
(int j) Prints the field parameters for field j to the standard output device.printInteger
(char justify, int sinOutWidth, int sin) static StringBuffer
printIntegerStatic
(char justify, int sinOutWidth, int sin) Returns justified integer within field width.printString
(char justify, int sinOutWidth, String sin) static StringBuffer
printStringStatic
(char justify, int sinOutWidth, String sin) Returns justified String within desired field width.void
reset()
Reset the current instance so that the contents are blank of zero length.void
setBeginCol
(int beginCol) Set the position of the first non-blank character in the field.void
setEndCol
(int endCol) Set the position of the last non-blank character in the field.void
setFieldContent
(StringBuffer fieldContent) Set the character string for the content of this field.void
setFieldWidthPrint
(int numCharsInField) char
setJustify
(char justify) void
setLength
(int numCol) Set the number of characters in the field.void
setNumDigits2RightOfDecimal
(int numDigits) void
setPattern
(String pattern) void
setSeparator
(char separator) Set the separator that was found for this field when parsing the record.void
void
setUseCommas
(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
-