1 17 package org.eclipse.emf.ecore.xml.type.util; 18 19 import java.math.BigDecimal ; 20 import java.math.BigInteger ; 21 22 import java.util.Iterator ; 23 import java.util.List ; 24 import java.util.Map ; 25 26 import org.eclipse.emf.common.util.DiagnosticChain; 27 28 import org.eclipse.emf.ecore.EPackage; 29 30 import org.eclipse.emf.ecore.util.EObjectValidator; 31 32 import org.eclipse.emf.ecore.xml.type.*; 33 34 41 public class XMLTypeValidator extends EObjectValidator 42 { 43 49 public static final XMLTypeValidator INSTANCE = new XMLTypeValidator(); 50 51 59 public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.ecore.xml.type"; 60 61 67 private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0; 68 69 75 protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; 76 77 83 public XMLTypeValidator() 84 { 85 super(); 86 } 87 88 94 protected EPackage getEPackage() 95 { 96 return XMLTypePackage.eINSTANCE; 97 } 98 99 105 protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context) 106 { 107 switch (classifierID) 108 { 109 case XMLTypePackage.ANY_TYPE: 110 return validateAnyType((AnyType)value, diagnostics, context); 111 case XMLTypePackage.SIMPLE_ANY_TYPE: 112 return validateSimpleAnyType((SimpleAnyType)value, diagnostics, context); 113 case XMLTypePackage.XML_TYPE_DOCUMENT_ROOT: 114 return validateXMLTypeDocumentRoot((XMLTypeDocumentRoot)value, diagnostics, context); 115 case XMLTypePackage.ANY_SIMPLE_TYPE: 116 return validateAnySimpleType(value, diagnostics, context); 117 case XMLTypePackage.ANY_URI: 118 return validateAnyURI((String )value, diagnostics, context); 119 case XMLTypePackage.BASE64_BINARY: 120 return validateBase64Binary((byte[])value, diagnostics, context); 121 case XMLTypePackage.BOOLEAN: 122 return validateBoolean(((Boolean )value).booleanValue(), diagnostics, context); 123 case XMLTypePackage.BOOLEAN_OBJECT: 124 return validateBooleanObject((Boolean )value, diagnostics, context); 125 case XMLTypePackage.BYTE: 126 return validateByte(((Byte )value).byteValue(), diagnostics, context); 127 case XMLTypePackage.BYTE_OBJECT: 128 return validateByteObject((Byte )value, diagnostics, context); 129 case XMLTypePackage.DATE: 130 return validateDate(value, diagnostics, context); 131 case XMLTypePackage.DATE_TIME: 132 return validateDateTime(value, diagnostics, context); 133 case XMLTypePackage.DECIMAL: 134 return validateDecimal((BigDecimal )value, diagnostics, context); 135 case XMLTypePackage.DOUBLE: 136 return validateDouble(((Double )value).doubleValue(), diagnostics, context); 137 case XMLTypePackage.DOUBLE_OBJECT: 138 return validateDoubleObject((Double )value, diagnostics, context); 139 case XMLTypePackage.DURATION: 140 return validateDuration(value, diagnostics, context); 141 case XMLTypePackage.ENTITIES: 142 return validateENTITIES((List )value, diagnostics, context); 143 case XMLTypePackage.ENTITIES_BASE: 144 return validateENTITIESBase((List )value, diagnostics, context); 145 case XMLTypePackage.ENTITY: 146 return validateENTITY((String )value, diagnostics, context); 147 case XMLTypePackage.FLOAT: 148 return validateFloat(((Float )value).floatValue(), diagnostics, context); 149 case XMLTypePackage.FLOAT_OBJECT: 150 return validateFloatObject((Float )value, diagnostics, context); 151 case XMLTypePackage.GDAY: 152 return validateGDay(value, diagnostics, context); 153 case XMLTypePackage.GMONTH: 154 return validateGMonth(value, diagnostics, context); 155 case XMLTypePackage.GMONTH_DAY: 156 return validateGMonthDay(value, diagnostics, context); 157 case XMLTypePackage.GYEAR: 158 return validateGYear(value, diagnostics, context); 159 case XMLTypePackage.GYEAR_MONTH: 160 return validateGYearMonth(value, diagnostics, context); 161 case XMLTypePackage.HEX_BINARY: 162 return validateHexBinary((byte[])value, diagnostics, context); 163 case XMLTypePackage.ID: 164 return validateID((String )value, diagnostics, context); 165 case XMLTypePackage.IDREF: 166 return validateIDREF((String )value, diagnostics, context); 167 case XMLTypePackage.IDREFS: 168 return validateIDREFS((List )value, diagnostics, context); 169 case XMLTypePackage.IDREFS_BASE: 170 return validateIDREFSBase((List )value, diagnostics, context); 171 case XMLTypePackage.INT: 172 return validateInt(((Integer )value).intValue(), diagnostics, context); 173 case XMLTypePackage.INTEGER: 174 return validateInteger((BigInteger )value, diagnostics, context); 175 case XMLTypePackage.INT_OBJECT: 176 return validateIntObject((Integer )value, diagnostics, context); 177 case XMLTypePackage.LANGUAGE: 178 return validateLanguage((String )value, diagnostics, context); 179 case XMLTypePackage.LONG: 180 return validateLong(((Long )value).longValue(), diagnostics, context); 181 case XMLTypePackage.LONG_OBJECT: 182 return validateLongObject((Long )value, diagnostics, context); 183 case XMLTypePackage.NAME: 184 return validateName((String )value, diagnostics, context); 185 case XMLTypePackage.NC_NAME: 186 return validateNCName((String )value, diagnostics, context); 187 case XMLTypePackage.NEGATIVE_INTEGER: 188 return validateNegativeInteger((BigInteger )value, diagnostics, context); 189 case XMLTypePackage.NMTOKEN: 190 return validateNMTOKEN((String )value, diagnostics, context); 191 case XMLTypePackage.NMTOKENS: 192 return validateNMTOKENS((List )value, diagnostics, context); 193 case XMLTypePackage.NMTOKENS_BASE: 194 return validateNMTOKENSBase((List )value, diagnostics, context); 195 case XMLTypePackage.NON_NEGATIVE_INTEGER: 196 return validateNonNegativeInteger((BigInteger )value, diagnostics, context); 197 case XMLTypePackage.NON_POSITIVE_INTEGER: 198 return validateNonPositiveInteger((BigInteger )value, diagnostics, context); 199 case XMLTypePackage.NORMALIZED_STRING: 200 return validateNormalizedString((String )value, diagnostics, context); 201 case XMLTypePackage.NOTATION: 202 return validateNOTATION(value, diagnostics, context); 203 case XMLTypePackage.POSITIVE_INTEGER: 204 return validatePositiveInteger((BigInteger )value, diagnostics, context); 205 case XMLTypePackage.QNAME: 206 return validateQName(value, diagnostics, context); 207 case XMLTypePackage.SHORT: 208 return validateShort(((Short )value).shortValue(), diagnostics, context); 209 case XMLTypePackage.SHORT_OBJECT: 210 return validateShortObject((Short )value, diagnostics, context); 211 case XMLTypePackage.STRING: 212 return validateString((String )value, diagnostics, context); 213 case XMLTypePackage.TIME: 214 return validateTime(value, diagnostics, context); 215 case XMLTypePackage.TOKEN: 216 return validateToken((String )value, diagnostics, context); 217 case XMLTypePackage.UNSIGNED_BYTE: 218 return validateUnsignedByte(((Short )value).shortValue(), diagnostics, context); 219 case XMLTypePackage.UNSIGNED_BYTE_OBJECT: 220 return validateUnsignedByteObject((Short )value, diagnostics, context); 221 case XMLTypePackage.UNSIGNED_INT: 222 return validateUnsignedInt(((Long )value).longValue(), diagnostics, context); 223 case XMLTypePackage.UNSIGNED_INT_OBJECT: 224 return validateUnsignedIntObject((Long )value, diagnostics, context); 225 case XMLTypePackage.UNSIGNED_LONG: 226 return validateUnsignedLong((BigInteger )value, diagnostics, context); 227 case XMLTypePackage.UNSIGNED_SHORT: 228 return validateUnsignedShort(((Integer )value).intValue(), diagnostics, context); 229 case XMLTypePackage.UNSIGNED_SHORT_OBJECT: 230 return validateUnsignedShortObject((Integer )value, diagnostics, context); 231 default: 232 return true; 233 } 234 } 235 236 241 public boolean validateAnyType(AnyType anyType, DiagnosticChain diagnostics, Map context) 242 { 243 return validate_EveryDefaultConstraint(anyType, diagnostics, context); 244 } 245 246 251 public boolean validateSimpleAnyType(SimpleAnyType simpleAnyType, DiagnosticChain diagnostics, Map context) 252 { 253 return validate_EveryDefaultConstraint(simpleAnyType, diagnostics, context); 254 } 255 256 261 public boolean validateXMLTypeDocumentRoot(XMLTypeDocumentRoot xmlTypeDocumentRoot, DiagnosticChain diagnostics, Map context) 262 { 263 return validate_EveryDefaultConstraint(xmlTypeDocumentRoot, diagnostics, context); 264 } 265 266 271 public boolean validateAnySimpleType(Object anySimpleType, DiagnosticChain diagnostics, Map context) 272 { 273 return true; 274 } 275 276 281 public boolean validateAnyURI(String anyURI, DiagnosticChain diagnostics, Map context) 282 { 283 return true; 284 } 285 286 291 public boolean validateBase64Binary(byte[] base64Binary, DiagnosticChain diagnostics, Map context) 292 { 293 return true; 294 } 295 296 301 public boolean validateBoolean(boolean boolean_, DiagnosticChain diagnostics, Map context) 302 { 303 return true; 304 } 305 306 311 public boolean validateBooleanObject(Boolean booleanObject, DiagnosticChain diagnostics, Map context) 312 { 313 return true; 314 } 315 316 321 public boolean validateByte(byte byte_, DiagnosticChain diagnostics, Map context) 322 { 323 return true; 324 } 325 326 331 public boolean validateByteObject(Byte byteObject, DiagnosticChain diagnostics, Map context) 332 { 333 return true; 334 } 335 336 341 public boolean validateDate(Object date, DiagnosticChain diagnostics, Map context) 342 { 343 return true; 344 } 345 346 351 public boolean validateDateTime(Object dateTime, DiagnosticChain diagnostics, Map context) 352 { 353 return true; 354 } 355 356 361 public boolean validateDecimal(BigDecimal decimal, DiagnosticChain diagnostics, Map context) 362 { 363 return true; 364 } 365 366 371 public boolean validateDouble(double double_, DiagnosticChain diagnostics, Map context) 372 { 373 return true; 374 } 375 376 381 public boolean validateDoubleObject(Double doubleObject, DiagnosticChain diagnostics, Map context) 382 { 383 return true; 384 } 385 386 391 public boolean validateDuration(Object duration, DiagnosticChain diagnostics, Map context) 392 { 393 return true; 394 } 395 396 401 public boolean validateENTITIES(List entities, DiagnosticChain diagnostics, Map context) 402 { 403 boolean result = validateENTITIESBase_ItemType(entities, diagnostics, context); 404 if (result || diagnostics != null) result &= validateENTITIES_MinLength(entities, diagnostics, context); 405 return result; 406 } 407 408 414 public boolean validateENTITIES_MinLength(List entities, DiagnosticChain diagnostics, Map context) 415 { 416 int length = entities.size(); 417 boolean result = length >= 1; 418 if (!result && diagnostics != null) 419 reportMinLengthViolation(XMLTypePackage.eINSTANCE.getENTITIES(), entities, length, 1, diagnostics, context); 420 return result; 421 } 422 423 428 public boolean validateENTITIESBase(List entitiesBase, DiagnosticChain diagnostics, Map context) 429 { 430 boolean result = validateENTITIESBase_ItemType(entitiesBase, diagnostics, context); 431 return result; 432 } 433 434 440 public boolean validateENTITIESBase_ItemType(List entitiesBase, DiagnosticChain diagnostics, Map context) 441 { 442 boolean result = true; 443 for (Iterator i = entitiesBase.iterator(); i.hasNext() && (result || diagnostics != null); ) 444 { 445 Object item = i.next(); 446 if (XMLTypePackage.eINSTANCE.getENTITY().isInstance(item)) 447 { 448 result &= validateENTITY((String )item, diagnostics, context); 449 } 450 else 451 { 452 result = false; 453 reportDataValueTypeViolation(XMLTypePackage.eINSTANCE.getENTITY(), item, diagnostics, context); 454 } 455 } 456 return result; 457 } 458 459 464 public boolean validateENTITY(String entity, DiagnosticChain diagnostics, Map context) 465 { 466 boolean result = validateNCName_Pattern(entity, diagnostics, context); 467 return result; 468 } 469 470 475 public boolean validateFloat(float float_, DiagnosticChain diagnostics, Map context) 476 { 477 return true; 478 } 479 480 485 public boolean validateFloatObject(Float floatObject, DiagnosticChain diagnostics, Map context) 486 { 487 return true; 488 } 489 490 495 public boolean validateGDay(Object gDay, DiagnosticChain diagnostics, Map context) 496 { 497 return true; 498 } 499 500 505 public boolean validateGMonth(Object gMonth, DiagnosticChain diagnostics, Map context) 506 { 507 return true; 508 } 509 510 515 public boolean validateGMonthDay(Object gMonthDay, DiagnosticChain diagnostics, Map context) 516 { 517 return true; 518 } 519 520 525 public boolean validateGYear(Object gYear, DiagnosticChain diagnostics, Map context) 526 { 527 return true; 528 } 529 530 535 public boolean validateGYearMonth(Object gYearMonth, DiagnosticChain diagnostics, Map context) 536 { 537 return true; 538 } 539 540 545 public boolean validateHexBinary(byte[] hexBinary, DiagnosticChain diagnostics, Map context) 546 { 547 return true; 548 } 549 550 555 public boolean validateID(String id, DiagnosticChain diagnostics, Map context) 556 { 557 boolean result = validateNCName_Pattern(id, diagnostics, context); 558 return result; 559 } 560 561 566 public boolean validateIDREF(String idref, DiagnosticChain diagnostics, Map context) 567 { 568 boolean result = validateNCName_Pattern(idref, diagnostics, context); 569 return result; 570 } 571 572 577 public boolean validateIDREFS(List idrefs, DiagnosticChain diagnostics, Map context) 578 { 579 boolean result = validateIDREFSBase_ItemType(idrefs, diagnostics, context); 580 if (result || diagnostics != null) result &= validateIDREFS_MinLength(idrefs, diagnostics, context); 581 return result; 582 } 583 584 590 public boolean validateIDREFS_MinLength(List idrefs, DiagnosticChain diagnostics, Map context) 591 { 592 int length = idrefs.size(); 593 boolean result = length >= 1; 594 if (!result && diagnostics != null) 595 reportMinLengthViolation(XMLTypePackage.eINSTANCE.getIDREFS(), idrefs, length, 1, diagnostics, context); 596 return result; 597 } 598 599 604 public boolean validateIDREFSBase(List idrefsBase, DiagnosticChain diagnostics, Map context) 605 { 606 boolean result = validateIDREFSBase_ItemType(idrefsBase, diagnostics, context); 607 return result; 608 } 609 610 616 public boolean validateIDREFSBase_ItemType(List idrefsBase, DiagnosticChain diagnostics, Map context) 617 { 618 boolean result = true; 619 for (Iterator i = idrefsBase.iterator(); i.hasNext() && (result || diagnostics != null); ) 620 { 621 Object item = i.next(); 622 if (XMLTypePackage.eINSTANCE.getIDREF().isInstance(item)) 623 { 624 result &= validateIDREF((String )item, diagnostics, context); 625 } 626 else 627 { 628 result = false; 629 reportDataValueTypeViolation(XMLTypePackage.eINSTANCE.getIDREF(), item, diagnostics, context); 630 } 631 } 632 return result; 633 } 634 635 640 public boolean validateInt(int int_, DiagnosticChain diagnostics, Map context) 641 { 642 return true; 643 } 644 645 650 public boolean validateInteger(BigInteger integer, DiagnosticChain diagnostics, Map context) 651 { 652 return true; 653 } 654 655 660 public boolean validateIntObject(Integer intObject, DiagnosticChain diagnostics, Map context) 661 { 662 return true; 663 } 664 665 670 public boolean validateLanguage(String language, DiagnosticChain diagnostics, Map context) 671 { 672 boolean result = validateLanguage_Pattern(language, diagnostics, context); 673 return result; 674 } 675 676 682 public static final PatternMatcher [][] LANGUAGE__PATTERN__VALUES = 683 new PatternMatcher [][] 684 { 685 new PatternMatcher [] 686 { 687 XMLTypeUtil.createPatternMatcher("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*") 688 } 689 }; 690 691 697 public boolean validateLanguage_Pattern(String language, DiagnosticChain diagnostics, Map context) 698 { 699 return validatePattern(XMLTypePackage.eINSTANCE.getLanguage(), language, LANGUAGE__PATTERN__VALUES, diagnostics, context); 700 } 701 702 707 public boolean validateLong(long long_, DiagnosticChain diagnostics, Map context) 708 { 709 return true; 710 } 711 712 717 public boolean validateLongObject(Long longObject, DiagnosticChain diagnostics, Map context) 718 { 719 return true; 720 } 721 722 727 public boolean validateName(String name, DiagnosticChain diagnostics, Map context) 728 { 729 boolean result = validateName_Pattern(name, diagnostics, context); 730 return result; 731 } 732 733 739 public static final PatternMatcher [][] NAME__PATTERN__VALUES = 740 new PatternMatcher [][] 741 { 742 new PatternMatcher [] 743 { 744 XMLTypeUtil.createPatternMatcher("\\i\\c*") 745 } 746 }; 747 748 754 public boolean validateName_Pattern(String name, DiagnosticChain diagnostics, Map context) 755 { 756 return validatePattern(XMLTypePackage.eINSTANCE.getName_(), name, NAME__PATTERN__VALUES, diagnostics, context); 757 } 758 759 764 public boolean validateNCName(String ncName, DiagnosticChain diagnostics, Map context) 765 { 766 boolean result = validateNCName_Pattern(ncName, diagnostics, context); 767 return result; 768 } 769 770 776 public static final PatternMatcher [][] NC_NAME__PATTERN__VALUES = 777 new PatternMatcher [][] 778 { 779 new PatternMatcher [] 780 { 781 XMLTypeUtil.createPatternMatcher("[\\i-[:]][\\c-[:]]*") 782 }, 783 new PatternMatcher [] 784 { 785 XMLTypeUtil.createPatternMatcher("\\i\\c*") 786 } 787 }; 788 789 795 public boolean validateNCName_Pattern(String ncName, DiagnosticChain diagnostics, Map context) 796 { 797 return validatePattern(XMLTypePackage.eINSTANCE.getNCName(), ncName, NC_NAME__PATTERN__VALUES, diagnostics, context); 798 } 799 800 805 public boolean validateNegativeInteger(BigInteger negativeInteger, DiagnosticChain diagnostics, Map context) 806 { 807 boolean result = validateNegativeInteger_Max(negativeInteger, diagnostics, context); 808 return result; 809 } 810 811 817 public static final BigInteger NEGATIVE_INTEGER__MAX__VALUE = new BigInteger ("-1"); 818 819 825 public boolean validateNegativeInteger_Max(BigInteger negativeInteger, DiagnosticChain diagnostics, Map context) 826 { 827 boolean result = negativeInteger.compareTo(NEGATIVE_INTEGER__MAX__VALUE) <= 0; 828 if (!result && diagnostics != null) 829 reportMaxViolation(XMLTypePackage.eINSTANCE.getNegativeInteger(), negativeInteger, NEGATIVE_INTEGER__MAX__VALUE, true, diagnostics, context); 830 return result; 831 } 832 833 838 public boolean validateNMTOKEN(String nmtoken, DiagnosticChain diagnostics, Map context) 839 { 840 boolean result = validateNMTOKEN_Pattern(nmtoken, diagnostics, context); 841 return result; 842 } 843 844 850 public static final PatternMatcher [][] NMTOKEN__PATTERN__VALUES = 851 new PatternMatcher [][] 852 { 853 new PatternMatcher [] 854 { 855 XMLTypeUtil.createPatternMatcher("\\c+") 856 } 857 }; 858 859 865 public boolean validateNMTOKEN_Pattern(String nmtoken, DiagnosticChain diagnostics, Map context) 866 { 867 return validatePattern(XMLTypePackage.eINSTANCE.getNMTOKEN(), nmtoken, NMTOKEN__PATTERN__VALUES, diagnostics, context); 868 } 869 870 875 public boolean validateNMTOKENS(List nmtokens, DiagnosticChain diagnostics, Map context) 876 { 877 boolean result = validateNMTOKENSBase_ItemType(nmtokens, diagnostics, context); 878 if (result || diagnostics != null) result &= validateNMTOKENS_MinLength(nmtokens, diagnostics, context); 879 return result; 880 } 881 882 888 public boolean validateNMTOKENS_MinLength(List nmtokens, DiagnosticChain diagnostics, Map context) 889 { 890 int length = nmtokens.size(); 891 boolean result = length >= 1; 892 if (!result && diagnostics != null) 893 reportMinLengthViolation(XMLTypePackage.eINSTANCE.getNMTOKENS(), nmtokens, length, 1, diagnostics, context); 894 return result; 895 } 896 897 902 public boolean validateNMTOKENSBase(List nmtokensBase, DiagnosticChain diagnostics, Map context) 903 { 904 boolean result = validateNMTOKENSBase_ItemType(nmtokensBase, diagnostics, context); 905 return result; 906 } 907 908 914 public boolean validateNMTOKENSBase_ItemType(List nmtokensBase, DiagnosticChain diagnostics, Map context) 915 { 916 boolean result = true; 917 for (Iterator i = nmtokensBase.iterator(); i.hasNext() && (result || diagnostics != null); ) 918 { 919 Object item = i.next(); 920 if (XMLTypePackage.eINSTANCE.getNMTOKEN().isInstance(item)) 921 { 922 result &= validateNMTOKEN((String )item, diagnostics, context); 923 } 924 else 925 { 926 result = false; 927 reportDataValueTypeViolation(XMLTypePackage.eINSTANCE.getNMTOKEN(), item, diagnostics, context); 928 } 929 } 930 return result; 931 } 932 933 938 public boolean validateNonNegativeInteger(BigInteger nonNegativeInteger, DiagnosticChain diagnostics, Map context) 939 { 940 boolean result = validateNonNegativeInteger_Min(nonNegativeInteger, diagnostics, context); 941 return result; 942 } 943 944 950 public static final BigInteger NON_NEGATIVE_INTEGER__MIN__VALUE = new BigInteger ("0"); 951 952 958 public boolean validateNonNegativeInteger_Min(BigInteger nonNegativeInteger, DiagnosticChain diagnostics, Map context) 959 { 960 boolean result = nonNegativeInteger.compareTo(NON_NEGATIVE_INTEGER__MIN__VALUE) >= 0; 961 if (!result && diagnostics != null) 962 reportMinViolation(XMLTypePackage.eINSTANCE.getNonNegativeInteger(), nonNegativeInteger, NON_NEGATIVE_INTEGER__MIN__VALUE, true, diagnostics, context); 963 return result; 964 } 965 966 971 public boolean validateNonPositiveInteger(BigInteger nonPositiveInteger, DiagnosticChain diagnostics, Map context) 972 { 973 boolean result = validateNonPositiveInteger_Max(nonPositiveInteger, diagnostics, context); 974 return result; 975 } 976 977 983 public static final BigInteger NON_POSITIVE_INTEGER__MAX__VALUE = new BigInteger ("0"); 984 985 991 public boolean validateNonPositiveInteger_Max(BigInteger nonPositiveInteger, DiagnosticChain diagnostics, Map context) 992 { 993 boolean result = nonPositiveInteger.compareTo(NON_POSITIVE_INTEGER__MAX__VALUE) <= 0; 994 if (!result && diagnostics != null) 995 reportMaxViolation(XMLTypePackage.eINSTANCE.getNonPositiveInteger(), nonPositiveInteger, NON_POSITIVE_INTEGER__MAX__VALUE, true, diagnostics, context); 996 return result; 997 } 998 999 1004 public boolean validateNormalizedString(String normalizedString, DiagnosticChain diagnostics, Map context) 1005 { 1006 return true; 1007 } 1008 1009 1014 public boolean validateNOTATION(Object notation, DiagnosticChain diagnostics, Map context) 1015 { 1016 return true; 1017 } 1018 1019 1024 public boolean validatePositiveInteger(BigInteger positiveInteger, DiagnosticChain diagnostics, Map context) 1025 { 1026 boolean result = validatePositiveInteger_Min(positiveInteger, diagnostics, context); 1027 return result; 1028 } 1029 1030 1036 public static final BigInteger POSITIVE_INTEGER__MIN__VALUE = new BigInteger ("1"); 1037 1038 1044 public boolean validatePositiveInteger_Min(BigInteger positiveInteger, DiagnosticChain diagnostics, Map context) 1045 { 1046 boolean result = positiveInteger.compareTo(POSITIVE_INTEGER__MIN__VALUE) >= 0; 1047 if (!result && diagnostics != null) 1048 reportMinViolation(XMLTypePackage.eINSTANCE.getPositiveInteger(), positiveInteger, POSITIVE_INTEGER__MIN__VALUE, true, diagnostics, context); 1049 return result; 1050 } 1051 1052 1057 public boolean validateQName(Object qName, DiagnosticChain diagnostics, Map context) 1058 { 1059 return true; 1060 } 1061 1062 1067 public boolean validateShort(short short_, DiagnosticChain diagnostics, Map context) 1068 { 1069 return true; 1070 } 1071 1072 1077 public boolean validateShortObject(Short shortObject, DiagnosticChain diagnostics, Map context) 1078 { 1079 return true; 1080 } 1081 1082 1087 public boolean validateString(String string, DiagnosticChain diagnostics, Map context) 1088 { 1089 return true; 1090 } 1091 1092 1097 public boolean validateTime(Object time, DiagnosticChain diagnostics, Map context) 1098 { 1099 return true; 1100 } 1101 1102 1107 public boolean validateToken(String token, DiagnosticChain diagnostics, Map context) 1108 { 1109 return true; 1110 } 1111 1112 1117 public boolean validateUnsignedByte(short unsignedByte, DiagnosticChain diagnostics, Map context) 1118 { 1119 boolean result = validateUnsignedByte_Min(unsignedByte, diagnostics, context); 1120 if (result || diagnostics != null) result &= validateUnsignedByte_Max(unsignedByte, diagnostics, context); 1121 return result; 1122 } 1123 1124 1130 public static final short UNSIGNED_BYTE__MIN__VALUE = 0; 1131 1132 1138 public boolean validateUnsignedByte_Min(short unsignedByte, DiagnosticChain diagnostics, Map context) 1139 { 1140 boolean result = unsignedByte >= UNSIGNED_BYTE__MIN__VALUE; 1141 if (!result && diagnostics != null) 1142 reportMinViolation(XMLTypePackage.eINSTANCE.getUnsignedByte(), new Short (unsignedByte), new Short (UNSIGNED_BYTE__MIN__VALUE), true, diagnostics, context); 1143 return result; 1144 } 1145 1146 1152 public static final short UNSIGNED_BYTE__MAX__VALUE = 255; 1153 1154 1160 public boolean validateUnsignedByte_Max(short unsignedByte, DiagnosticChain diagnostics, Map context) 1161 { 1162 boolean result = unsignedByte <= UNSIGNED_BYTE__MAX__VALUE; 1163 if (!result && diagnostics != null) 1164 reportMaxViolation(XMLTypePackage.eINSTANCE.getUnsignedByte(), new Short (unsignedByte), new Short (UNSIGNED_BYTE__MAX__VALUE), true, diagnostics, context); 1165 return result; 1166 } 1167 1168 1173 public boolean validateUnsignedByteObject(Short unsignedByteObject, DiagnosticChain diagnostics, Map context) 1174 { 1175 boolean result = validateUnsignedByte_Min(unsignedByteObject.shortValue(), diagnostics, context); 1176 if (result || diagnostics != null) result &= validateUnsignedByte_Max(unsignedByteObject.shortValue(), diagnostics, context); 1177 return result; 1178 } 1179 1180 1185 public boolean validateUnsignedInt(long unsignedInt, DiagnosticChain diagnostics, Map context) 1186 { 1187 boolean result = validateUnsignedInt_Min(unsignedInt, diagnostics, context); 1188 if (result || diagnostics != null) result &= validateUnsignedInt_Max(unsignedInt, diagnostics, context); 1189 return result; 1190 } 1191 1192 1198 public static final long UNSIGNED_INT__MIN__VALUE = 0L; 1199 1200 1206 public boolean validateUnsignedInt_Min(long unsignedInt, DiagnosticChain diagnostics, Map context) 1207 { 1208 boolean result = unsignedInt >= UNSIGNED_INT__MIN__VALUE; 1209 if (!result && diagnostics != null) 1210 reportMinViolation(XMLTypePackage.eINSTANCE.getUnsignedInt(), new Long (unsignedInt), new Long (UNSIGNED_INT__MIN__VALUE), true, diagnostics, context); 1211 return result; 1212 } 1213 1214 1220 public static final long UNSIGNED_INT__MAX__VALUE = 4294967295L; 1221 1222 1228 public boolean validateUnsignedInt_Max(long unsignedInt, DiagnosticChain diagnostics, Map context) 1229 { 1230 boolean result = unsignedInt <= UNSIGNED_INT__MAX__VALUE; 1231 if (!result && diagnostics != null) 1232 reportMaxViolation(XMLTypePackage.eINSTANCE.getUnsignedInt(), new Long (unsignedInt), new Long (UNSIGNED_INT__MAX__VALUE), true, diagnostics, context); 1233 return result; 1234 } 1235 1236 1241 public boolean validateUnsignedIntObject(Long unsignedIntObject, DiagnosticChain diagnostics, Map context) 1242 { 1243 boolean result = validateUnsignedInt_Min(unsignedIntObject.longValue(), diagnostics, context); 1244 if (result || diagnostics != null) result &= validateUnsignedInt_Max(unsignedIntObject.longValue(), diagnostics, context); 1245 return result; 1246 } 1247 1248 1253 public boolean validateUnsignedLong(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) 1254 { 1255 boolean result = validateUnsignedLong_Min(unsignedLong, diagnostics, context); 1256 if (result || diagnostics != null) result &= validateUnsignedLong_Max(unsignedLong, diagnostics, context); 1257 return result; 1258 } 1259 1260 1266 public static final BigInteger UNSIGNED_LONG__MIN__VALUE = new BigInteger ("0"); 1267 1268 1274 public boolean validateUnsignedLong_Min(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) 1275 { 1276 boolean result = unsignedLong.compareTo(UNSIGNED_LONG__MIN__VALUE) >= 0; 1277 if (!result && diagnostics != null) 1278 reportMinViolation(XMLTypePackage.eINSTANCE.getUnsignedLong(), unsignedLong, UNSIGNED_LONG__MIN__VALUE, true, diagnostics, context); 1279 return result; 1280 } 1281 1282 1288 public static final BigInteger UNSIGNED_LONG__MAX__VALUE = new BigInteger ("18446744073709551615"); 1289 1290 1296 public boolean validateUnsignedLong_Max(BigInteger unsignedLong, DiagnosticChain diagnostics, Map context) 1297 { 1298 boolean result = unsignedLong.compareTo(UNSIGNED_LONG__MAX__VALUE) <= 0; 1299 if (!result && diagnostics != null) 1300 reportMaxViolation(XMLTypePackage.eINSTANCE.getUnsignedLong(), unsignedLong, UNSIGNED_LONG__MAX__VALUE, true, diagnostics, context); 1301 return result; 1302 } 1303 1304 1309 public boolean validateUnsignedShort(int unsignedShort, DiagnosticChain diagnostics, Map context) 1310 { 1311 boolean result = validateUnsignedShort_Min(unsignedShort, diagnostics, context); 1312 if (result || diagnostics != null) result &= validateUnsignedShort_Max(unsignedShort, diagnostics, context); 1313 return result; 1314 } 1315 1316 1322 public static final int UNSIGNED_SHORT__MIN__VALUE = 0; 1323 1324 1330 public boolean validateUnsignedShort_Min(int unsignedShort, DiagnosticChain diagnostics, Map context) 1331 { 1332 boolean result = unsignedShort >= UNSIGNED_SHORT__MIN__VALUE; 1333 if (!result && diagnostics != null) 1334 reportMinViolation(XMLTypePackage.eINSTANCE.getUnsignedShort(), new Integer (unsignedShort), new Integer (UNSIGNED_SHORT__MIN__VALUE), true, diagnostics, context); 1335 return result; 1336 } 1337 1338 1344 public static final int UNSIGNED_SHORT__MAX__VALUE = 65535; 1345 1346 1352 public boolean validateUnsignedShort_Max(int unsignedShort, DiagnosticChain diagnostics, Map context) 1353 { 1354 boolean result = unsignedShort <= UNSIGNED_SHORT__MAX__VALUE; 1355 if (!result && diagnostics != null) 1356 reportMaxViolation(XMLTypePackage.eINSTANCE.getUnsignedShort(), new Integer (unsignedShort), new Integer (UNSIGNED_SHORT__MAX__VALUE), true, diagnostics, context); 1357 return result; 1358 } 1359 1360 1365 public boolean validateUnsignedShortObject(Integer unsignedShortObject, DiagnosticChain diagnostics, Map context) 1366 { 1367 boolean result = validateUnsignedShort_Min(unsignedShortObject.intValue(), diagnostics, context); 1368 if (result || diagnostics != null) result &= validateUnsignedShort_Max(unsignedShortObject.intValue(), diagnostics, context); 1369 return result; 1370 } 1371 1372} | Popular Tags |