org.decisiondeck.jmcda.persist.xmcda2
Class XMCDAAssignments

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.XMCDAAssignments

public class XMCDAAssignments
extends XMCDAHelperWithVarious

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


Constructor Summary
XMCDAAssignments()
          Creates a new object which will use the default error management strategy XMCDAErrorsManager.ErrorManagement.THROW.
XMCDAAssignments(XMCDAErrorsManager errorsManager)
          Creates a new object delegating error management to the given error manager in case of unexpected data read.
 
Method Summary
 SortedSet<Category> getCategories()
          Retrieves a copy of the categories stored in this object, or null if the categories have not been set yet.
 IAssignmentsToMultiple read(XAlternativesAffectations xAlternativesAffectations)
           Retrieves an object representing the assignments, possibly to multiple categories, contained in the given fragment.
 Map<DecisionMaker,IAssignmentsToMultiple> readAll(Collection<XAlternativesAffectations> xAllAlternativesAffectations)
           Retrieves assignments to multiple categories objects per decision makers, containing the information in the given fragment.
 Map<DecisionMaker,IAssignmentsWithCredibilities> readAllWithCredibilities(Collection<XAlternativesAffectations> xAlternativesAffectationsCollection)
           Retrieves assignments with credibilities objects per decision makers, containing the information in the given fragment.
 IAssignmentsWithCredibilities readWithCredibilities(XAlternativesAffectations xAlternativesAffectations)
           Retrieves an object representing the assignments with credibilities contained in the given fragment.
 void setAlternativesOrder(Collection<Alternative> alternativesOrder)
           
 void setCategories(SortedSet<Category> categories)
          Sets the categories stored in this object.
 void setDmsOrder(Collection<DecisionMaker> dmsOrder)
           
 XAlternativesAffectations write(IOrderedAssignmentsToMultipleRead assignments)
          Retrieves the XMCDA equivalent of the given assignments.
 XAlternativesAffectations write(IOrderedAssignmentsWithCredibilitiesRead assignments)
          Retrieves the XMCDA equivalent of the given assignments.
 Collection<XAlternativesAffectations> writeAll(Map<DecisionMaker,? extends IOrderedAssignmentsToMultipleRead> allAssignments)
          Retrieves the XMCDA equivalent of the given assignments.
 Collection<XAlternativesAffectations> writeAllWithCredibilities(Map<DecisionMaker,? extends IOrderedAssignmentsWithCredibilitiesRead> allAssignments)
          Retrieves the XMCDA equivalent of the given assignments.
 
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

XMCDAAssignments

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


XMCDAAssignments

public XMCDAAssignments(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

write

public XAlternativesAffectations write(IOrderedAssignmentsWithCredibilitiesRead assignments)
Retrieves the XMCDA equivalent of the given assignments. There must be at least one assignment.

Parameters:
assignments - not null.
Returns:
not null.

readAll

public Map<DecisionMaker,IAssignmentsToMultiple> readAll(Collection<XAlternativesAffectations> xAllAlternativesAffectations)
                                                  throws InvalidInputException

Retrieves assignments to multiple categories objects per decision makers, containing the information in the given fragment. The iteration order of the key set of the returned map reflects the order read in the 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:
xAllAlternativesAffectations - not null, no null values.
Returns:
not null.
Throws:
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy.
See Also:
setCategories(java.util.SortedSet)

read

public IAssignmentsToMultiple read(XAlternativesAffectations xAlternativesAffectations)
                            throws InvalidInputException

Retrieves an object representing the assignments, possibly to multiple categories, contained 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:
xAlternativesAffectations - not null, no null values.
Returns:
not null.
Throws:
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy.
See Also:
setCategories(java.util.SortedSet)

writeAllWithCredibilities

public Collection<XAlternativesAffectations> writeAllWithCredibilities(Map<DecisionMaker,? extends IOrderedAssignmentsWithCredibilitiesRead> allAssignments)
Retrieves the XMCDA equivalent of the given assignments. The assignments objects given as values must each have at least one assignment.

Parameters:
allAssignments - not null.
Returns:
not null.

readWithCredibilities

public IAssignmentsWithCredibilities readWithCredibilities(XAlternativesAffectations xAlternativesAffectations)
                                                    throws InvalidInputException

Retrieves an object representing the assignments with credibilities contained 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:
xAlternativesAffectations - not null, no null values.
Returns:
not null.
Throws:
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy.
See Also:
setCategories(java.util.SortedSet)

write

public XAlternativesAffectations write(IOrderedAssignmentsToMultipleRead assignments)
Retrieves the XMCDA equivalent of the given assignments. There must be at least one assignment.

Parameters:
assignments - not null.
Returns:
not null.

readAllWithCredibilities

public Map<DecisionMaker,IAssignmentsWithCredibilities> readAllWithCredibilities(Collection<XAlternativesAffectations> xAlternativesAffectationsCollection)
                                                                          throws InvalidInputException

Retrieves assignments with credibilities objects per decision makers, containing the information in the given fragment. The iteration order of the key set of the returned map reflects the order read in the 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:
xAlternativesAffectationsCollection - not null, no null key or values.
Returns:
not null.
Throws:
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy.
See Also:
setCategories(java.util.SortedSet)

getCategories

public SortedSet<Category> getCategories()
Retrieves a copy of the categories stored in this object, or null if the categories have not been set yet.

Returns:
null iff not set yet.

setCategories

public void setCategories(SortedSet<Category> categories)
Sets the categories stored in this object. No reference is held to the given set.

Parameters:
categories - possibly null.

setAlternativesOrder

public void setAlternativesOrder(Collection<Alternative> alternativesOrder)

setDmsOrder

public void setDmsOrder(Collection<DecisionMaker> dmsOrder)

writeAll

public Collection<XAlternativesAffectations> writeAll(Map<DecisionMaker,? extends IOrderedAssignmentsToMultipleRead> allAssignments)
Retrieves the XMCDA equivalent of the given assignments. The assignments objects given as values must each have at least one assignment.

Parameters:
allAssignments - not null.
Returns:
not null.


Copyright © 2011. All Rights Reserved.