source: fedd/abac-src/rtml/src/edu/stanford/rt/datatype/TimeType.java @ 8780cbec

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 8780cbec was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package edu.stanford.rt.datatype;
2
3import java.util.Date;
4
5/**
6 * @author Ninghui Li, Sandra Qiu<br>
7 *
8 * DataType for time values in RTML. It's a wrapper class for XML built-in
9 * date time type.
10 */
11public class TimeType extends OrderedType
12{
13    /**
14     * Constructor for TimeType.
15     */
16    public TimeType(String name)
17    {
18        super(name);
19    }
20   
21        /* (non-Javadoc)
22         * @see edu.stanford.rt.datatype.SimpleType#isValidValue(DataValue)
23         */
24    public boolean isValidValue(DataValue value)
25    {
26        if(! (value instanceof TimeValue))
27            return false;
28
29        return true;
30    }
31   
32        /* (non-Javadoc)
33         * @see edu.stanford.rt.datatype.OrderedType#compares(DataValue, DataValue)
34         */
35    public int compares(DataValue value1, DataValue value2)
36    {
37//        if( !(value1 instanceof TimeValue) ||
38//            !(value2 instanceof TimeValue) )
39//            throw new IllegalArgumentException("Wrong argument type");
40//           
41//        Date date1 = ((TimeValue)value1).getValue();
42//        Date date2 = ((TimeValue)value2).getValue();
43//        return date1.compareTo(date2);
44        return 0;
45    }
46   
47        /* (non-Javadoc)
48         * @see edu.stanford.rt.datatype.DataType#toString(String)
49         */
50    public String toString(String indent)
51    {
52        String thisIndent = indent + "  ";
53        return thisIndent + getName()+"\n";
54    }
55   
56}
Note: See TracBrowser for help on using the repository browser.