Geometry
Class Slice

java.lang.Object
  |
  +--Geometry.Slice

public class Slice
extends java.lang.Object

Defines the components comprising a Region. A Slice is specified by a set of starting and ending Cells along a two-dimensional projection of rings and sectors.

Version:
Created 17 November 2002
Author:
Dan Tappan
See Also:
Slice.Cell, Region

Nested Class Summary
private  class Slice.Cell
          Defines a single point along the starting and ending interval of a Slice.
 
Field Summary
private  java.lang.String m_slice_definition
           
private  Slice.Cell m_slice_end
           
private  Slice.Cell m_slice_start
           
 
Constructor Summary
Slice(java.lang.String definition)
          Creates a new Slice.
 
Method Summary
 java.lang.String getDefinition()
          Returns the original definition string specified in the constructor.
protected  Slice.Cell getEnd()
          Returns the ending Cell.
protected  java.util.ArrayList getSectorInterval()
          Returns the list of sectors numbers between their starting and ending point.
protected  Slice.Cell getStart()
          Returns the starting Cell.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_slice_definition

private java.lang.String m_slice_definition

m_slice_start

private Slice.Cell m_slice_start

m_slice_end

private Slice.Cell m_slice_end
Constructor Detail

Slice

public Slice(java.lang.String definition)
      throws java.lang.Exception
Creates a new Slice.

The grammar is defined as:

   slice        := segment (' ' segment)*

   segment      := ring_start sector_start ring_end sector_end

   ring_start   := ring
   ring_end     := ring

   sector_start := sector
   sector_end   := sector

   ring         := {1,2,..,Region.NUM_RINGS}
   sector       := {1,2,..,Region.NUM_SECTORS}
 

Parameters:
definition - - the definition; e.g., a14b03
Throws:
java.lang.Exception - - if any definition components are invalid
Method Detail

getSectorInterval

protected java.util.ArrayList getSectorInterval()
Returns the list of sectors numbers between their starting and ending point. This handles the case where the starting point is less than or equal to Region.NUM_SECTORS and extends over the wraparound boundary to 1 or greater.

Returns:
the sector numbers

getEnd

protected Slice.Cell getEnd()
Returns the ending Cell.

Returns:
the ending cell

getStart

protected Slice.Cell getStart()
Returns the starting Cell.

Returns:
the starting cell

getDefinition

public java.lang.String getDefinition()
Returns the original definition string specified in the constructor.

Returns:
the definition

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
the String representation
See Also:
Support