org.uacalc.util
Class IntArray

java.lang.Object
  extended by org.uacalc.util.IntArray
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
BasicPartition, BasicSet

public class IntArray
extends java.lang.Object
implements java.lang.Cloneable

This class is a wrapper for an array of int's mainly so we can specify the equals and hashCode methods.

Version:
$Id: IntArray.java,v 1.7 2011/04/03 01:25:33 ralphfreese Exp $
Author:
Ralph Freese

Field Summary
protected  int[] array
           
protected  int size
           
 
Constructor Summary
IntArray()
           
IntArray(int size)
           
IntArray(int[] array)
           
 
Method Summary
 java.lang.Object clone()
           
static boolean equalIntArrays(int[] u, int[] v)
           
 boolean equals(java.lang.Object obj)
           
 int get(int i)
           
 int[] getArray()
           
 int hashCode()
           
static java.lang.String intArrayToString(int[] array)
           
 boolean isIdempotent()
          Test if this represents an idempotent function; that is, one satisfying the equation f(f(x)) ≈ f(x).
static java.util.Comparator<IntArray> lexicographicComparitor()
           
 boolean satisfiesConstraint(int[][] blocks)
           
 boolean satisfiesConstraint(int[][] blocks, int[][] values)
          Checks if this intArray is equal on the indices of each block and has the values specified by values.
 void set(int index, int value)
           
 void setIntArray(int[] v)
           
 int[] toArray()
           
 java.lang.String toString()
           
 int universeSize()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

size

protected int size

array

protected int[] array
Constructor Detail

IntArray

public IntArray()

IntArray

public IntArray(int[] array)

IntArray

public IntArray(int size)
Method Detail

satisfiesConstraint

public boolean satisfiesConstraint(int[][] blocks)

satisfiesConstraint

public boolean satisfiesConstraint(int[][] blocks,
                                   int[][] values)
Checks if this intArray is equal on the indices of each block and has the values specified by values.

Parameters:
blocks - an array of the level blocks
values - an array of pairs [i,v] specifying array[i] = v
Returns:
true if the condition is satisfied

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

toArray

public final int[] toArray()

getArray

public final int[] getArray()

universeSize

public final int universeSize()

setIntArray

public final void setIntArray(int[] v)

get

public final int get(int i)

set

public final void set(int index,
                      int value)

isIdempotent

public boolean isIdempotent()
Test if this represents an idempotent function; that is, one satisfying the equation f(f(x)) ≈ f(x).

Returns:
true iff f(f(x)) = f(x) for all 0 ≤ x < size.

lexicographicComparitor

public static java.util.Comparator<IntArray> lexicographicComparitor()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

intArrayToString

public static final java.lang.String intArrayToString(int[] array)

equalIntArrays

public static final boolean equalIntArrays(int[] u,
                                           int[] v)


Copyright 2003 Ralph Freese. All Rights Reserved.