Class GMonthDayValue

All Implemented Interfaces:
Iterable<AtomicValue>, AtomicMatchKey, AtomicSequence, GroundedValue, IdentityComparable, Item, Sequence, ConversionResult

public class GMonthDayValue extends GDateValue
Implementation of the xs:gYear data type
  • Constructor Details

    • GMonthDayValue

      public GMonthDayValue(int month, int day, int tz)
      Constructs an instance of GMonthDayValue without any validation of the input values.
      Parameters:
      month - - number of a month within an arbitrary year
      day - - number of a day within the specified month
      tz - - number of minutes to adjust by for the timezone
    • GMonthDayValue

      public GMonthDayValue(int month, int day, int tz, AtomicMetadata type)
      Constructs an instance of GMonthDayValue without any validation of the input values.
      Parameters:
      month - - number of a month within an arbitrary year
      day - - number of a day within the specified month
      tz - - number of minutes to adjust by for the timezone
      type - = the type annotation to be used
  • Method Details

    • getDefinedComponents

      protected EnumSet<AccessorFn.Component> getDefinedComponents()
      Overrides:
      getDefinedComponents in class GDateValue
    • makeGMonthDayValue

      public static ConversionResult makeGMonthDayValue(UnicodeString value)
      Parse a GMonthDay value from its lexical representation
      Parameters:
      value - the lexical representation of the xs:gMonthDay value
      Returns:
      either a GMonthDayValue, or a validation error
    • makeGMonthDayValue

      public static ConversionResult makeGMonthDayValue(int month, int day, int timezoneInMinutes)
      Creates an instance of GMonthDayValue. Includes validation checks. If a validation error is detected, an instance of ValidationFailure will be returned instead.
      Parameters:
      month - - number of a month within an arbitrary year
      day - - number of a day within the specified month
      timezoneInMinutes - - number of minutes to adjust by for the timezone
      Returns:
      - an instance of GMonthDayValue or ValidationFailure
    • withMetadata

      public AtomicValue withMetadata(AtomicMetadata metadata)
      Make a copy of this date, time, or dateTime value, with a different type annotation
      Specified by:
      withMetadata in class AtomicValue
      Parameters:
      metadata - the type label of the new copy. The caller is responsible for checking that the value actually conforms to this type.
      Returns:
      the copied value
    • getXPathComparable

      public XPathComparable getXPathComparable(StringCollator collator, int implicitTimezone, int specVersion) throws NoDynamicContextException
      Description copied from class: AtomicValue
      Get an object value that implements the XPath equality and ordering comparison semantics for this value. A collation is supplied for comparing strings, and an implicit timezone for comparing date/time values that have no saved timezone. An atomic value may return itself as the result, provided that its ordering rules are independent of the collation and timezone, and provided that it implements the XPathComparable interface: which means that its compareTo, equals, and hashCode methods must be compatible with the rules for XPath value comparisons.
      Overrides:
      getXPathComparable in class GDateValue
      Parameters:
      collator - the collation to be used when comparing strings
      implicitTimezone - the implicit timezone in the dynamic context, used when comparing dates/times with and without timezone
      specVersion - the version of the XPath specification (31 for 3.1, 40 for 4.0)
      Returns:
      an Object that implements the XPath value comparison semantics with respect to this atomic value. For an atomic type that is not ordered (according to XPath rules), return null.
      Throws:
      NoDynamicContextException - if the supplied implicit timezone is "NO_TIMEZONE" (meaning unknown), and the implicit timezone is actually required because the value in question is a date/time value with no timezone. This can cause a failure to evaluate expressions statically (because the implicit timezone is not known statically), and it will then be caught, meaning that the expression has to be evaluated dynamically.
    • getPrimitiveType

      public BuiltInAtomicType getPrimitiveType()
      Determine the primitive type of the value. This delivers the same answer as getItemType().getPrimitiveItemType(). The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is AnyAtomicType.
      Specified by:
      getPrimitiveType in class AtomicValue
      Returns:
      the primitive type
    • getPrimitiveStringValue

      public UnicodeString getPrimitiveStringValue()
      Description copied from class: AtomicValue
      Convert the value to a string, using the serialization rules for the primitive type. This is the result of conversion to a string except that postprocessing defined by the saxon:preprocess facet is not (yet) applied.
      Specified by:
      getPrimitiveStringValue in class AtomicValue
      Returns:
      the value converted to a string according to the rules for the primitive type
    • add

      public CalendarValue add(DurationValue duration) throws XPathException
      Add a duration to this date/time value
      Specified by:
      add in class CalendarValue
      Parameters:
      duration - the duration to be added (which might be negative)
      Returns:
      a new date/time value representing the result of adding the duration. The original object is not modified.
      Throws:
      XPathException - if an error is detected
    • adjustTimezone

      public CalendarValue adjustTimezone(int tz)
      Return a new date, time, or dateTime with the same normalized value, but in a different timezone
      Specified by:
      adjustTimezone in class CalendarValue
      Parameters:
      tz - the new timezone, in minutes
      Returns:
      the date/time in the new timezone