From 6c4fa7d1cc2fefc22d464b0b7c1612bd2280ef29 Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Sun, 24 Nov 2024 20:56:37 -0500 Subject: [PATCH] More javadocs and some light refactoring. --- .../core/datatype/DataTypeService.java | 14 +-- .../core/datatype/adapter/Base64Adapter.java | 6 +- .../core/datatype/adapter/BooleanAdapter.java | 5 +- .../core/datatype/adapter/DateAdapter.java | 5 +- .../datatype/adapter/DateTimeAdapter.java | 6 +- .../adapter/DateTimeWithTZAdapter.java | 6 +- .../datatype/adapter/DateWithTZAdapter.java | 5 +- .../core/datatype/adapter/DayTimeAdapter.java | 5 +- .../core/datatype/adapter/DecimalAdapter.java | 5 +- .../datatype/adapter/EmailAddressAdapter.java | 6 +- .../datatype/adapter/HostnameAdapter.java | 5 +- .../datatype/adapter/IPv4AddressAdapter.java | 5 +- .../datatype/adapter/IPv6AddressAdapter.java | 5 +- .../core/datatype/adapter/IntegerAdapter.java | 5 +- .../core/datatype/adapter/NcNameAdapter.java | 6 +- .../adapter/NonNegativeIntegerAdapter.java | 6 +- .../adapter/PositiveIntegerAdapter.java | 6 +- .../core/datatype/adapter/StringAdapter.java | 5 +- .../core/datatype/adapter/TokenAdapter.java | 5 +- .../core/datatype/adapter/UriAdapter.java | 5 +- .../datatype/adapter/UriReferenceAdapter.java | 5 +- .../core/datatype/adapter/UuidAdapter.java | 5 +- .../datatype/adapter/YearMonthAdapter.java | 5 +- .../markup/MarkupDataTypeProvider.java | 4 +- .../datatype/markup/MarkupLineAdapter.java | 5 +- .../markup/MarkupMultilineAdapter.java | 5 +- .../core/metapath/StaticContext.java | 48 +++++++-- .../cst/AbstractExpressionVisitor.java | 25 +++++ .../core/metapath/cst/BuildCSTVisitor.java | 25 +++++ .../core/metapath/cst/CSTPrinter.java | 25 +++++ .../metapath/cst/ICstExpressionFactory.java | 8 ++ .../core/metapath/cst/IExpressionVisitor.java | 25 +++++ .../cst/comparison/AbstractComparison.java | 2 +- .../AbstractLiteralExpression.java | 3 +- .../cst/{ => items}/AbstractLookup.java | 3 +- .../{ => items}/ArraySequenceConstructor.java | 4 +- .../{ => items}/ArraySquareConstructor.java | 4 +- .../cst/{ => items}/DecimalLiteral.java | 3 +- .../cst/{ => items}/EmptySequence.java | 5 +- .../cst/{ => items}/FunctionCallAccessor.java | 4 +- .../cst/{ => items}/ILiteralExpression.java | 3 +- .../cst/{ => items}/IntegerLiteral.java | 3 +- .../metapath/cst/{ => items}/Intersect.java | 5 +- .../cst/{ => items}/MapConstructor.java | 4 +- .../cst/{ => items}/PostfixLookup.java | 4 +- .../metapath/cst/{ => items}/Quantified.java | 5 +- .../core/metapath/cst/{ => items}/Range.java | 5 +- .../metapath/cst/{ => items}/SimpleMap.java | 5 +- .../cst/{ => items}/StringConcat.java | 5 +- .../cst/{ => items}/StringLiteral.java | 3 +- .../metapath/cst/{ => items}/UnaryLookup.java | 4 +- .../core/metapath/cst/{ => items}/Union.java | 6 +- .../{ => logic}/AbstractFilterExpression.java | 5 +- .../core/metapath/cst/{ => logic}/And.java | 5 +- .../core/metapath/cst/{ => logic}/Except.java | 4 +- .../{ => logic}/IBooleanLogicExpression.java | 3 +- .../core/metapath/cst/{ => logic}/If.java | 5 +- .../core/metapath/cst/{ => logic}/Negate.java | 6 +- .../core/metapath/cst/{ => logic}/Or.java | 5 +- .../cst/{ => logic}/PredicateExpression.java | 5 +- .../core/metapath/cst/math/package-info.java | 3 + .../cst/path/AbstractPathExpression.java | 1 - .../cst/{ => path}/IPathExpression.java | 3 +- .../core/metapath/cst/path/package-info.java | 3 + .../{ => type}/AbstractCastingExpression.java | 18 +++- .../core/metapath/cst/{ => type}/Cast.java | 4 +- .../metapath/cst/{ => type}/Castable.java | 4 +- .../metapath/cst/{ => type}/InstanceOf.java | 5 +- .../core/metapath/cst/type/package-info.java | 10 ++ .../core/metapath/function/IArgument.java | 23 ----- .../core/metapath/impl/AbstractArrayItem.java | 60 ++++++++++- .../core/metapath/impl/AbstractMapItem.java | 69 ++++++++++++- .../core/metapath/impl/AbstractSequence.java | 7 ++ .../metapath/impl/AbstractStringMapKey.java | 7 +- .../atomic/impl/AbstractIPAddressItem.java | 13 +++ .../item/atomic/impl/AbstractMarkupItem.java | 15 ++- .../metapath/item/function/IArrayItem.java | 62 +----------- .../core/metapath/item/function/IMapItem.java | 64 +----------- .../core/metapath/item/function/IMapKey.java | 3 + .../type/AbstractAtomicOrUnionType.java | 16 +-- .../core/metapath/type/DataTypeItemType.java | 10 +- .../core/metapath/type/IItemType.java | 49 ++++----- .../core/metapath/type/ISequenceType.java | 2 +- .../type/impl/AbstractDefinitionTest.java | 58 ++++++++++- .../metapath/type/impl/AbstractItemType.java | 20 +++- ...ItemType.java => AnyFunctionItemType.java} | 31 ++++-- .../core/metapath/type/impl/AnyItemType.java | 8 ++ .../core/metapath/type/impl/AnyKindTest.java | 34 ++++++- .../metapath/type/impl/ArrayTestImpl.java | 11 +++ .../type/impl/DynamicTypeSupport.java | 40 ++++++++ .../type/impl/KindAssemblyTestImpl.java | 18 +++- .../type/impl/KindDocumentTestImpl.java | 17 ++-- .../metapath/type/impl/KindFieldTestImpl.java | 18 +++- .../metapath/type/impl/KindFlagTestImpl.java | 18 +++- .../core/metapath/type/impl/MapTestImpl.java | 14 ++- .../type/impl/NonAdapterAtomicItemType.java | 24 ++++- .../metapath/type/impl/SequenceTypeImpl.java | 25 ++++- .../metapath/type/impl/TypeConstants.java | 15 +-- .../core/model/FlagContainerBuilder.java | 2 +- .../impl/DefaultContainerFlagSupport.java | 6 ++ .../core/model/impl/EmptyFlagContainer.java | 15 ++- .../core/model/xml/impl/XmlModule.java | 2 +- .../metaschema/core/qname/EQNameFactory.java | 56 +++++++---- .../metaschema/core/qname/IEnhancedQName.java | 99 +++++++++++++++++-- .../metaschema/core/qname/NamespaceCache.java | 50 ++++++++-- .../metaschema/core/qname/QNameCache.java | 37 +++---- .../core/util/CustomCollectors.java | 3 + .../metapath/cst/BuildCstVisitorTest.java | 3 + .../cst/{ => items}/QuantifiedTest.java | 2 +- .../metapath/cst/{ => items}/RangeTest.java | 2 +- .../CSTLogicalExpressionsTest.java | 5 +- .../{ => logic}/PredicateExpressionTest.java | 4 +- .../cst/{ => logic}/ValueComparisonTest.java | 3 +- .../metapath/cst/{ => path}/FlagTest.java | 2 +- .../cst/{ => path}/RootSlashOnlyTest.java | 2 +- .../metapath/cst/{ => type}/CastTest.java | 2 +- .../cst/{ => type}/InstanceOfTest.java | 2 +- 117 files changed, 1102 insertions(+), 416 deletions(-) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/AbstractLiteralExpression.java (86%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/AbstractLookup.java (90%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/ArraySequenceConstructor.java (90%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/ArraySquareConstructor.java (89%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/DecimalLiteral.java (91%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/EmptySequence.java (84%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/FunctionCallAccessor.java (93%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/ILiteralExpression.java (86%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/IntegerLiteral.java (90%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/Intersect.java (81%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/MapConstructor.java (95%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/PostfixLookup.java (92%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/Quantified.java (96%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/Range.java (89%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/SimpleMap.java (85%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/StringConcat.java (84%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/StringLiteral.java (91%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/UnaryLookup.java (91%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/Union.java (83%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/AbstractFilterExpression.java (87%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/And.java (87%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/Except.java (87%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/IBooleanLogicExpression.java (76%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/If.java (90%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/Negate.java (83%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/Or.java (89%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/PredicateExpression.java (93%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => path}/IPathExpression.java (73%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/AbstractCastingExpression.java (82%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/Cast.java (88%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/Castable.java (90%) rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/InstanceOf.java (89%) create mode 100644 core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/package-info.java rename core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/{AnyRawItemType.java => AnyFunctionItemType.java} (54%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/QuantifiedTest.java (95%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => items}/RangeTest.java (96%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/CSTLogicalExpressionsTest.java (94%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/PredicateExpressionTest.java (94%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => logic}/ValueComparisonTest.java (97%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => path}/FlagTest.java (97%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => path}/RootSlashOnlyTest.java (95%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/CastTest.java (99%) rename core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/{ => type}/InstanceOfTest.java (99%) diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/DataTypeService.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/DataTypeService.java index 8dcc107ad..00994b6a2 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/DataTypeService.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/DataTypeService.java @@ -9,8 +9,8 @@ import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; import gov.nist.secauto.metaschema.core.metapath.type.IItemType; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.CollectionUtil; import gov.nist.secauto.metaschema.core.util.CustomCollectors; import gov.nist.secauto.metaschema.core.util.ObjectUtils; @@ -28,10 +28,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; -import javax.xml.namespace.QName; - import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import nl.talsmasoftware.lazy4j.Lazy; /** @@ -167,10 +166,13 @@ private DataTypeService() { * @return the data type or {@code null} if the data type is unknown to the type * system */ + @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "false positive") @Nullable - public IAtomicOrUnionType getAtomicTypeByQName(@NonNull QName qname) { - IEnhancedQName result = QNameCache.instance().get(qname); - return result == null ? null : getAtomicTypeByQNameIndex(result.getIndexPosition()); + public IAtomicOrUnionType getAtomicTypeByQName(@NonNull IEnhancedQName qname) { + return EQNameFactory.instance() + .get(qname.getIndexPosition()) + .map(name -> getAtomicTypeByQNameIndex(name.getIndexPosition())) + .orElse(null); } /** diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/Base64Adapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/Base64Adapter.java index 4e71b4035..c0ac0e427 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/Base64Adapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/Base64Adapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBase64BinaryItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.nio.ByteBuffer; @@ -30,9 +30,9 @@ public class Base64Adapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "base64"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "base64"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "base64Binary"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "base64Binary"))); Base64Adapter() { super(ByteBuffer.class, IBase64BinaryItem.class, IBase64BinaryItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/BooleanAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/BooleanAdapter.java index afdb3bb3a..4625ec2a3 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/BooleanAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/BooleanAdapter.java @@ -12,8 +12,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.io.IOException; @@ -31,7 +31,8 @@ public class BooleanAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "boolean"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "boolean"))); BooleanAdapter() { super(Boolean.class, IBooleanItem.class, IBooleanItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateAdapter.java index a3e3c87a6..92510937c 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateAdapter.java @@ -11,8 +11,8 @@ import gov.nist.secauto.metaschema.core.datatype.object.AmbiguousDate; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.LocalDate; @@ -36,7 +36,8 @@ public class DateAdapter extends AbstractCustomJavaDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "date"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "date"))); @NonNull private static final Pattern DATE_TIMEZONE = ObjectUtils.notNull( Pattern.compile("^(" diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeAdapter.java index d0c1d3fc9..6c5133842 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeAdapter.java @@ -11,8 +11,8 @@ import gov.nist.secauto.metaschema.core.datatype.object.AmbiguousDateTime; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateTimeItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.LocalDateTime; @@ -33,9 +33,9 @@ public class DateTimeAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "date-time"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "date-time"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "dateTime"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "dateTime"))); DateTimeAdapter() { super(AmbiguousDateTime.class, IDateTimeItem.class, IDateTimeItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeWithTZAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeWithTZAdapter.java index 3979596cd..5e31f852c 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeWithTZAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateTimeWithTZAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateTimeWithTimeZoneItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.DateTimeException; @@ -31,9 +31,9 @@ public class DateTimeWithTZAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "date-time-with-timezone"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "date-time-with-timezone"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "dateTime-with-timezone"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "dateTime-with-timezone"))); DateTimeWithTZAdapter() { super(ZonedDateTime.class, IDateTimeWithTimeZoneItem.class, IDateTimeWithTimeZoneItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateWithTZAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateWithTZAdapter.java index 4e0894cd7..896d63e5f 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateWithTZAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DateWithTZAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateWithTimeZoneItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.DateTimeException; @@ -32,7 +32,8 @@ public class DateWithTZAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "date-with-timezone"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "date-with-timezone"))); private static final Pattern DATE_TIMEZONE = Pattern.compile("^(" + "^(?:(?:2000|2400|2800|(?:19|2[0-9](?:0[48]|[2468][048]|[13579][26])))-02-29)" + "|(?:(?:(?:19|2[0-9])[0-9]{2})-02-(?:0[1-9]|1[0-9]|2[0-8]))" diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DayTimeAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DayTimeAdapter.java index 608959d22..e0cebaa51 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DayTimeAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DayTimeAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDayTimeDurationItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.Duration; @@ -29,7 +29,8 @@ public class DayTimeAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "day-time-duration"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "day-time-duration"))); DayTimeAdapter() { super(Duration.class, IDayTimeDurationItem.class, IDayTimeDurationItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DecimalAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DecimalAdapter.java index bcf32cfd6..f4e5247e0 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DecimalAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/DecimalAdapter.java @@ -11,8 +11,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDecimalItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.io.IOException; @@ -32,7 +32,8 @@ public class DecimalAdapter private static final MathContext MATH_CONTEXT = MathContext.DECIMAL64; @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "decimal"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "decimal"))); DecimalAdapter() { super(BigDecimal.class, IDecimalItem.class, IDecimalItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/EmailAddressAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/EmailAddressAdapter.java index a0f3aabd0..aedd28b02 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/EmailAddressAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/EmailAddressAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IEmailAddressItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -25,9 +25,9 @@ public class EmailAddressAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "email-address"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "email-address"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "email"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "email"))); EmailAddressAdapter() { super(IEmailAddressItem.class, IEmailAddressItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/HostnameAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/HostnameAdapter.java index 2f0a8ce43..68fd877cd 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/HostnameAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/HostnameAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IHostnameItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -24,7 +24,8 @@ public class HostnameAdapter extends AbstractStringAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "hostname"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "hostname"))); HostnameAdapter() { super(IHostnameItem.class, IHostnameItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv4AddressAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv4AddressAdapter.java index 3febea6ee..12bc8b126 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv4AddressAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv4AddressAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIPv4AddressItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -32,7 +32,8 @@ public class IPv4AddressAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "ip-v4-address"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "ip-v4-address"))); private static final IPAddressStringParameters IP_V_4; static { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv6AddressAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv6AddressAdapter.java index f6693b5fe..7b16256e9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv6AddressAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IPv6AddressAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIPv6AddressItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -32,7 +32,8 @@ public class IPv6AddressAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "ip-v6-address"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "ip-v6-address"))); private static final IPAddressStringParameters IP_V_6; static { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IntegerAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IntegerAdapter.java index 0e9d45b78..78b075792 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IntegerAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/IntegerAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.math.BigInteger; @@ -25,7 +25,8 @@ public class IntegerAdapter extends AbstractIntegerAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "integer"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "integer"))); IntegerAdapter() { super(IIntegerItem.class, IIntegerItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NcNameAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NcNameAdapter.java index 0e5704b35..fe15f2a50 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NcNameAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NcNameAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.INcNameItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -27,9 +27,9 @@ public class NcNameAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "ncname"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "ncname"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "NCName"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "NCName"))); private static final Pattern NCNAME = Pattern.compile(String.format("^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$")); /** diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NonNegativeIntegerAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NonNegativeIntegerAdapter.java index 04c793e34..c8d0bfa2e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NonNegativeIntegerAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/NonNegativeIntegerAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.INonNegativeIntegerItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.math.BigInteger; @@ -26,9 +26,9 @@ public class NonNegativeIntegerAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "non-negative-integer"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "non-negative-integer"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "nonNegativeInteger"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "nonNegativeInteger"))); NonNegativeIntegerAdapter() { super(INonNegativeIntegerItem.class, INonNegativeIntegerItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/PositiveIntegerAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/PositiveIntegerAdapter.java index a4d5a23db..a0ec219fe 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/PositiveIntegerAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/PositiveIntegerAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IPositiveIntegerItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.math.BigInteger; @@ -26,9 +26,9 @@ public class PositiveIntegerAdapter @NonNull private static final List NAMES = ObjectUtils.notNull( List.of( - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "positive-integer"), + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "positive-integer"), // for backwards compatibility with original type name - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "positiveInteger"))); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "positiveInteger"))); PositiveIntegerAdapter() { super(IPositiveIntegerItem.class, IPositiveIntegerItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/StringAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/StringAdapter.java index 5b3af0a32..ab657ad70 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/StringAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/StringAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -24,7 +24,8 @@ public class StringAdapter extends AbstractStringAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "string"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "string"))); StringAdapter() { super(IStringItem.class, IStringItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/TokenAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/TokenAdapter.java index 74e723fd2..fc83bae97 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/TokenAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/TokenAdapter.java @@ -7,8 +7,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.ITokenItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -24,7 +24,8 @@ public class TokenAdapter extends AbstractStringAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "token"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "token"))); TokenAdapter() { super(ITokenItem.class, ITokenItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriAdapter.java index 1017698fc..29232cd00 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyUriItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.net.URI; @@ -28,7 +28,8 @@ public class UriAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "uri"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "uri"))); UriAdapter() { super(URI.class, IAnyUriItem.class, IAnyUriItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriReferenceAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriReferenceAdapter.java index 304576140..5931557f9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriReferenceAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UriReferenceAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IUriReferenceItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.net.URI; @@ -28,7 +28,8 @@ public class UriReferenceAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "uri-reference"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "uri-reference"))); UriReferenceAdapter() { super(URI.class, IUriReferenceItem.class, IUriReferenceItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UuidAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UuidAdapter.java index 4beb8356e..c45c98b9f 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UuidAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/UuidAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IUuidItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.List; @@ -29,7 +29,8 @@ public class UuidAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "uuid"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "uuid"))); /** * A regular expression that matches a valid UUID. diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/YearMonthAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/YearMonthAdapter.java index 5339e278a..137301b84 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/YearMonthAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/YearMonthAdapter.java @@ -10,8 +10,8 @@ import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeAdapter; import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IYearMonthDurationItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.time.Period; @@ -29,7 +29,8 @@ public class YearMonthAdapter extends AbstractDataTypeAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "year-month-duration"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "year-month-duration"))); YearMonthAdapter() { super(Period.class, IYearMonthDurationItem.class, IYearMonthDurationItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java index abcbe5614..c4c0bb2ee 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java @@ -9,7 +9,7 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IMarkupItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; -import gov.nist.secauto.metaschema.core.qname.QNameCache; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import edu.umd.cs.findbugs.annotations.NonNull; @@ -42,7 +42,7 @@ public final class MarkupDataTypeProvider = IAtomicOrUnionType.of( IMarkupItem.class, IMarkupItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "markup")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "markup")); /** * Create the data type provider. diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupLineAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupLineAdapter.java index 9bd2e55ae..e24134c86 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupLineAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupLineAdapter.java @@ -9,8 +9,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IMarkupLineItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import org.codehaus.stax2.XMLEventReader2; @@ -32,7 +32,8 @@ public class MarkupLineAdapter extends AbstractMarkupAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "markup-line"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "markup-line"))); MarkupLineAdapter() { super(MarkupLine.class, IMarkupLineItem.class, IMarkupLineItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupMultilineAdapter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupMultilineAdapter.java index a83ec26b4..0e7ddfdc9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupMultilineAdapter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupMultilineAdapter.java @@ -9,8 +9,8 @@ import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IMarkupMultilineItem; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import org.codehaus.stax2.XMLEventReader2; @@ -32,7 +32,8 @@ public class MarkupMultilineAdapter extends AbstractMarkupAdapter { @NonNull private static final List NAMES = ObjectUtils.notNull( - List.of(QNameCache.instance().of(MetapathConstants.NS_METAPATH, "markup-multiline"))); + List.of( + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "markup-multiline"))); MarkupMultilineAdapter() { super(MarkupMultiline.class, IMarkupMultilineItem.class, IMarkupMultilineItem::cast); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/StaticContext.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/StaticContext.java index f2a64ba7a..50c42cccb 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/StaticContext.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/StaticContext.java @@ -64,7 +64,7 @@ public final class StaticContext { WELL_KNOWN_NAMESPACES = CollectionUtil.unmodifiableMap(knownNamespaces); WELL_KNOWN_NAMESPACES.forEach( - (prefix, namespace) -> NamespaceCache.instance().of(ObjectUtils.notNull(namespace))); + (prefix, namespace) -> NamespaceCache.instance().indexOf(ObjectUtils.notNull(namespace))); WELL_KNOWN_URI_TO_PREFIX = ObjectUtils.notNull(WELL_KNOWN_NAMESPACES.entrySet().stream() .collect(Collectors.toUnmodifiableMap( @@ -217,6 +217,31 @@ private String getDefaultFunctionNamespace() { return defaultFunctionNamespace; } + /** + * Parse the name of an atomic type. + * + *

+ * This method will attempt to identify the namespace corresponding to a given + * prefix. + *

+ * The prefix will be resolved using the following lookup order, advancing to + * the next when a {@code null} value is returned: + *

    + *
  1. Lookup the prefix using the namespaces registered with the static + * context.
  2. + *
  3. Lookup the prefix in the well-known namespaces.
  4. + *
+ * + * If an empty prefix is provided, the {@link MetapathConstants#NS_METAPATH} + * namespace will be used. + * + * @param name + * the name + * @return the parsed qualified name + * @throws StaticMetapathException + * with the code {@link StaticMetapathException#PREFIX_NOT_EXPANDABLE} + * if a non-empty prefix is provided + */ @NonNull public IEnhancedQName parseAtomicTypeName(@NonNull String name) { return EQNameFactory.instance().parseName( @@ -425,9 +450,11 @@ public static IFunction lookupFunction(@NonNull IEnhancedQName qname, int arity) *
  • Lookup the prefix using the namespaces registered with the static * context.
  • *
  • Lookup the prefix in the well-known namespaces.
  • - *
  • Use {@link XMLConstants#NULL_NS_URI}.
  • * * + * If an empty prefix is provided, the {@link XMLConstants#NULL_NS_URI} + * namespace will be used. + * * @param name * the name * @return the parsed qualified name @@ -462,9 +489,9 @@ private String resolveBasicPrefix(@NonNull String prefix) { *
  • Lookup the prefix using the namespaces registered with the static * context.
  • *
  • Lookup the prefix in the well-known namespaces.
  • - *
  • Use the default model namespace (see - * {@link Builder#defaultModelNamespace(String)}).
  • * + * If an empty prefix is provided, the + * {@link Builder#defaultModelNamespace(String)} namespace will be used. * * @param name * the name @@ -500,8 +527,9 @@ private String resolveModelReferencePrefix(@NonNull String prefix) { *
  • Lookup the prefix using the namespaces registered with the static * context.
  • *
  • Lookup the prefix in the well-known namespaces.
  • - *
  • Use {@link XMLConstants#NULL_NS_URI}.
  • * + * If an empty prefix is provided, the {@link XMLConstants#NULL_NS_URI} + * namespace will be used. * * @param name * the name @@ -627,7 +655,7 @@ public Builder namespace(@NonNull String prefix, @NonNull URI uri) { @NonNull public Builder namespace(@NonNull String prefix, @NonNull String uri) { this.namespaces.put(prefix, uri); - NamespaceCache.instance().of(uri); + NamespaceCache.instance().indexOf(uri); return this; } @@ -643,7 +671,7 @@ public Builder namespace(@NonNull String prefix, @NonNull String uri) { public Builder defaultModelNamespace(@NonNull URI namespace) { String uri = ObjectUtils.notNull(namespace.toASCIIString()); this.defaultModelNamespace = uri; - NamespaceCache.instance().of(uri); + NamespaceCache.instance().indexOf(uri); return this; } @@ -663,7 +691,7 @@ public Builder defaultModelNamespace(@NonNull String uri) { } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } - NamespaceCache.instance().of(uri); + NamespaceCache.instance().indexOf(uri); return this; } @@ -679,7 +707,7 @@ public Builder defaultModelNamespace(@NonNull String uri) { public Builder defaultFunctionNamespace(@NonNull URI namespace) { String uri = ObjectUtils.notNull(namespace.toASCIIString()); this.defaultFunctionNamespace = uri; - NamespaceCache.instance().of(uri); + NamespaceCache.instance().indexOf(uri); return this; } @@ -699,7 +727,7 @@ public Builder defaultFunctionNamespace(@NonNull String uri) { } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } - NamespaceCache.instance().of(uri); + NamespaceCache.instance().indexOf(uri); return this; } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractExpressionVisitor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractExpressionVisitor.java index 2ea54b21a..502e0399f 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractExpressionVisitor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractExpressionVisitor.java @@ -7,6 +7,28 @@ import gov.nist.secauto.metaschema.core.metapath.cst.comparison.GeneralComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySquareConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.DecimalLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.EmptySequence; +import gov.nist.secauto.metaschema.core.metapath.cst.items.FunctionCallAccessor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.IntegerLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Intersect; +import gov.nist.secauto.metaschema.core.metapath.cst.items.MapConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.PostfixLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Quantified; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Range; +import gov.nist.secauto.metaschema.core.metapath.cst.items.SimpleMap; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringConcat; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.UnaryLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Union; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Except; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Negate; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Or; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.PredicateExpression; import gov.nist.secauto.metaschema.core.metapath.cst.math.Addition; import gov.nist.secauto.metaschema.core.metapath.cst.math.Division; import gov.nist.secauto.metaschema.core.metapath.cst.math.IntegerDivision; @@ -25,6 +47,9 @@ import gov.nist.secauto.metaschema.core.metapath.cst.path.RootSlashPath; import gov.nist.secauto.metaschema.core.metapath.cst.path.Step; import gov.nist.secauto.metaschema.core.metapath.cst.path.Wildcard; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Cast; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Castable; +import gov.nist.secauto.metaschema.core.metapath.cst.type.InstanceOf; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCSTVisitor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCSTVisitor.java index 32a493fd3..8fa8ab952 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCSTVisitor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCSTVisitor.java @@ -11,6 +11,29 @@ import gov.nist.secauto.metaschema.core.metapath.cst.comparison.GeneralComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; import gov.nist.secauto.metaschema.core.metapath.cst.impl.TypeTestSupport; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySquareConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.DecimalLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.EmptySequence; +import gov.nist.secauto.metaschema.core.metapath.cst.items.FunctionCallAccessor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.IntegerLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Intersect; +import gov.nist.secauto.metaschema.core.metapath.cst.items.MapConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.PostfixLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Quantified; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Range; +import gov.nist.secauto.metaschema.core.metapath.cst.items.SimpleMap; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringConcat; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.UnaryLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Union; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Except; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.IBooleanLogicExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Negate; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Or; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.PredicateExpression; import gov.nist.secauto.metaschema.core.metapath.cst.math.Addition; import gov.nist.secauto.metaschema.core.metapath.cst.math.Division; import gov.nist.secauto.metaschema.core.metapath.cst.math.IntegerDivision; @@ -32,6 +55,8 @@ import gov.nist.secauto.metaschema.core.metapath.cst.path.RootSlashPath; import gov.nist.secauto.metaschema.core.metapath.cst.path.Step; import gov.nist.secauto.metaschema.core.metapath.cst.path.Wildcard; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Cast; +import gov.nist.secauto.metaschema.core.metapath.cst.type.InstanceOf; import gov.nist.secauto.metaschema.core.metapath.function.ComparisonFunctions; import gov.nist.secauto.metaschema.core.metapath.impl.AbstractKeySpecifier; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTPrinter.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTPrinter.java index acec9a7be..7bc09039e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTPrinter.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTPrinter.java @@ -7,6 +7,28 @@ import gov.nist.secauto.metaschema.core.metapath.cst.comparison.GeneralComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySquareConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.DecimalLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.EmptySequence; +import gov.nist.secauto.metaschema.core.metapath.cst.items.FunctionCallAccessor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.IntegerLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Intersect; +import gov.nist.secauto.metaschema.core.metapath.cst.items.MapConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.PostfixLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Quantified; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Range; +import gov.nist.secauto.metaschema.core.metapath.cst.items.SimpleMap; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringConcat; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.UnaryLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Union; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Except; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Negate; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Or; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.PredicateExpression; import gov.nist.secauto.metaschema.core.metapath.cst.math.Addition; import gov.nist.secauto.metaschema.core.metapath.cst.math.Division; import gov.nist.secauto.metaschema.core.metapath.cst.math.IntegerDivision; @@ -25,6 +47,9 @@ import gov.nist.secauto.metaschema.core.metapath.cst.path.RootSlashPath; import gov.nist.secauto.metaschema.core.metapath.cst.path.Step; import gov.nist.secauto.metaschema.core.metapath.cst.path.Wildcard; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Cast; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Castable; +import gov.nist.secauto.metaschema.core.metapath.cst.type.InstanceOf; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ICstExpressionFactory.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ICstExpressionFactory.java index 578c41aa0..4a3c4e048 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ICstExpressionFactory.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ICstExpressionFactory.java @@ -6,6 +6,14 @@ package gov.nist.secauto.metaschema.core.metapath.cst; import gov.nist.secauto.metaschema.core.metapath.cst.Let.VariableDeclaration; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySquareConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.DecimalLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.EmptySequence; +import gov.nist.secauto.metaschema.core.metapath.cst.items.FunctionCallAccessor; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Except; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; import gov.nist.secauto.metaschema.core.metapath.cst.math.Addition; import gov.nist.secauto.metaschema.core.metapath.item.IItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IExpressionVisitor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IExpressionVisitor.java index eae6c8fe3..055489253 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IExpressionVisitor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IExpressionVisitor.java @@ -7,6 +7,28 @@ import gov.nist.secauto.metaschema.core.metapath.cst.comparison.GeneralComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySequenceConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.ArraySquareConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.DecimalLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.EmptySequence; +import gov.nist.secauto.metaschema.core.metapath.cst.items.FunctionCallAccessor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.IntegerLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Intersect; +import gov.nist.secauto.metaschema.core.metapath.cst.items.MapConstructor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.PostfixLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Quantified; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Range; +import gov.nist.secauto.metaschema.core.metapath.cst.items.SimpleMap; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringConcat; +import gov.nist.secauto.metaschema.core.metapath.cst.items.StringLiteral; +import gov.nist.secauto.metaschema.core.metapath.cst.items.UnaryLookup; +import gov.nist.secauto.metaschema.core.metapath.cst.items.Union; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Except; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Negate; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Or; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.PredicateExpression; import gov.nist.secauto.metaschema.core.metapath.cst.math.Addition; import gov.nist.secauto.metaschema.core.metapath.cst.math.Division; import gov.nist.secauto.metaschema.core.metapath.cst.math.IntegerDivision; @@ -25,6 +47,9 @@ import gov.nist.secauto.metaschema.core.metapath.cst.path.RootSlashPath; import gov.nist.secauto.metaschema.core.metapath.cst.path.Step; import gov.nist.secauto.metaschema.core.metapath.cst.path.Wildcard; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Cast; +import gov.nist.secauto.metaschema.core.metapath.cst.type.Castable; +import gov.nist.secauto.metaschema.core.metapath.cst.type.InstanceOf; import edu.umd.cs.findbugs.annotations.NonNull; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/comparison/AbstractComparison.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/comparison/AbstractComparison.java index f563faae3..50d8de931 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/comparison/AbstractComparison.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/comparison/AbstractComparison.java @@ -6,8 +6,8 @@ package gov.nist.secauto.metaschema.core.metapath.cst.comparison; import gov.nist.secauto.metaschema.core.metapath.cst.AbstractBinaryExpression; -import gov.nist.secauto.metaschema.core.metapath.cst.IBooleanLogicExpression; import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.IBooleanLogicExpression; import gov.nist.secauto.metaschema.core.metapath.function.ComparisonFunctions; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLiteralExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLiteralExpression.java similarity index 86% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLiteralExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLiteralExpression.java index 1384b9655..6d94bd891 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLiteralExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLiteralExpression.java @@ -3,8 +3,9 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import edu.umd.cs.findbugs.annotations.NonNull; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLookup.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLookup.java similarity index 90% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLookup.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLookup.java index 476b682de..5ad3d9a5e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractLookup.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/AbstractLookup.java @@ -3,8 +3,9 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IKeySpecifier; import gov.nist.secauto.metaschema.core.metapath.item.function.IMapItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySequenceConstructor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySequenceConstructor.java similarity index 90% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySequenceConstructor.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySequenceConstructor.java index 038b7d678..32f6ba745 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySequenceConstructor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySequenceConstructor.java @@ -3,10 +3,12 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import java.util.List; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySquareConstructor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySquareConstructor.java similarity index 89% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySquareConstructor.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySquareConstructor.java index 6fb27e415..f79185922 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ArraySquareConstructor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ArraySquareConstructor.java @@ -3,10 +3,12 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/DecimalLiteral.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/DecimalLiteral.java similarity index 91% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/DecimalLiteral.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/DecimalLiteral.java index 8a567dc13..626c4e739 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/DecimalLiteral.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/DecimalLiteral.java @@ -3,10 +3,11 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDecimalItem; import java.math.BigDecimal; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/EmptySequence.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/EmptySequence.java similarity index 84% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/EmptySequence.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/EmptySequence.java index b97ad5b1c..9cf7ad6a3 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/EmptySequence.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/EmptySequence.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import java.util.Collections; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/FunctionCallAccessor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/FunctionCallAccessor.java similarity index 93% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/FunctionCallAccessor.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/FunctionCallAccessor.java index a427cc638..c1420dc17 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/FunctionCallAccessor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/FunctionCallAccessor.java @@ -3,12 +3,14 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.ISequence; import gov.nist.secauto.metaschema.core.metapath.StaticMetapathException; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.ArrayGet; import gov.nist.secauto.metaschema.core.metapath.function.library.MapGet; import gov.nist.secauto.metaschema.core.metapath.item.IItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ILiteralExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ILiteralExpression.java similarity index 86% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ILiteralExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ILiteralExpression.java index 2c072c439..f4e62453f 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/ILiteralExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/ILiteralExpression.java @@ -3,8 +3,9 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import java.util.Collections; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IntegerLiteral.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/IntegerLiteral.java similarity index 90% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IntegerLiteral.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/IntegerLiteral.java index 1625df92f..9bb45d8b5 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IntegerLiteral.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/IntegerLiteral.java @@ -3,10 +3,11 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem; import java.math.BigInteger; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Intersect.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Intersect.java similarity index 81% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Intersect.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Intersect.java index 0ab69f05e..1a2c9423e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Intersect.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Intersect.java @@ -3,9 +3,12 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.AbstractFilterExpression; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/MapConstructor.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/MapConstructor.java similarity index 95% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/MapConstructor.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/MapConstructor.java index 36e9c67c0..56a1c03df 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/MapConstructor.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/MapConstructor.java @@ -3,11 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IMapItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PostfixLookup.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/PostfixLookup.java similarity index 92% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PostfixLookup.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/PostfixLookup.java index 277e4fdc6..b07a5a2f6 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PostfixLookup.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/PostfixLookup.java @@ -3,11 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IKeySpecifier; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Quantified.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Quantified.java similarity index 96% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Quantified.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Quantified.java index c499d335a..8ef354ca5 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Quantified.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Quantified.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.FnBoolean; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Range.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Range.java similarity index 89% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Range.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Range.java index cfbfd960a..985026c74 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Range.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Range.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractBinaryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IIntegerItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/SimpleMap.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/SimpleMap.java similarity index 85% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/SimpleMap.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/SimpleMap.java index ad97b897e..9cbe5bbcf 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/SimpleMap.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/SimpleMap.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractBinaryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.util.CustomCollectors; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringConcat.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringConcat.java similarity index 84% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringConcat.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringConcat.java index e8599a887..2ef84c679 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringConcat.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringConcat.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractNAryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.FnConcat; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringLiteral.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringLiteral.java similarity index 91% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringLiteral.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringLiteral.java index 79222d7bc..e8c6b356e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/StringLiteral.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/StringLiteral.java @@ -3,10 +3,11 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IStringItem; import edu.umd.cs.findbugs.annotations.NonNull; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/UnaryLookup.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/UnaryLookup.java similarity index 91% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/UnaryLookup.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/UnaryLookup.java index 2398cbf4b..6a8c2aed4 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/UnaryLookup.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/UnaryLookup.java @@ -3,11 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IKeySpecifier; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Union.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Union.java similarity index 83% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Union.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Union.java index b2f3ad708..4b488a372 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Union.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/items/Union.java @@ -3,10 +3,14 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractNAryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.ExpressionUtils; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractFilterExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/AbstractFilterExpression.java similarity index 87% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractFilterExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/AbstractFilterExpression.java index 63b7ad7b8..23fc150bd 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractFilterExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/AbstractFilterExpression.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractBinaryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.ExpressionUtils; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import java.util.List; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/And.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/And.java similarity index 87% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/And.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/And.java index 9b3e0a6e0..ade1200db 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/And.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/And.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractNAryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.FnBoolean; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Except.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Except.java similarity index 87% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Except.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Except.java index 316f3e07e..5b88a1c78 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Except.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Except.java @@ -3,9 +3,11 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IBooleanLogicExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/IBooleanLogicExpression.java similarity index 76% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IBooleanLogicExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/IBooleanLogicExpression.java index f7d4d486b..77767241c 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IBooleanLogicExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/IBooleanLogicExpression.java @@ -3,8 +3,9 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; public interface IBooleanLogicExpression extends IExpression { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/If.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/If.java similarity index 90% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/If.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/If.java index 26de91c49..c3e78ba28 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/If.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/If.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.FnBoolean; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Negate.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Negate.java similarity index 83% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Negate.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Negate.java index be7451226..71c7bcb7e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Negate.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Negate.java @@ -3,10 +3,14 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractUnaryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.ExpressionUtils; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.FunctionUtils; import gov.nist.secauto.metaschema.core.metapath.function.OperationFunctions; import gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Or.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Or.java similarity index 89% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Or.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Or.java index b634c7cfe..abd9e94c9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Or.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/Or.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractNAryExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.function.library.FnBoolean; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpression.java similarity index 93% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpression.java index 001911ba7..8808011a3 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpression.java @@ -3,11 +3,14 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; import gov.nist.secauto.metaschema.core.metapath.MetapathEvaluationFeature; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; +import gov.nist.secauto.metaschema.core.metapath.cst.items.IntegerLiteral; import gov.nist.secauto.metaschema.core.metapath.function.library.FnBoolean; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/math/package-info.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/math/package-info.java index 0ac6d98ea..b08c109ec 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/math/package-info.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/math/package-info.java @@ -2,5 +2,8 @@ * SPDX-FileCopyrightText: none * SPDX-License-Identifier: CC0-1.0 */ +/** + * Compact syntax tree expressions supporting Metapath math operations. + */ package gov.nist.secauto.metaschema.core.metapath.cst.math; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/AbstractPathExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/AbstractPathExpression.java index aef36aea9..4f0cb4a62 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/AbstractPathExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/AbstractPathExpression.java @@ -9,7 +9,6 @@ import gov.nist.secauto.metaschema.core.metapath.ISequence; import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; -import gov.nist.secauto.metaschema.core.metapath.cst.IPathExpression; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.ItemUtils; import gov.nist.secauto.metaschema.core.metapath.item.node.ICycledAssemblyNodeItem; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IPathExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/IPathExpression.java similarity index 73% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IPathExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/IPathExpression.java index 5fd5748c3..9ab010c70 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/IPathExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/IPathExpression.java @@ -3,8 +3,9 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.path; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.IItem; public interface IPathExpression extends IExpression { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/package-info.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/package-info.java index c5e5edff0..a486ffded 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/package-info.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/path/package-info.java @@ -2,5 +2,8 @@ * SPDX-FileCopyrightText: none * SPDX-License-Identifier: CC0-1.0 */ +/** + * Compact syntax tree expressions supporting Metapath path traversal. + */ package gov.nist.secauto.metaschema.core.metapath.cst.path; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractCastingExpression.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/AbstractCastingExpression.java similarity index 82% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractCastingExpression.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/AbstractCastingExpression.java index 0514903b3..7bb4fd7be 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/AbstractCastingExpression.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/AbstractCastingExpression.java @@ -1,7 +1,13 @@ +/* + * SPDX-FileCopyrightText: none + * SPDX-License-Identifier: CC0-1.0 + */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; import gov.nist.secauto.metaschema.core.metapath.type.InvalidTypeMetapathException; @@ -11,6 +17,9 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * A base class for compact syntax expressions that perform casting operations. + */ public abstract class AbstractCastingExpression extends AbstractExpression { @NonNull @@ -74,6 +83,13 @@ public List getChildren() { return ObjectUtils.notNull(List.of(value)); } + /** + * Perform the cast operation. + * + * @param sequence + * the sequence to cast, which should contain a single item + * @return a sequence containing the casted item + */ @NonNull protected ISequence cast(@NonNull ISequence sequence) { IAnyAtomicItem result = type.cast(sequence); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Cast.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Cast.java similarity index 88% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Cast.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Cast.java index 4e461c757..85538bfbb 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Cast.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Cast.java @@ -3,10 +3,12 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Castable.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Castable.java similarity index 90% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Castable.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Castable.java index be257b4f2..1171d3296 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/Castable.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/Castable.java @@ -3,11 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; import gov.nist.secauto.metaschema.core.metapath.MetapathException; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOf.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOf.java similarity index 89% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOf.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOf.java index b798b22ee..e1d556c93 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOf.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOf.java @@ -3,10 +3,13 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.AbstractExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpressionVisitor; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/package-info.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/package-info.java new file mode 100644 index 000000000..e8b1a2c06 --- /dev/null +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/cst/type/package-info.java @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: none + * SPDX-License-Identifier: CC0-1.0 + */ + +/** + * Compact syntax tree expressions supporting Metapath type introspection. + */ + +package gov.nist.secauto.metaschema.core.metapath.cst.type; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IArgument.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IArgument.java index 6367bb907..af1ef9401 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IArgument.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/IArgument.java @@ -12,13 +12,10 @@ import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; import gov.nist.secauto.metaschema.core.metapath.type.Occurrence; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.qname.QNameCache; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.Objects; -import javax.xml.namespace.QName; - import edu.umd.cs.findbugs.annotations.NonNull; /** @@ -109,26 +106,6 @@ public Builder type(@NonNull IEnhancedQName name) { return this; } - /** - * Define the type of the function argument. - *

    - * By default an argument has the type {@link IItem}. - * - * @param name - * the qualified name of the argument's type - * @return this builder - */ - @NonNull - public Builder type(@NonNull QName name) { - IEnhancedQName result = QNameCache.instance().get(name); - if (result == null) { - throw new IllegalArgumentException( - String.format("A data type with the qname '%s' was not found.", - name)); - } - return type(result); - } - /** * Define the type of the function argument. *

    diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractArrayItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractArrayItem.java index 9c6350d09..5c3ee17c4 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractArrayItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractArrayItem.java @@ -25,19 +25,26 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * The base class for {@link IArrayItem} implementations, that provides an + * implementation of common methods. + * + * @param + * the Java type of the items contained within the sequence + */ public abstract class AbstractArrayItem extends ImmutableCollections.AbstractImmutableDelegatedList implements IArrayItem { @NonNull - public static final IEnhancedQName QNAME = IEnhancedQName.of("array"); + private static final IEnhancedQName QNAME = IEnhancedQName.of("array"); @NonNull - public static final Set PROPERTIES = ObjectUtils.notNull( + private static final Set PROPERTIES = ObjectUtils.notNull( EnumSet.of(FunctionProperty.DETERMINISTIC)); @NonNull - public static final List ARGUMENTS = ObjectUtils.notNull(List.of( + private static final List ARGUMENTS = ObjectUtils.notNull(List.of( IArgument.builder().name("position").type(IIntegerItem.type()).one().build())); @NonNull - public static final ISequenceType RESULT = ISequenceType.of( + private static final ISequenceType RESULT = ISequenceType.of( IAnyAtomicItem.type(), Occurrence.ZERO_OR_ONE); @NonNull @@ -56,6 +63,51 @@ public static IArrayItem empty() { return (IArrayItem) EMPTY; } + @Override + public boolean isDeterministic() { + return true; + } + + @Override + public boolean isContextDepenent() { + return false; + } + + @Override + public boolean isFocusDepenent() { + return false; + } + + @Override + public IEnhancedQName getQName() { + return QNAME; + } + + @Override + public Set getProperties() { + return PROPERTIES; + } + + @Override + public List getArguments() { + return ARGUMENTS; + } + + @Override + public int arity() { + return 1; + } + + @Override + public boolean isArityUnbounded() { + return false; + } + + @Override + public ISequenceType getResult() { + return RESULT; + } + @Override public ISequence execute(List> arguments, DynamicContext dynamicContext, ISequence focus) { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractMapItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractMapItem.java index 27fb9e08b..840b8f373 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractMapItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractMapItem.java @@ -27,19 +27,35 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * The base class for {@link IMapItem} implementations, that provide an + * implementation of common utility methods. + * + * @param + * the Java type of the value items contained within the map + */ public abstract class AbstractMapItem extends ImmutableCollections.AbstractImmutableDelegatedMap implements IMapItem { + /** + * The function qualified name. + */ @NonNull - public static final IEnhancedQName QNAME = IEnhancedQName.of("map"); + private static final IEnhancedQName QNAME = IEnhancedQName.of("map"); + /** + * The function properties. + */ @NonNull - public static final Set PROPERTIES = ObjectUtils.notNull( + private static final Set PROPERTIES = ObjectUtils.notNull( EnumSet.of(FunctionProperty.DETERMINISTIC)); + /** + * The function arguments. + */ @NonNull - public static final List ARGUMENTS = ObjectUtils.notNull(List.of( + private static final List ARGUMENTS = ObjectUtils.notNull(List.of( IArgument.builder().name("key").type(IAnyAtomicItem.type()).one().build())); @NonNull - public static final ISequenceType RESULT = ISequenceType.of( + private static final ISequenceType RESULT = ISequenceType.of( IAnyAtomicItem.type(), Occurrence.ZERO_OR_ONE); @NonNull @@ -59,6 +75,51 @@ public static IMapItem empty() { return (IMapItem) EMPTY; } + @Override + public boolean isDeterministic() { + return true; + } + + @Override + public boolean isContextDepenent() { + return false; + } + + @Override + public boolean isFocusDepenent() { + return false; + } + + @Override + public IEnhancedQName getQName() { + return QNAME; + } + + @Override + public Set getProperties() { + return PROPERTIES; + } + + @Override + public List getArguments() { + return ARGUMENTS; + } + + @Override + public int arity() { + return 1; + } + + @Override + public boolean isArityUnbounded() { + return false; + } + + @Override + public ISequenceType getResult() { + return RESULT; + } + @Override public ISequence execute(List> arguments, DynamicContext dynamicContext, ISequence focus) { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractSequence.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractSequence.java index 18db8ce0a..f67d81791 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractSequence.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractSequence.java @@ -13,6 +13,13 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * The base class for {@link ISequence} implementations, that provides an + * implementation of common methods. + * + * @param + * the Java type of the items contained within the sequence + */ public abstract class AbstractSequence extends ImmutableCollections.AbstractImmutableDelegatedList implements ISequence { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractStringMapKey.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractStringMapKey.java index 4e6ac4f16..be145cd1a 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractStringMapKey.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/impl/AbstractStringMapKey.java @@ -7,6 +7,9 @@ import gov.nist.secauto.metaschema.core.metapath.item.function.IMapKey; +/** + * An implementation of a {@link IMapKey} that uses a string-based value. + */ public abstract class AbstractStringMapKey implements IMapKey { @@ -18,7 +21,7 @@ public int hashCode() { @Override public boolean equals(Object obj) { return this == obj || - (obj instanceof AbstractStringMapKey - && getKey().asStringItem().equals(((AbstractStringMapKey) obj).getKey().asStringItem())); + obj instanceof AbstractStringMapKey + && getKey().asStringItem().equals(((AbstractStringMapKey) obj).getKey().asStringItem()); } } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractIPAddressItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractIPAddressItem.java index 22ace2b65..7bca4b6ce 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractIPAddressItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractIPAddressItem.java @@ -12,10 +12,23 @@ import edu.umd.cs.findbugs.annotations.NonNull; import inet.ipaddr.IPAddress; +/** + * An abstract implementation of a Metapath atomic item representing an IP + * address-based data value. + * + * @param + * the Java type of the data value + */ public abstract class AbstractIPAddressItem extends AbstractAnyAtomicItem implements IIPAddressItem { + /** + * Construct a new item. + * + * @param value + * the item's data value + */ protected AbstractIPAddressItem(@NonNull TYPE value) { super(value); } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractMarkupItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractMarkupItem.java index eb8f67631..0487571b1 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractMarkupItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/atomic/impl/AbstractMarkupItem.java @@ -12,11 +12,24 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * An abstract implementation of a Metapath atomic item representing a + * markup-based data value. + * + * @param + * the Java type of this markup item + */ public abstract class AbstractMarkupItem> extends AbstractAnyAtomicItem implements IMarkupItem { - public AbstractMarkupItem(@NonNull TYPE value) { + /** + * Construct a new item. + * + * @param value + * the item's data value + */ + protected AbstractMarkupItem(@NonNull TYPE value) { super(value); } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IArrayItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IArrayItem.java index 031064b9c..055fa7eee 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IArrayItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IArrayItem.java @@ -5,19 +5,15 @@ package gov.nist.secauto.metaschema.core.metapath.item.function; -import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.IPrintable; import gov.nist.secauto.metaschema.core.metapath.ISequence; -import gov.nist.secauto.metaschema.core.metapath.function.IArgument; import gov.nist.secauto.metaschema.core.metapath.function.IFunction; import gov.nist.secauto.metaschema.core.metapath.impl.AbstractArrayItem; import gov.nist.secauto.metaschema.core.metapath.impl.ArrayItemN; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.IItemVisitor; import gov.nist.secauto.metaschema.core.metapath.type.IItemType; -import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; -import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.ArrayList; @@ -46,6 +42,11 @@ */ @SuppressWarnings({ "PMD.ShortMethodName", "PMD.ExcessivePublicCount" }) public interface IArrayItem extends IFunction, IItem, List, IPrintable { + /** + * Get the type information for this item. + * + * @return the type information + */ @NonNull static IItemType type() { return IItemType.array(); @@ -63,59 +64,6 @@ static IArrayItem empty() { return AbstractArrayItem.empty(); } - @Override - default IEnhancedQName getQName() { - return AbstractArrayItem.QNAME; - } - - @Override - default Set getProperties() { - return AbstractArrayItem.PROPERTIES; - } - - @Override - default boolean isDeterministic() { - return true; - } - - @Override - default boolean isContextDepenent() { - return false; - } - - @Override - default boolean isFocusDepenent() { - return false; - } - - @Override - default List getArguments() { - return AbstractArrayItem.ARGUMENTS; - } - - @Override - default int arity() { - return 1; - } - - @Override - default boolean isArityUnbounded() { - return false; - } - - @Override - default ISequenceType getResult() { - return AbstractArrayItem.RESULT; - } - - @Override - ISequence execute(List> arguments, DynamicContext dynamicContext, ISequence focus); - - @Override - default String toSignature() { - return "array()"; - } - @Override List getValue(); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapItem.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapItem.java index bf6fc3bdf..eeb0be561 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapItem.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapItem.java @@ -5,11 +5,9 @@ package gov.nist.secauto.metaschema.core.metapath.item.function; -import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ICollectionValue; import gov.nist.secauto.metaschema.core.metapath.IPrintable; import gov.nist.secauto.metaschema.core.metapath.ISequence; -import gov.nist.secauto.metaschema.core.metapath.function.IArgument; import gov.nist.secauto.metaschema.core.metapath.function.IFunction; import gov.nist.secauto.metaschema.core.metapath.impl.AbstractMapItem; import gov.nist.secauto.metaschema.core.metapath.impl.MapItemN; @@ -17,14 +15,10 @@ import gov.nist.secauto.metaschema.core.metapath.item.IItemVisitor; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem; import gov.nist.secauto.metaschema.core.metapath.type.IItemType; -import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; -import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; -import java.util.Set; import edu.umd.cs.findbugs.annotations.NonNull; @@ -36,6 +30,11 @@ */ public interface IMapItem extends IFunction, IItem, Map, IPrintable { + /** + * Get the type information for this item. + * + * @return the type information + */ @NonNull static IItemType type() { return IItemType.map(); @@ -53,59 +52,6 @@ static IMapItem empty() { return AbstractMapItem.empty(); } - @Override - default IEnhancedQName getQName() { - return AbstractMapItem.QNAME; - } - - @Override - default Set getProperties() { - return AbstractMapItem.PROPERTIES; - } - - @Override - default boolean isDeterministic() { - return true; - } - - @Override - default boolean isContextDepenent() { - return false; - } - - @Override - default boolean isFocusDepenent() { - return false; - } - - @Override - default List getArguments() { - return AbstractMapItem.ARGUMENTS; - } - - @Override - default int arity() { - return 1; - } - - @Override - default boolean isArityUnbounded() { - return false; - } - - @Override - default ISequenceType getResult() { - return AbstractMapItem.RESULT; - } - - @Override - ISequence execute(List> arguments, DynamicContext dynamicContext, ISequence focus); - - @Override - default String toSignature() { - return "array()"; - } - @Override Map getValue(); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapKey.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapKey.java index 435a9f5b6..623ab45ee 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapKey.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/item/function/IMapKey.java @@ -9,6 +9,9 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * The key value used in an {@link IMapItem}. + */ public interface IMapKey { /** diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/AbstractAtomicOrUnionType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/AbstractAtomicOrUnionType.java index c7c0aae57..0a92b4ed8 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/AbstractAtomicOrUnionType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/AbstractAtomicOrUnionType.java @@ -13,14 +13,14 @@ /** * An abstract implementation of an atomic type. * - * @param + * @param * the Java type of the item supported by the implementation */ -public abstract class AbstractAtomicOrUnionType - extends AbstractItemType - implements IAtomicOrUnionType { +public abstract class AbstractAtomicOrUnionType + extends AbstractItemType + implements IAtomicOrUnionType { @NonNull - private final ICastExecutor castExecutor; + private final ICastExecutor castExecutor; /** * Construct a new atomic type. @@ -31,14 +31,14 @@ public abstract class AbstractAtomicOrUnionType * the executor used to cast an item to an item of this type */ public AbstractAtomicOrUnionType( - @NonNull Class itemClass, - @NonNull ICastExecutor castExecutor) { + @NonNull Class itemClass, + @NonNull ICastExecutor castExecutor) { super(itemClass); this.castExecutor = castExecutor; } @Override - public I cast(IAnyAtomicItem item) { + public T cast(IAnyAtomicItem item) { return castExecutor.cast(item); } } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/DataTypeItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/DataTypeItemType.java index 2e3c7b952..1664d8dfa 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/DataTypeItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/DataTypeItemType.java @@ -16,11 +16,11 @@ /** * An abstract implementation of an atomic type backed by a data type adapter. * - * @param + * @param * the Java type of the item supported by the implementation */ -public class DataTypeItemType - extends AbstractAtomicOrUnionType { +public class DataTypeItemType + extends AbstractAtomicOrUnionType { @NonNull private final IDataTypeAdapter adapter; @@ -36,8 +36,8 @@ public class DataTypeItemType */ public DataTypeItemType( @NonNull IDataTypeAdapter adapter, - @NonNull Class itemClass, - @NonNull ICastExecutor castExecutor) { + @NonNull Class itemClass, + @NonNull ICastExecutor castExecutor) { super(itemClass, castExecutor); this.adapter = adapter; } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/IItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/IItemType.java index 942b1c462..6ba9de111 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/IItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/IItemType.java @@ -13,9 +13,9 @@ import gov.nist.secauto.metaschema.core.metapath.item.node.IFlagNodeItem; import gov.nist.secauto.metaschema.core.metapath.item.node.IModuleNodeItem; import gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem; +import gov.nist.secauto.metaschema.core.metapath.type.impl.AnyFunctionItemType; import gov.nist.secauto.metaschema.core.metapath.type.impl.AnyItemType; import gov.nist.secauto.metaschema.core.metapath.type.impl.AnyKindTest; -import gov.nist.secauto.metaschema.core.metapath.type.impl.AnyRawItemType; import gov.nist.secauto.metaschema.core.metapath.type.impl.ArrayTestImpl; import gov.nist.secauto.metaschema.core.metapath.type.impl.KindAssemblyTestImpl; import gov.nist.secauto.metaschema.core.metapath.type.impl.KindDocumentTestImpl; @@ -52,7 +52,7 @@ static IItemType item() { * @return the function test */ static IItemType function() { - return AnyRawItemType.ANY_FUNCTION; + return AnyFunctionItemType.ANY_FUNCTION; } // static IFunctionTest function(@NonNull ISequenceType result, @NonNull @@ -67,7 +67,7 @@ static IItemType function() { */ @NonNull static IItemType map() { - return AnyRawItemType.ANY_MAP; + return AnyFunctionItemType.ANY_MAP; } /** @@ -94,7 +94,7 @@ static IMapTest map(@NonNull IAtomicOrUnionType key, @NonNull ISequenceType v */ @NonNull static IItemType array() { - return AnyRawItemType.ANY_ARRAY; + return AnyFunctionItemType.ANY_ARRAY; } /** @@ -122,7 +122,7 @@ static IAtomicOrUnionType anyAtomic() { } /** - * Get a new kind test that matches any node item. + * Get a new kind test that matches any {@link INodeItem}. * * @return the node kind test */ @@ -132,7 +132,7 @@ static IKindTest node() { } /** - * Get a new kind test that matches any Metaschema module. + * Get a new kind test that matches any Metaschema {@link IModuleNodeItem}. * * @return the module kind test */ @@ -142,7 +142,7 @@ static IKindTest module() { } /** - * Get a new kind test that matches any document. + * Get a new kind test that matches any {@link IDocumentNodeItem}. * * @param test * the root node test @@ -154,8 +154,8 @@ static IKindTest document() { } /** - * Get a new kind test that that matches a document that has a root node of the - * provided kind. + * Get a new kind test that that matches an {@link IDocumentNodeItem} that has a + * root node of the provided kind. * * @param test * the root node test @@ -167,7 +167,7 @@ static IKindTest document(@NonNull IKindTest assembly() { } /** - * Matches an assembly with the provided name and a type matching the provided - * name of a specific assembly definition. + * Get a new kind test that matches a {@link IAssemblyNodeItem} with the + * provided name and a type matching the provided name of a specific assembly + * definition. *

    * If used as part of a document kind test, the the provided * {@code instanceName} will match the root assembly name of the document's @@ -202,8 +203,8 @@ static IKindTest assembly( } /** - * Matches an assembly with any name and a type matching the provided name of a - * specific assembly definition. + * Get a new kind test that matches an {@link IAssemblyNodeItem} with any name + * and a type matching the provided name of a specific assembly definition. * * @param typeName * the name of the assembly definition to match @@ -219,7 +220,7 @@ static IKindTest assembly( } /** - * Matches any field regardless of its name or type. + * Matches any {@link IFieldNodeItem} regardless of its name or type. * * @return the test */ @@ -229,8 +230,8 @@ static IKindTest field() { } /** - * Matches an field with the provided name and a type matching the provided name - * of a specific field definition. + * Matches any {@link IFieldNodeItem} with the provided name and a type matching + * the provided name of a specific field definition. * * @param instanceName * the name of the field instance to match depending on the use context @@ -249,8 +250,8 @@ static IKindTest field( } /** - * Matches an field with any name and a type matching the provided name of a - * specific field definition. + * Matches any {@link IFieldNodeItem} with a name and type matching the provided + * name of a specific field definition. * * @param typeName * the name of the field definition to match @@ -264,7 +265,7 @@ static IKindTest field(@NonNull String typeName, @NonNull Static } /** - * Matches any flag regardless of its name or type. + * Matches any {@link IFlagNodeItem} regardless of its name or type. * * @return the test */ @@ -274,8 +275,8 @@ static IKindTest flag() { } /** - * Matches an flag with the provided name and a type matching the provided name - * of a specific globally-scoped flag definition. + * Matches any {@link IFlagNodeItem} with the provided name and type matching + * the provided name of a specific globally-scoped flag definition. * * @param instanceName * the name of the flag instance to match @@ -294,8 +295,8 @@ static IKindTest flag( } /** - * Matches an flag with any name and a type matching the provided name of a - * specific globally-scoped flag definition. + * Matches any {@link IFlagNodeItem} with any name and type matching the + * provided name of a specific globally-scoped flag definition. * * @param typeName * the name of the globally-scoped flag definition to match diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/ISequenceType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/ISequenceType.java index 06ac6ad9f..2caad97ec 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/ISequenceType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/ISequenceType.java @@ -23,7 +23,7 @@ public interface ISequenceType { */ @NonNull static ISequenceType empty() { - return SequenceTypeImpl.EMPTY; + return SequenceTypeImpl.empty(); } /** diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractDefinitionTest.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractDefinitionTest.java index cf96da57e..bcad8e444 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractDefinitionTest.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractDefinitionTest.java @@ -15,11 +15,28 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * This abstract implementation supports kind tests based on node item that have + * an underlying Metaschema definition. + *

    + * This class uses late binding for the type name, to ensure that the same name + * can be used to identify the name of the definition or the name of the atomic + * type (in the case of a field or flag). + * + * @param + * the Java type of the node-based item supported by the implementation + */ public abstract class AbstractDefinitionTest> implements IKindTest { + /** + * The qualified name of the node instance. + */ @Nullable - protected final IEnhancedQName instanceName; + private final IEnhancedQName instanceName; + /** + * The qualified name of the definition or atomic type. + */ @Nullable - protected final String typeName; + private final String typeName; @NonNull private final String signature; @NonNull @@ -69,6 +86,31 @@ protected AbstractDefinitionTest( .toString()); } + /** + * Get the qualified name of the node instance. + * + * @return the qualified name + */ + @Nullable + protected IEnhancedQName getInstanceName() { + return instanceName; + } + + /** + * Get the qualified name of the definition or atomic type. + * + * @return the qualified name or {@code null} if this value should not be tested + */ + @Nullable + protected String getTypeName() { + return typeName; + } + + /** + * Get the static context used to lookup names and types for the test. + * + * @return the static context + */ @NonNull protected StaticContext getTestStaticContext() { return testStaticContext; @@ -87,13 +129,21 @@ public boolean isInstance(IItem item) { && matches((T) item); } - protected boolean matches(@NonNull T item) { + private boolean matches(@NonNull T item) { return matchesInstance(item) && matchesType(item); } - protected boolean matchesInstance(@NonNull T item) { + private boolean matchesInstance(@NonNull T item) { return instanceName == null || ObjectUtils.notNull(instanceName).equals(item.getQName()); } + /** + * Perform the model type-specific checks. + * + * @param item + * the item to test + * @return {@code true} if the item meets expectations, or {@code false} + * otherwise + */ protected abstract boolean matchesType(@NonNull T item); } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractItemType.java index bd5692b7a..87266cf50 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AbstractItemType.java @@ -10,16 +10,28 @@ import edu.umd.cs.findbugs.annotations.NonNull; -public abstract class AbstractItemType implements IItemType { +/** + * A common base class for item type implementations. + * + * @param + * the Java type of the item supported by the implementation + */ +public abstract class AbstractItemType implements IItemType { @NonNull - private final Class itemClass; + private final Class itemClass; - protected AbstractItemType(@NonNull Class itemClass) { + /** + * Construct a new item type. + * + * @param itemClass + * the item class this type supports + */ + protected AbstractItemType(@NonNull Class itemClass) { this.itemClass = itemClass; } @Override - public Class getItemClass() { + public Class getItemClass() { return itemClass; } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyRawItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyFunctionItemType.java similarity index 54% rename from core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyRawItemType.java rename to core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyFunctionItemType.java index 40e4995f5..911cf9157 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyRawItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyFunctionItemType.java @@ -6,34 +6,49 @@ package gov.nist.secauto.metaschema.core.metapath.type.impl; import gov.nist.secauto.metaschema.core.metapath.function.IFunction; -import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import gov.nist.secauto.metaschema.core.metapath.item.function.IMapItem; import gov.nist.secauto.metaschema.core.metapath.type.IItemType; import edu.umd.cs.findbugs.annotations.NonNull; -public final class AnyRawItemType - extends AbstractItemType { +/** + * An item type that applies to all items of a specific node-based type. + * + * @param + * the Java type of the function-based item supported by the + * implementation + */ +public final class AnyFunctionItemType + extends AbstractItemType { + /** + * Matches to all {@link IFunction}. + */ @NonNull - public static final IItemType ANY_FUNCTION = new AnyRawItemType<>( + public static final IItemType ANY_FUNCTION = new AnyFunctionItemType<>( IFunction.class, "function(*)"); + /** + * Matches to all {@link IMapItem}. + */ @NonNull - public static final IItemType ANY_MAP = new AnyRawItemType<>( + public static final IItemType ANY_MAP = new AnyFunctionItemType<>( IMapItem.class, "map(*)"); + /** + * Matches to all {@link IArrayItem}. + */ @NonNull - public static final IItemType ANY_ARRAY = new AnyRawItemType<>( + public static final IItemType ANY_ARRAY = new AnyFunctionItemType<>( IArrayItem.class, "array(*)"); @NonNull private final String signature; - private AnyRawItemType( - @NonNull Class itemClass, + private AnyFunctionItemType( + @NonNull Class itemClass, @NonNull String signature) { super(itemClass); this.signature = signature; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyItemType.java index 957a044ae..4ae9c4c68 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyItemType.java @@ -11,12 +11,20 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +/** + * An item type that applies to all items. + */ @SuppressFBWarnings(value = "SING_SINGLETON_GETTER_NOT_SYNCHRONIZED", justification = "false positive") public final class AnyItemType implements IItemType { @NonNull private static final AnyItemType INSTANCE = new AnyItemType(); + /** + * Get the singleton instance. + * + * @return the singleton instance + */ @NonNull public static AnyItemType instance() { return INSTANCE; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyKindTest.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyKindTest.java index 26b256546..e9c3d0cf9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyKindTest.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/AnyKindTest.java @@ -16,35 +16,59 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * An item type that applies to all items of a specific node-based type. + * + * @param + * the Java type of the node-based item supported by the implementation + */ @SuppressWarnings("PMD.TestClassWithoutTestCases") -public class AnyKindTest - extends AbstractItemType - implements IKindTest { +public final class AnyKindTest + extends AbstractItemType + implements IKindTest { + /** + * Matches to all nodes. + */ @NonNull public static final IKindTest ANY_NODE = new AnyKindTest<>( "node", INodeItem.class, ""); + /** + * Matches all module nodes. + */ @NonNull public static final IKindTest ANY_MODULE = new AnyKindTest<>( "module", IModuleNodeItem.class, ""); + /** + * Matches all document nodes. + */ @NonNull public static final IKindTest ANY_DOCUMENT = new AnyKindTest<>( "document-node", IDocumentNodeItem.class, ""); + /** + * Matches all assembly nodes. + */ @NonNull public static final IKindTest ANY_ASSEMBLY = new AnyKindTest<>( "assembly", IAssemblyNodeItem.class, ""); + /** + * Matches all field nodes. + */ @NonNull public static final IKindTest ANY_FIELD = new AnyKindTest<>( "field", IFieldNodeItem.class, ""); + /** + * Matches all flag nodes. + */ @NonNull public static final IKindTest ANY_FLAG = new AnyKindTest<>( "flag", @@ -53,9 +77,9 @@ public class AnyKindTest @NonNull private final String signature; - protected AnyKindTest( + private AnyKindTest( @NonNull String testName, - @NonNull Class itemClass, + @NonNull Class itemClass, @NonNull String test) { super(itemClass); this.signature = ObjectUtils.notNull(new StringBuilder() diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/ArrayTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/ArrayTestImpl.java index bb7fd18e7..a019b71fe 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/ArrayTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/ArrayTestImpl.java @@ -5,15 +5,26 @@ package gov.nist.secauto.metaschema.core.metapath.type.impl; +import gov.nist.secauto.metaschema.core.metapath.item.function.IArrayItem; import gov.nist.secauto.metaschema.core.metapath.type.IArrayTest; import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; import edu.umd.cs.findbugs.annotations.NonNull; +/** + * An item type that applies to all {@link IArrayItem} with a specific value + * type. + */ public class ArrayTestImpl implements IArrayTest { @NonNull private final ISequenceType valueType; + /** + * Construct a new item type. + * + * @param valueType + * the sequence type to match array contents against + */ public ArrayTestImpl(@NonNull ISequenceType valueType) { this.valueType = valueType; } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/DynamicTypeSupport.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/DynamicTypeSupport.java index 00266dee3..0d694b072 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/DynamicTypeSupport.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/DynamicTypeSupport.java @@ -21,8 +21,24 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * Provides a variety of methods to check the dynamic type of a definition-based + * node item. + */ public final class DynamicTypeSupport { + /** + * Checks that the provided actual item matches the provided expected type name. + * + * @param actual + * the item to check + * @param expected + * the expected definition or atomic type name + * @param staticContext + * used to resolve definition names and lookup atomic type names + * @return {@code true} if the expected name matches either the node's + * definition name or the node's atomic type, or {@code false} otherwise + */ public static boolean derivesFrom( @NonNull IFlagNodeItem actual, @NonNull String expected, @@ -32,6 +48,18 @@ public static boolean derivesFrom( || compareAtomicTypes(expected, definition.getJavaTypeAdapter().getItemType(), staticContext); } + /** + * Checks that the provided actual item matches the provided expected type name. + * + * @param actual + * the item to check + * @param expected + * the expected definition or atomic type name + * @param staticContext + * used to resolve definition names and lookup atomic type names + * @return {@code true} if the expected name matches either the node's + * definition name or the node's atomic type, or {@code false} otherwise + */ public static boolean derivesFrom( @NonNull IFieldNodeItem actual, @NonNull String expected, @@ -41,6 +69,18 @@ public static boolean derivesFrom( || compareAtomicTypes(expected, definition.getJavaTypeAdapter().getItemType(), staticContext); } + /** + * Checks that the provided actual item matches the provided expected type name. + * + * @param actual + * the item to check + * @param expected + * the expected definition name + * @param staticContext + * used to resolve definition names + * @return {@code true} if the expected name matches the node's definition name, + * or {@code false} otherwise + */ public static boolean derivesFrom( @NonNull IAssemblyNodeItem actual, @NonNull String expected, diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindAssemblyTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindAssemblyTestImpl.java index 3bc14f20a..e7e510751 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindAssemblyTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindAssemblyTestImpl.java @@ -9,14 +9,27 @@ import gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem; import gov.nist.secauto.metaschema.core.metapath.type.IKindTest; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.util.ObjectUtils; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * Tests that that a given item is an {@link IAssemblyNodeItem} with the + * provided node and type name. + */ public class KindAssemblyTestImpl extends AbstractDefinitionTest implements IKindTest { + /** + * Construct a new test. + * + * @param instanceName + * the name of the node + * @param typeName + * the expected definition name to check against + * @param staticContext + * used to resolve the definition name + */ public KindAssemblyTestImpl( @Nullable IEnhancedQName instanceName, @Nullable String typeName, @@ -31,7 +44,8 @@ public Class getItemClass() { @Override protected boolean matchesType(IAssemblyNodeItem item) { + String typeName = getTypeName(); return typeName == null - || DynamicTypeSupport.derivesFrom(item, ObjectUtils.notNull(typeName), getTestStaticContext()); + || DynamicTypeSupport.derivesFrom(item, typeName, getTestStaticContext()); } } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindDocumentTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindDocumentTestImpl.java index ecc248d69..b8430a21c 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindDocumentTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindDocumentTestImpl.java @@ -14,18 +14,21 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * Tests that that a given item is an {@link IDocumentNodeItem} that has a root + * node of the provided kind. + */ public class KindDocumentTestImpl implements IKindTest { - @NonNull - public static final KindDocumentTestImpl ANY = new KindDocumentTestImpl(); private final IKindTest assemblyTest; @NonNull private final String signature; - private KindDocumentTestImpl() { - this.assemblyTest = null; - this.signature = "document()"; - } - + /** + * Construct a new test. + * + * @param assemblyTest + * the root node test + */ public KindDocumentTestImpl(@NonNull IKindTest assemblyTest) { this.assemblyTest = assemblyTest; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFieldTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFieldTestImpl.java index 0c553005e..06b9a3342 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFieldTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFieldTestImpl.java @@ -9,15 +9,28 @@ import gov.nist.secauto.metaschema.core.metapath.item.node.IFieldNodeItem; import gov.nist.secauto.metaschema.core.metapath.type.IKindTest; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.util.ObjectUtils; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * Tests that that a given item is an {@link IFieldNodeItem} with the provided + * node and type name. + */ public class KindFieldTestImpl extends AbstractDefinitionTest implements IKindTest { + /** + * Construct a new test. + * + * @param instanceName + * the name of the node + * @param typeName + * the expected definition or atomic type name to check against + * @param staticContext + * used to resolve definition names and lookup atomic type names + */ public KindFieldTestImpl( @Nullable IEnhancedQName instanceName, @Nullable String typeName, @@ -32,7 +45,8 @@ public Class getItemClass() { @Override protected boolean matchesType(IFieldNodeItem item) { + String typeName = getTypeName(); return typeName == null - || DynamicTypeSupport.derivesFrom(item, ObjectUtils.notNull(typeName), getTestStaticContext()); + || DynamicTypeSupport.derivesFrom(item, typeName, getTestStaticContext()); } } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFlagTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFlagTestImpl.java index 1280b7fb9..8783ecfc5 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFlagTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/KindFlagTestImpl.java @@ -9,14 +9,27 @@ import gov.nist.secauto.metaschema.core.metapath.item.node.IFlagNodeItem; import gov.nist.secauto.metaschema.core.metapath.type.IKindTest; import gov.nist.secauto.metaschema.core.qname.IEnhancedQName; -import gov.nist.secauto.metaschema.core.util.ObjectUtils; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * Tests that that a given item is an {@link IFlagNodeItem} with the provided + * node and type name. + */ public class KindFlagTestImpl extends AbstractDefinitionTest implements IKindTest { + /** + * Construct a new test. + * + * @param instanceName + * the name of the node + * @param typeName + * the expected definition or atomic type name to check against + * @param staticContext + * used to resolve definition names and lookup atomic type names + */ public KindFlagTestImpl( @Nullable IEnhancedQName instanceName, @Nullable String typeName, @@ -31,7 +44,8 @@ public Class getItemClass() { @Override protected boolean matchesType(IFlagNodeItem item) { + String typeName = getTypeName(); return typeName == null - || DynamicTypeSupport.derivesFrom(item, ObjectUtils.notNull(typeName), getTestStaticContext()); + || DynamicTypeSupport.derivesFrom(item, typeName, getTestStaticContext()); } } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/MapTestImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/MapTestImpl.java index 782b00bc4..1216e727f 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/MapTestImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/MapTestImpl.java @@ -5,19 +5,31 @@ package gov.nist.secauto.metaschema.core.metapath.type.impl; +import gov.nist.secauto.metaschema.core.metapath.item.function.IMapItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; import gov.nist.secauto.metaschema.core.metapath.type.IMapTest; import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType; import edu.umd.cs.findbugs.annotations.NonNull; +/** + * An item type that applies to all {@link IMapItem} with a specific key and + * value type. + */ public class MapTestImpl implements IMapTest { - // FIXME: share code with ArrayTest? @NonNull private final IAtomicOrUnionType keyType; @NonNull private final ISequenceType valueType; + /** + * Construct a new item type. + * + * @param keyType + * the atomic type to match map keys against + * @param valueType + * the sequence type to match map values against + */ public MapTestImpl( @NonNull IAtomicOrUnionType keyType, @NonNull ISequenceType valueType) { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/NonAdapterAtomicItemType.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/NonAdapterAtomicItemType.java index eba898e1c..6761dfc0d 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/NonAdapterAtomicItemType.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/NonAdapterAtomicItemType.java @@ -15,14 +15,30 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; -public class NonAdapterAtomicItemType - extends AbstractAtomicOrUnionType { +/** + * An abstract implementation of an abstract atomic type. + * + * @param + * the Java type of the item supported by the implementation + */ +public class NonAdapterAtomicItemType + extends AbstractAtomicOrUnionType { @NonNull private final IEnhancedQName qname; + /** + * Construct a new atomic type. + * + * @param itemClass + * the item class this atomic type supports + * @param castExecutor + * the executor used to cast an item to an item of this type + * @param qname + * the qualified name of the data type + */ public NonAdapterAtomicItemType( - @NonNull Class itemClass, - @NonNull ICastExecutor castExecutor, + @NonNull Class itemClass, + @NonNull ICastExecutor castExecutor, @NonNull IEnhancedQName qname) { super(itemClass, castExecutor); this.qname = qname; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/SequenceTypeImpl.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/SequenceTypeImpl.java index 1b761bcc4..5bd2edb58 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/SequenceTypeImpl.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/SequenceTypeImpl.java @@ -17,9 +17,14 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * A concrete implementation that supports + * sequence + * type testing. + */ public class SequenceTypeImpl implements ISequenceType { @NonNull - public static final ISequenceType EMPTY = new ISequenceType() { + private static final ISequenceType EMPTY = new ISequenceType() { @Override public boolean isEmpty() { return true; @@ -51,6 +56,24 @@ public boolean matches(ICollectionValue item) { @NonNull private final Occurrence occurrence; + /** + * Matches an empty sequence. + * + * @return the empty sequence type + */ + @NonNull + public static ISequenceType empty() { + return EMPTY; + } + + /** + * Construct a new sequence type. + * + * @param type + * the type of items in the sequence + * @param occurrence + * the occurrence of items in the sequence + */ public SequenceTypeImpl(@NonNull IItemType type, @NonNull Occurrence occurrence) { Objects.requireNonNull(type, "type"); Objects.requireNonNull(occurrence, "occurrence"); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/TypeConstants.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/TypeConstants.java index 2fe230c9f..c65eb4d91 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/TypeConstants.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/type/impl/TypeConstants.java @@ -12,10 +12,13 @@ import gov.nist.secauto.metaschema.core.metapath.item.atomic.INumericItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.ITemporalItem; import gov.nist.secauto.metaschema.core.metapath.type.IAtomicOrUnionType; -import gov.nist.secauto.metaschema.core.qname.QNameCache; +import gov.nist.secauto.metaschema.core.qname.EQNameFactory; import edu.umd.cs.findbugs.annotations.NonNull; +/** + * Provides static instances for all abstract atomic types. + */ @SuppressWarnings("PMD.DataClass") public final class TypeConstants { @@ -27,7 +30,7 @@ public final class TypeConstants { = IAtomicOrUnionType.of( IAnyAtomicItem.class, IAnyAtomicItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "any-atomic-type")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "any-atomic-type")); /** * The Metaschema data type that represents all duration types. */ @@ -36,7 +39,7 @@ public final class TypeConstants { = IAtomicOrUnionType.of( IDurationItem.class, IDurationItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "duration")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "duration")); /** * The Metaschema data type that represents all IP address types. */ @@ -45,7 +48,7 @@ public final class TypeConstants { = IAtomicOrUnionType.of( IIPAddressItem.class, IIPAddressItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "ip-address")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "ip-address")); /** * The Metaschema data type that represents all numeric types. */ @@ -54,7 +57,7 @@ public final class TypeConstants { = IAtomicOrUnionType.of( INumericItem.class, INumericItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "numeric")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "numeric")); /** * The Metaschema data type that represents all temporal types that work with * dates and times. @@ -64,7 +67,7 @@ public final class TypeConstants { = IAtomicOrUnionType.of( ITemporalItem.class, ITemporalItem::cast, - QNameCache.instance().of(MetapathConstants.NS_METAPATH, "temporal")); + EQNameFactory.instance().newQName(MetapathConstants.NS_METAPATH, "temporal")); private TypeConstants() { // disable construction diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/FlagContainerBuilder.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/FlagContainerBuilder.java index d380da319..cc66edeb1 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/FlagContainerBuilder.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/FlagContainerBuilder.java @@ -79,7 +79,7 @@ private static INSTANCE handleShadowedInstances IModelDefinition owningDefinition = shadowing.getContainingDefinition(); IModule module = owningDefinition.getContainingModule(); LOGGER.error("Unexpected duplicate flag instance name '%s' in definition '%s' in module name '%s' at '%s'", - EQNameFactory.instance().get(keyIndex), + EQNameFactory.instance().get(keyIndex).or(null), owningDefinition.getDefinitionQName(), module.getShortName(), module.getLocation()); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/DefaultContainerFlagSupport.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/DefaultContainerFlagSupport.java index ebeb462b8..51a8078fa 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/DefaultContainerFlagSupport.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/DefaultContainerFlagSupport.java @@ -13,6 +13,12 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * A flag container. + * + * @param + * the Java type of the flags supported by the container + */ public class DefaultContainerFlagSupport implements IContainerFlagSupport { @NonNull private final Map instances; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/EmptyFlagContainer.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/EmptyFlagContainer.java index 742f6756a..40fa4c9d2 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/EmptyFlagContainer.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/impl/EmptyFlagContainer.java @@ -13,10 +13,23 @@ import edu.umd.cs.findbugs.annotations.NonNull; -public class EmptyFlagContainer implements IContainerFlagSupport { +/** + * Represents an flag container with no flags. + * + * @param + * the Java type of the flags supported by the container + */ +public final class EmptyFlagContainer implements IContainerFlagSupport { + /** + * The singleton instance. + */ @NonNull public static final EmptyFlagContainer EMPTY = new EmptyFlagContainer<>(); + private EmptyFlagContainer() { + // diable construction + } + @Override public Map getFlagInstanceMap() { return CollectionUtil.emptyMap(); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlModule.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlModule.java index d876537e3..38e16af29 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlModule.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlModule.java @@ -271,7 +271,7 @@ private Definitions(@NonNull METASCHEMA metaschemaNode) { (key, v1, v2) -> { throw new ModelInitializationException( String.format("Duplicate root QName '%s' for root assemblies: %s and %s in %s.", - IEnhancedQName.of(key), + IEnhancedQName.of(key).or(null), v1.getName(), v2.getName(), XmlObjectParser.toLocation(cursor))); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/EQNameFactory.java b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/EQNameFactory.java index ef5913823..e82b4218d 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/EQNameFactory.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/EQNameFactory.java @@ -7,18 +7,24 @@ import gov.nist.secauto.metaschema.core.util.ObjectUtils; -import java.net.URI; +import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.XMLConstants; -import javax.xml.namespace.QName; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; import nl.talsmasoftware.lazy4j.Lazy; -public class EQNameFactory { +/** + * A factory that produces qualified names. + *

    + * This implementation uses an underlying integer-based cache to reduce the + * memory footprint of qualified names and namespaces by reusing instances with + * the same namespace and local name. + */ +public final class EQNameFactory { private static final Pattern URI_QUALIFIED_NAME = Pattern.compile("^Q\\{([^{}]*)\\}(.+)$"); private static final Pattern LEXICAL_NAME = Pattern.compile("^(?:([^:]+):)?(.+)$"); @NonNull @@ -27,6 +33,11 @@ public class EQNameFactory { @NonNull private final QNameCache cache; + /** + * Get the singleton instance. + * + * @return the singleton instance + */ @NonNull public static EQNameFactory instance() { return ObjectUtils.notNull(INSTANCE.get()); @@ -37,35 +48,38 @@ private EQNameFactory() { this(QNameCache.instance()); } - public EQNameFactory(@NonNull QNameCache cache) { + private EQNameFactory(@NonNull QNameCache cache) { this.cache = cache; } - @Nullable - public IEnhancedQName get(int index) { - return cache.get(index); - } - - @NonNull - public IEnhancedQName newQName(@NonNull QName qname) { - return cache.of(qname); - } - + /** + * Get an existing qualified name by looking up the cached entry using the + * provided index value. + * + * @param index + * the index value to lookup + * @return an optional containing the qualified name, if it exists + */ @NonNull - public IEnhancedQName newQName(@NonNull String localName) { - return cache.of("", localName); + public Optional get(int index) { + return ObjectUtils.notNull(Optional.ofNullable(cache.get(index))); } + /** + * Get a new qualified name based on the provided namespace and local name. + * + * @param namespace + * the namespace part of the qualified name + * @param localName + * the local part of the qualified name + * + * @return the qualified name + */ @NonNull public IEnhancedQName newQName(@NonNull String namespace, @NonNull String localName) { return cache.of(namespace, localName); } - @NonNull - public IEnhancedQName newQName(@NonNull URI namespace, @NonNull String localName) { - return cache.of(namespace, localName); - } - /** * Parse a name as a qualified name. *

    diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/IEnhancedQName.java b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/IEnhancedQName.java index 811c14436..39ab98b0b 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/IEnhancedQName.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/IEnhancedQName.java @@ -9,6 +9,7 @@ import gov.nist.secauto.metaschema.core.util.ObjectUtils; import java.net.URI; +import java.util.Optional; import javax.xml.XMLConstants; import javax.xml.namespace.QName; @@ -16,47 +17,115 @@ import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; +/** + * An efficient cache-backed representation of a qualified name. + *

    + * This implementation uses an underlying integer-based cache to reduce the + * memory footprint of qualified names and namespaces by reusing instances with + * the same namespace and local name. + */ public interface IEnhancedQName { + /** + * Get the index position of the qualified name. + *

    + * This value can be used in place of this object. The object can be retrieved + * using this index with the {@link #of(int)} method. + * + * @return the index position + */ int getIndexPosition(); + /** + * Get the namespace part of the qualified name. + * + * @return the namespace + */ @NonNull String getNamespace(); + /** + * Get the namespace part of the qualified name. + * + * @return the namespace as a URI + */ @NonNull URI getNamespaceAsUri(); + /** + * Get the local part of the qualified name. + * + * @return the local name + */ @NonNull String getLocalName(); + /** + * Get an existing qualified name by looking up the cached entry using the + * provided index value. + * + * @param index + * the index value to lookup + * @return an optional containing the qualified name, if it exists + */ @SuppressWarnings("PMD.ShortMethodName") - @Nullable - static IEnhancedQName of(int index) { + @NonNull + static Optional of(int index) { return EQNameFactory.instance().get(index); } + /** + * Get a qualified name using the provided {@link QName} value. + * + * @param qname + * the qualified name to get + * @return the qualified name + */ @SuppressWarnings("PMD.ShortMethodName") @NonNull static IEnhancedQName of(@NonNull QName qname) { - return EQNameFactory.instance().newQName(qname); + return of(ObjectUtils.notNull(qname.getNamespaceURI()), ObjectUtils.notNull(qname.getLocalPart())); } + /** + * Get a qualified name using the provided local name value with no namespace. + * + * @param localName + * the qualified name local part + * @return the qualified name + */ @SuppressWarnings("PMD.ShortMethodName") @NonNull static IEnhancedQName of(@NonNull String localName) { - return EQNameFactory.instance().newQName(localName); + return of("", localName); } + /** + * Get a qualified name using the provided namespace and local name. + * + * @param namespace + * the qualified name namespace part + * @param localName + * the qualified name local part + * @return the qualified name + */ @SuppressWarnings("PMD.ShortMethodName") @NonNull - static IEnhancedQName of(@NonNull String namespace, @NonNull String localName) { - return namespace.isEmpty() - ? EQNameFactory.instance().newQName(localName) - : EQNameFactory.instance().newQName(namespace, localName); + static IEnhancedQName of(@NonNull URI namespace, @NonNull String localName) { + return of(ObjectUtils.notNull(namespace.toASCIIString()), localName); } + /** + * Get a qualified name using the provided namespace and local name. + * + * @param namespace + * the qualified name namespace part + * @param localName + * the qualified name local part + * @return the qualified name + */ @SuppressWarnings("PMD.ShortMethodName") @NonNull - static IEnhancedQName of(@NonNull URI namespace, @NonNull String localName) { + static IEnhancedQName of(@NonNull String namespace, @NonNull String localName) { return EQNameFactory.instance().newQName(namespace, localName); } @@ -91,11 +160,23 @@ default String toEQName(@Nullable NamespaceToPrefixResolver resolver) { .toString()); } + /** + * Generate a {@link QName} without a namespace prefix. + * + * @return the name + */ @NonNull default QName toQName() { return toQName(XMLConstants.DEFAULT_NS_PREFIX); } + /** + * Generate a {@link QName} using the provided namespace prefix. + * + * @param prefix + * the prefix to use + * @return the name + */ @NonNull QName toQName(@NonNull String prefix); diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/NamespaceCache.java b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/NamespaceCache.java index 3eada2beb..8a08f08de 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/NamespaceCache.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/NamespaceCache.java @@ -16,6 +16,10 @@ import edu.umd.cs.findbugs.annotations.NonNull; import nl.talsmasoftware.lazy4j.Lazy; +/** + * An integer-based cache of namespaces to reduce the memory footprint of + * namespaces used by reusing instances with the same namespace. + */ public final class NamespaceCache { @NonNull private static final Lazy INSTANCE = ObjectUtils.notNull(Lazy.lazy(NamespaceCache::new)); @@ -30,25 +34,31 @@ public final class NamespaceCache { */ private final AtomicInteger indexCounter = new AtomicInteger(); + /** + * Get the singleton instance. + * + * @return the singleton instance + */ @NonNull public static NamespaceCache instance() { return ObjectUtils.notNull(INSTANCE.get()); } - public NamespaceCache() { + private NamespaceCache() { // claim the "0" position - int noNamespaceIndex = of(""); + int noNamespaceIndex = indexOf(""); assert noNamespaceIndex == 0; } - // FIXME: check for use and prefer the string version - @SuppressWarnings("PMD.ShortMethodName") - public int of(@NonNull URI namespace) { - return of(ObjectUtils.notNull(namespace.toASCIIString())); - } - + /** + * Get the index value of the provided namespace. + * + * @param namespace + * the namespace + * @return the index value + */ @SuppressWarnings("PMD.ShortMethodName") - public int of(@NonNull String namespace) { + public int indexOf(@NonNull String namespace) { return nsToIndex.computeIfAbsent(namespace, key -> { int nextIndex = indexCounter.getAndIncrement(); indexToNs.put(nextIndex, namespace); @@ -56,16 +66,38 @@ public int of(@NonNull String namespace) { }); } + /** + * Lookup the index value for an existing namespace. + * + * @param namespace + * the namespace to lookup + * @return an optional containing the index value, if it exists + */ @NonNull public Optional get(@NonNull String namespace) { return ObjectUtils.notNull(Optional.ofNullable(nsToIndex.get(namespace))); } + /** + * Lookup the namespace using the index value for an existing namespace. + * + * @param index + * the index value to lookup + * @return an optional containing the namespace, if the index value exists + */ @NonNull public Optional get(int index) { return ObjectUtils.notNull(Optional.ofNullable(indexToNs.get(index))); } + /** + * Lookup the namespace using the index value for an existing namespace. + * + * @param index + * the index value to lookup + * @return an optional containing the namespace as a URI, if the index value + * exists + */ @NonNull public Optional getAsURI(int index) { return ObjectUtils.notNull(Optional.ofNullable(indexToNsUri.computeIfAbsent(index, key -> { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/QNameCache.java b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/QNameCache.java index f65477547..e12114070 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/qname/QNameCache.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/qname/QNameCache.java @@ -20,7 +20,7 @@ import edu.umd.cs.findbugs.annotations.Nullable; import nl.talsmasoftware.lazy4j.Lazy; -public class QNameCache { +final class QNameCache { @NonNull private static final Lazy INSTANCE = ObjectUtils.notNull(Lazy.lazy(QNameCache::new)); @@ -34,6 +34,11 @@ public class QNameCache { */ private final AtomicInteger indexCounter = new AtomicInteger(); + /** + * Get the singleton qualified name cache. + * + * @return the singleton instance + */ @NonNull public static QNameCache instance() { return ObjectUtils.notNull(INSTANCE.get()); @@ -44,36 +49,20 @@ private QNameCache() { this(NamespaceCache.instance()); } - public QNameCache(@NonNull NamespaceCache nsCache) { + private QNameCache(@NonNull NamespaceCache nsCache) { this.namespaceCache = nsCache; } @NonNull - public NamespaceCache getNamespaceCache() { + private NamespaceCache getNamespaceCache() { return namespaceCache; } @SuppressWarnings("PMD.ShortMethodName") @NonNull - public IEnhancedQName of(@NonNull URI namespace, @NonNull String name) { - return of( - ObjectUtils.notNull(namespace.toASCIIString()), - name); - } - - @SuppressWarnings("PMD.ShortMethodName") - @NonNull - public IEnhancedQName of(@NonNull QName qname) { - return of( - ObjectUtils.notNull(qname.getNamespaceURI()), - ObjectUtils.notNull(qname.getLocalPart())); - } - - @SuppressWarnings("PMD.ShortMethodName") - @NonNull - public IEnhancedQName of(@NonNull String namespace, @NonNull String name) { + IEnhancedQName of(@NonNull String namespace, @NonNull String name) { - int namespacePosition = namespaceCache.of(namespace); + int namespacePosition = namespaceCache.indexOf(namespace); Map namespaceNames = nsIndexToLocalNameToIndex .computeIfAbsent(namespacePosition, key -> new ConcurrentHashMap<>()); @@ -87,14 +76,14 @@ public IEnhancedQName of(@NonNull String namespace, @NonNull String name) { } @Nullable - public IEnhancedQName get(@NonNull QName qname) { + IEnhancedQName get(@NonNull QName qname) { return get( ObjectUtils.notNull(qname.getNamespaceURI()), ObjectUtils.notNull(qname.getLocalPart())); } @Nullable - public IEnhancedQName get(@NonNull String namespace, @NonNull String name) { + IEnhancedQName get(@NonNull String namespace, @NonNull String name) { Optional nsPosition = namespaceCache.get(namespace); if (!nsPosition.isPresent()) { throw new IllegalArgumentException( @@ -108,7 +97,7 @@ public IEnhancedQName get(@NonNull String namespace, @NonNull String name) { } @Nullable - public IEnhancedQName get(int index) { + IEnhancedQName get(int index) { return indexToQName.get(index); } diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/util/CustomCollectors.java b/core/src/main/java/gov/nist/secauto/metaschema/core/util/CustomCollectors.java index 9ecf33633..03eb2e86c 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/util/CustomCollectors.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/util/CustomCollectors.java @@ -26,6 +26,9 @@ import edu.umd.cs.findbugs.annotations.NonNull; +/** + * A variety of collector and other stream utilities. + */ @SuppressWarnings("PMD.CouplingBetweenObjects") public final class CustomCollectors { /** diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java index 7320132b4..8580a2a01 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/BuildCstVisitorTest.java @@ -31,6 +31,9 @@ import gov.nist.secauto.metaschema.core.metapath.cst.comparison.AbstractComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.GeneralComparison; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; +import gov.nist.secauto.metaschema.core.metapath.cst.items.SimpleMap; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.If; import gov.nist.secauto.metaschema.core.metapath.function.ComparisonFunctions; import gov.nist.secauto.metaschema.core.metapath.item.IItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/QuantifiedTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/QuantifiedTest.java similarity index 95% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/QuantifiedTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/QuantifiedTest.java index 7ac9fae69..5631496b0 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/QuantifiedTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/QuantifiedTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RangeTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/RangeTest.java similarity index 96% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RangeTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/RangeTest.java index af9c7bcde..392290f58 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RangeTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/items/RangeTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.items; import static gov.nist.secauto.metaschema.core.metapath.TestUtils.integer; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTLogicalExpressionsTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/CSTLogicalExpressionsTest.java similarity index 94% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTLogicalExpressionsTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/CSTLogicalExpressionsTest.java index 18633e8a8..086962e93 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CSTLogicalExpressionsTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/CSTLogicalExpressionsTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -11,6 +11,9 @@ import gov.nist.secauto.metaschema.core.metapath.ExpressionTestBase; import gov.nist.secauto.metaschema.core.metapath.ISequence; import gov.nist.secauto.metaschema.core.metapath.MetapathExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.And; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.Or; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.util.ObjectUtils; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpressionTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpressionTest.java similarity index 94% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpressionTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpressionTest.java index 6c2f12542..b33fd5da4 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/PredicateExpressionTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/PredicateExpressionTest.java @@ -3,13 +3,15 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import static org.junit.jupiter.api.Assertions.assertEquals; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ExpressionTestBase; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; +import gov.nist.secauto.metaschema.core.metapath.cst.logic.PredicateExpression; import gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem; import gov.nist.secauto.metaschema.core.util.CollectionUtil; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/ValueComparisonTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/ValueComparisonTest.java similarity index 97% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/ValueComparisonTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/ValueComparisonTest.java index 19ea510bf..2759bb2da 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/ValueComparisonTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/logic/ValueComparisonTest.java @@ -3,13 +3,14 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.logic; import static org.junit.jupiter.api.Assertions.assertEquals; import gov.nist.secauto.metaschema.core.metapath.DynamicContext; import gov.nist.secauto.metaschema.core.metapath.ExpressionTestBase; import gov.nist.secauto.metaschema.core.metapath.ISequence; +import gov.nist.secauto.metaschema.core.metapath.cst.IExpression; import gov.nist.secauto.metaschema.core.metapath.cst.comparison.ValueComparison; import gov.nist.secauto.metaschema.core.metapath.function.ComparisonFunctions; import gov.nist.secauto.metaschema.core.metapath.item.IItem; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/FlagTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/FlagTest.java similarity index 97% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/FlagTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/FlagTest.java index 83c272db3..0ae6d5c48 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/FlagTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/FlagTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.path; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RootSlashOnlyTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/RootSlashOnlyTest.java similarity index 95% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RootSlashOnlyTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/RootSlashOnlyTest.java index e5f2e2137..f263fecf2 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/RootSlashOnlyTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/path/RootSlashOnlyTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.path; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CastTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/CastTest.java similarity index 99% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CastTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/CastTest.java index ec00cafcb..aac262e96 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/CastTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/CastTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import static gov.nist.secauto.metaschema.core.metapath.TestUtils.base64; import static gov.nist.secauto.metaschema.core.metapath.TestUtils.bool; diff --git a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOfTest.java b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOfTest.java similarity index 99% rename from core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOfTest.java rename to core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOfTest.java index 44c55fe22..51a0b1d53 100644 --- a/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/InstanceOfTest.java +++ b/core/src/test/java/gov/nist/secauto/metaschema/core/metapath/cst/type/InstanceOfTest.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: CC0-1.0 */ -package gov.nist.secauto.metaschema.core.metapath.cst; +package gov.nist.secauto.metaschema.core.metapath.cst.type; import static gov.nist.secauto.metaschema.core.metapath.TestUtils.integer; import static gov.nist.secauto.metaschema.core.metapath.TestUtils.string;