View Javadoc

1   // Copyright 2006-2007, by the California Institute of Technology.
2   // ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged.
3   // Any commercial use must be negotiated with the Office of Technology Transfer
4   // at the California Institute of Technology.
5   //
6   // This software is subject to U. S. export control laws and regulations
7   // (22 C.F.R. 120-130 and 15 C.F.R. 730-774). To the extent that the software
8   // is subject to U.S. export control laws and regulations, the recipient has
9   // the responsibility to obtain export licenses or other export authority as
10  // may be required before exporting such information to foreign countries or
11  // providing access to foreign nationals.
12  //
13  // $Id: Statement.java 2606 2007-04-18 19:35:09Z pramirez $ 
14  //
15  
16  package gov.nasa.pds.tools.label;
17  
18  /***
19   * This class represents a statement in a PDS label.
20   * 
21   * @author pramirez
22   * @version $Revision: 2606 $
23   * 
24   */
25  public abstract class Statement implements Comparable {  
26      protected int lineNumber;
27      protected String identifier;
28      protected String filename;
29      protected String context;
30      
31      /***
32       * Constructs a statement
33       * @param lineNumber on which this statement begins
34       * @param identifier which uniquely identifies this statement
35       */
36      public Statement(int lineNumber, String identifier) {
37          this(null, lineNumber, identifier);
38      }
39      
40      public Statement(String filename, int lineNumber, String identifier) {
41          this(null, filename, lineNumber, identifier);
42      }
43      
44      public Statement(String context, String filename, int lineNumber, String identifier) {
45          this.lineNumber = lineNumber;
46          this.identifier = identifier;
47          this.filename = filename;
48          this.context = context;
49      }
50      
51      /***
52       * Retrieves the line for this statement
53       * @return The line on which the statment starts
54       */
55      public int getLineNumber() {
56          return lineNumber;
57      }
58      
59      /***
60       * Retrieves the identifier for the statement
61       * @return unique identifier
62       */
63      public String getIdentifier() {
64          return identifier;
65      }
66      
67      public String getFilename() {
68          return filename;
69      }
70      
71      public void setFilename(String filename) {
72          this.filename = filename;
73      }
74  
75      public String getContext() {
76          return context;
77      }
78      
79      public void setContext(String context) {
80          this.context = context;
81      }
82      
83      public abstract void attachComment(CommentStatement commet);
84      
85      public int compareTo(Object o) {
86          return this.getLineNumber() - ((Statement) o).getLineNumber();
87      }
88  }