com.gcapmedia.dab.epg.binary
Class Element

java.lang.Object
  extended by com.gcapmedia.dab.epg.binary.Element
All Implemented Interfaces:
Encodable

public class Element
extends java.lang.Object
implements Encodable

Element binary encoding


Constructor Summary
Element(ElementTag tag)
           
 
Method Summary
 void addAttribute(Attribute attribute)
          Add an attribute to this element
 void addChild(Element child)
          Add a child to this element
 boolean equals(java.lang.Object obj)
           
static Element fromBytes(byte[] bytes)
          Parse an object from its byte array representation
static Element fromBytes(byte[] bytes, TokenTable tokens)
          Parse an object from its byte array representation
 Attribute getAttribute(AttributeTag tag)
          Returns a specific attribute
 java.util.Collection<Attribute> getAttributes()
           
 byte[] getBytes()
           
 CData getCData()
           
 java.util.Collection<Element> getChildren()
           
 java.util.Collection<Element> getChildren(ElementTag tag)
          Returns child elements of the specified type
 int getLength()
           
 ElementTag getTag()
           
 boolean hasAttribute(AttributeTag tag)
          Returns whether a specific attribute is defined for this element
 boolean hasChildren(ElementTag tag)
          Returns whether any elements of the specified type are children to this element
 void setCData(CData cdata)
          Set this elements CDATA
 void setTokenTable(TokenTable tokens)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Element

public Element(ElementTag tag)
Parameters:
tag -
Method Detail

getTag

public ElementTag getTag()
Returns:
Returns the element tag

setTokenTable

public void setTokenTable(TokenTable tokens)

addAttribute

public void addAttribute(Attribute attribute)
Add an attribute to this element

Parameters:
attribute - Attribute to add

getAttributes

public java.util.Collection<Attribute> getAttributes()
Returns:
Returns any element attributes

getAttribute

public Attribute getAttribute(AttributeTag tag)
Returns a specific attribute

Parameters:
tag - Tag of attribute to retrieve
Returns:
Returns the attribute if found, null otherwise

hasAttribute

public boolean hasAttribute(AttributeTag tag)
Returns whether a specific attribute is defined for this element

Parameters:
tag - Tag of attribute to test for
Returns:
Returns true if the attribute is defined for this element

addChild

public void addChild(Element child)
Add a child to this element

Parameters:
child - Child to add

getChildren

public java.util.Collection<Element> getChildren()
Returns:
Returns all child elements

getChildren

public java.util.Collection<Element> getChildren(ElementTag tag)
Returns child elements of the specified type

Parameters:
tag - Element tag to return
Returns:

hasChildren

public boolean hasChildren(ElementTag tag)
Returns whether any elements of the specified type are children to this element

Parameters:
tag - Element tag to test for
Returns:
True if any elements of the specified type are children to this element

setCData

public void setCData(CData cdata)
Set this elements CDATA

Parameters:
cdata - CDATA to set

getCData

public CData getCData()
Returns:
Returns any associated CData

getBytes

public byte[] getBytes()
Specified by:
getBytes in interface Encodable
Returns:
Returns the data as bytes
See Also:
Encodable.getBytes()

getLength

public int getLength()
Specified by:
getLength in interface Encodable
Returns:
Returns the length of this data
See Also:
Encodable.getLength()

fromBytes

public static Element fromBytes(byte[] bytes)
Parse an object from its byte array representation

Parameters:
bytes - Byte array representation

fromBytes

public static Element fromBytes(byte[] bytes,
                                TokenTable tokens)
Parse an object from its byte array representation

Parameters:
bytes - Byte array representation

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2007. All Rights Reserved.