@Test public void testSetNumericAttributes() { CobolDataItem dataItem = new CobolDataItem(); dataItem.setPicture("99V9"); dataItem.setUsage(Usage.DISPLAY); XsdDataItem mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("ZONED_DECIMAL_ITEM", mapper.getCobolType().toString()); assertEquals("DECIMAL", mapper.getXsdType().toString()); assertEquals(3, mapper.getTotalDigits()); assertEquals(1, mapper.getFractionDigits()); assertEquals("99V9", mapper.getPicture()); dataItem.setPicture("99.9"); dataItem.setUsage(Usage.DISPLAY); mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("NUMERIC_EDITED_ITEM", mapper.getCobolType().toString()); assertEquals("STRING", mapper.getXsdType().toString()); assertEquals(3, mapper.getTotalDigits()); assertEquals(1, mapper.getFractionDigits()); assertEquals("99.9", mapper.getPicture()); dataItem.setPicture("S99V9"); dataItem.setUsage(Usage.PACKEDDECIMAL); mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("PACKED_DECIMAL_ITEM", mapper.getCobolType().toString()); assertEquals("DECIMAL", mapper.getXsdType().toString()); assertEquals(3, mapper.getTotalDigits()); assertEquals(1, mapper.getFractionDigits()); dataItem.setPicture("S999"); dataItem.setUsage(Usage.BINARY); mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("BINARY_ITEM", mapper.getCobolType().toString()); assertEquals("SHORT", mapper.getXsdType().toString()); assertEquals(3, mapper.getTotalDigits()); assertEquals(0, mapper.getFractionDigits()); dataItem.setPicture("999999999"); dataItem.setUsage(Usage.NATIVEBINARY); mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("NATIVE_BINARY_ITEM", mapper.getCobolType().toString()); assertEquals("UINT", mapper.getXsdType().toString()); assertEquals(9, mapper.getTotalDigits()); assertEquals(0, mapper.getFractionDigits()); dataItem.setPicture("S99999999999"); dataItem.setUsage(Usage.BINARY); mapper = new XsdDataItem(dataItem, defaultConfig, null, 0, new ArrayList < String >(), _errorHandler); assertEquals("BINARY_ITEM", mapper.getCobolType().toString()); assertEquals("LONG", mapper.getXsdType().toString()); assertEquals(11, mapper.getTotalDigits()); assertEquals(0, mapper.getFractionDigits()); }
private void setNumericAttributes(final String picture, final char currencyChar, final boolean decimalPointIsComma) { setDigitsAndSign(picture, currencyChar, decimalPointIsComma); if (_fractionDigits == 0) { if (_totalDigits < 5) { _xsdType = (_isSigned) ? XsdType.SHORT : XsdType.USHORT; } else if (_totalDigits < 10) { _xsdType = (_isSigned) ? XsdType.INT : XsdType.UINT; } else if (_totalDigits < 20) { _xsdType = (_isSigned) ? XsdType.LONG : XsdType.ULONG; } else { _xsdType = XsdType.INTEGER; } } else { _xsdType = XsdType.DECIMAL; } switch (_cobolType) { case BINARY_ITEM: case NATIVE_BINARY_ITEM: if (_totalDigits < 5) { _minStorageLength = 2; } else if (_totalDigits < 10) { _minStorageLength = 4; } else { _minStorageLength = 8; } break; case PACKED_DECIMAL_ITEM: _minStorageLength = (_totalDigits / 2) + 1; break; default: break; } }
XsdDataItem { private void setNumericAttributes(final String picture, final char currencyChar, final boolean decimalPointIsComma) { setDigitsAndSign(picture, currencyChar, decimalPointIsComma); if (_fractionDigits == 0) { if (_totalDigits < 5) { _xsdType = (_isSigned) ? XsdType.SHORT : XsdType.USHORT; } else if (_totalDigits < 10) { _xsdType = (_isSigned) ? XsdType.INT : XsdType.UINT; } else if (_totalDigits < 20) { _xsdType = (_isSigned) ? XsdType.LONG : XsdType.ULONG; } else { _xsdType = XsdType.INTEGER; } } else { _xsdType = XsdType.DECIMAL; } switch (_cobolType) { case BINARY_ITEM: case NATIVE_BINARY_ITEM: if (_totalDigits < 5) { _minStorageLength = 2; } else if (_totalDigits < 10) { _minStorageLength = 4; } else { _minStorageLength = 8; } break; case PACKED_DECIMAL_ITEM: _minStorageLength = (_totalDigits / 2) + 1; break; default: break; } } }
XsdDataItem { private void setNumericAttributes(final String picture, final char currencyChar, final boolean decimalPointIsComma) { setDigitsAndSign(picture, currencyChar, decimalPointIsComma); if (_fractionDigits == 0) { if (_totalDigits < 5) { _xsdType = (_isSigned) ? XsdType.SHORT : XsdType.USHORT; } else if (_totalDigits < 10) { _xsdType = (_isSigned) ? XsdType.INT : XsdType.UINT; } else if (_totalDigits < 20) { _xsdType = (_isSigned) ? XsdType.LONG : XsdType.ULONG; } else { _xsdType = XsdType.INTEGER; } } else { _xsdType = XsdType.DECIMAL; } switch (_cobolType) { case BINARY_ITEM: case NATIVE_BINARY_ITEM: if (_totalDigits < 5) { _minStorageLength = 2; } else if (_totalDigits < 10) { _minStorageLength = 4; } else { _minStorageLength = 8; } break; case PACKED_DECIMAL_ITEM: _minStorageLength = (_totalDigits / 2) + 1; break; default: break; } } XsdDataItem(final CobolDataItem cobolDataItem,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order, final List < String > nonUniqueCobolNames,
            final RecognizerErrorHandler errorHandler); }
XsdDataItem { private void setNumericAttributes(final String picture, final char currencyChar, final boolean decimalPointIsComma) { setDigitsAndSign(picture, currencyChar, decimalPointIsComma); if (_fractionDigits == 0) { if (_totalDigits < 5) { _xsdType = (_isSigned) ? XsdType.SHORT : XsdType.USHORT; } else if (_totalDigits < 10) { _xsdType = (_isSigned) ? XsdType.INT : XsdType.UINT; } else if (_totalDigits < 20) { _xsdType = (_isSigned) ? XsdType.LONG : XsdType.ULONG; } else { _xsdType = XsdType.INTEGER; } } else { _xsdType = XsdType.DECIMAL; } switch (_cobolType) { case BINARY_ITEM: case NATIVE_BINARY_ITEM: if (_totalDigits < 5) { _minStorageLength = 2; } else if (_totalDigits < 10) { _minStorageLength = 4; } else { _minStorageLength = 8; } break; case PACKED_DECIMAL_ITEM: _minStorageLength = (_totalDigits / 2) + 1; break; default: break; } } XsdDataItem(final CobolDataItem cobolDataItem,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order, final List < String > nonUniqueCobolNames,
            final RecognizerErrorHandler errorHandler); boolean markODOObjectInAncestor(final String odoObjectCobolName); boolean markODOObjectInChildren(final String odoObjectCobolName,
            final String stopChildCobolName); void updateRedefinition(final String cobolName); static String formatElementName(final CobolDataItem cobolDataItem,
            final List < String > nonUniqueCobolNames,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order); static String formatTypeName(final String elementName,
            final CobolDataItem cobolDataItem,
            final List < String > nonUniqueCobolNames,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order); static String getXmlCompatibleCobolName(final String cobolName); XsdType getXsdType(); CobolTypes getCobolType(); int getLength(); String getPattern(); int getTotalDigits(); int getFractionDigits(); String getXsdElementName(); String getXsdTypeName(); List < XsdDataItem > getChildren(); int getMinOccurs(); int getCobolMinOccurs(); int getMaxOccurs(); int getCobolMaxOccurs(); int getLevelNumber(); String getCobolName(); String getPicture(); Usage getUsage(); String getUsageForCobol(); boolean isJustifiedRight(); boolean isSign(); boolean isSignLeading(); boolean isSignSeparate(); String getDependingOn(); boolean isSigned(); String getRedefines(); String getValue(); int getSrceLine(); DataEntryType getDataEntryType(); List < String > getConditionLiterals(); List < Range > getConditionRanges(); boolean isBlankWhenZero(); XsdDataItem getParent(); boolean isODOObject(); boolean isRedefined(); void setIsODOObject(final boolean isODOObject); void setIsRedefined(final boolean isRedefined); int getMinStorageLength(); int getMaxStorageLength(); boolean isNumeric(); List < CobolDataItem > getCobolChildren(); String toString(); }
XsdDataItem { private void setNumericAttributes(final String picture, final char currencyChar, final boolean decimalPointIsComma) { setDigitsAndSign(picture, currencyChar, decimalPointIsComma); if (_fractionDigits == 0) { if (_totalDigits < 5) { _xsdType = (_isSigned) ? XsdType.SHORT : XsdType.USHORT; } else if (_totalDigits < 10) { _xsdType = (_isSigned) ? XsdType.INT : XsdType.UINT; } else if (_totalDigits < 20) { _xsdType = (_isSigned) ? XsdType.LONG : XsdType.ULONG; } else { _xsdType = XsdType.INTEGER; } } else { _xsdType = XsdType.DECIMAL; } switch (_cobolType) { case BINARY_ITEM: case NATIVE_BINARY_ITEM: if (_totalDigits < 5) { _minStorageLength = 2; } else if (_totalDigits < 10) { _minStorageLength = 4; } else { _minStorageLength = 8; } break; case PACKED_DECIMAL_ITEM: _minStorageLength = (_totalDigits / 2) + 1; break; default: break; } } XsdDataItem(final CobolDataItem cobolDataItem,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order, final List < String > nonUniqueCobolNames,
            final RecognizerErrorHandler errorHandler); boolean markODOObjectInAncestor(final String odoObjectCobolName); boolean markODOObjectInChildren(final String odoObjectCobolName,
            final String stopChildCobolName); void updateRedefinition(final String cobolName); static String formatElementName(final CobolDataItem cobolDataItem,
            final List < String > nonUniqueCobolNames,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order); static String formatTypeName(final String elementName,
            final CobolDataItem cobolDataItem,
            final List < String > nonUniqueCobolNames,
            final Cob2XsdConfig config, final XsdDataItem parent,
            final int order); static String getXmlCompatibleCobolName(final String cobolName); XsdType getXsdType(); CobolTypes getCobolType(); int getLength(); String getPattern(); int getTotalDigits(); int getFractionDigits(); String getXsdElementName(); String getXsdTypeName(); List < XsdDataItem > getChildren(); int getMinOccurs(); int getCobolMinOccurs(); int getMaxOccurs(); int getCobolMaxOccurs(); int getLevelNumber(); String getCobolName(); String getPicture(); Usage getUsage(); String getUsageForCobol(); boolean isJustifiedRight(); boolean isSign(); boolean isSignLeading(); boolean isSignSeparate(); String getDependingOn(); boolean isSigned(); String getRedefines(); String getValue(); int getSrceLine(); DataEntryType getDataEntryType(); List < String > getConditionLiterals(); List < Range > getConditionRanges(); boolean isBlankWhenZero(); XsdDataItem getParent(); boolean isODOObject(); boolean isRedefined(); void setIsODOObject(final boolean isODOObject); void setIsRedefined(final boolean isRedefined); int getMinStorageLength(); int getMaxStorageLength(); boolean isNumeric(); List < CobolDataItem > getCobolChildren(); String toString(); static final String SAFE_NAME_PREFIX; }