|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.document.schema.impl.export.ElementRuleImpl
public class ElementRuleImpl
Implements the ElementRuleP
interface.
Constructor Summary | |
---|---|
ElementRuleImpl(SchemaImpl schema,
Element e)
Constructs instance of object. |
Method Summary | |
---|---|
List<? extends Element> |
areElementsDeletable(Set<? extends Element> elements)
Checks whether given elements are deletable. |
IAttributeRuleP |
getAttributeRule(Attr attribute)
Returns rule for given attribute. |
INameListP<? extends INewElementRuleP> |
getEnclosingElements(sk.baka.ikslibs.ptr.DOMPoint start,
sk.baka.ikslibs.ptr.DOMPoint end)
Computes and returns an one-sized insertlist of elements, that can enclose given nodeset. |
INameListP<? extends IAttributeRuleP> |
getInsertableAttributes()
Returns all attributes that can be created in this element. |
List<? extends IInsertListP> |
getInsertableElements(sk.baka.ikslibs.ptr.DOMPoint point)
Computes insertable elements, with their positions between other nodes. |
IValueRule |
getValueRule()
Gets text acceptor, that checks valid text values for given element. |
boolean |
isAnyStringInsertable(sk.baka.ikslibs.ptr.DOMPoint ip)
Checks, if there can be any string inserted into given point. |
boolean |
isDeclosable(Element e)
Checks if given element is declosable - if the contents of given element can replace the element. |
boolean |
isDeletable(sk.baka.ikslibs.ptr.DOMPoint start,
sk.baka.ikslibs.ptr.DOMPoint end)
Checks if given interval is removable from the document. |
boolean |
isDeletable(Node node)
Checks if a simple node is deletable from the element. |
boolean |
isDeletableAttribute(Attr attribute)
Checks, whether given attribute is deletable from its element. |
boolean |
isInsertable(sk.baka.ikslibs.ptr.DOMPoint ip,
Node node)
Checks if given nodes are insertable into given position. |
String |
toString()
|
void |
validate()
Validates the element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ElementRuleImpl(SchemaImpl schema, Element e)
schema
- the schema instance.e
- element, which will this rule represent.
DocumentValidityException
- if e is invalid against this schema.Method Detail |
---|
public INameListP<? extends IAttributeRuleP> getInsertableAttributes()
IElementRuleP
getInsertableAttributes
in interface IElementRuleP
AttributeRule
instances - all
attribute rules, that can be added to element e
.public boolean isDeletableAttribute(Attr attribute)
IElementRuleP
isDeletableAttribute
in interface IElementRuleP
attribute
- attribute to check. It may be foreign attribute also.
public List<? extends IInsertListP> getInsertableElements(sk.baka.ikslibs.ptr.DOMPoint point)
IElementRuleP
getInsertableElements
in interface IElementRuleP
point
- insertion point, before which we want to insert element. If
InsertPoint.FIRST
, new element will be created before
first node.
public IValueRule getValueRule()
IElementRuleP
getValueRule
in interface IElementRuleP
null
.public IAttributeRuleP getAttributeRule(Attr attribute)
IElementRuleP
getAttributeRule
in interface IElementRuleP
attribute
- attribute, which rule must be returned. It must be a
local attribute.
public boolean isAnyStringInsertable(sk.baka.ikslibs.ptr.DOMPoint ip)
IElementRuleP
Checks, if there can be any string inserted into given point. Must be used only for element, that contains some elements - if true, then any string can be inserted at selected position, if false, then no string can be inserted at all.
When element doesn't contain no child element, then
getValueRule
should be used: it returns more useful rule.
isAnyStringInsertable
in interface IElementRuleP
ip
- insert point, where we want to insert some text. ip.pos must be
equal to zero.
public String toString()
toString
in class Object
public List<? extends Element> areElementsDeletable(Set<? extends Element> elements)
IElementRuleP
null
is returned then given elements
are not deletable.
areElementsDeletable
in interface IElementRuleP
elements
- set of elements that are to be deleted.
elements
aswell. If null
is returned then
given elements cannot be deleted.public INameListP<? extends INewElementRuleP> getEnclosingElements(sk.baka.ikslibs.ptr.DOMPoint start, sk.baka.ikslibs.ptr.DOMPoint end)
IElementRuleP
getEnclosingElements
in interface IElementRuleP
start
- the start of the nodeset. It must point before the
end
insertpoint.end
- the end of the nodeset.
null
is returned then no such element is suitable.public boolean isDeclosable(Element e)
IElementRuleP
isDeclosable
in interface IElementRuleP
e
- the element to declose
true
if e is declosable, false
otherwise.public boolean isDeletable(Node node)
isDeletable
in interface IElementRuleP
node
- the node to query. Only the text/cdata/element/entity node
that is child of context element can be queried.
public boolean isInsertable(sk.baka.ikslibs.ptr.DOMPoint ip, Node node)
IElementRuleP
isInsertable
in interface IElementRuleP
ip
- the point where the sequence shall be insertednode
- the node to insert. Entities, Entity references and document
fragments are automatically expanded - replaced by their children. The
node may be or contain any type of node, including entity references,
comments etc.
true
if these nodes are insertable,
false
otherwise.public boolean isDeletable(sk.baka.ikslibs.ptr.DOMPoint start, sk.baka.ikslibs.ptr.DOMPoint end)
IElementRuleP
isDeletable
in interface IElementRuleP
start
- the start of the intervalend
- the end of the interval
true
if these nodes are removable,
false
otherwise.public void validate() throws SchemaException
IElementRuleP
Validates the element. It must be full validation, no elements nor texts must not be skipped. If this element is not valid, exception must be thrown.
When element from another namespace uri is encountered in the process of
validation, just call ValidationContextP.validate()
to
validate this unknown element.
The only exception to this rule is emp:id
attribute, which
the schema must ignore.
validate
in interface IElementRuleP
SchemaException
- if something goes wrong in the process of
validation. The Schema
instance must provide as much
information as possible about error. It should display path to errorneous
element with getPathToRoot()
method of
EuromathSchemaProvider
class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |