|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelper
org.decisiondeck.jmcda.persist.xmcda2.utils.XMCDAHelperWithVarious
org.decisiondeck.jmcda.persist.xmcda2.XMCDAAlternatives
public class XMCDAAlternatives
Methods for reading alternatives from XMCDA fragments, and writing (sets of) alternatives to XMCDA.
| Nested Class Summary | |
|---|---|
static class |
XMCDAAlternatives.AlternativesParsingMethod
|
| Constructor Summary | |
|---|---|
XMCDAAlternatives()
Creates a new object which will use the default error management strategy XMCDAErrorsManager.ErrorManagement.THROW. |
|
XMCDAAlternatives(XMCDAErrorsManager errorsManager)
Creates a new object delegating error management to the given error manager in case of unexpected data read. |
|
| Method Summary | |
|---|---|
Set<Alternative> |
getAlternativesMarkedReal()
Retrieves the subset of alternatives stored in this object that are marked as being real. |
Map<Alternative,Boolean> |
getFictiveStatus()
Retrieves a writeable view to the status of the alternatives, observed during a read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or stored after a
setFictiveStatus(Set, Set). |
Set<Alternative> |
getInactiveAlternatives()
Retrieves the alternatives stored in this object as inactive. |
Set<Alternative> |
getMarkedAlternatives(XAlternativeType.Enum type)
Retrieves the subset of alternatives stored in this object that are marked as requested. |
Map<Alternative,String> |
getNames()
Retrieves a writeable view of the set of the alternative names stored in this object, observed during a read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or stored after a setNames(java.util.Map. |
Set<Alternative> |
keepOnly(Set<Alternative> alternatives,
boolean fictitious)
Returns a new set containing all the alternatives in the given set that are marked in this object as being fictive, or the complementary, those that are not marked as being fictive, depending on the value of the boolean parameter. |
static Set<Alternative> |
read(Collection<XAlternatives> xAlternativesCollection,
XAlternativeType.Enum type,
XMCDAAlternatives.AlternativesParsingMethod parsingMethod)
Returns all the alternatives found in the given XMCDA fragments, or a part of these, depending on the requested parsing method. |
Alternative |
read(XAlternative xAlternative)
Returns an alternative corresponding to the given XMCDA alternative. |
Set<Alternative> |
readAll(Collection<XAlternatives> xAlternativesList)
Returns all the alternatives found in the given XMCDA fragments, except those marked as inactive. |
Set<Alternative> |
readAll(XAlternatives xAlternatives)
Returns all the alternatives found in the given XMCDA fragment, except those marked as inactive. |
Set<Alternative> |
readUsingConcept(Collection<XAlternatives> xAlternativesList,
XAlternativeType.Enum type)
Returns some of the alternatives found in the given XMCDA fragments, reading only the alternatives found in tags named after the appropriate concept (fictive or real), depending on the requested type. |
Set<Alternative> |
readUsingMarking(Collection<XAlternatives> xAlternativesList,
XAlternativeType.Enum type)
Returns some of the alternatives found in the given XMCDA fragments. |
void |
setFictiveStatus(Set<Alternative> realAlternatives,
Set<Alternative> fictiveAlternatives)
Marks the given alternatives as real or fictive, for storing in this object. |
void |
setInactiveAlternatives(Set<Alternative> inactiveAlternatives)
Stores the given alternatives in this object. |
void |
setMarkActiveAlternatives(boolean activeAlternatives)
|
void |
setNames(Map<Alternative,String> names)
Sets the alternative names stored in this object as the given names. |
XAlternatives |
writeAlternatives(Set<Alternative> alternatives,
XAlternativeType.Enum type)
Retrieves the XMCDA equivalent of the given alternatives. |
| 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 |
|---|
public XMCDAAlternatives()
XMCDAErrorsManager.ErrorManagement.THROW.
public XMCDAAlternatives(XMCDAErrorsManager errorsManager)
errorsManager - not null.| Method Detail |
|---|
public Set<Alternative> readUsingConcept(Collection<XAlternatives> xAlternativesList,
XAlternativeType.Enum type)
throws InvalidInputException
Returns some of the alternatives found in the given XMCDA fragments, reading only the alternatives found in tags named after the appropriate concept (fictive or real), depending on the requested type. The alternative names, if found, are stored in this object, as well as the information of whether an alternative is marked fictive. Alternatives marked as inactive are stored in this object but are not included in the returned set. Any previously stored information is deleted.
The returned set iteration order respects the order of the source.
This method expects each alternative to have an id set, and maximum one type. 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.
xAlternativesList - not null.type - not null, XAlternativeType.REAL or XAlternativeType.FICTIVE.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public Set<Alternative> keepOnly(Set<Alternative> alternatives,
boolean fictitious)
Returns a new set containing all the alternatives in the given set that are marked in this object as being
fictive, or the complementary, those that are not marked as being fictive, depending on the value of the boolean
parameter. See also getFictiveStatus(). Note that this is not symmetric: this method considers an
alternative as being by default non fictive.
The iteration order of the returned set matches that of the given set of alternatives.
alternatives - not null.fictitious - true to receive only the alternatives specifically marked as fictive, false
to receive only alternatives not specifically marked as fictive.
null, may be empty.public Set<Alternative> getAlternativesMarkedReal()
read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or setFictiveStatus(java.util.Set, java.util.Set) occurred yet.
null.public Map<Alternative,Boolean> getFictiveStatus()
Retrieves a writeable view to the status of the alternatives, observed during a read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or stored after a
setFictiveStatus(Set, Set). The returned map has no null key, no null values,
and such entries may not be added to the map.
Entries with a value true are the alternatives marked fictive, entries with a value
false are marked real. Missing entries have no mark.
null.
public void setFictiveStatus(Set<Alternative> realAlternatives,
Set<Alternative> fictiveAlternatives)
realAlternatives - not null, may be empty, no null entry.fictiveAlternatives - not null, may be empty, no null entry.writeAlternatives(java.util.Set, org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternativeType.Enum)
public Alternative read(XAlternative xAlternative)
throws InvalidInputException
Returns an alternative corresponding to the given XMCDA alternative. The name, if found, is stored in this
object. If the given alternative is marked as being fictive, or as being non fictive, this is also stored in this
object. If the alternative is marked as inactive, null is returned, but the alternative is added to
the inactive alternatives stored in this object.
This method expects the alternative to have an id set, and maximum one type. In case of unexpected data, an
exception is thrown if this object follows the XMCDAErrorsManager.ErrorManagement.THROW strategy, otherwise, this method
returns null if the id could not be read.
xAlternative - not null.
null if unexpected content has been read and this object follows a permissive
strategy, or if the given xml alternative is marked as inactive.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.getInactiveAlternatives()
public Set<Alternative> readAll(XAlternatives xAlternatives)
throws InvalidInputException
Returns all the alternatives found in the given XMCDA fragment, except those marked as inactive. The alternative names, if found, are stored in this object, as well as the information of whether an alternative is fictive. Alternatives marked as inactive are stored in this object. Any previously stored information is deleted.
The returned set iteration order respects the order of the source.
This method expects each alternative to have an id set, and maximum one type. 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.
xAlternatives - not null.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public XAlternatives writeAlternatives(Set<Alternative> alternatives,
XAlternativeType.Enum type)
alternatives - not null, may be empty.type - may be null.
null.setFictiveStatus(java.util.Set, java.util.Set) ,
setNames(java.util.Map) ,
setInactiveAlternatives(java.util.Set) public void setMarkActiveAlternatives(boolean activeAlternatives)
activeAlternatives - true to mark the alternatives as active when they are not found in the inactive
alternatives. The default is to only mark inactive alternatives.setInactiveAlternatives(Set)public Map<Alternative,String> getNames()
read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or stored after a setNames(java.util.Map) . The returned map has no null key, no
null values, and such entries may not be added to the map..
null.
public Set<Alternative> readAll(Collection<XAlternatives> xAlternativesList)
throws InvalidInputException
Returns all the alternatives found in the given XMCDA fragments, except those marked as inactive. The alternative names, if found, are stored in this object, as well as the information of whether an alternative is fictive. Alternatives marked as inactive are stored in this object. Any previously stored information is deleted.
The returned set iteration order respects the order of the source.
This method expects each alternative to have an id set, and maximum one type. 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.
xAlternativesList - not null.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.public void setNames(Map<Alternative,String> names)
names - not null, may be empty, no null key or value.writeAlternatives(java.util.Set, org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternativeType.Enum) public Set<Alternative> getMarkedAlternatives(XAlternativeType.Enum type)
read(org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternative) or setFictiveStatus(java.util.Set, java.util.Set) occurred yet.
type - not null, XAlternativeType.FICTIVE or XAlternativeType.REAL.
null.
public Set<Alternative> readUsingMarking(Collection<XAlternatives> xAlternativesList,
XAlternativeType.Enum type)
throws InvalidInputException
Returns some of the alternatives found in the given XMCDA fragments. The alternative names, if found, are stored in this object, as well as the information of whether an alternative is fictive. Alternatives marked as inactive are stored in this object but are not included in the returned set. Any previously stored information is deleted.
The returned set iteration order respects the order of the source.
This method expects each alternative to have an id set, and maximum one type. 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.
xAlternativesList - not null.type - not null, XAlternativeType.FICTIVE to receive only the alternatives specifically
marked as fictive, XAlternativeType.REAL to receive only alternatives not specifically marked
as fictive. Note that this is not symmetric: this method considers an alternative as being by default
non fictive.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.
public static Set<Alternative> read(Collection<XAlternatives> xAlternativesCollection,
XAlternativeType.Enum type,
XMCDAAlternatives.AlternativesParsingMethod parsingMethod)
throws InvalidInputException
Returns all the alternatives found in the given XMCDA fragments, or a part of these, depending on the requested parsing method. Alternatives marked as inactive are not returned.
XMCDAAlternatives.AlternativesParsingMethod.TAKE_ALL, all the alternatives are returned.XMCDAAlternatives.AlternativesParsingMethod.SEEK_CONCEPT, only the alternatives found in tags named after the
appropriate concept (fictive or real), depending on the requested type, are returned.XMCDAAlternatives.AlternativesParsingMethod.USE_MARKING, and the type is XAlternativeType.FICTIVE, the
alternatives specifically marked as fictive, accross all the XMCDA fragments, are returned. If it is
XMCDAAlternatives.AlternativesParsingMethod.USE_MARKING and the type is XAlternativeType.REAL, the alternatives not
specifically marked as fictive, accross all the XMCDA fragments, are returned. Note that this is not symmetric:
this method considers an alternative as being by default non fictive.For each alternative contained in the returned set, the alternative name, if found, as well as the information of whether an alternative is fictive, are stored in this object. Any previously stored information is deleted.
The returned set iteration order matches the order of the source.
This method expects each alternative to have an id set, and maximum one type. 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.
xAlternativesCollection - not null.type - unused and may be null if parsing method is XMCDAAlternatives.AlternativesParsingMethod.TAKE_ALL,
otherwise, must be one of XAlternativeType.REAL or XAlternativeType.FICTIVE.parsingMethod - not null.
null.
InvalidInputException - iff unexpected content has been read and this object follows the XMCDAErrorsManager.ErrorManagement.THROW
strategy.readAll(Collection),
#readUsingConcept(Collection, Enum),
#readUsingMarking(Collection, Enum)public Set<Alternative> getInactiveAlternatives()
setInactiveAlternatives(Set) occurred yet.
null.public void setInactiveAlternatives(Set<Alternative> inactiveAlternatives)
inactiveAlternatives - not null, may be empty, no null entry.writeAlternatives(java.util.Set, org.decisiondeck.jmcda.persist.xmcda2.generated.XAlternativeType.Enum)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||