|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvoicexml.xml.AbstractXmlNode
org.jvoicexml.xml.srgs.Item
public final class Item
Define an expansion with optional repeating and probability. An item element can surround any expansion to permit a repeat attribute or language identifier to be attached.
| Field Summary | |
|---|---|
protected static ArrayList<String> |
ATTRIBUTE_NAMES
Supported attribute names for this node. |
static String |
ATTRIBUTE_REPEAT
Defines a legal rule expansion as being another sub-expansion that is optional, that is repeated zero or more times, that is repeated one or more times, or that is repeated some range of times. |
static String |
ATTRIBUTE_REPEAT_PROB
Any repeat operator may specify an optional repeat probability. |
static String |
ATTRIBUTE_WEIGHT
A weight may be optionally provided for any number of alternatives in an alternative expansion. |
static String |
ATTRIBUTE_XML_LANG
The language identifier for the grammar. |
static String |
TAG_NAME
Name of the tag. |
| Constructor Summary | |
|---|---|
Item()
Construct a new item object without a node. |
|
| Method Summary | |
|---|---|
Text |
addText(String text)
Create a new text within this node. |
protected boolean |
canContainChild(String tagName)
Can the specified sub-tag be contained within this node? |
Collection<String> |
getAttributeNames()
Returns a collection of permitted attribute names for the node. |
int |
getMaxRepeat()
Retrieves the maximal number of repetitions. |
int |
getMinRepeat()
Retrieves the minimal number of repetitions. |
String |
getRepeat()
Retrieve the repeat attribute. |
String |
getRepeatProb()
Retrieve the repeatProb attribute. |
String |
getTagName()
Get the name of the tag for the derived node. |
String |
getWeight()
Retrieve the weight attribute. |
String |
getXmlLang()
Retrieve the xmlLang attribute. |
Locale |
getXmlLangObject()
Retrieve the xml:lang attribute. |
boolean |
isOptional()
Checks if this item is optional.This means the value of the repeat attribute equals 0-1. |
XmlNode |
newInstance(Node n,
XmlNodeFactory<? extends XmlNode> factory)
Create a new instance for the given node. |
void |
setOptional()
Sets the repeat attribute to optional, this means to a value 0-1. |
void |
setRepeat(int repeat)
Set the repeat attribute. |
void |
setRepeat(int min,
int max)
Set the repeat attribute. |
void |
setRepeat(String repeat)
Set the repeat attribute. |
void |
setRepeatProb(String repeatProb)
Set the repeatProb attribute. |
void |
setWeight(String weight)
Set the weight attribute. |
void |
setXmlLang(Locale locale)
Set the xml:lang attribute. |
void |
setXmlLang(String xmlLang)
Set the xmlLang attribute. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jvoicexml.xml.XmlNode |
|---|
addChild, getAttribute, getChildNodes, getChildren, getNode, setAttribute |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
| Field Detail |
|---|
public static final String TAG_NAME
public static final String ATTRIBUTE_REPEAT
public static final String ATTRIBUTE_REPEAT_PROB
public static final String ATTRIBUTE_WEIGHT
public static final String ATTRIBUTE_XML_LANG
protected static final ArrayList<String> ATTRIBUTE_NAMES
| Constructor Detail |
|---|
public Item()
This is necessary for the node factory.
VoiceXmlNodeFactory| Method Detail |
|---|
public String getTagName()
getTagName in interface XmlNode
public XmlNode newInstance(Node n,
XmlNodeFactory<? extends XmlNode> factory)
Each XmlNode can serve as a prototype in a
XmlNodeFactory to produce a collection of
child nodes. Factories can then use the prototype pattern to
produce new nodes.
newInstance in interface XmlNoden - The node to encapsulate.factory - the factroy that calls this method.
XmlNodeFactorypublic String getRepeat()
ATTRIBUTE_REPEATpublic int getMinRepeat()
public int getMaxRepeat()
-1 if there is no
maximum.public void setRepeat(int repeat)
repeat - number of repetitionsATTRIBUTE_REPEAT
public void setRepeat(int min,
int max)
Throws an IllegalArgumentException for illegal values, i.e.
min < 0 or min < max.
min - minimal number of repetitionsmax - maximal number of repetitions, a value of -1
denotes an infinite maximum.ATTRIBUTE_REPEATpublic void setRepeat(String repeat)
repeat - Value of the repeat attribute.ATTRIBUTE_REPEATpublic void setOptional()
0-1.
public boolean isOptional()
0-1.
true if this item is optional.public String getRepeatProb()
ATTRIBUTE_REPEAT_PROBpublic void setRepeatProb(String repeatProb)
repeatProb - Value of the repeatProb attribute.ATTRIBUTE_REPEAT_PROBpublic String getWeight()
ATTRIBUTE_WEIGHTpublic void setWeight(String weight)
weight - Value of the weight attribute.ATTRIBUTE_WEIGHTpublic String getXmlLang()
ATTRIBUTE_XML_LANGpublic Locale getXmlLangObject()
ATTRIBUTE_XML_LANGpublic void setXmlLang(String xmlLang)
xmlLang - Value of the xmlLang attribute.ATTRIBUTE_XML_LANGpublic void setXmlLang(Locale locale)
locale - Value of the xml:lang attribute.ATTRIBUTE_XML_LANGpublic Text addText(String text)
text - The text to be added.
protected boolean canContainChild(String tagName)
canContainChild in class AbstractXmlNodetagName - Name of child.
public Collection<String> getAttributeNames()
getAttributeNames in interface XmlNodegetAttributeNames in class AbstractXmlNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||