Class TwoSequence

    • Field Detail

      • swap

        protected boolean swap
    • Method Detail

      • valid_types

        public final boolean valid_types​(VarInfo[] vis)
        Description copied from class: Invariant
        Returns whether or not the invariant is valid over the basic types in vis. This only checks basic types (scalar, string, array, etc) and should match the basic superclasses of invariant (SingleFloat, SingleScalarSequence, ThreeScalar, etc). More complex checks that depend on variable details can be implemented in instantiate_ok().
        Specified by:
        valid_types in class Invariant
        See Also:
        Invariant.instantiate_ok(VarInfo[])
      • get_swap

        public boolean get_swap()
        Returns whether or not the variable order is currently swapped for this invariant.
        Overrides:
        get_swap in class BinaryInvariant
      • resurrect_done

        protected Invariant resurrect_done​(int[] permutation)
        Checks to see if the variable order was swapped and calls the correct routine to handle it.
        Specified by:
        resurrect_done in class Invariant
        Parameters:
        permutation - the permutation
        Returns:
        the permuted invariant
      • var1

        public VarInfo var1​(@GuardSatisfied TwoSequence this)
        Returns the first variable. This is the only mechanism by which subclasses should access variables.
      • var2

        public VarInfo var2​(@GuardSatisfied TwoSequence this)
        Returns the first variable. This is the only mechanism by which subclasses should access variables.
      • var1

        public VarInfo var1​(VarInfo[] vis)
        Returns the first variable from the specified vis. This is the only mechanism by which subclasses should access variables.
      • var2

        public VarInfo var2​(VarInfo[] vis)
        Returns the first variable in the specified vis. This is the only mechanism by which subclasses should access variables.
      • check_modified

        public abstract InvariantStatus check_modified​(long @Interned [] v1,
                                                       long @Interned [] v2,
                                                       int count)
        Presents a sample to the invariant. Returns whether the sample is consistent with the invariant. Does not change the state of the invariant.
        Parameters:
        count - how many identical samples were observed in a row. For example, three calls to check_modified with a count parameter of 1 is equivalent to one call to check_modified with a count parameter of 3.
        Returns:
        whether or not the sample is consistent with the invariant
      • add_modified

        public InvariantStatus add_modified​(long @Interned [] v1,
                                            long @Interned [] v2,
                                            int count)
        Default implementation simply calls check. Subclasses can override.
      • add_unmodified

        public InvariantStatus add_unmodified​(long @Interned [] v1,
                                              long @Interned [] v2,
                                              int count)
        By default, do nothing if the value hasn't been seen yet. Subclasses can override this.
      • repr

        public String repr​(@GuardSatisfied TwoSequence this)
        Returns a representation of the class. This includes the classname, variables, and swap state.
        Overrides:
        repr in class Invariant
        Returns:
        a string representation of this
      • isSameFormula

        @Pure
        public boolean isSameFormula​(Invariant other)
        Return true if both invariants are the same class and the order of the variables (swap) is the same.
        Specified by:
        isSameFormula in class Invariant
        Parameters:
        other - the invariant to compare to this one
        Returns:
        true iff the two invariants represent the same mathematical formula. Does not consider