source: branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/AbstractStructure.java@ 9858

Last change on this file since 9858 was 6287, checked in by cs025, 20 years ago

Various changes to the METS structures and identifier factories to
move towards updateable structures and to add section support.

  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
Line 
1package org.greenstone.gsdl3.gs3build.metadata;
2
3import java.io.PrintWriter;
4
5import java.util.List;
6import java.util.ArrayList;
7import java.util.Map;
8import java.util.LinkedHashMap;
9import java.util.Iterator;
10
11/**
12 * A helpful 'superclass' of METSStructure and METSDivision which allows for some
13 * simple generalisation of the two classes.
14 */
15
16public abstract class AbstractStructure
17{ Map children;
18 AbstractStructure parent;
19 String ID; // the unique identifier for this division (unique within the
20 // document, not necessarily unique within the collection).
21
22 public AbstractStructure(String ID)
23 { this.children = new LinkedHashMap();
24 this.parent = null;
25 this.ID = ID;
26 }
27
28 public AbstractStructure getParent()
29 { return this.parent;
30 }
31
32 public void setParent(AbstractStructure parent)
33 { this.parent = parent;
34 }
35
36 /**
37 * Get the identifer of this structure
38 *
39 * @param <code>String</code> the identifier.
40 */
41 public String getID()
42 { return this.ID;
43 }
44
45 public abstract String getStructureType();
46
47 /**
48 * Add a child division, or sub-division to the document. For example,
49 * sections within a chapter.
50 *
51 * @param <code>METSDivision</code> the child division.
52 */
53 public void addDivision(METSDivision child)
54 { this.children.put(child.getLabel(), child);
55 child.setParent(this);
56 }
57
58 public Iterator getChildIterator()
59 { return this.children.values().iterator();
60 }
61
62 public int size()
63 { return this.children.size();
64 }
65}
66
Note: See TracBrowser for help on using the repository browser.