part6
Class SimpleRedundancy

java.lang.Object
  extended bypart6.SimpleRedundancy
All Implemented Interfaces:
Redundancy

public class SimpleRedundancy
extends java.lang.Object
implements Redundancy

A redundancy class that adds k 1-bits to an m-bit integer.


Constructor Summary
SimpleRedundancy(int m, int k)
          Initialization parameters m and k.
 
Method Summary
 boolean ok(java.math.BigInteger x)
          A method to test if the value x was produced by protect().
 java.math.BigInteger protect(java.math.BigInteger x)
          A method to add redundancy to a big integer x.
 java.math.BigInteger recover(java.math.BigInteger x)
          A method to recover a big integer value from a redundant value x produced by protect().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleRedundancy

public SimpleRedundancy(int m,
                        int k)
                 throws java.lang.Exception
Initialization parameters m and k.

Throws:
java.lang.Exception
Method Detail

protect

public java.math.BigInteger protect(java.math.BigInteger x)
                             throws java.lang.Exception
Description copied from interface: Redundancy
A method to add redundancy to a big integer x.

Specified by:
protect in interface Redundancy
Throws:
java.lang.Exception

recover

public java.math.BigInteger recover(java.math.BigInteger x)
                             throws java.lang.Exception
Description copied from interface: Redundancy
A method to recover a big integer value from a redundant value x produced by protect().

Specified by:
recover in interface Redundancy
Throws:
java.lang.Exception - if the value x was not created by protect().

ok

public boolean ok(java.math.BigInteger x)
           throws java.lang.Exception
Description copied from interface: Redundancy
A method to test if the value x was produced by protect().

Specified by:
ok in interface Redundancy
Throws:
java.lang.Exception