Class ImmutablePreferenceImpl

    • Constructor Detail

      • ImmutablePreferenceImpl

        protected ImmutablePreferenceImpl​(Voter voter,
                                          Graph<Alternative> graph)
        Parameters:
        voter - not null
        graph - not null graph with ordered Alternatives
    • Method Detail

      • asImmutablePreference

        public static ImmutablePreference asImmutablePreference​(Voter voter,
                                                                Graph<Alternative> graph)
        Parameters:
        voter - not null
        graph - not null graph with ordered Alternatives
        Returns:
        new ImmutablePreference
      • copyOf

        public static ImmutablePreference copyOf​(Preference preference)
        Transform Preference to ImmutablePreference
        Parameters:
        preference - not null
        Returns:
        ImmutablePreference
      • asGraph

        public ImmutableGraph<Alternative> asGraph()
        Description copied from interface: ImmutablePreference
        In the graph : a relation from a to b means "a is at least as good as b". This graph can’t be modified, but is not necessarily immutable. Reflexive and transitive. This graph is immutable.
        Specified by:
        asGraph in interface ImmutablePreference
        Specified by:
        asGraph in interface Preference
        Returns:
        the Graph corresponding to the Preference.
      • getVoter

        public Voter getVoter()
        Specified by:
        getVoter in interface Preference
        Returns:
        Voter instance of the preference, Returns the voter 0 if no specific voter is associated to this preference