Package pointgon

Class Trie

java.lang.Object
pointgon.Trie
All Implemented Interfaces:
Serializable

public class Trie extends Object implements Serializable
Class for a trie to store partition subproblem solutions.
Since:
2005.02.18 (Christian Borgelt)
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Trie(int vertcnt)
    Create a subproblem trie.
    Trie(int vertcnt, boolean rev)
    Create a subproblem trie.
    Trie(int vertcnt, int holecnt)
    Create a subproblem trie.
    Trie(int vertcnt, int holecnt, boolean rev)
    Create a subproblem trie.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    add(Vertex[] key, double weight, Object object)
    Add a subproblem to the trie.
    int
    add(Vertex[] key, int len, double weight, Object object)
    Add a subproblem to the trie.
    Get a subproblem solution.
    getObject(Vertex[] key, int len)
    Get a subproblem solution.
    int[]
    Get statistics about the trie.
    double
    Get a subproblem solution (triangulation weight).
    double
    getWeight(Vertex[] key, int len)
    Get a subproblem solution (triangulation weight).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Trie

      public Trie(int vertcnt, boolean rev)
      Create a subproblem trie.
      Parameters:
      vertcnt - the number of perimeter vertices
      rev - whether to reverse the key direction
      Since:
      2005.02.18 (Christian Borgelt)
    • Trie

      public Trie(int vertcnt, int holecnt, boolean rev)
      Create a subproblem trie.
      Parameters:
      vertcnt - the number of perimeter vertices
      holecnt - the number of hole vertices
      rev - whether to reverse the key direction
      Since:
      2005.02.18 (Christian Borgelt)
    • Trie

      public Trie(int vertcnt)
      Create a subproblem trie.
      Parameters:
      vertcnt - the number of perimeter vertices
      Since:
      2005.02.18 (Christian Borgelt)
    • Trie

      public Trie(int vertcnt, int holecnt)
      Create a subproblem trie.
      Parameters:
      vertcnt - the number of perimeter vertices
      holecnt - the number of hole vertices
      Since:
      2005.02.18 (Christian Borgelt)
  • Method Details

    • add

      public int add(Vertex[] key, double weight, Object object)
      Add a subproblem to the trie.
      Parameters:
      key - the key of the subproblem
      weight - the weight of the solution of the subproblem
      object - the solution of the subproblem
      Returns:
      0 if adding the subproblem was successful, -1 if the corresponding node os already in use
      Since:
      2005.02.18 (Christian Borgelt)
    • add

      public int add(Vertex[] key, int len, double weight, Object object)
      Add a subproblem to the trie.
      Parameters:
      key - the key of the subproblem
      len - the size of the subproblem
      weight - the weight of the solution of the subproblem
      object - the solution of the subproblem
      Returns:
      0 if adding the subproblem was successful, -1 if the corresponding node os already in use
      Since:
      2005.02.18 (Christian Borgelt)
    • getWeight

      public double getWeight(Vertex[] key)
      Get a subproblem solution (triangulation weight).
      Parameters:
      key - the key of the subproblem
      Returns:
      the weight of the triangulation
      Since:
      2005.02.18 (Christian Borgelt)
    • getWeight

      public double getWeight(Vertex[] key, int len)
      Get a subproblem solution (triangulation weight).
      Parameters:
      key - the key of the subproblem
      len - the size of the subproblem
      Returns:
      the weight of the triangulation
      Since:
      2005.02.18 (Christian Borgelt)
    • getObject

      public Object getObject(Vertex[] key)
      Get a subproblem solution.
      Parameters:
      key - the key of the subproblem
      Returns:
      the solution of the subproblem
      Since:
      2005.02.18 (Christian Borgelt)
    • getObject

      public Object getObject(Vertex[] key, int len)
      Get a subproblem solution.
      Parameters:
      key - the key of the subproblem
      len - the size of the subproblem
      Returns:
      the solution of the subproblem
      Since:
      2005.02.18 (Christian Borgelt)
    • getStats

      public int[] getStats()
      Get statistics about the trie.
      Returns:
      a list of five integers with different counts
      Since:
      2005.02.18 (Christian Borgelt)