Class Row<V>

java.lang.Object
ghidra.graph.viewer.layout.Row<V>
Type Parameters:
V - the vertex type

public class Row<V> extends Object
A row in a grid. This class stores its row index, its y offset and its height. The y value is the layout space y value of a Point2D object. That is, unlike the GridLocationMap, the y value of this object is in layout space and not indexes of a grid.

This class maintains a collection of vertices on this row, organized by column index. You can get the column of a vertex from getColumn(V).

  • Field Details

    • y

      public int y
      The layout y coordinate of the column
    • height

      public int height
    • index

      public int index
      The grid index of this row (0, 1...n) for the number of rows
  • Method Details

    • setColumn

      public void setColumn(V v, int col)
      Sets the column index in this row for the given vertex
      Parameters:
      v - the vertex
      col - the column index
    • getColumn

      public int getColumn(V v)
      Returns the column index for the given vertex
      Parameters:
      v - the vertex
      Returns:
      the column index for the given vertex
    • getVertex

      public V getVertex(int column)
      Returns the vertex at the given column index or null if there is no vertex at that column
      Parameters:
      column - the column index
      Returns:
      the vertex
    • getColumnCount

      public int getColumnCount()
      Represents the range of columns in this row. For this given row in a grid:
              0 1 2 3 4 5 6
              - - v - v - - 
       
      the column count is 3--where the column range is 2-4, inclusive.

      Note: this differs from then number of vertices in this row, as the column count includes columns that have no vertex.

      Returns:
      the number of columns in this row, including empty columns between start and end
    • getStartColumn

      public Integer getStartColumn()
      Returns the smallest column index in this row
      Returns:
      the smallest column index in this row
    • getEndColumn

      public int getEndColumn()
      Returns the largest column index in this row
      Returns:
      the largest column index in this row
    • getVertices

      public List<V> getVertices()
      Returns all vertices in this row, sorted by column index (min to max).

      Note: the index of a vertex in the list does not match the column index. To get the column index for a vertex, call getColumn(V).

      Returns:
      all vertices in this row
    • getPaddedHeight

      public int getPaddedHeight(boolean isCondensed)
    • isInitialized

      public boolean isInitialized()
    • toString

      public String toString()
      Overrides:
      toString in class Object