Class Hints


  • public class Hints
    extends Object
    A basic interface for storing and accessing Hints. The general structure for a Hint is

    hint = hintType.option

    • hintType designates the category of hint
    • option designates the preference within the category
    • hint is the combination of hintType and option with a delimiting .

    For example, you might write a hintType to designate preferences on a tradeoff between performance and loss. That hintType might be Lossiness, with options LOSSLESS and LOSSY.

    Author:
    Gabriel Selzer
    • Constructor Detail

      • Hints

        public Hints​(String... startingHints)
    • Method Detail

      • plus

        public Hints plus​(String... hints)
        Returns a new Hints with:
        1. All hints in this Hints
        2. All hints in hints
        Parameters:
        hints - the hints to add to this Hints
        Returns:
        a new Hints containing the union of the two sets of hints
      • plus

        public Hints plus​(Hints other)
        Returns a new Hints with:
        1. All hints in this Hints
        2. All hints in other
        Parameters:
        other - the other Hints object
        Returns:
        a new Hints containing the union of the two sets of hints
      • minus

        public Hints minus​(String... hints)
        Returns a new Hints with only the hints in this Hints that are not also in hints
        Parameters:
        hints - the hints that should not carry over from this Hints
        Returns:
        a new Hints containing the hints in this Hints but not in hints
      • contains

        public boolean contains​(String hint)
        Determines whether hint is in this Hints
        Parameters:
        hint - a hint
        Returns:
        true iff hint is in this Hints
      • containsNone

        public boolean containsNone​(String... hints)
        Determines whether any hints in hints are also in this Hints
        Parameters:
        hints - an array of hints
        Returns:
        true iff each hint in hints is not in this Hints
      • containsAny

        public boolean containsAny​(String... hints)
        Determines whether any hints in hints are in this Hints
        Parameters:
        hints - an array of hints
        Returns:
        true iff any hint in hints is in this Hints
      • containsAll

        public boolean containsAll​(String... hints)
        Determines whether any hints in hints are in this Hints
        Parameters:
        hints - an array of hints
        Returns:
        true iff each hint in hints is in this Hints
      • copy

        public Hints copy()
        Generates a new Hints with identical hints.
        Returns:
        a new Hints Object with the same hints as this Hints
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object