home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-11-27 | 1.5 KB | 45 lines |
- // An AnimationMaster Figure
-
- // Written by Bernie Roehl, November 1996
-
- package hash;
-
- import java.io.*;
- import java.util.*;
-
- public class Figure {
- protected int version;
- protected int platformType;
- Part root;
-
- public int getVersion() { return version; }
- public int getPlatformType() { return platformType; }
- public Part getRoot() { return root; }
-
- public void dump() {
- System.out.println("Version " + version);
- System.out.println("Platform = " + platformType);
- root.dump("");
- }
-
- public Figure(DataInputStream input)
- throws IOException, HashSyntaxException {
- StringTokenizer s;
-
- s = new StringTokenizer(input.readLine());
- if (s.countTokens() != 7)
- throw new HashSyntaxException("missing fields in header line");
- if (s.nextToken().equals("FIGU") == false)
- throw new HashSyntaxException("missing signature in first line");
- version = Integer.parseInt(s.nextToken());
- s.nextToken(); // skip zero
- platformType = Integer.parseInt(s.nextToken());
- input.readLine(); // skip zero line
- if (version == 6) {
- input.readLine();
- input.readLine();
- }
- root = new Part(input);
- }
- }
-