View Javadoc

1   /*
2    * $Id: ZObject.java,v 1.3 2005/10/25 00:20:07 weiju Exp $
3    * 
4    * Created on 14.10.2005
5    * Copyright 2005 by Wei-ju Wu
6    *
7    * This file is part of The Z-machine Preservation Project (ZMPP).
8    *
9    * ZMPP is free software; you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as published by
11   * the Free Software Foundation; either version 2 of the License, or
12   * (at your option) any later version.
13   *
14   * ZMPP is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   *
19   * You should have received a copy of the GNU General Public License
20   * along with ZMPP; if not, write to the Free Software
21   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22   */
23  package org.zmpp.vm;
24  
25  /***
26   * This is the interface definition for an object in the object tree.
27   * 
28   * @author Wei-ju Wu
29   * @version 1.0
30   */
31  public interface ZObject {
32  
33    /***
34     * Tests if the specified attribute is set.
35     * 
36     * @param attributeNum the attribute number, starting with 0
37     * @return true if the attribute is set
38     */
39    boolean isAttributeSet(int attributeNum);
40  
41    /***
42     * Sets the specified attribute.
43     * 
44     * @param attributeNum the attribute number, starting with 0
45     */
46    void setAttribute(int attributeNum);
47  
48  
49    /***
50     * Clears the specified attribute.
51     * 
52     * @param attributeNum the attribute number, starting with 0
53     */
54    void clearAttribute(int attributeNum);
55    
56    /***
57     * Returns the number of this object's parent object.
58     * 
59     * @return the parent object's number
60     */
61    int getParent();
62  
63    /***
64     * Assigns a new parent object.
65     * 
66     * @param parent the new parent object
67     */
68    void setParent(int parent);
69    
70    /***
71     * Returns the object number of this object's sibling object.
72     * 
73     * @return the sibling object's object number
74     */
75    int getSibling();
76    
77    /***
78     * Assigns a new sibling to this object.
79     * 
80     * @param sibling the new sibling's object number
81     */
82    void setSibling(int sibling);
83    
84    /***
85     * Returns the object number of this object's child object.
86     * 
87     * @return the child object's object number
88     */
89    int getChild();
90    
91    /***
92     * Assigns a new child to this object.
93     * 
94     * @param child the new child
95     */
96    void setChild(int child);
97      
98    /***
99     * Returns this object's property table address. Might be made private
100    * in the future.
101    * 
102    * @return the address of this object's property table
103    */
104   int getPropertyTableAddress();
105   
106   /***
107    * Returns the properties description address.
108    * 
109    * @return the description address
110    */
111   int getPropertiesDescriptionAddress();
112   
113   /***
114    * Returns the number of properties.
115    * 
116    * @return the number of properties
117    */
118   int getNumProperties();
119   
120   /***
121    * The number of bytes in the specified property.
122    * 
123    * @param property the property number
124    * @return the specified property's number of bytes
125    */
126   int getPropertySize(int property);
127 
128   /***
129    * Returns the the specified property byte.
130    *  
131    * @param property the property number
132    * @param bytenum the byte number
133    * @return the value of the specified property byte
134    */
135   byte getPropertyByte(int property, int bytenum);
136   
137   /***
138    * Returns the address of the specified property. Note that this will not
139    * include the length byte.
140    * 
141    * @param property the property
142    * @return the specified property's address
143    */
144   int getPropertyAddress(int property);
145   
146   /***
147    * Returns true if the specified property is available.
148    * 
149    * @param property the property number
150    * @return true if the property is available, false otherwise
151    */
152   boolean isPropertyAvailable(int property);
153   
154   /***
155    * Returns the next property in the list. If property is 0, this
156    * will return the first propery number, if propery is the last
157    * element in the list, it will return 0.
158    * 
159    * @param property the property number
160    * @return the next property in the list or 0
161    */
162   int getNextProperty(int property);  
163 
164   /***
165    * Sets the specified property byte to the given value.
166    * 
167    * @param property the property
168    * @param bytenum the byte number
169    * @param value the value
170    */
171   void setPropertyByte(int property, int bytenum, byte value);
172 }