Class Region

java.lang.Object
loci.poi.hssf.util.Region
All Implemented Interfaces:
Comparable

public class Region extends Object implements Comparable
Represents a from/to row/col square. This is a object primitive that can be used to represent row,col - row,col just as one would use String to represent a string of characters. Its really only useful for HSSF though.
Author:
Andrew C. Oliver acoliver at apache dot org
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of Region (0,0 - 0,0)
    Region(int rowFrom, short colFrom, int rowTo, short colTo)
     
    special constructor (I know this is bad but it is so wrong that its right okay) that makes a region from a mergedcells's region subrecord.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    Compares that the given region is the same less than or greater than this region.
    boolean
    contains(int row, short col)
    Answers: "is the row/column inside this range?"
    boolean
     
    int
     
    short
    get the upper left hand corner column number
    short
    get the lower right hand corner column number
    int
    get the upper left hand corner row number
    int
    get the lower right hand corner row number
    void
    setColumnFrom(short colFrom)
    set the upper left hand corner column number
    void
    setColumnTo(short colTo)
    set the lower right hand corner column number
    void
    setRowFrom(int rowFrom)
    set the upper left hand corner row number
    void
    setRowTo(int rowTo)
    get the lower right hand corner row number

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Region

      public Region()
      Creates a new instance of Region (0,0 - 0,0)
    • Region

      public Region(int rowFrom, short colFrom, int rowTo, short colTo)
    • Region

      public Region(MergeCellsRecord.MergedRegion region)
      special constructor (I know this is bad but it is so wrong that its right okay) that makes a region from a mergedcells's region subrecord.
  • Method Details

    • getColumnFrom

      public short getColumnFrom()
      get the upper left hand corner column number
      Returns:
      column number for the upper left hand corner
    • getRowFrom

      public int getRowFrom()
      get the upper left hand corner row number
      Returns:
      row number for the upper left hand corner
    • getColumnTo

      public short getColumnTo()
      get the lower right hand corner column number
      Returns:
      column number for the lower right hand corner
    • getRowTo

      public int getRowTo()
      get the lower right hand corner row number
      Returns:
      row number for the lower right hand corner
    • setColumnFrom

      public void setColumnFrom(short colFrom)
      set the upper left hand corner column number
      Parameters:
      colFrom - column number for the upper left hand corner
    • setRowFrom

      public void setRowFrom(int rowFrom)
      set the upper left hand corner row number
      Parameters:
      rowFrom - row number for the upper left hand corner
    • setColumnTo

      public void setColumnTo(short colTo)
      set the lower right hand corner column number
      Parameters:
      colTo - column number for the lower right hand corner
    • setRowTo

      public void setRowTo(int rowTo)
      get the lower right hand corner row number
      Parameters:
      rowTo - row number for the lower right hand corner
    • contains

      public boolean contains(int row, short col)
      Answers: "is the row/column inside this range?"
      Returns:
      true if the cell is in the range and false if it is not
    • equals

      public boolean equals(Region r)
    • compareTo

      public int compareTo(Region r)
      Compares that the given region is the same less than or greater than this region. If any regional coordiant passed in is less than this regions coordinants then a positive integer is returned. Otherwise a negative integer is returned.
      Parameters:
      r - region
      See Also:
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable
    • getArea

      public int getArea()
      Returns:
      the area contained by this region (number of cells)