PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer
Class Utils

java.lang.Object
  |
  +--jp.ne.dti.lares.foozy.pagemixer.Utils

public class Utils
extends java.lang.Object

Utilities.


Constructor Summary
Utils()
           
 
Method Summary
static int calcHash(java.lang.Object object)
          Utility to calculate hash code from object safely.
static int calcHashes(java.lang.Object[] objects)
          Utility to calculate hash code from object array.
static boolean compare(java.lang.Object[] a1, java.lang.Object[] a2)
          Utility to compare contents of two object arrays.
static boolean equals(java.lang.String s1, java.lang.String s2)
          Compare two strings.
static java.lang.String toString(java.lang.Object object)
          Get string representation safely.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

compare

public static boolean compare(java.lang.Object[] a1,
                              java.lang.Object[] a2)
Utility to compare contents of two object arrays.

Order of elements does not effect the result of this method. So, this is usefull to compare two Attribute arrays of Token, because Tokens are recognized as same as each other when they have same Attributes.

This assumes that there is no null element in both arrays.

Parameters:
a1 - an array to be compared(may be null)
a2 - another array to be compared(may be null)

calcHash

public static int calcHash(java.lang.Object object)
Utility to calculate hash code from object safely.

Please use calcHashes(java.lang.Object[]) to calculate hash code of object array.


calcHashes

public static int calcHashes(java.lang.Object[] objects)
Utility to calculate hash code from object array.

This returns XOR hashCode of all elements in the array.


equals

public static boolean equals(java.lang.String s1,
                             java.lang.String s2)
Compare two strings.

This returns true not only when s1 has as same value as s2, but also when both s1 and s2 are null safely.


toString

public static java.lang.String toString(java.lang.Object object)
Get string representation safely.

This examines whether specified object is null or not, and returns "<null>" if so.

Otherwise, this returns result of toString method invocation on that object.


PageMixer API - 3.1