Class Rule

    • Method Detail

      • builder

        public static Rule.Builder builder()
        Builder to create a Rule instance.
        Returns:
        returns a new Builder.
      • builder

        public static Rule.Builder builder​(FromSourceLocation sourceLocation)
        Builder to create a Rule instance.
        Parameters:
        sourceLocation - the source of the rule.
        Returns:
        returns a new Builder.
      • fromNode

        public static Rule fromNode​(Node node)
        Creates a Rule instance from the given Node information.
        Parameters:
        node - the node to deserialize.
        Returns:
        the created Rule.
      • getConditions

        public java.util.List<Condition> getConditions()
        Gets the conditions required to satisfy this rule.
        Returns:
        the list of conditions.
      • getDocumentation

        public java.util.Optional<java.lang.String> getDocumentation()
        Gets the documentation value.
        Returns:
        returns the optional documentation value.
      • accept

        public abstract <T> T accept​(RuleValueVisitor<T> visitor)
        Invoke the RuleValueVisitor functions for this Rule.
        Type Parameters:
        T - the visitor return type.
        Parameters:
        visitor - the visitor to be invoked.
        Returns:
        the return value of the visitor.
      • typecheckValue

        protected abstract Type typecheckValue​(Scope<Type> scope)
      • typeCheck

        public Type typeCheck​(Scope<Type> scope)
        Description copied from interface: TypeCheck
        Checks whether the given types within a scope satisfy the constraints.
        Specified by:
        typeCheck in interface TypeCheck
        Parameters:
        scope - the scope to evaluate.
        Returns:
        the type validated by the scope check.
      • toNode

        public Node toNode()
        Description copied from interface: ToNode
        Converts a value to a Node.
        Specified by:
        toNode in interface ToNode
        Returns:
        Returns the creates Node.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object