pl.netanel.swt.matrix
Class CellExtent<X extends java.lang.Number,Y extends java.lang.Number>

java.lang.Object
  extended by pl.netanel.swt.matrix.CellExtent<X,Y>
Type Parameters:
X - indexing type for horizontal axis
Y - indexing type for vertical axis

public class CellExtent<X extends java.lang.Number,Y extends java.lang.Number>
extends java.lang.Object

Rectangular set of cells represented by start and end indexes on both axises. Instances of this class are immutable.


Method Summary
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
create(Cell<X,Y> start, Cell<X,Y> end)
          Creates a new instance of CellExtent from start and end cells.
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
create(Extent<X> extentX, Extent<Y> extentY)
          Creates a new instance of CellExtent from X and Y extents.
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
create(X startX, X endX, Y startY, Y endY)
          Creates a new instance of CellExtent.
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
createUnchecked(Cell<X,Y> start, Cell<X,Y> end)
          Creates a new instance of CellExtent without checking arguments validity.
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
createUnchecked(Extent<X> extentX, Extent<Y> extentY)
          Creates a new instance of CellExtent from X and Y extents without checking arguments validity.
static
<X extends java.lang.Number,Y extends java.lang.Number>
CellExtent<X,Y>
createUnchecked(X startX, X endX, Y startY, Y endY)
          Creates a new instance of CellExtent without checking arguments validity.
 boolean equals(java.lang.Object obj)
           
 X getEndX()
          Returns end cell index on the horizontal axis.
 Y getEndY()
          Returns end cell index on the vertical axis.
 X getStartX()
          Returns start cell index on the horizontal axis.
 Y getStartY()
          Returns start cell index on the vertical axis.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> create(X startX,
                                                                                             X endX,
                                                                                             Y startY,
                                                                                             Y endY)
Creates a new instance of CellExtent. Arguments are validated.

startX,endX, startY and endY numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
startX - first index of the range of column items
endX - last index of the range of column items
startY - first index of the range of row items
endY - last index of the range of row items
Returns:
a new instance of this class
Throws:
java.lang.IllegalArgumentException - if startX or endX or startY or endY is null.
java.lang.IndexOutOfBoundsException - startX or endX or startY or endY is negative.
java.lang.IllegalArgumentException - if startX is greater then endX or startY is greater then endY

createUnchecked

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> createUnchecked(X startX,
                                                                                                      X endX,
                                                                                                      Y startY,
                                                                                                      Y endY)
Creates a new instance of CellExtent without checking arguments validity.

startX,endX, startY and endY numbers are item indexes in the model, not the visual position of the item on the screen which can be altered by move and hide operations.

Parameters:
startX - first index of the range of column items
endX - last index of the range of column items
startY - first index of the range of row items
endY - last index of the range of row items
Returns:
a new instance of this class

create

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> create(Cell<X,Y> start,
                                                                                             Cell<X,Y> end)
Creates a new instance of CellExtent from start and end cells. Arguments are validated.

Parameters:
start - the top left corner of the range of cells
end - the bottom right corner of the range of cells
Returns:
a new instance of this class
Throws:
java.lang.IllegalArgumentException - if start or end is null.
java.lang.IndexOutOfBoundsException - indexX or indexY of start or end is negative.
java.lang.IllegalArgumentException - if indexX of start is greater then indexX of end or indexY of start is greater then indexY of end

createUnchecked

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> createUnchecked(Cell<X,Y> start,
                                                                                                      Cell<X,Y> end)
Creates a new instance of CellExtent without checking arguments validity.

Parameters:
start - the top left corner of the range of cells
end - the bottom right corner of the range of cells
Returns:
a new instance of this class

create

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> create(Extent<X> extentX,
                                                                                             Extent<Y> extentY)
Creates a new instance of CellExtent from X and Y extents. Arguments are validated.

Parameters:
extentX - range of items on the X axis
extentY - range of items on the Y axis
Returns:
a new instance of this class
Throws:
java.lang.IllegalArgumentException - if start or end is null.
java.lang.IndexOutOfBoundsException - indexX or indexY of start or end is negative.
java.lang.IllegalArgumentException - if indexX of start is greater then indexX of end or indexY of start is greater then indexY of end

createUnchecked

public static <X extends java.lang.Number,Y extends java.lang.Number> CellExtent<X,Y> createUnchecked(Extent<X> extentX,
                                                                                                      Extent<Y> extentY)
Creates a new instance of CellExtent from X and Y extents without checking arguments validity.

Parameters:
extentX - range of items on the X axis
extentY - range of items on the Y axis
Returns:
a new instance of this class

getStartX

public X getStartX()
Returns start cell index on the horizontal axis.

Returns:
start cell index on the horizontal axis

getEndX

public X getEndX()
Returns end cell index on the horizontal axis.

Returns:
end cell index on the horizontal axis

getStartY

public Y getStartY()
Returns start cell index on the vertical axis.

Returns:
start cell index on the vertical axis

getEndY

public Y getEndY()
Returns end cell index on the vertical axis.

Returns:
end cell index on the vertical axis

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011 netanel.pl. All Rights Reserved.