com.generationjava.util
Class Pair

java.lang.Object
  extended bycom.generationjava.util.Pair

public class Pair
extends Object

A Lisp like Pair object.


Constructor Summary
Pair(Object one)
          A Pair with only one object.
Pair(Object one, int weighting)
          A Pair with only one object of a specific weighting.
Pair(Object one, Object two)
          A Pair with two Objects of equal weighting.
Pair(Object one, Object two, int weighting1, int weighting2)
          A Pair with two Objects, weighted with the weightings given.
Pair(Pair one, Pair two)
          Create a Pair with two Pairs in it.
 
Method Summary
 Object car()
          Get the first element of this Pair.
 int carWeighting()
          Get the weighting of the first element of this Pair.
 Object cdr()
          Get the second element of this Pair.
 int cdrWeighting()
          Get the weighting of the second element of this Pair.
 String dumpTree()
          Create a String version of a tree of pairs.
 String dumpTree(Pair pair)
          Create a String version of a tree of pairs using this start pair.
 String toString()
          Simple debug version of this Pair.
 int weighting()
          Get the combined weighting of this Pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(Pair one,
            Pair two)
Create a Pair with two Pairs in it.


Pair

public Pair(Object one,
            Object two,
            int weighting1,
            int weighting2)
A Pair with two Objects, weighted with the weightings given.


Pair

public Pair(Object one,
            Object two)
A Pair with two Objects of equal weighting.


Pair

public Pair(Object one,
            int weighting)
A Pair with only one object of a specific weighting.


Pair

public Pair(Object one)
A Pair with only one object.

Method Detail

dumpTree

public String dumpTree()
Create a String version of a tree of pairs.


dumpTree

public String dumpTree(Pair pair)
Create a String version of a tree of pairs using this start pair.


weighting

public int weighting()
Get the combined weighting of this Pair.


carWeighting

public int carWeighting()
Get the weighting of the first element of this Pair.


cdrWeighting

public int cdrWeighting()
Get the weighting of the second element of this Pair.


car

public Object car()
Get the first element of this Pair.


cdr

public Object cdr()
Get the second element of this Pair.


toString

public String toString()
Simple debug version of this Pair.



Copyright © 2000-2005 OSJava. All Rights Reserved.