Skip to content
Snippets Groups Projects
Commit 498811f6 authored by tjc's avatar tjc
Browse files

tidy

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@6999 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 5aef97d1
No related branches found
No related tags found
No related merge requests found
...@@ -20,14 +20,11 @@ ...@@ -20,14 +20,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/Action.java,v 1.1 2004-06-09 09:41:40 tjc Exp $ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/Action.java,v 1.2 2008-01-28 16:27:54 tjc Exp $
*/ */
package uk.ac.sanger.artemis; package uk.ac.sanger.artemis;
import uk.ac.sanger.artemis.io.Key;
import uk.ac.sanger.artemis.io.Location;
import uk.ac.sanger.artemis.io.QualifierVector;
/** /**
* An Action is anything done by the user that causes the state of the data * An Action is anything done by the user that causes the state of the data
...@@ -37,58 +34,63 @@ import uk.ac.sanger.artemis.io.QualifierVector; ...@@ -37,58 +34,63 @@ import uk.ac.sanger.artemis.io.QualifierVector;
* FeatureChangeEvent for each Feature that was trimmed. * FeatureChangeEvent for each Feature that was trimmed.
* *
* @author Kim Rutherford <kmr@sanger.ac.uk> * @author Kim Rutherford <kmr@sanger.ac.uk>
* @version $Id: Action.java,v 1.1 2004-06-09 09:41:40 tjc Exp $ * @version $Id: Action.java,v 1.2 2008-01-28 16:27:54 tjc Exp $
**/ **/
public class Action { public class Action
{
/**
* Delegate.
**/
private final ChangeEventVector change_vector = new ChangeEventVector ();
/** /**
* Create a new, empty Action. * Create a new, empty Action.
**/ **/
public Action () { public Action ()
{
} }
/** /**
* Returns true if and only if nothing has happened during this action. * Returns true if and only if nothing has happened during this action.
**/ **/
public boolean isEmpty () { public boolean isEmpty ()
if (change_vector.size () == 0) { {
if (change_vector.size () == 0)
return true; return true;
} else { else
return false; return false;
}
} }
/** /**
* Add a new ChangeEvent to this Action. * Add a new ChangeEvent to this Action.
**/ **/
public void addChangeEvent (final ChangeEvent change_event) { public void addChangeEvent (final ChangeEvent change_event)
if (change_event instanceof FeatureChangeEvent) { {
if (change_event instanceof FeatureChangeEvent)
addFeatureChangeEvent ((FeatureChangeEvent) change_event); addFeatureChangeEvent ((FeatureChangeEvent) change_event);
} else { else if (change_event instanceof EntryChangeEvent)
if (change_event instanceof EntryChangeEvent) { addEntryChangeEvent ((EntryChangeEvent) change_event);
addEntryChangeEvent ((EntryChangeEvent) change_event); else
} else { throw new Error ("internal error - unknown event type: " +
throw new Error ("internal error - unknown event type: " + change_event);
change_event);
}
}
} }
/** /**
* Add a new FeatureChangeEvent to this Action. * Add a new FeatureChangeEvent to this Action.
**/ **/
public void addFeatureChangeEvent (final FeatureChangeEvent public void addFeatureChangeEvent (final FeatureChangeEvent
feature_change_event) { feature_change_event)
if (feature_change_event.featureHasChanged ()) { {
if (feature_change_event.featureHasChanged ())
change_vector.add (feature_change_event); change_vector.add (feature_change_event);
}
} }
/** /**
* Add a new EntryChangeEvent to this Action. * Add a new EntryChangeEvent to this Action.
**/ **/
public void addEntryChangeEvent (final EntryChangeEvent entry_change_event) { public void addEntryChangeEvent (final EntryChangeEvent entry_change_event)
{
change_vector.add (entry_change_event); change_vector.add (entry_change_event);
} }
...@@ -96,12 +98,8 @@ public class Action { ...@@ -96,12 +98,8 @@ public class Action {
* Return a ChangeEventVector containing all the ChangeEvents that occured * Return a ChangeEventVector containing all the ChangeEvents that occured
* during this Action. * during this Action.
**/ **/
public ChangeEventVector getChangeEvents () { public ChangeEventVector getChangeEvents ()
{
return change_vector; return change_vector;
} }
/**
* Delegate.
**/
final ChangeEventVector change_vector = new ChangeEventVector ();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment