public class FHX2_Sample extends java.lang.Object implements java.io.Serializable, ErrorTrackerInterface
Modifier and Type | Field and Description |
---|---|
private boolean |
bark |
private char |
closingChar |
private java.util.ArrayList<SampleErrorModel> |
errors |
private EventTable |
eventTable |
static java.lang.String |
FHX2_SAMPLE_NAME_LENGTH_MESSAGE |
private java.util.Vector<javax.swing.event.ChangeListener> |
listeners
Vector ChangeListener utility methods (part of error checking feature)
|
private char |
openingChar |
private boolean |
pith |
private RecordingTable |
recordingTable |
private int |
sampleFirstYear |
private int |
sampleLastYear |
private java.lang.String |
sampleName |
private static long |
serialVersionUID |
Constructor and Description |
---|
FHX2_Sample()
Default Constructor for FHX2_Sample.
|
FHX2_Sample(int inSampleFirstYear,
int inSampleLastYear)
Alternative Constructor for FHX2_Sample.
|
FHX2_Sample(java.lang.String inName)
Alternative Constructor for FHX2_Sample.
|
FHX2_Sample(java.lang.String inName,
int inSampleFirstYear,
int inSampleLastYear,
boolean inPith,
boolean inBark)
Alternative Constructor for FHX2_Sample.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l) |
void |
addEvent(FHX2_Event inEvent)
Adds an event to the sample.
|
void |
addRecording(FHX2_Recording recording)
Adds a recording to the sample.
|
int |
changeEventType(int inEventIndex,
char inEventType)
Changes the event type and eventYear in the case that the type changes from "fire scar" to "other injury"
|
private char |
charAt(int inYear)
Returns a character representing the event at the input year.
|
private java.lang.String |
checkSampleNameLength(java.lang.String inputName)
Checks the length of the sample name against the old FHX2 requirements.
|
boolean |
containsYear(int year)
Checks if year is contained in this sample.
|
boolean |
eventYearAvailable(int year)
Returns whether or not this event year is available.
|
private void |
fixEventsAndRecordingsWithNewYears()
Adjusts the table values with the new years after a change has occurred.
|
java.util.ArrayList<SampleErrorModel> |
getErrors()
TODO
|
FHX2_Event |
getEvent(int index)
Gets an event from the sample according to its index in the list.
|
java.util.ArrayList<FHX2_Event> |
getEvents()
Gets an ArrayList of all events in the eventTable.
|
EventTable |
getEventTable()
Gets the eventTable.
|
int |
getNextAvailableEventYear()
Returns the next year that is in a recording and not taken by another event.
|
int |
getNextAvailableEventYear(int preferredYear)
Returns the next year that is in a recording and not taken by another event.
|
int |
getNextAvailableRecordingYear()
Returns the next year that is not recording.
|
int |
getNextAvailableRecordingYear(int preferredYear)
Returns the next year that is not recording.
|
int |
getNumOfEvents()
Returns an integer representing the total number of events.
|
int |
getNumOfRecordings()
Returns an integer representing the total number of recordings.
|
FHX2_Recording |
getRecording(int index)
Gets a recording from the index location.
|
java.util.ArrayList<FHX2_Recording> |
getRecordings()
Gets an ArrayList of all recordings in the recordingTable.
|
RecordingTable |
getRecordingTable()
Gets the recordingTable
|
int |
getSampleFirstYear()
Returns an integer representing the first year of the sample.
|
int |
getSampleLastYear()
Returns an integer representing the last year of the sample.
|
java.lang.String |
getSampleName()
Returns a string representing the name of the sample.
|
boolean |
hasBark()
Returns a value representing the status of bark.
|
boolean |
hasEventInYear(int year)
Checks whether or not an event has occurred on the input year.
|
boolean |
hasPith()
Returns a value representing the status of pith.
|
private void |
initializeTables()
Initializes the event and recording tables.
|
boolean |
isYearInRecordings(int year)
Returns whether or not a year is in one of the recordings.
|
void |
parseDataString(java.lang.String inData,
int dataSetFirstYear)
Parses input to the appropriate variables.
|
void |
redrawEventTable()
Redraws the eventTable in the GUI.
|
void |
removeChangeListener(javax.swing.event.ChangeListener l) |
void |
removeEvent(int index)
Removes an event from the sample.
|
void |
removeRecording(int index)
Removes a recording from the sample.
|
void |
removeRecording(int index,
boolean ignoreOutOfRangeEvents)
Removes a recording from the sample.
|
java.lang.Boolean |
sampleEndsWithEvent()
Checks if the sample's last year is an event.
|
private char |
sampleFirstYearAsChar()
Returns a character representing whether or not the sample begins with a pith.
|
private char |
sampleLastYearAsChar()
Returns a character representing whether or not the sample ends at the bark.
|
java.lang.Boolean |
sampleStartsWithEvent()
Checks if the sample's first year is an event.
|
void |
setBark(boolean inBark)
Updates the status of bark according to the parameter, then updates the GUI.
|
void |
setPith(boolean inPith)
Updates the status of pith according to the parameter, the updates the GUI.
|
void |
setSampleFirstYear(int inSampleFirstYear)
Updates the sampleFirstYear according to the parameter, then updates the GUI.
|
void |
setSampleLastYear(int inSampleLastYear)
Updates the sampleLastYear according to the parameter, then updates the GUI.
|
void |
setSampleName(java.lang.String inName)
Renames the sample according to the string in the parameter, then updates the GUI.
|
void |
sortEvents()
Sorts events in the sample according to their year of occurrence.
|
java.lang.String |
toString()
Generates a specially formatted string containing the sample's name, first year, and last year.
|
java.lang.String |
toString(int inDatasetFirstYear,
int inDatasetLastYear)
Generates a specially formatted string containing all information between the first and last years given by the input parameters.
|
void |
updateClosingChar()
Updates the closing character of the sample.
|
void |
updateOpeningChar()
Updates the opening character of the sample.
|
private static final long serialVersionUID
public static final java.lang.String FHX2_SAMPLE_NAME_LENGTH_MESSAGE
private java.lang.String sampleName
private int sampleFirstYear
private int sampleLastYear
private char openingChar
private char closingChar
private boolean pith
private boolean bark
private EventTable eventTable
private RecordingTable recordingTable
private java.util.ArrayList<SampleErrorModel> errors
private java.util.Vector<javax.swing.event.ChangeListener> listeners
public FHX2_Sample()
public FHX2_Sample(java.lang.String inName)
inName
- (the name of the sample)public FHX2_Sample(int inSampleFirstYear, int inSampleLastYear)
inSampleFirstYear
- (the first year of the sample)inSampleLastYear
- (the last year of the sample)public FHX2_Sample(java.lang.String inName, int inSampleFirstYear, int inSampleLastYear, boolean inPith, boolean inBark)
inName
- (the name of the sample)inSampleFirstYear
- (the first year of the sample)inSampleLastYear
- (the last year of the sample)inPith
- (whether or not the sample begins with a pith)inBark
- (whether or not the sample ends at the bark)private void initializeTables()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int inDatasetFirstYear, int inDatasetLastYear)
inDatasetFirstYear
- inDatasetLastYear
- public java.lang.String getSampleName()
public void setSampleName(java.lang.String inName)
inName
- public int getSampleFirstYear()
public void setSampleFirstYear(int inSampleFirstYear)
inSampleFirstYear
- public int getSampleLastYear()
public void setSampleLastYear(int inSampleLastYear)
inSampleLastYear
- public boolean hasPith()
public boolean hasBark()
public void setPith(boolean inPith)
inPith
- public void setBark(boolean inBark)
inBark
- public java.lang.Boolean sampleStartsWithEvent()
public java.lang.Boolean sampleEndsWithEvent()
private char sampleFirstYearAsChar()
private char sampleLastYearAsChar()
public void updateOpeningChar()
public void updateClosingChar()
public boolean containsYear(int year)
year
- private java.lang.String checkSampleNameLength(java.lang.String inputName)
name
- public int getNumOfEvents()
public FHX2_Event getEvent(int index)
index
- public java.util.ArrayList<FHX2_Event> getEvents()
public EventTable getEventTable()
public int getNextAvailableEventYear()
public int getNextAvailableEventYear(int preferredYear)
preferredYear
- public void addEvent(FHX2_Event inEvent)
inEvent
- public void removeEvent(int index)
index
- public int changeEventType(int inEventIndex, char inEventType)
inEventIndex
- inEventType
- public boolean eventYearAvailable(int year)
year
- public boolean hasEventInYear(int year)
year
- public void redrawEventTable()
public void sortEvents()
public int getNumOfRecordings()
public FHX2_Recording getRecording(int index)
index
- public java.util.ArrayList<FHX2_Recording> getRecordings()
public RecordingTable getRecordingTable()
public int getNextAvailableRecordingYear()
public int getNextAvailableRecordingYear(int preferredYear)
preferredYear
- public void addRecording(FHX2_Recording recording)
recording
- public void removeRecording(int index)
index
- public void removeRecording(int index, boolean ignoreOutOfRangeEvents)
index
- ignoreOutOfRangeEvents
- public boolean isYearInRecordings(int year)
year
- private void fixEventsAndRecordingsWithNewYears()
private char charAt(int inYear)
inYear
- public void parseDataString(java.lang.String inData, int dataSetFirstYear) throws CompositeFileException
inData
- (the string of data to be parsed)dataSetFirstYear
- (the first year of data)CompositeFileException
public void addChangeListener(javax.swing.event.ChangeListener l)
public void removeChangeListener(javax.swing.event.ChangeListener l)
public java.util.ArrayList<SampleErrorModel> getErrors()
ErrorTrackerInterface
getErrors
in interface ErrorTrackerInterface