software.common
Class Util

java.lang.Object
  extended by software.common.Util

public class Util
extends java.lang.Object

Helper class

Author:
stefan

Nested Class Summary
static class Util.BallotType
           
 
Field Summary
static java.lang.String fileSeparator
           
 
Constructor Summary
Util()
           
 
Method Summary
static java.lang.String AddleadingZeros(java.lang.String serial, int serialLenght)
           
static Util.BallotType askWhatTypeOfBallot(java.awt.Component parent)
           
static java.lang.String ByteToHex(byte data)
           
static java.lang.Object cloneObject(java.lang.Object o)
           
static int compare(byte[] a, byte[] b)
           
static void delete(java.lang.String path)
           
static org.w3c.dom.Document DomParse(java.lang.String fileToParse)
           
static void eliminateFakeChilds(org.w3c.dom.Node node)
           
static javax.xml.parsers.DocumentBuilder GetDocumentBuilder()
           
static byte[] getInverse(byte[] perm)
           
static byte[] getInverse(byte[] perm, int start, int length)
           
static int[] getInverse(int[] perm)
           
static int getNumberOfWords(java.lang.String s)
           
static byte[] intArrayToByteArray(int[] m)
           
static byte[] makeDMessage(byte partitionId, byte instanceId, byte[] rowId, int d1, byte[] d2)
           
static void makeFib(byte[] psAnswers, org.gwu.voting.standardFormat.filledInBallot.FilledInBallot fib)
           
static byte[] makePMessage(byte[] serial, byte[] p)
           
static byte[] parse(java.lang.String ballot)
           
static java.awt.Color[] permColor(byte[] perm, java.awt.Color[] orig, int start, int length)
           
static byte[] permString(byte[] perm, byte[] orig)
           
static java.lang.String prepareXMLforUpload(java.lang.String xml)
           
static void print(byte[] a)
           
static void print(byte[][] a)
           
static void print(int[] a)
           
static void printPdfPrintDialog(java.lang.String file)
           
static void printPdfSilently(java.lang.String file)
           
static java.util.Hashtable<java.lang.String,java.lang.String> SerialToPid(java.lang.String serialMap)
           
static java.util.Vector<java.util.Vector<java.lang.Integer>> setPartitions(org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es, java.lang.String confFile)
           
static char toHexChar(int i)
           
static java.lang.String toString(byte[] a)
           
static void write(byte[] a, java.io.OutputStream out)
           
static void writeComma(byte[] a, java.io.OutputStream out)
           
static void writeComma(java.lang.String as, java.io.OutputStream out)
           
static byte[] xor(byte[] a, byte[] b)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileSeparator

public static java.lang.String fileSeparator
Constructor Detail

Util

public Util()
Method Detail

makePMessage

public static byte[] makePMessage(byte[] serial,
                                  byte[] p)

makeDMessage

public static byte[] makeDMessage(byte partitionId,
                                  byte instanceId,
                                  byte[] rowId,
                                  int d1,
                                  byte[] d2)

compare

public static int compare(byte[] a,
                          byte[] b)

xor

public static byte[] xor(byte[] a,
                         byte[] b)
                  throws java.lang.Exception
Throws:
java.lang.Exception

print

public static void print(byte[][] a)

print

public static void print(byte[] a)

print

public static void print(int[] a)

writeComma

public static void writeComma(java.lang.String as,
                              java.io.OutputStream out)
                       throws java.io.IOException
Throws:
java.io.IOException

writeComma

public static void writeComma(byte[] a,
                              java.io.OutputStream out)
                       throws java.io.IOException
Throws:
java.io.IOException

write

public static void write(byte[] a,
                         java.io.OutputStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

toString

public static java.lang.String toString(byte[] a)

intArrayToByteArray

public static byte[] intArrayToByteArray(int[] m)

getInverse

public static int[] getInverse(int[] perm)

getInverse

public static byte[] getInverse(byte[] perm)

getInverse

public static byte[] getInverse(byte[] perm,
                                int start,
                                int length)

ByteToHex

public static java.lang.String ByteToHex(byte data)

toHexChar

public static char toHexChar(int i)

getNumberOfWords

public static int getNumberOfWords(java.lang.String s)

parse

public static byte[] parse(java.lang.String ballot)

makeFib

public static void makeFib(byte[] psAnswers,
                           org.gwu.voting.standardFormat.filledInBallot.FilledInBallot fib)

delete

public static void delete(java.lang.String path)

permString

public static byte[] permString(byte[] perm,
                                byte[] orig)

permColor

public static java.awt.Color[] permColor(byte[] perm,
                                         java.awt.Color[] orig,
                                         int start,
                                         int length)

cloneObject

public static java.lang.Object cloneObject(java.lang.Object o)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

eliminateFakeChilds

public static void eliminateFakeChilds(org.w3c.dom.Node node)

setPartitions

public static java.util.Vector<java.util.Vector<java.lang.Integer>> setPartitions(org.gwu.voting.standardFormat.electionSpecification.ElectionSpecification es,
                                                                                  java.lang.String confFile)

AddleadingZeros

public static java.lang.String AddleadingZeros(java.lang.String serial,
                                               int serialLenght)

prepareXMLforUpload

public static java.lang.String prepareXMLforUpload(java.lang.String xml)

printPdfSilently

public static void printPdfSilently(java.lang.String file)

printPdfPrintDialog

public static void printPdfPrintDialog(java.lang.String file)

DomParse

public static org.w3c.dom.Document DomParse(java.lang.String fileToParse)
                                     throws org.xml.sax.SAXException,
                                            java.io.IOException
Throws:
org.xml.sax.SAXException
java.io.IOException

GetDocumentBuilder

public static javax.xml.parsers.DocumentBuilder GetDocumentBuilder()

askWhatTypeOfBallot

public static Util.BallotType askWhatTypeOfBallot(java.awt.Component parent)

SerialToPid

public static java.util.Hashtable<java.lang.String,java.lang.String> SerialToPid(java.lang.String serialMap)
                                                                          throws org.xml.sax.SAXException,
                                                                                 java.io.IOException
Throws:
org.xml.sax.SAXException
java.io.IOException