01: /*
02: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * [See end of file]
04: */
05: package com.hp.hpl.jena.util.tuple;
06:
07: /**
08: * The unit found in a line of a tuple.
09: * 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.7 2008/01/02 12:10:59 andy_seaborne Exp $
12: */
13: public class TupleItem {
14: public static final int URI = 0;
15: public static final int STRING = 1;
16: public static final int UNKNOWN = 2;
17: public static final int UNQUOTED = 3;
18: public static final int ANON = 4;
19:
20: String rep;
21: String datatype;
22: String asFound;
23: int itemType;
24:
25: TupleItem(String value, String valAsFound, int type, String dt) {
26: rep = value;
27: asFound = valAsFound;
28: itemType = type;
29: datatype = dt;
30: }
31:
32: public int getType() {
33: return itemType;
34: }
35:
36: public boolean isURI() {
37: return itemType == URI;
38: }
39:
40: public boolean isString() {
41: return itemType == STRING;
42: }
43:
44: public boolean isUnknown() {
45: return itemType == UNKNOWN;
46: }
47:
48: public boolean isUnquoted() {
49: return itemType == UNQUOTED;
50: }
51:
52: public boolean isAnon() {
53: return itemType == ANON;
54: }
55:
56: public String get() {
57: return rep;
58: }
59:
60: public String getDT() {
61: return datatype;
62: }
63:
64: public String asQuotedString() {
65: return asFound;
66: }
67:
68: public String toString() {
69: return rep;
70: }
71: }
72:
73: /*
74: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
75: * All rights reserved.
76: *
77: * Redistribution and use in source and binary forms, with or without
78: * modification, are permitted provided that the following conditions
79: * are met:
80: * 1. Redistributions of source code must retain the above copyright
81: * notice, this list of conditions and the following disclaimer.
82: * 2. Redistributions in binary form must reproduce the above copyright
83: * notice, this list of conditions and the following disclaimer in the
84: * documentation and/or other materials provided with the distribution.
85: * 3. The name of the author may not be used to endorse or promote products
86: * derived from this software without specific prior written permission.
87: *
88: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
89: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
90: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
91: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
92: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
93: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
94: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
95: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
96: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
97: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
98: */
|