|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschema2template.model.PuzzlePieceSet
public class PuzzlePieceSet
Collection Class for RelaxNG definitions of an Element, Attribute, Value or Datatype.
Conventions:
Constructor Summary | |
---|---|
PuzzlePieceSet()
|
|
PuzzlePieceSet(Collection<PuzzlePiece> c)
|
Method Summary | ||
---|---|---|
boolean |
add(PuzzlePiece e)
|
|
boolean |
addAll(Collection<? extends PuzzlePiece> c)
|
|
PuzzlePieceSet |
byParent(QNamedPuzzleComponent parents)
Returns new PuzzlePieceSet containing the elements of this PuzzlePieceSet, but only those which have at least one element from the QNamedPuzzleComponent parameter as one of their parent Definitions. |
|
boolean |
canHaveText()
Determines whether the Definitions can have text - provided that this PuzzlePieceSet is not empty and all Definitions have the same type and name. |
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
boolean |
containsName(QNamed aNamed)
Check whether this List contains an Element by this Name |
|
boolean |
containsName(String aDefinitionName)
Check whether this List contains an Element by this Name |
|
boolean |
equals(Object o)
|
|
PuzzlePieceSet |
getAttributes()
ELEMENT PuzzlePiece only: Get all attribute Definitions |
|
PuzzlePieceSet |
getChildElements()
ELEMENT PuzzlePiece only: Get all child element Definitions |
|
Collection<PuzzlePiece> |
getCollection()
Method to treat NamedDefined as a Collection of PuzzlePiece |
|
PuzzlePieceSet |
getDatatypes()
ATTRIBUTE PuzzlePiece only: Get all datatype Definitions |
|
String |
getLocalName()
Get only localname |
|
String |
getNamespace()
Get only namespace |
|
PuzzlePieceSet |
getParents()
Get all parent Definitions |
|
String |
getQName()
Gets the ns:local tag name of the Definitions - provided that this PuzzlePieceSet is not empty and all Definitions share the same tag name. |
|
MSVExpressionType |
getType()
Gets the type of the Definitions - provided that this PuzzlePieceSet is not empty and all Definitions have the same type and name. |
|
PuzzlePieceSet |
getValues()
ATTRIBUTE PuzzlePiece only: Get all value Definitions |
|
int |
hashCode()
|
|
boolean |
isEmpty()
|
|
boolean |
isMandatory(QNamedPuzzleComponent child)
ELEMENT Definition only: Determine solely by child type and name whether child is mandatory. |
|
boolean |
isSingleton(PuzzleComponent child)
Determines whether the child PuzzlePiece(s) is/are singleton(s) Convention: If child is a collection this method returns false if one child element is no singleton. |
|
Iterator<PuzzlePiece> |
iterator()
|
|
void |
makeImmutable()
Make PuzzlePieceSet immutable. |
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
retainAll(Collection<?> c)
|
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
String |
toString()
Returns String representation (convenient method for getQName()) |
|
PuzzlePieceSet |
without(QNamedPuzzleComponent removeAll)
Returns new PuzzlePieceSet containing the elements of this PuzzlePieceSet, but without the elements of the parameter removeAll |
|
PuzzlePieceSet |
withoutMultiples()
Returns new PuzzlePieceSet containing the elements of this PuzzlePieceSet, but restricted to one PuzzlePiece per Name. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PuzzlePieceSet()
public PuzzlePieceSet(Collection<PuzzlePiece> c)
Method Detail |
---|
public boolean equals(Object o)
equals
in interface Collection<PuzzlePiece>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<PuzzlePiece>
hashCode
in class Object
public void makeImmutable()
public PuzzlePieceSet withoutMultiples()
Returns new PuzzlePieceSet containing the elements of this PuzzlePieceSet, but restricted to one PuzzlePiece per Name.
Template Usage: #foreach ($element in $elements.withoutMultiples())
public PuzzlePieceSet without(QNamedPuzzleComponent removeAll)
Returns new PuzzlePieceSet containing the elements of this PuzzlePieceSet, but without the elements of the parameter removeAll
Template Usage: #set ($non_base_attributes = $element.getAttributes().without($baseclass.getAttributes())
removeAll
- QNamedPuzzleComponent which (or which elements) should be removed from the new PuzzlePieceSet
public PuzzlePieceSet byParent(QNamedPuzzleComponent parents)
Template Usage: Imagine we have one attribute name and we're not interested in the differences between Definitions sharing the same name. We're now printing the resulting allowed attribute values for each parent element name:
#set ( $oneOrMoreAttributes = $model.getAttribute($atttributename) )
## we want to write information about only _one_ parent per Name...
#foreach ($parent in $oneOrMoreAttributes.getParents().withoutMultiples())
- Allowed Values for Parent Element $parent :
## but we want the attribute values displayed which are allowed in _all_ parents with the same Name...
#foreach ($value in $oneOrMoreAttributes.byParent($parent.withMultiples()).getValues())
-- "$value"
#end
#end
parents
-
public boolean containsName(String aDefinitionName)
aDefinitionName
-
public boolean containsName(QNamed aNamed)
aNamed
-
public String getQName()
getQName
in interface QNamed
public MSVExpressionType getType()
getType
in interface PuzzleComponent
public boolean canHaveText()
canHaveText
in interface PuzzleComponent
public boolean isSingleton(PuzzleComponent child)
PuzzleComponent
isSingleton
in interface PuzzleComponent
child
- PuzzleComponent child
public String getLocalName()
QNamed
getLocalName
in interface QNamed
public String getNamespace()
QNamed
getNamespace
in interface QNamed
public String toString()
Returns String representation (convenient method for getQName())
Template Usage: Just use $aDefinitionSet as you would use a string variable
toString
in class Object
public boolean add(PuzzlePiece e)
add
in interface Collection<PuzzlePiece>
public boolean addAll(Collection<? extends PuzzlePiece> c)
addAll
in interface Collection<PuzzlePiece>
public void clear()
clear
in interface Collection<PuzzlePiece>
public boolean contains(Object o)
contains
in interface Collection<PuzzlePiece>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<PuzzlePiece>
public boolean isEmpty()
isEmpty
in interface Collection<PuzzlePiece>
public Iterator<PuzzlePiece> iterator()
iterator
in interface Iterable<PuzzlePiece>
iterator
in interface Collection<PuzzlePiece>
public boolean remove(Object o)
remove
in interface Collection<PuzzlePiece>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<PuzzlePiece>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<PuzzlePiece>
public int size()
size
in interface Collection<PuzzlePiece>
public Object[] toArray()
toArray
in interface Collection<PuzzlePiece>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<PuzzlePiece>
public PuzzlePieceSet getChildElements()
PuzzleComponent
getChildElements
in interface PuzzleComponent
public boolean isMandatory(QNamedPuzzleComponent child)
QNamedPuzzleComponent
Here's why we're not using the child Definition object(s) for this: An element often has a mandatory attribute, but two (or more) different content definitions for this attribute. This is done by defining this attribute twice and creating a CHOICE between both Definitions. If you'd ask whether one of these definitions is mandatory, you'd always get false as answer as you have the choice between the two definitions. Mostly this is not the answer you're looking for.
Contract: If 'this' is a Collection, mandatory means mandatory for one member of 'this'.
isMandatory
in interface QNamedPuzzleComponent
child
- The child Definition(s) of type ELEMENT or ATTRIBUTE
public Collection<PuzzlePiece> getCollection()
PuzzleComponent
getCollection
in interface PuzzleComponent
public PuzzlePieceSet getAttributes()
PuzzleComponent
getAttributes
in interface PuzzleComponent
public PuzzlePieceSet getDatatypes()
PuzzleComponent
getDatatypes
in interface PuzzleComponent
public PuzzlePieceSet getParents()
PuzzleComponent
getParents
in interface PuzzleComponent
public PuzzlePieceSet getValues()
PuzzleComponent
getValues
in interface PuzzleComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |