KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > buchuki > ensmer > prevayler > PrevayledObject


1 /*
2  * Copyright 2004 Dusty Phillips
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.buchuki.ensmer.prevayler;
17
18 import java.io.Serializable JavaDoc;
19 import javax.vecmath.Matrix4f;
20 import com.buchuki.ensmer.object.Backend;
21
22 /**
23  * Class to represent the details of a prevayled 3D object, including its
24  * class, serialized data, area identifier, and location.
25  *
26  * @author Dusty Phillips [dusty@buchuki.com]
27  */

28 public class PrevayledObject implements Serializable JavaDoc {
29
30     /**
31      * Give it a SerialVersionUID so it can be reinstantiated by later versions
32      * of the class
33      */

34     static final long serialVersionUID = 20050328L;
35
36     /**
37      * Construct a PrevayledObject with a reference to the Class of the object
38      * that is prevayled.
39      *
40      * @param backendClass the class of the backend to be loaded
41      */

42     public PrevayledObject(Class JavaDoc backendClass) {
43         this.backendClass = backendClass;
44     }
45
46
47     /**
48      * Returns the identifier for the area containing this object
49      *
50      * @return the object's area's identifier
51      */

52     public Long JavaDoc getAreaId() {
53         return areaId;
54     }
55
56     /**
57      * Returns the specific subclass of backend that this object stores
58      *
59      * @return the backend class to instatiate this object
60      */

61     public Class JavaDoc getBackendClass() {
62         return backendClass;
63     }
64
65     /**
66      * Returns the location and rotation of object in three space
67      *
68      * @return the location
69      */

70     public Matrix4f getLocation() {
71         return location;
72     }
73
74
75     /**
76      * Returns the Serialized data for this object
77      *
78      * @return the serialized data to reinstatiate the object
79      */

80     public Serializable JavaDoc getData() {
81         return data;
82     }
83
84     /**
85      * Sets the identifier of the area associated with this object
86      *
87      * @param areaId The new areaId value
88      */

89     public void setAreaId(Long JavaDoc areaId) {
90         this.areaId = areaId;
91     }
92
93     /**
94      * Set the location of the object
95      *
96      * @param location The new location.
97      */

98     public void setLocation(Matrix4f location) {
99         this.location = location;
100     }
101
102     /**
103      * Sets the serialized data needed to reinstatiate this backend
104      *
105      * @param data The new serialized data.
106      */

107     public void setData(Serializable JavaDoc data) {
108         this.data = data;
109     }
110
111     /**
112      * The identifier for the area associated with this object.
113      */

114     private Long JavaDoc areaId;
115
116     /**
117      * The class to act as a backend for this PrevayledObject
118      */

119     private Class JavaDoc backendClass;
120
121     /**
122      * The Matrix4f representing the location of the object in the world.
123      */

124     private Matrix4f location;
125
126     /**
127      * The Serializable object associated with the object backend
128      */

129     private Serializable JavaDoc data;
130 }
131
132
Popular Tags