View Javadoc

1   /*
2    * $Id: ObjectTree.java,v 1.5 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 of the object tree.
27   * 
28   * @author Wei-ju Wu
29   * @version 1.0
30   */
31  public interface ObjectTree {
32  
33    /***
34     * Returns the property default value at the specified position in the
35     * property defaults table.
36     * 
37     * @param propertyNum the default entry's propery number
38     * @return the property default value
39     */
40    short getPropertyDefault(int propertyNum);
41    
42    /***
43     * Returns the Z-object with the specified object number. The index is
44     * 1 based
45     * 
46     * @param objectNum object number
47     * @return the z object with the specified number
48     */
49    ZObject getObject(int objectNum);
50    
51    /***
52     * Returns the total number of objects.
53     * 
54     * @return the number of objects
55     */
56    int getNumObjects();
57    
58    /***
59     * Removes an object from its parent.
60     * 
61     * @param objectNum the object number
62     */
63    void removeObject(int objectNum);
64      
65    /***
66     * Inserts an object to a new parent.
67     * 
68     * @param parentNum the parent number
69     * @param objectNum the object number
70     */
71    void insertObject(int parentNum, int objectNum);
72    
73    /***
74     * Determines the length of the property at the specified address.
75     * The address is an address returned by ZObject.getPropertyAddress,
76     * i.e. it is starting after the length byte.
77     * 
78     * @param propertyAddress the property address
79     * @return the length
80     */
81    int getPropertyLength(int propertyAddress);
82  }