/** * Return the time component of the dateTime - i.e. just the hours/mins/seconds, * and returns the values in seconds. * @throws IllegalDateTimeFieldException if there is no legal time component */ public double getTimePart() throws IllegalDateTimeFieldException { if ((mask & TIME_MASK) == 0) throw new IllegalDateTimeFieldException("Time not available"); return ((data[h]) * 60l + data[m]) * 60l + getSeconds(); }
/** * Return the number of hours in the dateTime * @throws IllegalDateTimeFieldException if there is no legal time component */ public int getHours() throws IllegalDateTimeFieldException { if ((mask & TIME_MASK) == 0) throw new IllegalDateTimeFieldException("Time not available"); return data[h]; }
public NodeValueDuration(XSDDuration dt) { duration = dt ; if (dt.getDays() != 0 && dt.getMonths() !=0 && dt.getYears() != 0) { throw new ExprException("Illegal time: "+dt) ; } if ( dt.getTimePart() == 0 ) throw new ExprException("Illegal time: "+dt) ; }
public static String XSDDateTime2String(XSDDateTime xdt) { return xdt.toString() ; }
/** * Constructor - create a full DateTime object from a java calendar instance. * * @param date java calendar instance */ public XSDDateTime(Calendar date) { super(convertCalendar(date)); this.mask = FULL_MASK; }
/** * Return the time component of the duration - i.e. just the hours/mins/seconds, * and returns the values in seconds. */ public double getTimePart() { return ((data[h]) * 60l + data[m]) * 60l + getSeconds(); }
/** * Constructor * @param value the date/time value returned by the parsing */ public AbstractDateTime(Object value) { data = (int[]) value; //if (data[utc] == 0) data[utc]='Z'; extractFractionalSeconds(); }
/** * Comparison function. Not quite the same as normal java compare * because XSD date/times are not always comparable. * * @param other the time/date to compare to * @return an order flag - one of LESS_THAN, EQUAL, GREATER_THEN, INDETERMINATE */ public int compare(AbstractDateTime other) { return compareDates(data, other.data, true); }
protected static int fQuotient (int temp, int low, int high) { //fQuotient(a - low, high - low) return fQuotient(temp - low, high - low); }
/** @param lexical @return Number */ protected Number suitableInteger( String lexical ) { long number = Long.parseLong( lexical ); return suitableInteger( number ); }
@Override protected Node makeNode() { String lex = duration.toString() ; return Node.createLiteral(lex, null, XSDDatatype.XSDtime) ; }
public static String XSDDateTime2String(XSDDateTime xdt) { return xdt.toString() ; }
/** * Return the number of years in the dateTime. * @throws IllegalDateTimeFieldException if there is no legal year component */ public int getYears() throws IllegalDateTimeFieldException { if ((mask & YEAR_MASK) == 0) throw new IllegalDateTimeFieldException("Year not available"); return data[CY]; }
@Override protected Node makeNode() { String lex = dateTime.toString() ; return Node.createLiteral(lex, null, XSDDatatype.XSDdateTime) ; }
/** * Return the month in the dateTime, this is in ISO8601 format so january = 1 * @throws IllegalDateTimeFieldException if there is no legal month component */ public int getMonths() throws IllegalDateTimeFieldException { if ((mask & MONTH_MASK) == 0) throw new IllegalDateTimeFieldException("Month not available"); return data[M]; }
/** * Return the number of years in the dateTime * @throws IllegalDateTimeFieldException if there is no legal day component */ public int getDays() throws IllegalDateTimeFieldException { if ((mask & DAY_MASK) == 0) throw new IllegalDateTimeFieldException("Day not available"); return data[D]; }
/** * Return the number of minutes in the dateTime * @throws IllegalDateTimeFieldException if there is no legal time component */ public int getMinutes() throws IllegalDateTimeFieldException { if ((mask & TIME_MASK) == 0) throw new IllegalDateTimeFieldException("Time not available"); return data[m]; }
/** * Return the number of full seconds in the dateTime * @throws IllegalDateTimeFieldException if there is no legal time component */ public int getFullSeconds() throws IllegalDateTimeFieldException { if ((mask & TIME_MASK) == 0) throw new IllegalDateTimeFieldException("Time not available"); return data[s]; }
/** * Return the number of seconds in the dateTime, including fractional part * @throws IllegalDateTimeFieldException if there is no legal time component */ public double getSeconds() throws IllegalDateTimeFieldException { if ((mask & TIME_MASK) == 0) throw new IllegalDateTimeFieldException("Time not available"); return data[s] + fractionalSeconds; }