Interface QNamedPuzzleComponent

  • All Superinterfaces:
    PuzzleComponent, QNamed
    All Known Implementing Classes:
    PuzzlePiece, PuzzlePieceSet

    public interface QNamedPuzzleComponent
    extends QNamed, PuzzleComponent
    By using this interface you declare that:
    • you don't care if a QNamedPuzzleComponent is a Collection of Jigsaw pieces or one single Jigsaw piece.
    • you expect one single name. If the QNamedPuzzleComponent is a Collection of definitions, all definitions have to be equally named. Calling getQName(), toString(), getLocalName() or getNamespace() on a Collection of differently named definitions will throw a RuntimeException. For example: A multiple definition of an attribute is frequently used in an XML schema.
    • Method Detail

      • isMandatory

        boolean isMandatory​(QNamedPuzzleComponent child)
        ELEMENT Definition only: Determine solely by child type and name whether child is mandatory.

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

        child - The child Definition(s) of type ELEMENT or ATTRIBUTE
        true if child is a defined child of this and if it's mandatory. False otherwise.