org.abora.white.tumbler
Class RealRegion

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.spaces.basic.XnRegion
              |
              +--org.abora.white.tumbler.RealRegion

public class RealRegion
extends XnRegion


Field Summary
protected  boolean myStartsInside
           
protected  PrimIntegerArray myTransitionFlags
           
protected  PrimFloatArray myTransitionVals
           
protected static RealManager TheManager
           
 
Constructor Summary
RealRegion(boolean startsInside, PrimFloatArray vals, PrimIntegerArray flags)
           
RealRegion(Rcvr receiver)
           
 
Method Summary
 int actualHashForEqual()
          Defined by subclasses to produce the value returned by hashForEqual.
 Stepper actualStepper(OrderSpec order)
          Only called if I've already said I'm enumerable in the originally stated order.
 XnRegion asSimpleRegion()
          Return a simple region containing all positions contained by myself.
 XnRegion complement()
          Essential.
 CoordinateSpace coordinateSpace()
          Essential.
 IntegerValue count()
          How many positions do I contain? If I am not 'isFinite', then this message will BLAST.
 ScruSet distinctions()
          Break it up into a set of non-full distinctions.
 boolean hasMember(Position position)
          Do I contain this position? More than anything else, the behavior of this message is the defining characteristic of an XuRegion.
static void info()
          {Stepper CLIENT of: RealRegion} intervals: order {OrderSpec default: NULL} {BooleanVar CLIENT} isBoundedAbove {BooleanVar CLIENT} isBoundedBelow {BooleanVar CLIENT} isInterval {XuReal CLIENT} lowerBound {XuReal CLIENT} upperBound
 XnRegion intersect(XnRegion other)
          Essential.
 Stepper intervals()
           
 Stepper intervals(OrderSpec order)
          Essential.
 boolean isBoundedAbove()
          Same meaning as IntegerRegion::isBoundedAbove
 boolean isBoundedBelow()
          Same meaning as IntegerRegion::isBoundedBelow
 boolean isEmpty()
          Every coordinate space has exactly one empty region.
 boolean isEnumerable(OrderSpec order)
          Any representable infinite set of real numbers is also not enumerable
 boolean isEqual(Heaper other)
          Two regions are equal iff they contain exactly the same set of positions
 boolean isFinite()
          Essential.
 boolean isFull()
          true if this is the largest possible region in this space -- the region that contains all positions in the space.
 boolean isInterval()
          Whether this Region is a non-empty interval, i.e.
 boolean isSimple()
          Am I a simple region.
 boolean isSubsetOf(XnRegion other)
          I'm a subset of other if I don't have any positions that he doesn't.
 RealPos lowerBound()
          The largest real number such that all the positions in the region are >= it.
static RealRegion make(boolean startsInside, PrimArray transitions)
          Make a new region, reusing the given array.
 void printOn(java.io.PrintWriter oo)
          This should rarely be overridden.
 PtrArray secretTransitions()
           
 void sendSelfTo(Xmtr xmtr)
           
 Stepper simpleRegions(OrderSpec order)
          Break myself up into a finite set of non-empty simple regions which, when unionWith'ed together will yield me.
 XnRegion simpleUnion(XnRegion other)
          The result must contain all positions contained by either of the two original regions, and the result must be simple.
 boolean startsInside()
           
 Stepper stepper(OrderSpec order)
          Essential.
 XnRegion unionWith(XnRegion other)
          The result has as members exactly those positions which are members of either of the original two regions.
 RealPos upperBound()
          The smallest real number such that all the positions in the region are <= it.
static RealRegion usingx(boolean startsInside, PrimFloatArray vals, PrimIntegerArray flags)
           
 
Methods inherited from class org.abora.white.spaces.basic.XnRegion
chooseMany, chooseMany, chooseOne, chooseOne, delta, disjointSimpleRegions, disjointSimpleRegions, immuSet, intersects, isDistinction, isEnumerable, minus, simpleRegions, stepper, theOne, with, without
 
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

myStartsInside

protected boolean myStartsInside

myTransitionVals

protected PrimFloatArray myTransitionVals

myTransitionFlags

protected PrimIntegerArray myTransitionFlags

TheManager

protected static RealManager TheManager
Constructor Detail

RealRegion

public RealRegion(boolean startsInside,
                  PrimFloatArray vals,
                  PrimIntegerArray flags)

RealRegion

public RealRegion(Rcvr receiver)
Method Detail

count

public IntegerValue count()
Description copied from class: XnRegion
How many positions do I contain? If I am not 'isFinite', then this message will BLAST.

Specified by:
count in class XnRegion

distinctions

public ScruSet distinctions()
Description copied from class: XnRegion
Break it up into a set of non-full distinctions. It is an error to send this to a non-simple region. A full region will respond with the null set. Other distinctions will respond with a singleton set containing themselves, and simple regions will respond with a set of distinctions which, when intersected together, yield the original region.

Specified by:
distinctions in class XnRegion

intervals

public Stepper intervals(OrderSpec order)
Essential. Break this up into disjoint intervals


isInterval

public boolean isInterval()
Whether this Region is a non-empty interval, i.e. if A, B in the Region and A <= C <= B then C is in the Region. This includes inequalities (e.g. {x | x > 5}) and the fullRegion in addition to ordinary two-ended intervals.


simpleRegions

public Stepper simpleRegions(OrderSpec order)
Description copied from class: XnRegion
Break myself up into a finite set of non-empty simple regions which, when unionWith'ed together will yield me. May be sent to any region. If I am isEmpty, I will respond with the empty stepper. Otherwise, if I am simple I will respond with a stepper producing just myself. Please only use NULL for the 'order' argument for now unless the documentation for a particular region or coordinate space says that it will deal with the 'order' argument meaningfully. When no order is specified then I may return the simple regions in any order. When the ordering functionality is implemented, then I am constrained to produce the simple regions in an order consistent with the argument's ordering of my positions. When the simple regions don't overlap, and don't surround each other in the ordering, then the meaning is clear. Otherwise, there are several plausible options for how we should specify this message.

Specified by:
simpleRegions in class XnRegion

stepper

public Stepper stepper(OrderSpec order)
Description copied from class: XnRegion
Essential. If my positions are enumerable in the order specified, then return a stepper which will so enumerate them. If 'order' is NULL, then I may treat this as a request to enumerate according to any order I choose, except that if I am enumerable in ascending order, then I must be enumerable given NULL. For example, if I choose to regard NULL as implying ascending order, and I am only enumerable in descending order, then given NULL, I may blast even though there is an order in which I am enumerable. In fact, right now the ability to respond to an 'order' argument is in such a to-be-implemented state that it should only be considered safe to provide a NULL argument, unless the documentation on a particular space or region says otherwise. The eventual specification of this message is clear, and is upwards compatible from the current behavior: If I can enumerate in an order consistent with 'order', do so. If 'order' is NULL, then if I can be enumerated at all (if there is any counting sequence), then I still do so. For example, I should be able to get an (infinite) stepper for stepping through all the integers, but not all the reals. As the above example shows, being enumerable doesn't imply being finite. Also, being able to produce a stepper that continues to yield more positions in the specified order is not sufficient to imply being enumerable. To be enumerable, it must be the case that any given position which is a member of the region will eventually be reached by the stepper. Not all implementations currently succeed in guaranteeing this (See UnionCrossRegion::isEnumerable). See ScruTable::stepper.

Overrides:
stepper in class XnRegion

actualStepper

public Stepper actualStepper(OrderSpec order)
Description copied from class: XnRegion
Only called if I've already said I'm enumerable in the originally stated order. Also, if the originally stated order was NULL, I get a guaranteed non-null order. Subclasses which override 'stepper' to a method which doesn't send 'actualStepper' may override 'actualStepper' to a stub method which always BLASTs.

Specified by:
actualStepper in class XnRegion

actualHashForEqual

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

Overrides:
actualHashForEqual in class XnRegion

hasMember

public boolean hasMember(Position position)
Description copied from class: XnRegion
Do I contain this position? More than anything else, the behavior of this message is the defining characteristic of an XuRegion. All other messages (except for the simplicity characterization) should be specifiable in terms of the behavior of this message. What an XuRegion *is* (mostly) is a finite decision procedure for accepting or rejecting any given position.

Specified by:
hasMember in class XnRegion

isBoundedAbove

public boolean isBoundedAbove()
Same meaning as IntegerRegion::isBoundedAbove


isBoundedBelow

public boolean isBoundedBelow()
Same meaning as IntegerRegion::isBoundedBelow


isEmpty

public boolean isEmpty()
Description copied from class: XnRegion
Every coordinate space has exactly one empty region. It is the one containing no positions. It and only it responds 'true' to this message.

Specified by:
isEmpty in class XnRegion

isEnumerable

public boolean isEnumerable(OrderSpec order)
Any representable infinite set of real numbers is also not enumerable

Specified by:
isEnumerable in class XnRegion

isEqual

public boolean isEqual(Heaper other)
Description copied from class: XnRegion
Two regions are equal iff they contain exactly the same set of positions

Specified by:
isEqual in class XnRegion

isFinite

public boolean isFinite()
Description copied from class: XnRegion
Essential. Do I contain a finite number of positions? If I do, then the 'count' message will say how many, and I will gladly provide a stepper which will step over all of them. I.e., isFinite implies isEnumerable.

Specified by:
isFinite in class XnRegion

isFull

public boolean isFull()
Description copied from class: XnRegion
true if this is the largest possible region in this space -- the region that contains all positions in the space. Note that in a space which has no positions (which is perfectly valid), the one XuRegion would be both empty (since it has no positions) and full (since it has all the positions in the space).

Overrides:
isFull in class XnRegion

isSimple

public boolean isSimple()
Description copied from class: XnRegion
Am I a simple region. See XuRegion class comment for implications of being simple.

Specified by:
isSimple in class XnRegion

isSubsetOf

public boolean isSubsetOf(XnRegion other)
Description copied from class: XnRegion
I'm a subset of other if I don't have any positions that he doesn't. Note that if we are equal, then I am still a subset of him. If you want to know if I'm a strict subset, you can ask a->isSubsetOf(b) && !! a->isEqual(b)

Overrides:
isSubsetOf in class XnRegion

complement

public XnRegion complement()
Description copied from class: XnRegion
Essential. Return a region of containing exactly those positions not in this region. The complement of a distinction must be a distinction.

Specified by:
complement in class XnRegion

intersect

public XnRegion intersect(XnRegion other)
Description copied from class: XnRegion
Essential. The intersection of two simple regions must be simple. The intersection of two distinctions must therefore be a simple region. The result has exactly those members which both the original regions have.

Specified by:
intersect in class XnRegion

simpleUnion

public XnRegion simpleUnion(XnRegion other)
Description copied from class: XnRegion
The result must contain all positions contained by either of the two original regions, and the result must be simple. However, the result may contain additional positions. See the comment on 'XuRegion::asSimpleRegion'. a->simpleUnion(b) satisfies the same specification as (a->unionWith(b))->asSimpleRegion(). However, the two results do not have to be the same region.

Specified by:
simpleUnion in class XnRegion

unionWith

public XnRegion unionWith(XnRegion other)
Description copied from class: XnRegion
The result has as members exactly those positions which are members of either of the original two regions. No matter how simple the two original regions are, the result may be non-simple. The only reason this is called 'unionWith' instead of 'union' is that the latter is a C++ keyword.

Specified by:
unionWith in class XnRegion

secretTransitions

public PtrArray secretTransitions()

startsInside

public boolean startsInside()

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

asSimpleRegion

public XnRegion asSimpleRegion()
Description copied from class: XnRegion
Return a simple region containing all positions contained by myself. If I am simple, then the result must be me. Otherwise, the resulting region will contain more positions than I do, but it must contain all those that I do. It would be good for the resulting simple region to not contain many more points than it needs in order to satisfy these constraints; but this is a preference, not a specification. Particular spaces may specify stronger guarantees, but as far as class XuRegion is concerned it is correct (though silly) for this message to always return the full region for the space.

Overrides:
asSimpleRegion in class XnRegion

coordinateSpace

public CoordinateSpace coordinateSpace()
Description copied from class: XnRegion
Essential. The coordinate space in which this is a region

Specified by:
coordinateSpace in class XnRegion

lowerBound

public RealPos lowerBound()
The largest real number such that all the positions in the region are >= it. Does not necessarily lie in the region. For example, the region of all numbers > 2 has a lowerBound of 2.


upperBound

public RealPos upperBound()
The smallest real number such that all the positions in the region are <= it. Does not necessarily lie in the region. For example, the region of all numbers < 2 has an upperBound of 2.


intervals

public Stepper intervals()

sendSelfTo

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

make

public static RealRegion make(boolean startsInside,
                              PrimArray transitions)
Make a new region, reusing the given array. Noone else should ever modify it!!


usingx

public static RealRegion usingx(boolean startsInside,
                                PrimFloatArray vals,
                                PrimIntegerArray flags)

info

public static void info()
{Stepper CLIENT of: RealRegion} intervals: order {OrderSpec default: NULL} {BooleanVar CLIENT} isBoundedAbove {BooleanVar CLIENT} isBoundedBelow {BooleanVar CLIENT} isInterval {XuReal CLIENT} lowerBound {XuReal CLIENT} upperBound



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