jadex.swing.map
Class MapRange

java.lang.Object
  |
  +--jadex.swing.map.MapRange

public class MapRange
extends java.lang.Object

This is a utility class for storing the positions of the MapPoint, and processing the range calculations.


Constructor Summary
MapRange()
          Default constructor
MapRange(float startF, float endF)
          MapRange with float point numbers will be used in GeneticMap.
MapRange(long start, long end)
          MapRange with integer numbers will be used in SequenceMap and PhysicalMap.
MapRange(java.lang.String left, java.lang.String right)
          Construct a maprange with String arguments.
 
Method Summary
 MapRange combine(MapRange range1)
          Add two maprange together and return a changed this maprange
 boolean contain(long value)
          Check if this maprange contains a specific value.
 boolean equals(MapRange rg)
          Compare two mapranges.
 boolean equalsF(MapRange rg)
          Deprecated. use equals(MapRange rg).
 long getEnd()
          Get the end value.
 float getEndF()
          Get the end value in float.
 long getExtend()
          Get the total length of this MapRange.
 float getExtendF()
          How to include the two ends? This is a question?
 long getLeftEnd()
          Get the left end of this maprange
 long getRightEnd()
          Get the right end of this maprange
 long getStart()
          Get the start value.
 float getStartF()
          Get the start value in float.
 boolean intersect(MapRange r)
          Check if two mapranges intersect.
 MapRange moveDown(int step)
          Move the current range to the lower direction.
 MapRange moveUp(int step)
          Move the current range to the up direction.
 void setEnd(long e)
          Set the end value.
 void setEndF(float end)
          Set the end value in float.
 void setStart(long s)
          Set the start value.
 void setStartF(float start)
          Set the start value in float.
 java.lang.String toString()
          An handy print method.
 java.lang.String toStringF()
          Deprecated. use toString.
 MapRange zoomIn(int step)
          Zoom-in in the current range
 MapRange zoomOut(int step)
          Zoom-out the current range
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapRange

public MapRange()
Default constructor

MapRange

public MapRange(long start,
                long end)
MapRange with integer numbers will be used in SequenceMap and PhysicalMap.
Parameters:
start - the start position
end - the end position.

MapRange

public MapRange(float startF,
                float endF)
MapRange with float point numbers will be used in GeneticMap.
Parameters:
start - the start position in float.
end - the end position in float.

MapRange

public MapRange(java.lang.String left,
                java.lang.String right)
Construct a maprange with String arguments.
Parameters:
left - the start position in string.
right - the end position in string.
Method Detail

setStart

public void setStart(long s)
Set the start value.
Parameters:
s - the start value.

setEnd

public void setEnd(long e)
Set the end value.
Parameters:
e - the end value.

getStart

public long getStart()
              throws UnknownPositionException
Get the start value.
Returns:
the start value.
Throws:
throw - an UnknownPositionException if the position is unknown.

getEnd

public long getEnd()
            throws UnknownPositionException
Get the end value.
Returns:
the end value.
Throws:
throw - an UnknownPositionException is the position is unknown.

getExtend

public long getExtend()
               throws UnknownPositionException
Get the total length of this MapRange.
Returns:
the total length of this MapRange.
Throws:
throw - an UnknownPositionException is the value is not initialized.

getExtendF

public float getExtendF()
                 throws UnknownPositionException
How to include the two ends? This is a question?

toString

public java.lang.String toString()
An handy print method.
Overrides:
toString in class java.lang.Object
Following copied from class: java.lang.Object
Returns:
a string representation of the object.

toStringF

public java.lang.String toStringF()
Deprecated. use toString.

For float values.

equals

public boolean equals(MapRange rg)
Compare two mapranges.
Returns:
true if both start and end position are the same.

equalsF

public boolean equalsF(MapRange rg)
Deprecated. use equals(MapRange rg).

Compare two MapRanges in float values.

getStartF

public float getStartF()
                throws UnknownPositionException
Get the start value in float.
Returns:
the start value in float.

getEndF

public float getEndF()
              throws UnknownPositionException
Get the end value in float.
Returns:
the end value in float.

setStartF

public void setStartF(float start)
Set the start value in float.

setEndF

public void setEndF(float end)
Set the end value in float.

intersect

public boolean intersect(MapRange r)
Check if two mapranges intersect.
Parameters:
r - the compared maprange
Returns:
true if intersecting

zoomIn

public MapRange zoomIn(int step)
Zoom-in in the current range
Parameters:
the - strength of the zooming
Returns:
a new maprange

zoomOut

public MapRange zoomOut(int step)
Zoom-out the current range
Parameters:
the - strength of the zooming
Returns:
this object changed

moveUp

public MapRange moveUp(int step)
Move the current range to the up direction.
Parameters:
step - the magnitude of the moving.

moveDown

public MapRange moveDown(int step)
Move the current range to the lower direction.
Parameters:
step - the magnitude of the moving.

contain

public boolean contain(long value)
Check if this maprange contains a specific value. This is an inclusive comparison.
Parameters:
value - the compared value.
Returns:
true if this MapRange contains this value.

combine

public MapRange combine(MapRange range1)
Add two maprange together and return a changed this maprange
Parameters:
range1 - the maprange to be added
Returns:
a new maprange cover both this and range1

getLeftEnd

public long getLeftEnd()
Get the left end of this maprange

getRightEnd

public long getRightEnd()
Get the right end of this maprange