jadex.xml
Class XMLUtilities

java.lang.Object
  |
  +--jadex.xml.XMLUtilities

public class XMLUtilities
extends java.lang.Object

This is a utility class for processing XML files in Sequence View. Some frequently used methods for XML processing are here. All these methods are static to keep methods calling simple. The element data structure used here is JDOM format.


Constructor Summary
XMLUtilities()
           
 
Method Summary
static int getLayer(org.jdom.Element sequence)
          Get the layer of a element in XML document from root element, i.e., Chromosome.
static MapRange getMapRange(org.jdom.Element sequence)
          Extract the maprange information from sequence element
static MapRange getMapRange(org.jdom.Element sequence, org.jdom.Namespace ns)
          Extract the maprange information from sequence element
static java.lang.String getName(org.jdom.Element sequence)
          Get the name of the sequence from its attribute.
static org.jdom.Namespace getNamespace()
          Deprecated. please don't use this method anymore.
static long[] getPositions(org.jdom.Element sequence)
          Get the position of the sequence element.
static long[] getPositions(org.jdom.Element sequence, org.jdom.Namespace ns)
          Get the position of the sequence element.
static java.util.List getSubSequences(org.jdom.Element sequence)
          Get the subsequences from a sequence element or a chromosome (root).
static java.util.List getSubSequences(org.jdom.Element sequence, org.jdom.Namespace ns)
          Get the subsequences from a sequenc element.
static boolean isOdd(org.jdom.Element sequence)
          See the position of the sequence element in the subsequenc list is Odd or even.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtilities

public XMLUtilities()
Method Detail

getNamespace

public static org.jdom.Namespace getNamespace()
Deprecated. please don't use this method anymore.

Get the Namespace. In this Sequence View, it always return "http://www.wormbase.org". However, it should not be like this.
Returns:
the namespace used in our sequenceview. Always for the wormbase.

getPositions

public static long[] getPositions(org.jdom.Element sequence,
                                  org.jdom.Namespace ns)
Get the position of the sequence element.
Parameters:
sequence - the sequence element to be parsed.
ns - the Namespace this sequence elemenet used.
Returns:
a two element array: the first is the start postion, and the second the end position.

getPositions

public static long[] getPositions(org.jdom.Element sequence)
Get the position of the sequence element.
Parameters:
sequence - the sequenc elemnet too be parsed.
Returns:
a two element array: the first is the start position , and the second the end position.

getMapRange

public static MapRange getMapRange(org.jdom.Element sequence,
                                   org.jdom.Namespace ns)
Extract the maprange information from sequence element
Parameters:
sequence - element
Returns:
the maprange for this sequence

getMapRange

public static MapRange getMapRange(org.jdom.Element sequence)
Extract the maprange information from sequence element
Parameters:
sequence - element
Returns:
the maprange for this sequence

getSubSequences

public static java.util.List getSubSequences(org.jdom.Element sequence)
Get the subsequences from a sequence element or a chromosome (root).
Parameters:
sequence - the element to be parsed.
Returns:
the subsequence list in this sequence element.

getSubSequences

public static java.util.List getSubSequences(org.jdom.Element sequence,
                                             org.jdom.Namespace ns)
Get the subsequences from a sequenc element.
Parameters:
sequence - the sequence element to be parsed.
ns - the name space this sequence element is in.
Returns:
the subsequence list.

getName

public static java.lang.String getName(org.jdom.Element sequence)
Get the name of the sequence from its attribute.
Parameters:
sequence - the sequenc element.
Returns:
the sequence name.

getLayer

public static int getLayer(org.jdom.Element sequence)
Get the layer of a element in XML document from root element, i.e., Chromosome.
Parameters:
sequence - the sequence element to be analyzed.
Returns:
the layer of this sequence element.

isOdd

public static boolean isOdd(org.jdom.Element sequence)
See the position of the sequence element in the subsequenc list is Odd or even.
Parameters:
sequence - the sequence element to be analyzed.
Returns:
true if odd, e.g., 0, 2, 4, etc. Otherwise false, e.g., 1, 3, 5, ...