| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.s9api; |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
public class SequenceType { |
| 14 |
|
| 15 |
private ItemType itemType; |
| 16 |
private OccurrenceIndicator occurrenceIndicator; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
private SequenceType(ItemType itemType, OccurrenceIndicator occurrenceIndicator) { |
| 26 |
this.itemType = itemType; |
| 27 |
this.occurrenceIndicator = occurrenceIndicator; |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public static SequenceType makeSequenceType(ItemType itemType, OccurrenceIndicator occurrenceIndicator) { |
| 40 |
return new SequenceType(itemType, occurrenceIndicator); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
public ItemType getItemType() { |
| 50 |
return itemType; |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public OccurrenceIndicator getOccurrenceIndicator() { |
| 60 |
return occurrenceIndicator; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
public final boolean equals(Object other) { |
| 72 |
return other instanceof SequenceType && |
| 73 |
((SequenceType) other).getOccurrenceIndicator().equals(getOccurrenceIndicator()) && |
| 74 |
((SequenceType) other).getItemType().equals(getItemType()); |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public final int hashCode() { |
| 85 |
return getItemType().hashCode() ^ (getOccurrenceIndicator().hashCode() << 17); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
public net.sf.saxon.value.SequenceType getUnderlyingSequenceType() { |
| 94 |
return net.sf.saxon.value.SequenceType.makeSequenceType( |
| 95 |
itemType.getUnderlyingItemType(), occurrenceIndicator.getCardinality()); |
| 96 |
} |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
public static SequenceType fromUnderlyingSequenceType( |
| 106 |
Processor processor, net.sf.saxon.value.SequenceType st) { |
| 107 |
ItemTypeFactory factory = new ItemTypeFactory(processor); |
| 108 |
ItemType it = factory.exposeItemType(st.getPrimaryType()); |
| 109 |
OccurrenceIndicator oc = OccurrenceIndicator.getOccurrenceIndicator(st.getCardinality()); |
| 110 |
return makeSequenceType(it, oc); |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
} |