Documentation of 'org.hecl.Compare' Java class
Compare
org.hecl

Class Compare



  • public class Compare
    extends java.lang.Object
    The Compare class exists to compare things in different ways.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Compare() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int compareProc(Thing a, Thing b, Interp interp, Thing sortproc)
      The compareProc method takes two things to compare, an interpreter, andthe name of a proc to compare the two things with.
      static int compareString(Thing a, Thing b)
      compareString compares two Things as strings.
      static boolean same(Thing t1, Thing t2)
      same checks if two Things as the same.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Compare

        public Compare()
    • Method Detail

      • same

        public static boolean same(Thing t1,
                                   Thing t2)
        same checks if two Things as the same. In case the parameters are ObjectThings, they are the same only if they are identical, for all other Things this function calls compareString to check for sameness.

        This subtle difference in comparison is necessary since ObjectThing.toString() may yield the same string representation even when the objects are different (happens i.e. on Nokia 6630 for instances of javax.microeditoion.lcdui.Command.

        Parameters:
        t1 - a Thing value
        t2 - a Thing value
        Returns:
        boolean indicating sameness.
      • compareString

        public static int compareString(Thing a,
                                        Thing b)
        compareString compares two Things as strings. This can't fail, because all Things may be represented as strings.
        Parameters:
        a - a Thing value
        b - a Thing value
        Returns:
        an int value
      • compareProc

        public static int compareProc(Thing a,
                                      Thing b,
                                      Interp interp,
                                      Thing sortproc)
                               throws HeclException
        The compareProc method takes two things to compare, an interpreter, andthe name of a proc to compare the two things with. It puts together a codething, runs it, and returns the result: 0 if the two things are equal, -1 if A is "less than" B, and 1 if 1 if A is "greater than" B.
        Parameters:
        a - a Thing value
        b - a Thing value
        interp - an Interp value
        sortproc - a Thing value
        Returns:
        an int value
        Throws:
        HeclException - if an error occurs

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.