uk.ac.vamsas.objects.utils
Class Range

java.lang.Object
  extended byuk.ac.vamsas.objects.utils.Range

public class Range
extends java.lang.Object

Utilities for working with RangeType and MapType objects. Derived from bitter experience.

Author:
JimP

Constructor Summary
Range()
           
 
Method Summary
static int[] getBounds(RangeType dseta)
          get real bounds of a RangeType's specification.
static int[] getIntervals(RangeType range)
           
static int[] getMapping(RangeType dseta)
          map from a rangeType's internal frame to the referenced object's coordinate frame.
static int[] getSegRange(Seg visSeg, boolean ensureDirection)
          get start
static void initMapType(MapType maprange, MapList ml, boolean setUnits)
          initialise a MapType object from a MapList object.
static void initMapType(MapType maprange, MapList ml, boolean setUnits, boolean reverse)
           
static void initRangeType(RangeType mrt, int[] range)
          initialise a range type object from a set of start/end inclusive intervals
static MapList parsemapType(MapType map)
          Parse map with default units of 1,1
static MapList parsemapType(MapType maprange, int localu, int mappedu)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Range

public Range()
Method Detail

getSegRange

public static int[] getSegRange(Seg visSeg,
                                boolean ensureDirection)
get start
Parameters:
visSeg -
ensureDirection - when true - always ensure start is less than end.
Returns:
int[] { start, end, direction} where direction==1 for range running from end to start.

getBounds

public static int[] getBounds(RangeType dseta)
get real bounds of a RangeType's specification. start and end are an inclusive range within which all segments and positions lie. TODO: refactor to vamsas utils

Parameters:
dseta -
Returns:
int[] { start, end}

getMapping

public static int[] getMapping(RangeType dseta)
map from a rangeType's internal frame to the referenced object's coordinate frame.

Parameters:
dseta -
Returns:
int [] { ref(pos)...} for all pos in rangeType's frame.

getIntervals

public static int[] getIntervals(RangeType range)

initRangeType

public static void initRangeType(RangeType mrt,
                                 int[] range)
initialise a range type object from a set of start/end inclusive intervals

Parameters:
mrt -
range -

parsemapType

public static MapList parsemapType(MapType maprange,
                                   int localu,
                                   int mappedu)
Parameters:
maprange - where the from range is the local mapped range, and the to range is the 'mapped' range in the MapRangeType
Returns:
MapList

parsemapType

public static MapList parsemapType(MapType map)
Parse map with default units of 1,1

Parameters:
map -
Returns:
MapList representing map

initMapType

public static void initMapType(MapType maprange,
                               MapList ml,
                               boolean setUnits)
initialise a MapType object from a MapList object.

Parameters:
maprange -
ml -
setUnits -

initMapType

public static void initMapType(MapType maprange,
                               MapList ml,
                               boolean setUnits,
                               boolean reverse)
Parameters:
maprange -
ml -
setUnits -
reverse - - reverse MapList mapping for Local and Mapped ranges and units