Class KnowledgeGroup

java.lang.Object
edu.cmu.tetrad.data.KnowledgeGroup
All Implemented Interfaces:
TetradSerializable, Serializable

public final class KnowledgeGroup extends Object implements TetradSerializable
Represents a "Other Group" in Knowledge, which can be understood as: Group1 -> Group2 where there are edges between all members of Group1 to Group2.

Immutable.

Version:
$Id: $Id
Author:
Tyler Gibson
See Also:
  • Field Details

    • REQUIRED

      public static final int REQUIRED
      The types of groups (Can an enum be used instead?)
      See Also:
    • FORBIDDEN

      public static final int FORBIDDEN
      Constant FORBIDDEN=2
      See Also:
  • Constructor Details

    • KnowledgeGroup

      public KnowledgeGroup(int type, Set<String> from, Set<String> to)
      Constructs a group given the type.
      Parameters:
      type - - the type
      from - a Set object
      to - a Set object
    • KnowledgeGroup

      public KnowledgeGroup(int type)
      Constructs an empty instance of a knowledge group.
      Parameters:
      type - a int
  • Method Details

    • serializableInstance

      public static KnowledgeGroup serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a KnowledgeGroup object
    • getType

      public int getType()

      Getter for the field type.

      Returns:
      a int
    • isEmpty

      public boolean isEmpty()
      States whether this group is empty, that is there is no edges in it (Note there may be some partial information though).
      Returns:
      a boolean
    • getFromVariables

      public Set<String> getFromVariables()

      getFromVariables.

      Returns:
      a Set object
    • getToVariables

      public Set<String> getToVariables()

      getToVariables.

      Returns:
      a Set object
    • getEdges

      public List<KnowledgeEdge> getEdges()

      getEdges.

      Returns:
      - edges.
    • containsEdge

      public boolean containsEdge(KnowledgeEdge edge)

      containsEdge.

      Parameters:
      edge - a KnowledgeEdge object
      Returns:
      a boolean
    • hashCode

      public int hashCode()
      Computes a hashcode.
      Overrides:
      hashCode in class Object
      Returns:
      a int
    • equals

      public boolean equals(Object o)

      Equals when they are the same type and have the same edges.

      Overrides:
      equals in class Object