Class LabelSequence

java.lang.Object
dev.roanh.cpqindex.LabelSequence
All Implemented Interfaces:
Comparable<LabelSequence>

public final class LabelSequence extends Object implements Comparable<LabelSequence>
Class representing a sequence of edge labels.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private dev.roanh.gmark.core.graph.Predicate[]
    An ordered array of the labels that make up the label sequence.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new label sequence by joining the given sequences.
    LabelSequence(dev.roanh.gmark.core.graph.Predicate label)
    Constructs a new label sequence with just a single label.
    LabelSequence(DataInputStream in, dev.roanh.gmark.util.RangeList<dev.roanh.gmark.core.graph.Predicate> labels)
    Reads a label sequence from the given input stream and resolves the corresponding predicates from the given list.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
     
    dev.roanh.gmark.core.graph.Predicate[]
    Gets the label in this sequence as an array of predicates.
    int
     
     
    void
    Writes this label sequence to the given stream.

    Methods inherited from class java.lang.Object

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

    • data

      private dev.roanh.gmark.core.graph.Predicate[] data
      An ordered array of the labels that make up the label sequence.
  • Constructor Details

    • LabelSequence

      public LabelSequence(LabelSequence first, LabelSequence last)
      Constructs a new label sequence by joining the given sequences.
      Parameters:
      first - The start of the new label sequence.
      last - The end of the new label sequence.
    • LabelSequence

      public LabelSequence(dev.roanh.gmark.core.graph.Predicate label)
      Constructs a new label sequence with just a single label.
      Parameters:
      label - The single label of the sequence.
    • LabelSequence

      public LabelSequence(DataInputStream in, dev.roanh.gmark.util.RangeList<dev.roanh.gmark.core.graph.Predicate> labels) throws IOException
      Reads a label sequence from the given input stream and resolves the corresponding predicates from the given list.
      Parameters:
      in - The stream to read from.
      labels - A list with each predicate at its ID position.
      Throws:
      IOException - When an IO exception occurs.
  • Method Details

    • write

      public void write(DataOutputStream out) throws IOException
      Writes this label sequence to the given stream.
      Parameters:
      out - The stream to write to.
      Throws:
      IOException - When an IOException occurs.
    • getLabels

      public dev.roanh.gmark.core.graph.Predicate[] getLabels()
      Gets the label in this sequence as an array of predicates.
      Returns:
      The labels for this sequence.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(LabelSequence o)
      Specified by:
      compareTo in interface Comparable<LabelSequence>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object