edu.upenn.gloDB.parser
Class Operation

java.lang.Object
  extended by edu.upenn.gloDB.parser.Operation
All Implemented Interfaces:
java.lang.Cloneable

public class Operation
extends java.lang.Object
implements java.lang.Cloneable

These objects store the operations parsed by the parser. An Operation can contain either an array of Operations (ie a set of Operations to be processed as a group), or a Set of Features (ie a Track).

Version:
$Id: Operation.java,v 1.8.2.22 2007/03/01 21:17:33 fisher Exp $

Field Summary
private  java.util.ArrayList group
          If this Operation is a 'group' (ie '()'), then instead of containing a SortedSet of Features, it will contain an array of Operations.
private  boolean ignore
          Flag for whether the mapped Feature should be included in the output.
private  java.util.Iterator iterator
          An Iterator over 'Track'.
(package private)  int matched
          Number of times the Operation has been matched.
private  int maxLength
          Maximum acceptible Feature width.
(package private)  int maxPos
          Maximum number of positions since the previous Track.
private  int maxRepeat
          Maximum number of repeating features.
private  int maxSeqPos
          Maximum acceptible position within 'sequence'.
private  int maxWithin
          Maximum number of positions between repeating features.
private  int minLength
          Minimum acceptible Feature width.
(package private)  int minPos
          Minimum number of positions since the previous Track.
private  int minRepeat
          Minimum number of repeating features.
private  int minSeqPos
          Minimum acceptible position within 'sequence'.
private  int minWithin
          Minimum number of positions between repeating features.
private  boolean negate
          Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation).
private  Sequence sequence
          If not null, then ignore all other Sequences when testing for Feature matches.
 Track track
          SortedSet of Features to be searched.
private  int type
          Flag for the type of operation to be performed with the preceeding Operation.
 
Constructor Summary
private Operation()
          Create a new Operation object, used by clone() below.
  Operation(java.util.ArrayList group)
          Create a new Operation object containing a group.
  Operation(java.util.Set tracks)
          Create a new Operation object with a set of Tracks.
  Operation(Track track)
          Create a new Operation object with a Track.
 
Method Summary
 java.lang.Object clone()
          Create a shallow clone (just clone the structure, not the Objects) of the existing object.
 void filterOnLength()
          This will remove all Features from "track" that are not within the 'minLength'/'maxLength' boundaries.
 void filterOnRepeat()
          This will remove all Features from "track" that are not within the 'minRepeat/maxRepeat' and 'minWithin/maxWithin' boundaries.
 void filterOnSeqPos()
          This will remove all Features from "track" that are not within the 'minSeqPos'/'maxSeqPos' boundaries.
 void filterOnSequence()
          This will remove all Features from "track" that are not on "sequence".
 Feature firstFeature()
          Restart the Tracks iterator and return the first Feature.
 java.util.ArrayList getGroup()
          Gets the array of Operations.
 int getType()
          Get the Operation type: 0 = POS, 1 = AND, 2 = nAND, 3 = OR, 4 = LESS 10 = ., 11 = &&, 12 = ^&&, 13 = ||, 14 = -
 java.util.Iterator groupIterator()
          Returns an iterator over the group list, null if empty group.
 boolean hasNextFeature()
          Return true if there are more Features in 'iterator'.
private  void initialize()
           
 boolean isGroup()
          Returns true if this Operation is a group.
 boolean isIgnore()
          Gets the ignore flag.
 boolean isNegate()
          Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation).
 Feature nextFeature()
          Return the next Feature in iterator.
 int numFeatures()
          Returns the number of Features contained in Operation.
 void resetTrack()
          Restart iterator.
 void setGroup(java.util.ArrayList group)
          Sets the array of Operations.
 void setIgnore(boolean ignore)
          Sets the ignore flag.
 void setLength(int min, int max)
          This will set the min/max Length for all Features in "track".
 void setNegate(boolean negate)
          Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation).
 void setRepeat(int min, int max)
          This will set the min/max Repeat for all Features in "track".
 void setRepeat(int min, int max, int minW, int maxW)
           
 void setSeqPos(int min, int max)
          This will set the min/max seqquence position for all Features in "track".
 void setSequence(Sequence seq)
          This will remove all Features from "track" that are not on "sequence".
 void setType(int type)
          Set the Operation type: 0 = POS, 1 = AND, 2 = nAND, 3 = OR, 4 = LESS 10 = ., 11 = &&, 12 = ^&&, 13 = ||, 14 = -
 java.lang.String toString()
          Returns Operation information for debugging purposes.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

group

private java.util.ArrayList group
If this Operation is a 'group' (ie '()'), then instead of containing a SortedSet of Features, it will contain an array of Operations. This array of Operations, being a group will be processed and converted into a SortedSet of Features and stored in 'track'.


track

public Track track
SortedSet of Features to be searched. This set is filtered by sequence, minLength, maxLength, minSeqPos, and maxSeqPos. We use a Track to hold the operands because we can then take advantange of the various properties of a Track when computing the Operation.

Notes:
Needs to be private.

type

private int type
Flag for the type of operation to be performed with the preceeding Operation. When new types are added Operator.getType(), Parser.jj and Operator need to be updated. -1 = null (no preceeding operator - first Track in a group). 0 = POS, 1 = AND, 2 = OR, 3 = MINUS, 4 = sAND, 5 = sMINUS 10 = ., 11 = &&, 12 = ||, 13 = -

Notes:
Default = '-1'

negate

private boolean negate
Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation). There is no comparable option that preserves the Feature sets (ie non-binary operation).

Notes:
Default = 'false'

minPos

int minPos
Minimum number of positions since the previous Track.

Notes:
Default = '0', Needs to be private.

maxPos

int maxPos
Maximum number of positions since the previous Track.

Notes:
Default = '0', Needs to be private.

sequence

private Sequence sequence
If not null, then ignore all other Sequences when testing for Feature matches.

Notes:
Default = 'null'

minLength

private int minLength
Minimum acceptible Feature width.

Notes:
Default = '0'

maxLength

private int maxLength
Maximum acceptible Feature width.

Notes:
Default = '0'

minSeqPos

private int minSeqPos
Minimum acceptible position within 'sequence'.

Notes:
Default = '0'

maxSeqPos

private int maxSeqPos
Maximum acceptible position within 'sequence'. If -1, then goes to maximum Sequence length.

Notes:
Default = '0'

minRepeat

private int minRepeat
Minimum number of repeating features.

Notes:
Default = '1'

maxRepeat

private int maxRepeat
Maximum number of repeating features.

Notes:
Default = '1'

minWithin

private int minWithin
Minimum number of positions between repeating features. If '0', then any overlap between features will be valid.

Notes:
Default = '0'

maxWithin

private int maxWithin
Maximum number of positions between repeating features.

Notes:
Default = '0'

ignore

private boolean ignore
Flag for whether the mapped Feature should be included in the output.

Notes:
Default = 'false'

matched

int matched
Number of times the Operation has been matched.

Notes:
Needs to be private.

iterator

private java.util.Iterator iterator
An Iterator over 'Track'. This is initialized when the Operation is created and will be increment as successive Features are tested.

Constructor Detail

Operation

private Operation()
Create a new Operation object, used by clone() below.


Operation

public Operation(java.util.ArrayList group)
Create a new Operation object containing a group.


Operation

public Operation(Track track)
Create a new Operation object with a Track.


Operation

public Operation(java.util.Set tracks)
Create a new Operation object with a set of Tracks.

Method Detail

initialize

private void initialize()

setGroup

public void setGroup(java.util.ArrayList group)
Sets the array of Operations.


getGroup

public java.util.ArrayList getGroup()
Gets the array of Operations.


setType

public void setType(int type)
Set the Operation type: 0 = POS, 1 = AND, 2 = nAND, 3 = OR, 4 = LESS 10 = ., 11 = &&, 12 = ^&&, 13 = ||, 14 = -


getType

public int getType()
Get the Operation type: 0 = POS, 1 = AND, 2 = nAND, 3 = OR, 4 = LESS 10 = ., 11 = &&, 12 = ^&&, 13 = ||, 14 = -


setNegate

public void setNegate(boolean negate)
Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation). There is no comparable option that preserves the Feature sets (ie non-binary operation).


isNegate

public boolean isNegate()
Flag for whether to invert the output Track, treating the Track as a mask over the Sequence (ie binary operation). There is no comparable option that preserves the Feature sets (ie non-binary operation).


setIgnore

public void setIgnore(boolean ignore)
Sets the ignore flag.


isIgnore

public boolean isIgnore()
Gets the ignore flag.


setSequence

public void setSequence(Sequence seq)
This will remove all Features from "track" that are not on "sequence". If this is a group, then 'seq' is propogated to all inner groups.


setLength

public void setLength(int min,
                      int max)
This will set the min/max Length for all Features in "track". If not a group, then the values are set and "filterOnLength()" is run to perform the filtering. If a group, then filterOnLength() is not run and must be run separately, because should only filter the output of the group operation.

Notes:
Should throw an exception if max < min.

setSeqPos

public void setSeqPos(int min,
                      int max)
This will set the min/max seqquence position for all Features in "track". If not a group, then the values are set and "filterOnSeqPos()" is run to perform the filtering. If a group, then filterOnSeqPos() is not run and must be run separately.

Notes:
Should throw an exception if max < min.

setRepeat

public void setRepeat(int min,
                      int max)
This will set the min/max Repeat for all Features in "track". If not a group, then the values are set and "filterOnRepeat()" is run to perform the filtering. If a group, then filterOnRepeat() is not run and must be run separately, because should only filter the output of the group operation.

Notes:
Should throw an exception if max < min.

setRepeat

public void setRepeat(int min,
                      int max,
                      int minW,
                      int maxW)

filterOnSequence

public void filterOnSequence()
This will remove all Features from "track" that are not on "sequence".


filterOnLength

public void filterOnLength()
This will remove all Features from "track" that are not within the 'minLength'/'maxLength' boundaries.


filterOnSeqPos

public void filterOnSeqPos()
This will remove all Features from "track" that are not within the 'minSeqPos'/'maxSeqPos' boundaries. If 'max' is -1, then goes to maximum Sequence length.


filterOnRepeat

public void filterOnRepeat()
This will remove all Features from "track" that are not within the 'minRepeat/maxRepeat' and 'minWithin/maxWithin' boundaries.


isGroup

public boolean isGroup()
Returns true if this Operation is a group.


numFeatures

public int numFeatures()
Returns the number of Features contained in Operation.


resetTrack

public void resetTrack()
Restart iterator.


hasNextFeature

public boolean hasNextFeature()
Return true if there are more Features in 'iterator'.


firstFeature

public Feature firstFeature()
Restart the Tracks iterator and return the first Feature.


nextFeature

public Feature nextFeature()
Return the next Feature in iterator.


groupIterator

public java.util.Iterator groupIterator()
Returns an iterator over the group list, null if empty group.


clone

public java.lang.Object clone()
Create a shallow clone (just clone the structure, not the Objects) of the existing object.

Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Returns Operation information for debugging purposes.

Overrides:
toString in class java.lang.Object



Copyright 2012 Stephen Fisher and Junhyong Kim, University of Pennsylvania. All Rights Reserved.