| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.type; |
| 9 |
|
| 10 |
import net.sf.saxon.Configuration; |
| 11 |
import net.sf.saxon.expr.parser.Token; |
| 12 |
import net.sf.saxon.ma.arrays.ArrayItem; |
| 13 |
import net.sf.saxon.ma.arrays.ArrayItemType; |
| 14 |
import net.sf.saxon.ma.map.MapItem; |
| 15 |
import net.sf.saxon.ma.map.MapType; |
| 16 |
import net.sf.saxon.om.*; |
| 17 |
import net.sf.saxon.pattern.*; |
| 18 |
import net.sf.saxon.tree.iter.AxisIterator; |
| 19 |
import net.sf.saxon.value.*; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public abstract class Type { |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public static final short ELEMENT = 1; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
public static final short ATTRIBUTE = 2; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
public static final short TEXT = 3; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public static final short WHITESPACE_TEXT = 4; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public static final short PROCESSING_INSTRUCTION = 7; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
public static final short COMMENT = 8; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public static final short DOCUMENT = 9; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public static final short NAMESPACE = 13; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
public static final short STOPPER = 11; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
public static final short PARENT_POINTER = 12; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public static final short TEXTUAL_ELEMENT = 17; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public static final short EXTERNAL_NODE_REFERENCE = 33; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
public static final short NODE = 0; |
| 91 |
|
| 92 |
public static final ItemType NODE_TYPE = AnyNodeTest.getInstance(); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
public static final short ITEM = 88; |
| 99 |
|
| 100 |
public static final ItemType ITEM_TYPE = AnyItemType.getInstance(); |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
public static final short FUNCTION = 99; |
| 107 |
|
| 108 |
|
| 109 |
private Type() { |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
public static boolean isNodeType(ItemType type) { |
| 120 |
return type instanceof NodeTest; |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
public static ItemType getItemType( Item item, TypeHierarchy th) { |
| 136 |
if (item == null) { |
| 137 |
return AnyItemType.getInstance(); |
| 138 |
} else if (item instanceof AtomicValue) { |
| 139 |
return ((AtomicValue) item).getItemType(); |
| 140 |
} else if (item instanceof NodeInfo) { |
| 141 |
NodeInfo node = (NodeInfo) item; |
| 142 |
if (th == null) { |
| 143 |
th = node.getConfiguration().getTypeHierarchy(); |
| 144 |
} |
| 145 |
switch (node.getNodeKind()) { |
| 146 |
case Type.DOCUMENT: |
| 147 |
|
| 148 |
AxisIterator iter = node.iterateAxis(AxisInfo.CHILD); |
| 149 |
ItemType elementType = null; |
| 150 |
while (true) { |
| 151 |
NodeInfo n = iter.next(); |
| 152 |
if (n == null) { |
| 153 |
break; |
| 154 |
} |
| 155 |
int kind = n.getNodeKind(); |
| 156 |
if (kind == Type.TEXT) { |
| 157 |
elementType = null; |
| 158 |
break; |
| 159 |
} else if (kind == Type.ELEMENT) { |
| 160 |
if (elementType != null) { |
| 161 |
elementType = null; |
| 162 |
break; |
| 163 |
} |
| 164 |
elementType = Type.getItemType(n, th); |
| 165 |
} |
| 166 |
} |
| 167 |
if (elementType == null) { |
| 168 |
return NodeKindTest.DOCUMENT; |
| 169 |
} else { |
| 170 |
return new DocumentNodeTest((NodeTest) elementType); |
| 171 |
} |
| 172 |
|
| 173 |
case Type.ELEMENT: |
| 174 |
SchemaType eltype = node.getSchemaType(); |
| 175 |
if (eltype.equals(Untyped.getInstance()) || eltype.equals(AnyType.getInstance())) { |
| 176 |
return new SameNameTest(node); |
| 177 |
} else { |
| 178 |
return new CombinedNodeTest( |
| 179 |
new SameNameTest(node), |
| 180 |
Token.INTERSECT, |
| 181 |
new ContentTypeTest(Type.ELEMENT, eltype, node.getConfiguration(), false)); |
| 182 |
} |
| 183 |
|
| 184 |
case Type.ATTRIBUTE: |
| 185 |
SchemaType attype = node.getSchemaType(); |
| 186 |
if (attype.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { |
| 187 |
return new SameNameTest(node); |
| 188 |
} else { |
| 189 |
return new CombinedNodeTest( |
| 190 |
new SameNameTest(node), |
| 191 |
Token.INTERSECT, |
| 192 |
new ContentTypeTest(Type.ATTRIBUTE, attype, node.getConfiguration(), false)); |
| 193 |
} |
| 194 |
|
| 195 |
case Type.TEXT: |
| 196 |
return NodeKindTest.TEXT; |
| 197 |
|
| 198 |
case Type.COMMENT: |
| 199 |
return NodeKindTest.COMMENT; |
| 200 |
|
| 201 |
case Type.PROCESSING_INSTRUCTION: |
| 202 |
return NodeKindTest.PROCESSING_INSTRUCTION; |
| 203 |
|
| 204 |
case Type.NAMESPACE: |
| 205 |
return NodeKindTest.NAMESPACE; |
| 206 |
|
| 207 |
default: |
| 208 |
throw new IllegalArgumentException("Unknown node kind " + node.getNodeKind()); |
| 209 |
} |
| 210 |
} else if (item instanceof ExternalObject) { |
| 211 |
return ((ExternalObject) item).getItemType(th); |
| 212 |
} else if (item instanceof MapItem) { |
| 213 |
return ((MapItem)item).getItemType(th); |
| 214 |
} else if (item instanceof ArrayItem) { |
| 215 |
return new ArrayItemType(((ArrayItem) item).getMemberType(th)); |
| 216 |
} else { |
| 217 |
return ((Function) item).getFunctionItemType(); |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
public static String displayTypeName( Item item) { |
| 231 |
if (item instanceof NodeInfo) { |
| 232 |
NodeInfo node = (NodeInfo) item; |
| 233 |
switch (node.getNodeKind()) { |
| 234 |
case DOCUMENT: |
| 235 |
return "document-node()"; |
| 236 |
case ELEMENT: |
| 237 |
SchemaType annotation = node.getSchemaType(); |
| 238 |
return "element(" + |
| 239 |
((NodeInfo) item).getDisplayName() + ", " + |
| 240 |
annotation.getDisplayName() + ')'; |
| 241 |
case ATTRIBUTE: |
| 242 |
SchemaType annotation2 = node.getSchemaType(); |
| 243 |
return "attribute(" + |
| 244 |
((NodeInfo) item).getDisplayName() + ", " + |
| 245 |
annotation2.getDisplayName() + ')'; |
| 246 |
case TEXT: |
| 247 |
return "text()"; |
| 248 |
case COMMENT: |
| 249 |
return "comment()"; |
| 250 |
case PROCESSING_INSTRUCTION: |
| 251 |
return "processing-instruction()"; |
| 252 |
case NAMESPACE: |
| 253 |
return "namespace()"; |
| 254 |
default: |
| 255 |
return ""; |
| 256 |
} |
| 257 |
} else if (item instanceof ExternalObject) { |
| 258 |
return ObjectValue.displayTypeName(((ExternalObject) item).getObject()); |
| 259 |
} else if (item instanceof AtomicValue) { |
| 260 |
return ((AtomicValue) item).getItemType().toString(); |
| 261 |
} else if (item instanceof Function) { |
| 262 |
return "function(*)"; |
| 263 |
} else { |
| 264 |
return item.getClass().toString(); |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
public static ItemType getBuiltInItemType(String namespace, String localName) { |
| 278 |
SchemaType t = BuiltInType.getSchemaType( |
| 279 |
StandardNames.getFingerprint(namespace, localName)); |
| 280 |
if (t instanceof ItemType) { |
| 281 |
return (ItemType) t; |
| 282 |
} else { |
| 283 |
return null; |
| 284 |
} |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
public static SimpleType getBuiltInSimpleType(String namespace, String localName) { |
| 297 |
SchemaType t = BuiltInType.getSchemaType( |
| 298 |
StandardNames.getFingerprint(namespace, localName)); |
| 299 |
if (t instanceof SimpleType && ((SimpleType) t).isBuiltInType()) { |
| 300 |
return (SimpleType) t; |
| 301 |
} else { |
| 302 |
return null; |
| 303 |
} |
| 304 |
} |
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
public static boolean isSubType(AtomicType one, AtomicType two) { |
| 315 |
while (true) { |
| 316 |
if (one.getFingerprint() == two.getFingerprint()) { |
| 317 |
return true; |
| 318 |
} |
| 319 |
SchemaType s = one.getBaseType(); |
| 320 |
if (s instanceof AtomicType) { |
| 321 |
one = (AtomicType)s; |
| 322 |
} else { |
| 323 |
return false; |
| 324 |
} |
| 325 |
} |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
public static ItemType getCommonSuperType(ItemType t1, ItemType t2, TypeHierarchy th) { |
| 340 |
if (t1 == t2) { |
| 341 |
return t1; |
| 342 |
} |
| 343 |
if (t1 instanceof ErrorType) { |
| 344 |
return t2; |
| 345 |
} |
| 346 |
if (t2 instanceof ErrorType) { |
| 347 |
return t1; |
| 348 |
} |
| 349 |
if (t1 instanceof JavaExternalObjectType && t2 instanceof JavaExternalObjectType) { |
| 350 |
Configuration config = ((JavaExternalObjectType) t1).getConfiguration(); |
| 351 |
Class c1 = ((JavaExternalObjectType) t1).getJavaClass(); |
| 352 |
Class c2 = ((JavaExternalObjectType) t2).getJavaClass(); |
| 353 |
return config.getJavaExternalObjectType(leastCommonSuperClass(c1, c2)); |
| 354 |
} |
| 355 |
if (t1 instanceof MapType && t2 instanceof MapType) { |
| 356 |
if (t1 == MapType.EMPTY_MAP_TYPE) { |
| 357 |
return t2; |
| 358 |
} |
| 359 |
if (t2 == MapType.EMPTY_MAP_TYPE) { |
| 360 |
return t1; |
| 361 |
} |
| 362 |
ItemType keyType = getCommonSuperType(((MapType) t1).getKeyType(), ((MapType)t2).getKeyType()); |
| 363 |
AtomicType k; |
| 364 |
if (keyType instanceof AtomicType) { |
| 365 |
k = (AtomicType)keyType; |
| 366 |
} else { |
| 367 |
k = keyType.getAtomizedItemType().getPrimitiveItemType(); |
| 368 |
} |
| 369 |
SequenceType v = SequenceType.makeSequenceType( |
| 370 |
getCommonSuperType(((MapType) t1).getValueType().getPrimaryType(), ((MapType) t2).getValueType().getPrimaryType()), |
| 371 |
Cardinality.union(((MapType) t1).getValueType().getCardinality(), ((MapType) t2).getValueType().getCardinality())); |
| 372 |
return new MapType(k, v); |
| 373 |
} |
| 374 |
int r = th.relationship(t1, t2); |
| 375 |
if (r == TypeHierarchy.SAME_TYPE) { |
| 376 |
return t1; |
| 377 |
} else if (r == TypeHierarchy.SUBSUMED_BY) { |
| 378 |
return t2; |
| 379 |
} else if (r == TypeHierarchy.SUBSUMES) { |
| 380 |
return t1; |
| 381 |
} else { |
| 382 |
return t1.getUType().union(t2.getUType()).toItemType(); |
| 383 |
} |
| 384 |
} |
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
public static ItemType getCommonSuperType( ItemType t1, ItemType t2) { |
| 397 |
if (t1 == t2) { |
| 398 |
return t1; |
| 399 |
} |
| 400 |
if (t1 instanceof ErrorType) { |
| 401 |
return t2; |
| 402 |
} |
| 403 |
if (t2 instanceof ErrorType) { |
| 404 |
return t1; |
| 405 |
} |
| 406 |
if (t1 == AnyItemType.getInstance() || t2 == AnyItemType.getInstance()) { |
| 407 |
return AnyItemType.getInstance(); |
| 408 |
} |
| 409 |
ItemType p1 = t1.getPrimitiveItemType(); |
| 410 |
ItemType p2 = t2.getPrimitiveItemType(); |
| 411 |
if (p1 == p2) { |
| 412 |
return p1; |
| 413 |
} |
| 414 |
if ((p1 == BuiltInAtomicType.DECIMAL && p2 == BuiltInAtomicType.INTEGER) || |
| 415 |
(p2 == BuiltInAtomicType.DECIMAL && p1 == BuiltInAtomicType.INTEGER)) { |
| 416 |
return BuiltInAtomicType.DECIMAL; |
| 417 |
} |
| 418 |
if (p1 instanceof BuiltInAtomicType && ((BuiltInAtomicType) p1).isNumericType() && |
| 419 |
p2 instanceof BuiltInAtomicType && ((BuiltInAtomicType) p2).isNumericType()) { |
| 420 |
return NumericType.getInstance(); |
| 421 |
} |
| 422 |
if (t1.isAtomicType() && t2.isAtomicType()) { |
| 423 |
return BuiltInAtomicType.ANY_ATOMIC; |
| 424 |
} |
| 425 |
if (t1 instanceof NodeTest && t2 instanceof NodeTest) { |
| 426 |
return AnyNodeTest.getInstance(); |
| 427 |
} |
| 428 |
if (t1 instanceof JavaExternalObjectType && t2 instanceof JavaExternalObjectType) { |
| 429 |
Configuration config = ((JavaExternalObjectType) t1).getConfiguration(); |
| 430 |
Class c1 = ((JavaExternalObjectType) t1).getJavaClass(); |
| 431 |
Class c2 = ((JavaExternalObjectType) t2).getJavaClass(); |
| 432 |
return config.getJavaExternalObjectType(leastCommonSuperClass(c1, c2)); |
| 433 |
} |
| 434 |
return AnyItemType.getInstance(); |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
} |
| 439 |
|
| 440 |
public static SequenceType getCommonSuperType(SequenceType t1, SequenceType t2) { |
| 441 |
if (t1.equals(t2)) { |
| 442 |
return t1; |
| 443 |
} else { |
| 444 |
return SequenceType.makeSequenceType(getCommonSuperType(t1.getPrimaryType(), t2.getPrimaryType()), |
| 445 |
Cardinality.union(t1.getCardinality(), t2.getCardinality())); |
| 446 |
} |
| 447 |
} |
| 448 |
|
| 449 |
private static Class<?> leastCommonSuperClass(Class<?> class1, Class<?> class2) { |
| 450 |
if (class1 == class2) { |
| 451 |
return class1; |
| 452 |
} |
| 453 |
if (class1 == null || class2 == null) { |
| 454 |
return null; |
| 455 |
} |
| 456 |
if (!class1.isArray() && class1.isAssignableFrom(class2)) { |
| 457 |
return class1; |
| 458 |
} |
| 459 |
if (!class2.isArray() && class2.isAssignableFrom(class1)) { |
| 460 |
return class2; |
| 461 |
} |
| 462 |
if (class1.isInterface() || class2.isInterface()) { |
| 463 |
return Object.class; |
| 464 |
} |
| 465 |
return leastCommonSuperClass(class1.getSuperclass(), class2.getSuperclass()); |
| 466 |
} |
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
public static boolean isPrimitiveAtomicType(int fingerprint) { |
| 479 |
return fingerprint >= 0 && (fingerprint <= StandardNames.XS_INTEGER || |
| 480 |
fingerprint == StandardNames.XS_NUMERIC || |
| 481 |
fingerprint == StandardNames.XS_UNTYPED_ATOMIC || |
| 482 |
fingerprint == StandardNames.XS_ANY_ATOMIC_TYPE || |
| 483 |
fingerprint == StandardNames.XS_DAY_TIME_DURATION || |
| 484 |
fingerprint == StandardNames.XS_YEAR_MONTH_DURATION || |
| 485 |
fingerprint == StandardNames.XS_ANY_SIMPLE_TYPE); |
| 486 |
} |
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
public static boolean isPrimitiveAtomicUType(int fingerprint) { |
| 495 |
return fingerprint >= 0 && fingerprint <= StandardNames.XS_INTEGER; |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
public static boolean isGuaranteedComparable( BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered) { |
| 514 |
if (t1 == t2) { |
| 515 |
return true; |
| 516 |
} |
| 517 |
if (t1.isPrimitiveNumeric()) { |
| 518 |
return t2.isPrimitiveNumeric(); |
| 519 |
} |
| 520 |
if (t1.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || t1.equals(BuiltInAtomicType.ANY_URI)) { |
| 521 |
t1 = BuiltInAtomicType.STRING; |
| 522 |
} |
| 523 |
if (t2.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || t2.equals(BuiltInAtomicType.ANY_URI)) { |
| 524 |
t2 = BuiltInAtomicType.STRING; |
| 525 |
} |
| 526 |
|
| 527 |
if (!ordered) { |
| 528 |
if (t1.equals(BuiltInAtomicType.DAY_TIME_DURATION)) { |
| 529 |
t1 = BuiltInAtomicType.DURATION; |
| 530 |
} |
| 531 |
if (t2.equals(BuiltInAtomicType.DAY_TIME_DURATION)) { |
| 532 |
t2 = BuiltInAtomicType.DURATION; |
| 533 |
} |
| 534 |
if (t1.equals(BuiltInAtomicType.YEAR_MONTH_DURATION)) { |
| 535 |
t1 = BuiltInAtomicType.DURATION; |
| 536 |
} |
| 537 |
if (t2.equals(BuiltInAtomicType.YEAR_MONTH_DURATION)) { |
| 538 |
t2 = BuiltInAtomicType.DURATION; |
| 539 |
} |
| 540 |
} |
| 541 |
return t1 == t2; |
| 542 |
} |
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
public static boolean isPossiblyComparable( BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered) { |
| 560 |
if (t1 == t2) { |
| 561 |
return true; |
| 562 |
} |
| 563 |
if (t1.equals(BuiltInAtomicType.ANY_ATOMIC) || t2.equals(BuiltInAtomicType.ANY_ATOMIC)) { |
| 564 |
return true; |
| 565 |
} |
| 566 |
if (t1.isPrimitiveNumeric()) { |
| 567 |
return t2.isPrimitiveNumeric(); |
| 568 |
} |
| 569 |
if (t1.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || t1.equals(BuiltInAtomicType.ANY_URI)) { |
| 570 |
t1 = BuiltInAtomicType.STRING; |
| 571 |
} |
| 572 |
if (t2.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || t2.equals(BuiltInAtomicType.ANY_URI)) { |
| 573 |
t2 = BuiltInAtomicType.STRING; |
| 574 |
} |
| 575 |
if (t1.equals(BuiltInAtomicType.DAY_TIME_DURATION)) { |
| 576 |
t1 = BuiltInAtomicType.DURATION; |
| 577 |
} |
| 578 |
if (t2.equals(BuiltInAtomicType.DAY_TIME_DURATION)) { |
| 579 |
t2 = BuiltInAtomicType.DURATION; |
| 580 |
} |
| 581 |
if (t1.equals(BuiltInAtomicType.YEAR_MONTH_DURATION)) { |
| 582 |
t1 = BuiltInAtomicType.DURATION; |
| 583 |
} |
| 584 |
if (t2.equals(BuiltInAtomicType.YEAR_MONTH_DURATION)) { |
| 585 |
t2 = BuiltInAtomicType.DURATION; |
| 586 |
} |
| 587 |
return t1 == t2; |
| 588 |
} |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
public static boolean isGenerallyComparable( BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered) { |
| 605 |
return t1.equals(BuiltInAtomicType.ANY_ATOMIC) |
| 606 |
|| t2.equals(BuiltInAtomicType.ANY_ATOMIC) |
| 607 |
|| t1.equals(BuiltInAtomicType.UNTYPED_ATOMIC) |
| 608 |
|| t2.equals(BuiltInAtomicType.UNTYPED_ATOMIC) |
| 609 |
|| isGuaranteedComparable(t1, t2, ordered); |
| 610 |
} |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
public static boolean isGuaranteedGenerallyComparable( BuiltInAtomicType t1, BuiltInAtomicType t2, boolean ordered) { |
| 627 |
return !(t1.equals(BuiltInAtomicType.ANY_ATOMIC) || t2.equals(BuiltInAtomicType.ANY_ATOMIC)) |
| 628 |
&& isGenerallyComparable(t1, t2, ordered); |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
} |
| 633 |
|