java.lang.Object
org.legstar.cobol.utils.PictureUtils
Parser for cobol PICTURE clause.
TODO CR/DB and N/G probably not handled correctly
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAn alphanumeric propertiesstatic final recordA computational numeric properties -
Method Summary
Modifier and TypeMethodDescriptionstatic PictureUtils.AlphaNumericalphaNumeric(String pic) Aphanumerics have picture clauses like X(4) or +9(5).99.static intCalculate the number of characters given an alphanumeric like XXXX or X(4)static PictureUtils.CompNumericcompNumeric(String pic) Computational numerics have picture clauses like 9(4) or S9(5)V99.static intdigitCount(String numberPart) Calculate the number of digits given a numeric description like 9999 or 9(4)static booleanisAlphaNumeric(String pic) Is this picture that of an alphanumeric.static booleanisCompNumeric(String pic) Is this picture that of a computational numeric.
-
Method Details
-
compNumeric
Computational numerics have picture clauses like 9(4) or S9(5)V99.- Parameters:
pic- the cobol picture clause- Returns:
- the computational numeric properties
-
alphaNumeric
Aphanumerics have picture clauses like X(4) or +9(5).99.All characters contribute to the length of the alphanumeric apart from the V character which stands for a virtual decimal delimiter.
- Parameters:
pic- the cobol picture clause- Returns:
- the alphanumeric properties
-
isCompNumeric
Is this picture that of a computational numeric.- Parameters:
pic- the picture clause- Returns:
- true if this picture corresponds to a computational numeric
-
isAlphaNumeric
Is this picture that of an alphanumeric.- Parameters:
pic- the picture clause- Returns:
- true if this picture corresponds to an alphanumeric
-
digitCount
Calculate the number of digits given a numeric description like 9999 or 9(4)- Parameters:
numberPart- a numeric picture part- Returns:
- number of digits
-
charCount
Calculate the number of characters given an alphanumeric like XXXX or X(4)- Parameters:
alphaPart- the picture part- Returns:
- the number of characters
-