com.generationjava.util
Class Pair

java.lang.Object
  |
  +--com.generationjava.util.Pair

public class Pair
extends java.lang.Object

A Lisp like Pair object.


Constructor Summary
Pair(java.lang.Object one)
          A Pair with only one object.
Pair(java.lang.Object one, int weighting)
          A Pair with only one object of a specific weighting.
Pair(java.lang.Object one, java.lang.Object two)
          A Pair with two Objects of equal weighting.
Pair(java.lang.Object one, java.lang.Object two, int weighting1, int weighting2)
          A Pair with two Objects, weighted with the weightings given.
Pair(com.generationjava.util.Pair one, com.generationjava.util.Pair two)
          Create a Pair with two Pairs in it.
 
Method Summary
 java.lang.Object car()
          Get the first element of this Pair.
 int carWeighting()
          Get the weighting of the first element of this Pair.
 java.lang.Object cdr()
          Get the second element of this Pair.
 int cdrWeighting()
          Get the weighting of the second element of this Pair.
 java.lang.String dumpTree()
          Create a String version of a tree of pairs.
 java.lang.String dumpTree(com.generationjava.util.Pair pair)
          Create a String version of a tree of pairs using this start pair.
 java.lang.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(com.generationjava.util.Pair one,
            com.generationjava.util.Pair two)
Create a Pair with two Pairs in it.


Pair

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


Pair

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


Pair

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


Pair

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

Method Detail

dumpTree

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


dumpTree

public java.lang.String dumpTree(com.generationjava.util.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 java.lang.Object car()
Get the first element of this Pair.


cdr

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


toString

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

Overrides:
toString in class java.lang.Object


Copyright © 2000-2003 OSJava. All Rights Reserved.