Class Hyperlink

java.lang.Object
dk.gtz.graphedit.view.log.Hyperlink

public class Hyperlink extends Object
Class representing a clickable textual link.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Checks if the hyperlink display is empty or now
      Returns:
      true if length() returns 0, false otherwise
    • shareSameAncestor

      public boolean shareSameAncestor(Hyperlink other)
      Checks if this hyperlink links to the same base link as another one.
      Parameters:
      other - The other hyperlink to check
      Returns:
      true if the other hyperlink is refering to the same link
    • length

      public int length()
      Get the length of the displayed text in the hyperlink
      Returns:
      The string-length of the displayed hyperlink text
    • charAt

      public char charAt(int index)
      Get the displayed character at some index
      Parameters:
      index - of the character to get
      Returns:
      The char value at the specified index
      Throws:
      IndexOutOfBoundsException - if the index argument is negative or larger than the displayed text length
    • getOriginalDisplayedText

      public String getOriginalDisplayedText()
      Get the original text
      Returns:
      String with the original text
    • getDisplayedText

      public String getDisplayedText()
      Get the displayed text
      Returns:
      String with the displayed text
    • getLink

      public String getLink()
      Get the link component of the hyperlink
      Returns:
      String with the link
    • subSequence

      public Hyperlink subSequence(int start, int end)
      Create a new hyperlink where the displayed text is a subsequence of this hyperlink's displayed text
      Parameters:
      start - the beginning index, inclusive
      end - the ending index, exclusive
      Returns:
      A new hyperlink with the same original text and link, but a subsequence for the displayed text
    • subSequence

      public Hyperlink subSequence(int start)
      Create a new hyperlink where the displayed text is a subsequence of this hyperlink's displayed text
      Parameters:
      start - the beginning index, inclusive
      Returns:
      A new hyperlink with the same original text and link, but a subsequence for the displayed text
    • mapDisplayedText

      public Hyperlink mapDisplayedText(String text)
      Create a new hyperlink where the displayed text is replaced with a provided string value
      Parameters:
      text - The new displayed text
      Returns:
      A new hyperlink with the same original text and link, but an updated displayed text
    • toString

      public String toString()
      Overrides:
      toString in class Object