org.decisiondeck.jmcda.persist.xmcda2
Class XMCDAAlternativesScores

java.lang.Object
  extended by org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelper
      extended by org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelperWithVarious
          extended by org.decisiondeck.jmcda.persist.xmcda2.XMCDAAlternativesScores

public class XMCDAAlternativesScores
extends XMCDAHelperWithVarious

Methods for reading and writing alternative scores from and to XMCDA fragments.


Constructor Summary
XMCDAAlternativesScores()
          Creates a new object which will use the default error management strategy XMCDAErrorsManager.ErrorManagement.THROW.
XMCDAAlternativesScores(XMCDAErrorsManager errorsManager)
          Creates a new object delegating error management to the given error manager in case of unexpected data read.
 
Method Summary
 Set<Alternative> getAlternatives()
          Retrieves a writeable view of the set of alternatives stored in this object.
 AlternativesScores readScoredAlternatives(Collection<XAlternativesValues> xAlternativesValuesList)
           Retrieves a mapping between the alternatives and the scores found in the given fragment.
 void setAlternatives(Set<Alternative> alternatives)
          Sets the alternatives stored in this object as the given ones.
 XAlternativesValues writeScoredAlternatives(AlternativesScores scoredAlternatives)
          Retrieves the XMCDA equivalent of the given scores.
 
Methods inherited from class org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelper
error, getStrategy, setStrategy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMCDAAlternativesScores

public XMCDAAlternativesScores()
Creates a new object which will use the default error management strategy XMCDAErrorsManager.ErrorManagement.THROW.


XMCDAAlternativesScores

public XMCDAAlternativesScores(XMCDAErrorsManager errorsManager)
Creates a new object delegating error management to the given error manager in case of unexpected data read.

Parameters:
errorsManager - not null.
Method Detail

readScoredAlternatives

public AlternativesScores readScoredAlternatives(Collection<XAlternativesValues> xAlternativesValuesList)
                                          throws InvalidInputException

Retrieves a mapping between the alternatives and the scores found in the given fragment.

In case of unexpected data, an exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy, otherwise, non conforming informations will be skipped.

Parameters:
xAlternativesValuesList - not null.
Returns:
not null.
Throws:
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy.

writeScoredAlternatives

public XAlternativesValues writeScoredAlternatives(AlternativesScores scoredAlternatives)
Retrieves the XMCDA equivalent of the given scores.

Parameters:
scoredAlternatives - not null.
Returns:
not null.

getAlternatives

public Set<Alternative> getAlternatives()
Retrieves a writeable view of the set of alternatives stored in this object.

Returns:
not null.

setAlternatives

public void setAlternatives(Set<Alternative> alternatives)
Sets the alternatives stored in this object as the given ones. No reference is held to the given set.

Parameters:
alternatives - not null, may be empty.


Copyright © 2011. All Rights Reserved.