KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > util > tuple > TupleItem


1 /*
2  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5 package com.hp.hpl.jena.util.tuple;
6
7 /**
8  * The unit found in a line of a tuple.
9  * Can be a string (quoted, possibly with the datatype, or unquoted) or a URI.
10  * @author Andy Seaborne
11  * @version $Id: TupleItem.java,v 1.4 2005/02/21 12:19:26 andy_seaborne Exp $
12  */

13 public class TupleItem
14 {
15     public static final int URI = 0 ;
16     public static final int STRING = 1 ;
17     public static final int UNKNOWN = 2 ;
18     public static final int UNQUOTED = 3 ;
19     public static final int ANON = 4 ;
20
21     String JavaDoc rep ;
22     String JavaDoc datatype ;
23     String JavaDoc asFound ;
24     int itemType ;
25
26     TupleItem(String JavaDoc value, String JavaDoc valAsFound, int type, String JavaDoc dt)
27     {
28         rep = value ;
29         asFound = valAsFound ;
30         itemType = type ;
31         datatype = dt ;
32     }
33
34     public int getType() { return itemType ; }
35
36     public boolean isURI() { return itemType == URI ; }
37     public boolean isString() { return itemType == STRING ; }
38     public boolean isUnknown() { return itemType == UNKNOWN ; }
39     public boolean isUnquoted() { return itemType == UNQUOTED ; }
40     public boolean isAnon() { return itemType == ANON ; }
41
42     public String JavaDoc get() { return rep ; }
43     public String JavaDoc getDT() { return datatype ;
44     }
45     public String JavaDoc asQuotedString() { return asFound ; }
46     public String JavaDoc toString() { return rep ; }
47 }
48
49 /*
50  * (c) Copyright 2001 Hewlett-Packard Development Company, LP
51  * All rights reserved.
52  *
53  * Redistribution and use in source and binary forms, with or without
54  * modification, are permitted provided that the following conditions
55  * are met:
56  * 1. Redistributions of source code must retain the above copyright
57  * notice, this list of conditions and the following disclaimer.
58  * 2. Redistributions in binary form must reproduce the above copyright
59  * notice, this list of conditions and the following disclaimer in the
60  * documentation and/or other materials provided with the distribution.
61  * 3. The name of the author may not be used to endorse or promote products
62  * derived from this software without specific prior written permission.
63  *
64  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
65  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
66  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
67  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
68  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
69  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
70  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
71  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
73  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74  */

75
Popular Tags