lv.lumii.layoutengine.obstacleGraph

## Class Segment.VerticalPart<S extends Segment>

- java.lang.Object
- - lv.lumii.layoutengine.obstacleGraph.Segment.VerticalPart<S>

- Type Parameters:
    `S` - the segment class whose projections the parts will store.
  All Implemented Interfaces:
    java.lang.Comparable
  Enclosing class:
    Segment

      public static class Segment.VerticalPart<S extends Segment>
      extends java.lang.Object
      implements java.lang.Comparable

  A class for storing sweep-line segment projections on vertical axis.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `VerticalPart(double top, double bottom, S segment)` Creates a new VerticalPart object.
    `VerticalPart(S segment)` Creates a new VerticalPart object as a projection of a Segment instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(java.lang.Object op)` Compares this part to another `VerticalPart`.
    `double` | `getBottom()` Returns the bottom ordinate of the part.
    `S` | `getSegment()` Returns the ID of the segment this part belongs to.
    `double` | `getTop()` Returns the top ordinate of the part.
    `boolean` | `intersects(S segment)` Returns whether this part intersects the projection of the given segment.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### VerticalPart

          public VerticalPart(double top,
                              double bottom,
                              S segment)

      Creates a new VerticalPart object.
      Parameters:
        `top` - the top ordinate of the part
        `bottom` - the bottom ordinate of the part
        `segment` - the ID of the segment this part belongs to

    - #### VerticalPart

          public VerticalPart(S segment)

      Creates a new VerticalPart object as a projection of a Segment instance.
      Parameters:
        `segment` - the Segment to project

  - ### Method Detail

    - #### getTop

          public double getTop()

      Returns the top ordinate of the part.
      Returns:
        the top ordinate of the part.

    - #### getBottom

          public double getBottom()

      Returns the bottom ordinate of the part.
      Returns:
        the bottom ordinate of the part.

    - #### getSegment

          public S getSegment()

      Returns the ID of the segment this part belongs to.
      Returns:
        the ID of the segment this part belongs to.

    - #### intersects

          public boolean intersects(S segment)

      Returns whether this part intersects the projection of the given segment.
      Parameters:
        `segment` - - the segment to check for intersection
      Returns:
        whether this part intersects the projection of the given segment.

    - #### compareTo

          public int compareTo(java.lang.Object op)

      Compares this part to another `VerticalPart`. Compares with a priority to the top endpoint, than the bottom one.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      Parameters:
        `op` - the `VerticalPart` to compare to
      Returns:
        -1 if this part is smaller (higher than p), 0 if they are equal and 1 if this part is lower.