org.abora.white.spaces.integers
Class IntegerMapping

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.spaces.basic.Mapping
              |
              +--org.abora.white.spaces.basic.Dsp
                    |
                    +--org.abora.white.spaces.integers.IntegerMapping

public class IntegerMapping
extends Dsp

Transforms integers by adding a (possibly negative) offset. In addition to the Dsp protocol, an IntegerDsp will respond to "translation" with the offset that it is adding.

Old documentation indicated a possibility of a future upgrade of IntegerDsp which would also optionally reflect (or negate) its input in addition to offsetting. This would however be a non-upwards compatable change in that current clients already assume that the answer to "translation" fully describes the IntegerDsp. If such a possibility is introduced, it should be as a super-type of IntegerDsp, since it would have a weaker contract. Then compatability problems can be caught by the type checker.


Field Summary
protected  IntegerValue myTranslation
           
protected static IntegerMapping TheIdentityIntegerMapping
           
 
Constructor Summary
protected IntegerMapping(IntegerValue translation)
          Initialize instance variables
 
Method Summary
 int actualHashForEqual()
          Defined by subclasses to produce the value returned by hashForEqual.
 Dsp compose(Dsp other)
          Return the composition of the two Dsps.
 CoordinateSpace coordinateSpace()
          the coordinate space of the domain and range of the Dsp
static Dsp identity()
           
 Mapping inverse()
          Return the inverse of this transformation.
 Dsp inverseCompose(Dsp other)
          Return the composition of my inverse with the other.
 Position inverseOf(Position pos)
          Since Dsps always represent a unique mapping in either direction, the permission to BLAST in the Mapping constract no longer applies.
 XnRegion inverseOfAll(XnRegion reg)
          Inverse transform a region.
 IntegerValue inverseOfInt(IntegerValue pos)
          Unboxed version of 'this->inverseOf (xuInteger(pos))'.
 boolean isEqual(Heaper other)
          Should have same offset and reversal
 boolean isIdentity()
          Says whether this Dsp maps every Position onto itself
static IntegerMapping make()
           
static IntegerMapping make(IntegerValue translate)
           
static Heaper make(Rcvr rcvr)
           
 Dsp minus(Dsp other)
          Return the difference of the two Dsps.
 Position of(Position pos)
          Since Dsps always represent a unique mapping in either direction, the permission to BLAST in the Mapping constract no longer applies.
 XnRegion ofAll(XnRegion reg)
          If 'reg' is a simple region, then the result must also be simple
 IntegerValue ofInt(IntegerValue pos)
          Unboxed version of 'this->of (xuInteger(pos))'.
 void printOn(java.io.PrintWriter oo)
          This should rarely be overridden.
 void sendIntegerMapping(Xmtr xmtr)
           
 void sendSelfTo(Xmtr xmtr)
           
 IntegerValue translation()
          The offset which I add to a position.
 
Methods inherited from class org.abora.white.spaces.basic.Dsp
appliedAfter, domain, fetchCombine, fetchDsp, isComplete, preCompose, range, rangeSpace, restrict, restrictRange, simpleMappings, simpleRegionMappings, transformedBy
 
Methods inherited from class org.abora.white.spaces.basic.Mapping
combine, domainSpace, info, make, make, make, simplerMappings, unrestricted
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, printContentsOn, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myTranslation

protected final IntegerValue myTranslation

TheIdentityIntegerMapping

protected static final IntegerMapping TheIdentityIntegerMapping
Constructor Detail

IntegerMapping

protected IntegerMapping(IntegerValue translation)
Initialize instance variables

Method Detail

make

public static IntegerMapping make()

make

public static Heaper make(Rcvr rcvr)

make

public static IntegerMapping make(IntegerValue translate)

identity

public static Dsp identity()

printOn

public void printOn(java.io.PrintWriter oo)
Description copied from class: Heaper
This should rarely be overridden. In Tofu, it prints ClassName(...), where ... is either produced by printInsideOn or is ??? if printInsideOn it not overridden.

Overrides:
printOn in class Heaper

inverseOf

public Position inverseOf(Position pos)
Description copied from class: Dsp
Since Dsps always represent a unique mapping in either direction, the permission to BLAST in the Mapping constract no longer applies. a->inverseOf(b) ->isEqual (a->inverse()->of(b))

Overrides:
inverseOf in class Dsp

inverseOfAll

public XnRegion inverseOfAll(XnRegion reg)
Description copied from class: Dsp
Inverse transform a region. A simple region must yield a simple region. a->inverseOfAll(b) ->isEqual (a->inverseAll()->of(b))

Overrides:
inverseOfAll in class Dsp

inverseOfInt

public IntegerValue inverseOfInt(IntegerValue pos)
Description copied from class: Mapping
Unboxed version of 'this->inverseOf (xuInteger(pos))'. See discussion in the XuInteger class comment about boxed and unboxed protocols

Overrides:
inverseOfInt in class Mapping

of

public Position of(Position pos)
Description copied from class: Dsp
Since Dsps always represent a unique mapping in either direction, the permission to BLAST in the Mapping constract no longer applies.

Overrides:
of in class Dsp

ofAll

public XnRegion ofAll(XnRegion reg)
Description copied from class: Dsp
If 'reg' is a simple region, then the result must also be simple

Specified by:
ofAll in class Dsp

ofInt

public IntegerValue ofInt(IntegerValue pos)
Description copied from class: Mapping
Unboxed version of 'this->of (xuInteger(pos))'. See discussion in the XuInteger class comment about boxed and unboxed protocols

Overrides:
ofInt in class Mapping

coordinateSpace

public CoordinateSpace coordinateSpace()
Description copied from class: Dsp
the coordinate space of the domain and range of the Dsp

Specified by:
coordinateSpace in class Dsp

isIdentity

public boolean isIdentity()
Description copied from class: Dsp
Says whether this Dsp maps every Position onto itself

Specified by:
isIdentity in class Dsp

translation

public IntegerValue translation()
The offset which I add to a position. If my translation is 7, then this->of(4) is 11.


actualHashForEqual

public int actualHashForEqual()
Description copied from class: Heaper
Defined by subclasses to produce the value returned by hashForEqual.

Overrides:
actualHashForEqual in class Mapping

isEqual

public boolean isEqual(Heaper other)
Should have same offset and reversal

Specified by:
isEqual in class Heaper

compose

public Dsp compose(Dsp other)
Description copied from class: Dsp
Return the composition of the two Dsps. Two Dsps of the same space are always composable. (a->compose(b) ->minus(b))->isEqual (a) (a->compose(b) ->of(pos))->isEqual (a->of (b->of (pos))

Specified by:
compose in class Dsp

inverse

public Mapping inverse()
Description copied from class: Dsp
Return the inverse of this transformation. Considering the Dsp as a set of pairs (see class comment), return the Dsp which has the mirror image of all my pairs.

Specified by:
inverse in class Dsp

inverseCompose

public Dsp inverseCompose(Dsp other)
Description copied from class: Dsp
Return the composition of my inverse with the other. a->inverseCompose(b) ->isEqual (a->inverse()->compose(b))

Overrides:
inverseCompose in class Dsp

minus

public Dsp minus(Dsp other)
Description copied from class: Dsp
Return the difference of the two Dsps. (a->compose(b) ->minus(b))->isEqual (a)

Specified by:
minus in class Dsp

sendIntegerMapping

public void sendIntegerMapping(Xmtr xmtr)

sendSelfTo

public void sendSelfTo(Xmtr xmtr)
Overrides:
sendSelfTo in class Heaper


Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.