source: fedd/abac-src/rtml/src/edu/stanford/rt/datatype/SingletonValueSet.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.2 KB
Line 
1package edu.stanford.rt.datatype;
2
3import edu.stanford.rt.util.*;
4
5/**
6 * @author Ninghui Li, Sandra Qiu <br>
7 *
8 * A SingletonValueSet object is a value set that
9 * conatins a single value of <code>SimpleType</code>.
10 */
11public class SingletonValueSet extends ValueSet
12{
13    private DataValue value;
14
15    /**
16     * Constructor for SingletonValueSet.
17     */
18    public SingletonValueSet(SimpleType type, DataValue value)
19    {
20        super(type);
21        if (! type.isValidValue(value)) 
22        {
23            throw new IllegalArgumentException("Value type does not match");
24        }
25        this.value = value;
26    }
27
28        /**
29         * Method getValue.
30         * @return DataValue
31         */
32    public DataValue getValue()
33    {
34        return this.value;
35    }
36   
37        /* (non-Javadoc)
38         * @see edu.stanford.rt.datatype.ValueSet#toString(String)
39         */
40    public String toString(String indent)
41    {
42        String thisIndent = indent + "  ";
43        StringBuffer sb = new StringBuffer();
44        sb.append(thisIndent).append("SingletonValueSet: \n");
45        sb.append(thisIndent+"  ").append(getType().toString()).append("\n");
46        sb.append(thisIndent+"  ").append(value.toString());
47        return sb.toString();
48    }
49   
50}
Note: See TracBrowser for help on using the repository browser.