Class CompositorGuard
java.lang.Object
org.dlese.dpc.xml.schema.compositor.CompositorGuard
- Direct Known Subclasses:
AllGuard,ChoiceGuard,SequenceGuard
The CompositorGuard classes is responsible for enforcing the min and max
occurrance schema constraints defined for a Compositor (e.g., All, Choice,
or Sequence). CompositorGuards determine whether there is "room" in a given
instanceElement for any new members, and what members can be added.
- Author:
- ostwald
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompositorGuard(Compositor compositor, List instanceMembers) Constructor for the CompositorGuard objectCompositorGuard(Compositor compositor, org.dom4j.Element instanceElement) Constructor for the CompositorGuard object -
Method Summary
Modifier and TypeMethodDescriptionbooleanWill the CompositorGuard allow another member element to be added?booleanacceptsNewMember(String memberName, int memberIndex) Tests whether the instance element can accept a new member of "memberName" at the specified memberIndex.booleanNOT YET DOCUMENTEDorg.dlese.dpc.xml.schema.compositor.CompositorGuard.OccurrencefindOccurence(CompositorMember cm, int memberIndex) NOT YET DOCUMENTEDorg.dlese.dpc.xml.schema.compositor.CompositorGuard.OccurrencefindOccurrence(String leafName, int memberIndex) Find the occurrence containing the nth element of memberName.Gets the compositor attribute of the CompositorGuard objectstatic CompositorGuardgetInstance(Compositor compositor, org.dom4j.Element instanceElement) Gets the instance attribute of the CompositorGuard classprotected abstract ListReturns a list of occurrence instances that can be used to determine whether an instance document element satisfies the occurrence constraints of the schema.final intGets the occurrencesCount attribute of the CompositorGuard objectfinal intgetOccurrencesCount(String name) Gets the occurrencesCount attribute of the ChoiceGuard objectprotected final intgetSubOccurrenceCount(CompositorMember cm, org.dom4j.Element instanceElement) Gets the subOccurrenceCount attribute of the CompositorGuard objectvoidDescription of the MethodvoiddebuggingresolveLeafNameToCM(String leafName) Given a leaf element name, find the CompositorMember that ultimately controls itresolveLeafNameToCMName(String leafName) Uses resolveLeafNameToCM to return the instanceQualifiedName of the CompositorMember that controls the leafElement of leafName.toString()NOT YET DOCUMENTED
-
Field Details
-
instanceMembers
Description of the Field
-
-
Constructor Details
-
CompositorGuard
Constructor for the CompositorGuard object- Parameters:
compositor- NOT YET DOCUMENTEDinstanceElement- NOT YET DOCUMENTED
-
CompositorGuard
Constructor for the CompositorGuard object- Parameters:
compositor- Description of the ParameterinstanceMembers- Description of the Parameter
-
-
Method Details
-
toString
NOT YET DOCUMENTED -
acceptsNewMember
public boolean acceptsNewMember()Will the CompositorGuard allow another member element to be added?A hook to force validation is provided but not used because we most often are dealing with instanceElements that are not valid (e.g., user has just added a element in the metadata editor). Absent the validity constraint, this method returns if the number of occurrences are less then the number of occurrances allowed by the schema.
- Returns:
- true if the instance element can accept a new member.
-
acceptsNewMember
Tests whether the instance element can accept a new member of "memberName" at the specified memberIndex.- Parameters:
memberName- NOT YET DOCUMENTEDmemberIndex- NOT YET DOCUMENTED- Returns:
- true if the instance element will accept the specified member.
-
checkValid
NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
getCompositor
Gets the compositor attribute of the CompositorGuard object- Returns:
- The compositor value
-
getOccurrences
Returns a list of occurrence instances that can be used to determine whether an instance document element satisfies the occurrence constraints of the schema.- Returns:
- The occurrences value
- Throws:
Exception- NOT YET DOCUMENTED
-
getSubOccurrenceCount
protected final int getSubOccurrenceCount(CompositorMember cm, org.dom4j.Element instanceElement) throws Exception Gets the subOccurrenceCount attribute of the CompositorGuard object- Parameters:
cm- Description of the ParameterinstanceElement- Description of the Parameter- Returns:
- The subOccurrenceCount value
- Throws:
Exception- Description of the Exception
-
getInstance
Gets the instance attribute of the CompositorGuard class- Parameters:
compositor- Description of the ParameterinstanceElement- Description of the Parameter- Returns:
- The instance value
-
getOccurrencesCount
public final int getOccurrencesCount()Gets the occurrencesCount attribute of the CompositorGuard object- Returns:
- The occurrencesCount value
-
getOccurrencesCount
Gets the occurrencesCount attribute of the ChoiceGuard object- Parameters:
name- NOT YET DOCUMENTED- Returns:
- The occurrencesCount value
-
resolveLeafNameToCMName
Uses resolveLeafNameToCM to return the instanceQualifiedName of the CompositorMember that controls the leafElement of leafName.- Parameters:
leafName- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
resolveLeafNameToCM
Given a leaf element name, find the CompositorMember that ultimately controls it- Parameters:
leafName- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
- Throws:
Exception- NOT YET DOCUMENTED
-
printInstanceMembers
public void printInstanceMembers()Description of the Method -
findOccurence
public org.dlese.dpc.xml.schema.compositor.CompositorGuard.Occurrence findOccurence(CompositorMember cm, int memberIndex) NOT YET DOCUMENTED- Parameters:
cm- NOT YET DOCUMENTEDmemberIndex- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
findOccurrence
public org.dlese.dpc.xml.schema.compositor.CompositorGuard.Occurrence findOccurrence(String leafName, int memberIndex) Find the occurrence containing the nth element of memberName. This is used to determine which occurence can take a new member of memberName. SequenceGuard.acceptsNewMember calls this method to determine whether a member can be added at a certain place (one it determines which occurrence, then it checks to see if the member can be added to that occurrence legally.Caluclated by traversing the elements in each occurrence, keeping track of how many elements have memberName. When
- Parameters:
leafName- NOT YET DOCUMENTEDmemberIndex- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
printOccurrences
public void printOccurrences()debugging
-