All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ninja.xset.SETutils

java.lang.Object
   |
   +----ninja.xset.SETutils

public class SETutils
extends Object

Constructor Index

 o SETutils()

Method Index

 o getChildren(Element)
Methods that takes an XML4J/DOM element and returns its children, ignoring whitespaces between tags
 o hasher(Document, String)
 o hasher(String, String)
Method that implements a hashing algorithm (MD5 or SHA-1).
 o numChildren(Element)
Method to take an XML4J DOM element and count its number of children Whitespaces here are not ignored.
 o parseFile(String)
Method that packages up a file into an inputstream
 o printElement(Element)
Simplistic method to print out an element with its immediate children
 o queryMax(Vector, String)
Method that returns the desired document or tags that represents the maximum value in a given tag.
 o queryMin(Vector, String)
Method that returns the desired document or tags that represents the minimum value in a given tag.
 o stringMaxMin(Vector, int)
Method that rerturns the min or max string from a vector of strings
 o writeServiceEntry(String, ServiceEntry)
void writeServiceEntry(String, ServiceEntry) ** Method that takes in a ServiceEntry, and writes it to a specified filename, writing out the fields in this order:
1.

Constructors

 o SETutils
 public SETutils()

Methods

 o queryMax
 public static Vector queryMax(Vector xmlVector,
                               String rangeTag)
Method that returns the desired document or tags that represents the maximum value in a given tag. Just a wrapper for queryMaxMin

Parameters:
xmlVector - The vector of XML documents to be compared
rangeTag - The string name of the tag the max is executed on
Returns:
vector of simple xml documents as strings
 o queryMin
 public static Vector queryMin(Vector xmlVector,
                               String rangeTag)
Method that returns the desired document or tags that represents the minimum value in a given tag. Just a wrapper for queryMaxMin

Parameters:
xmlVector - The vector of XML documents to be compared
rangeTag - The string name of the tag the min is executed on
Returns:
vector of simple xml documents as strings
 o stringMaxMin
 public static String stringMaxMin(Vector stringV,
                                   int maxmin)
Method that rerturns the min or max string from a vector of strings

Parameters:
stringV - the vector of strings that we take the max or min from
maxmin, - indicator of max or min, if <0 min, if >0 max, if 0 null
Returns:
string that is the end result value as the max or min
 o writeServiceEntry
 public static void writeServiceEntry(String fileName,
                                      ServiceEntry se) throws RecoveryException
void writeServiceEntry(String, ServiceEntry) ** Method that takes in a ServiceEntry, and writes it to a specified filename, writing out the fields in this order:
1. String ID (SHA-1 Hash of contents)
2. Heart beat
3. XML description in String

The fields are written out separated by newlines, and the sequence number (numerical ID) is not written, since it is embedded in the filename.

If the file exists, it is not overwritten

Parameters:
fileName - Name of the file to be written out
content - The string contents of the file
Throws: thrown
when IOException hit or trying to write paged out entry
 o numChildren
 public static int numChildren(Element e)
Method to take an XML4J DOM element and count its number of children Whitespaces here are not ignored. For that value, do getChildren().size()

Parameters:
e - The DOM element in question
Returns:
integer that represents the number of children it has
 o getChildren
 public static Vector getChildren(Element e)
Methods that takes an XML4J/DOM element and returns its children, ignoring whitespaces between tags

Parameters:
e - The DOM element that we find nonwhitespace children for
Returns:
Vector containing the child DOM elements
 o printElement
 public static void printElement(Element n)
Simplistic method to print out an element with its immediate children

 o parseFile
 public static InputStream parseFile(String f) throws FileNotFoundException
Method that packages up a file into an inputstream

 o hasher
 public static String hasher(String inString,
                             String alg) throws NoSuchAlgorithmException
Method that implements a hashing algorithm (MD5 or SHA-1). Takes in a string and returns a string that represented the hashed value.

Parameters:
inString - The input that is to be hashed
alg - The algorithm to be used, either "MD5" or "SHA-1"
Returns:
the hashed value of inString
Throws: NoSuchAlgorithmException
thrown when algorithm is unknown
 o hasher
 public static String hasher(Document d,
                             String alg) throws NoSuchAlgorithmException

All Packages  Class Hierarchy  This Package  Previous  Next  Index