Class Link

  • All Implemented Interfaces:
    Cloneable

    public final class Link
    extends Object
    implements Cloneable
    Represents a directed link in a Bayesian network. For Dynamic Bayesian Networks, an order can be specified to link temporal nodes between different time slices.
    • Constructor Detail

      • Link

        public Link​(Node from,
                    Node to)
        Initializes a new instance of the Link class with the parent node specified in [from] and the child in [to].
        Parameters:
        from - The parent node.
        to - The child node.
        Throws:
        NullPointerException - Raised if either [from] or [to] is null.
      • Link

        public Link​(Node from,
                    Node to,
                    int temporalOrder)
        Initializes a new instance of the Link class with a specified [temporalOrder], the parent node specified in [from] and the child in [to]. If a temporal order is specified that is greater than zero, then a link can connect two nodes (which may be the same) at different times.
        Parameters:
        from - The parent node.
        to - The child node.
        temporalOrder - The temporal order. Must be greater than or equal to zero.
        Throws:
        NullPointerException - Raised if either [from] or [to] is null.
        IllegalArgumentException - Raised if [temporalOrder] is negative.
    • Method Detail

      • copy

        public Link copy​(Node from,
                         Node to,
                         int temporalOrder)
        Creates a new link, copying the properties from this instance, such as getDescription() and getCustomProperties().
        Parameters:
        from - The parent node.
        to - The child node.
        temporalOrder - The temporal order. Must be greater than or equal to zero.
        Returns:
        A new link instance.
      • getCustomProperties

        public CustomPropertyCollection getCustomProperties()
        Gets custom properties associated with this instance. Custom properties allow storage of custom information, which will be saved with the network.
      • getIndex

        public int getIndex()
        The Index of this instance in the collection of links belonging to a network, or -1 if the link does not belong to a network.
      • getDescription

        public String getDescription()
        Optional description for the link.
      • setDescription

        public void setDescription​(String value)
        Optional description for the link.
      • getTemporalOrder

        public int getTemporalOrder()
        Gets the temporal order of the link. If the link is not temporal, zero will be returned.
      • getNoisyOrder

        public NoisyOrder getNoisyOrder()
        Gets a value which determines the nature of the effect between the parent node (from) and a noisy child node (to). This property has no effect if the child node is not a noisy node.
      • setNoisyOrder

        public void setNoisyOrder​(NoisyOrder value)
        Sets a value which determines the nature of the effect between the parent node (from) and a noisy child node (to). This property has no effect if the child node is not a noisy node.
      • getFrom

        public Node getFrom()
        The parent node of the directed link.
      • getTo

        public Node getTo()
        The child node of the directed link.
      • getNetwork

        public Network getNetwork()
        The Network the link belongs to. Value will be null unless the link has been added to a network.