Class Type

java.lang.Object
dev.roanh.gmark.core.graph.Type
All Implemented Interfaces:
IDable

public class Type extends Object implements IDable
Represents a single type in a graph schema. A type encoded information about the number of nodes of that specific type in a concrete graph instance.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The textual alias name for this type.
    private Integer
    If this nodes of this type are present in a fixed quantity in a concrete graph instance then this is the number of nodes of this type present in the graph.
    private final int
    The ID of this type.
    private Double
    If this nodes of this type are present as a proportion of all nodes in a concrete graph instance then this is the fraction of nodes of this type present in the graph.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Type(int id, String alias, double proportion)
    Constructs a new type with the given id, alias and proportional presence quantity.
    Type(int id, String alias, int fixed)
    Constructs a new type with the given id, alias and fixed presence quantity.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    Gets the textual alias name for this type.
    int
    Gets the unique ID for this object.
    int
    If this nodes of this type are present in a fixed quantity in a concrete graph instance then this gets the number of nodes of this type present in the graph.
    double
    If this nodes of this type are present as a proportion of all nodes in a concrete graph instance then this gets the fraction of nodes of this type present in the graph.
    int
     
    boolean
    Checks if nodes of this type scale in number with the size of the graph.
     

    Methods inherited from class java.lang.Object

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

    • id

      private final int id
      The ID of this type.
    • alias

      private String alias
      The textual alias name for this type.
    • fixed

      private Integer fixed
      If this nodes of this type are present in a fixed quantity in a concrete graph instance then this is the number of nodes of this type present in the graph. Otherwise this value is null.
    • proportion

      private Double proportion
      If this nodes of this type are present as a proportion of all nodes in a concrete graph instance then this is the fraction of nodes of this type present in the graph. Otherwise this value is null.
  • Constructor Details

    • Type

      public Type(int id, String alias, int fixed)
      Constructs a new type with the given id, alias and fixed presence quantity.
      Parameters:
      id - The ID of this type.
      alias - The alias name of this type.
      fixed - The number of nodes in a concrete graph instance that are of this type.
    • Type

      public Type(int id, String alias, double proportion)
      Constructs a new type with the given id, alias and proportional presence quantity.
      Parameters:
      id - The ID of this type.
      alias - The alias name of this type.
      proportion - The fraction of all nodes in a concrete graph instance that are of this type.
  • Method Details

    • isScalable

      public boolean isScalable()
      Checks if nodes of this type scale in number with the size of the graph. If this is false then nodes of this type are instead present in a fixed quantity.
      Returns:
      True if nodes of this type are scalable.
    • getNodeCount

      public int getNodeCount()
      If this nodes of this type are present in a fixed quantity in a concrete graph instance then this gets the number of nodes of this type present in the graph.
      Returns:
      The number of nodes in a graph instance of this type.
      Throws:
      IllegalStateException - If this type is not present in a fixed quantity.
      See Also:
    • getProportion

      public double getProportion()
      If this nodes of this type are present as a proportion of all nodes in a concrete graph instance then this gets the fraction of nodes of this type present in the graph.
      Returns:
      The fraction of all nodes in a graph that are of this type.
      Throws:
      IllegalStateException - If this type is not present in a proportional quantity.
      See Also:
    • getAlias

      public String getAlias()
      Gets the textual alias name for this type.
      Returns:
      The alias for this type.
    • getID

      public int getID()
      Description copied from interface: IDable
      Gets the unique ID for this object. This ID uniquely identifies all objects of this type.
      Specified by:
      getID in interface IDable
      Returns:
      The unique ID for this object.
    • toString

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

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object