KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > daml > impl > IntLiteralAccessorImpl


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena
7  * Created 26 Jan 2001
8  * Filename $RCSfile: IntLiteralAccessorImpl.java,v $
9  * Revision $Revision: 1.8 $
10  * Release status Preview-release $State: Exp $
11  *
12  * Last modified on $Date: 2005/02/21 12:05:30 $
13  * by $Author: andy_seaborne $
14  *
15  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
16  * (see footer for full conditions)
17  *****************************************************************************/

18
19 // Package
20
///////////////
21
package com.hp.hpl.jena.ontology.daml.impl;
22
23
24 // Imports
25
///////////////
26

27 import com.hp.hpl.jena.rdf.model.*;
28 import com.hp.hpl.jena.ontology.*;
29 import com.hp.hpl.jena.ontology.daml.*;
30
31
32 /**
33  * <p>Encapsulates the standard methods of modifying a property on a DAML object, where
34  * the value of the property is an RDF literal (as opposed to another DAML value,
35  * see {@link PropertyAccessor}, and the literal is known to encapsulate an integer value.</p>
36  *
37  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com">email</a>)
38  * @version CVS info: $Id: IntLiteralAccessorImpl.java,v 1.8 2005/02/21 12:05:30 andy_seaborne Exp $
39  */

40 public class IntLiteralAccessorImpl
41     extends LiteralAccessorImpl
42     implements IntLiteralAccessor
43 {
44     // Constants
45
//////////////////////////////////
46

47
48     // Static variables
49
//////////////////////////////////
50

51
52     // Instance variables
53
//////////////////////////////////
54

55
56     // Constructors
57
//////////////////////////////////
58

59     /**
60      * <p>Construct a new accessor for integer literal values of the given property.</p>
61      *
62      * @param property The property that this accessor works on
63      * @param val The DAML value that has this property
64      */

65     public IntLiteralAccessorImpl( Property property, OntResource val ) {
66         super( property, val );
67     }
68
69
70
71     // External signature methods
72
//////////////////////////////////
73

74     /**
75      * <p>Answer the integer value of the encapsulated property.</p>
76      *
77      * @return A value for the encapsulated property in the model, as an integer.
78      */

79     public int getInt() {
80         return getValue().getInt();
81     }
82
83
84     /**
85      * <p>Add a value to the encapsulated property.</p>
86      *
87      * @param value The value to be added, as an int.
88      */

89     public void addInt( int value ) {
90         add( m_val.getModel().createTypedLiteral( value ) );
91     }
92
93
94     /**
95      * <p>Remove an integer value from the encapsulated property.</p>
96      *
97      * @param value The value to be removed, as an int.
98      */

99     public void removeInt( int value ) {
100         remove( m_val.getModel().createTypedLiteral( value ) );
101     }
102
103
104     /**
105      * <p>Answer true if the encapsulated property has the given value as one of its
106      * values.</p>
107      *
108      * @param value An int value to test for
109      * @return True if the RDF model contains a statement giving a value for
110      * the encapsulated property matching the given value.
111      */

112     public boolean hasIntValue( int value ) {
113         return hasValue( m_val.getModel().createTypedLiteral( value ) );
114     }
115
116
117     // Internal implementation methods
118
//////////////////////////////////
119

120
121
122
123     //==============================================================================
124
// Inner class definitions
125
//==============================================================================
126

127
128 }
129
130 /*
131     (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
132     All rights reserved.
133
134     Redistribution and use in source and binary forms, with or without
135     modification, are permitted provided that the following conditions
136     are met:
137
138     1. Redistributions of source code must retain the above copyright
139        notice, this list of conditions and the following disclaimer.
140
141     2. Redistributions in binary form must reproduce the above copyright
142        notice, this list of conditions and the following disclaimer in the
143        documentation and/or other materials provided with the distribution.
144
145     3. The name of the author may not be used to endorse or promote products
146        derived from this software without specific prior written permission.
147
148     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
149     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
150     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
151     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
152     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
153     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
154     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
155     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
156     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
157     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
158 */

159
160
Popular Tags