Class BlockInfo

java.lang.Object
net.sf.basedb.core.BlockInfo

public final class BlockInfo extends Object
A BlockInfo object is used to represent the uniqe identifiers of an ArrayDesignBlock. It can either be the block number or the metagrid coordinates. If block number is used metagrid can be added but they are not used to identify an arraydesignblock and it is possible to create two blocks with the same metagrid as long as the blocknumbers are uniqe.
Version:
2.0
Author:
Enell, Nicklas
Last modified
$Date: 2009-04-06 14:52:39 +0200 (må, 06 apr 2009) $
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The block number.
    private final int
    The X coordinate of the block.
    private final int
    The Y coordinate of the block.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockInfo(int metaGridX, int metaGridY)
    Create a new block info using the meta coordinates.
    BlockInfo(int block, int metaGridX, int metaGridY)
    Create a new block info using meta coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Check if this object is equal to another BlockInfo object.
    int
    Get the block number.
    int
    Get the row or x meta coordinate.
    int
    Get the column or y meta coordinate.
    final int
    Calculate the hash code for the object.
    final String
    Get the coordinate as [number;metaGridX,metaGridY]

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • block

      private final int block
      The block number.
    • metaGridY

      private final int metaGridY
      The Y coordinate of the block.
    • metaGridX

      private final int metaGridX
      The X coordinate of the block.
  • Constructor Details

    • BlockInfo

      public BlockInfo(int metaGridX, int metaGridY) throws InvalidDataException
      Create a new block info using the meta coordinates. Block is set to 0.
      Parameters:
      metaGridX - The row or x meta coordinate
      metaGridY - The column or y meta coordinate
      Throws:
      InvalidDataException - If any of the coordinates is 0 or negative
    • BlockInfo

      public BlockInfo(int block, int metaGridX, int metaGridY) throws InvalidDataException
      Create a new block info using meta coordinates.
      Parameters:
      block - The block number which must be greater or equal than 0
      metaGridX - The row or x meta coordinate, use 0 if unknown
      metaGridY - The column or y meta coordinate, use 0 if unknown
      Throws:
      InvalidDataException - If the block number is 0 or negative
  • Method Details

    • equals

      public final boolean equals(Object o)
      Check if this object is equal to another BlockInfo object. They are equal if they have the same block number > 0, or the same meta coordinates.
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Calculate the hash code for the object.
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Get the coordinate as [number;metaGridX,metaGridY]
      Overrides:
      toString in class Object
    • getMetaGridX

      public int getMetaGridX()
      Get the row or x meta coordinate.
    • getMetaGridY

      public int getMetaGridY()
      Get the column or y meta coordinate.
    • getBlock

      public int getBlock()
      Get the block number. If the block number is 0 it is considerd unknown and meta coordinates are used instead.