Class Surround.Block

java.lang.Object
uk.ac.starlink.ttools.plot2.Surround.Block
Enclosing class:
Surround

public static class Surround.Block extends Object
Represents the space taken along one side of a rectangle. The extent is considered to be the distance perpendicular to the side away from the rectangle, while the under/over values are non-negative overhang distances in the negative/positive directions parallel to the side. The top block is represented by the following magnificent ASCII-art:
       ----------------------------------------------------------
       |           .              ^                  .          |
       |           .              |                  .          |
       |(--under--).            extent               .(--over--)|
       |           .              |                  .          |
       |-----------.              V                  .----------|
                   +++++++++++++++++++++++++++++++++++
                   ++++++ Attached rectangle +++++++++
                   +++++++++++++++++++++++++++++++++++
 
  • Field Details

    • extent

      public int extent
    • under

      public int under
    • over

      public int over
  • Constructor Details

    • Block

      public Block()
      Constructs an empty block.
    • Block

      public Block(Surround.Block other)
      Clone constructor. A deep copy of the provided template is constructed.
      Parameters:
      other - template block
    • Block

      public Block(int extent)
      Constructs a block with an extent but no over or under.
      Parameters:
      extent - extent
    • Block

      public Block(int extent, int under, int over)
      Constructs a block with all members supplied.
      Parameters:
      extent - extent perpendicular to axis
      under - non-negative overhang in negative direction parallel to axis
      over - non-negative overhang in positive direction parallel to axis
  • Method Details

    • add

      public Surround.Block add(Surround.Block other)
      Creates a block which is represents the sum of this and another. Extents are added, and the larger over/under values are used.
      Parameters:
      other - block to add to this one
      Returns:
      new block
    • union

      public Surround.Block union(Surround.Block other)
      Creates a block which represents the union of this and another. For each of extent, under and over, the maximum values is used.
      Parameters:
      other - block to add to this one
      Returns:
      new block
    • toString

      public String toString()
      Overrides:
      toString in class Object