Java API v6.0

rasj
Class RasMInterval

java.lang.Object
  |
  +--rasj.RasMInterval

public class RasMInterval
extends java.lang.Object

 Copyright (C) 2003 Dr. Peter Baumann

 SOURCE:  RasMInterval.java

 PACKAGE: rasj
 CLASS:   RasMInterval

 PURPOSE:
 The spatial domain of an MDD is represented by an object
 of class RasMInterval. It specifies lower and upper bound
 of the point set for each dimension of an MDD. Internally,
 the class is realized through an array of intervals of type
 RasSInterval.

 For the operations union, difference, and intersection the
 dimensionalties of the operands must be equal, otherwise an
 exception is raised. The semantics of the operations are
 defined as follows for each dimension:

    | ...  fixed bound
    -* ...  open bound


 class   orientation       union    difference  intersection
 -----------------------------------------------------------
   1     |-a-| |-b-|       error    a           error

   2     |-a-|             [a1,b2]  [a1,b1]     [b1,a2]
   2        |-b-|

   3     |--a--|           a        error       b
   3      |-b-|

   4     |-b-|             [b1,a2]  [b2,a2]     [a1,b2]
   4        |-a-|

   5     |--b--|           b        error       a
   5      |-a-|

   6     |-b-| |-a-|       error    a           error

   7     |-a-|-b-|         [a1,b2]  a           [a2,a2]

   8     |-b-|-a-|         [b1,a2]  a           [b2,b2]

   9     |--a--|           a        [a1,b1]     b
   9       |-b-|

  10     |--a--|           a        [b2,a2]     b
  10     |-b-|

  11     |-a-|             a        error       a
  11     |-b-|

  12     |--b--|           b        error       a
  12     |-a-|

  13     |--b--|           b        error       a
  13       |-a-|

  -----------------------------------------------------

  14     |--a--*           a        error       b
  14      |-b-|

  15     |--a--*           a        [b2,a2]     b
  15     |-b-|

  16     |-b-| |-a-*       error    a           error

  17     |-b-|-a-*         [b1,a2]  a           [b2,b2]

  18      |--a--*          [b1,a2]  [b2,a2]     [a1,b2]
  18     |-b-|

  -----------------------------------------------------

  19     *--a--|          a        error       b
  19      |-b-|

  20     *--a--|          a        [a1,b1]     b
  20       |-b-|

  21     *-a-| |-b-|       error    a           error

  22     *-a-|-b-|         [a1,b2]  a           [a2,a2]

  23     *--a--|           [a1,b2]  [a1,b1]     [b1,a2]
  23        |-b-|

  -----------------------------------------------------

  24     |--b--*           b        error       a
  24      |-a-|

  25     |--b--*           b        error       a
  25     |-a-|

  26     |-a-| |-b-*       error    a           error

  27     |-a-|-b-*         [a1,b2]  a           [a2,a2]

  28      |--b--*          [a1,b2]  [a1,b1]     [b1,a2]
  28     |-a-|

  -----------------------------------------------------

  29     *--b--|           b        error       a
  29      |-a-|

  30     *--b--|           b        error       a
  30       |-a-|

  31     *-b-| |-a-|       error    a           error

  32     *-b-|-a-|         [b1,a2]  a           [b2,b2]

  33     *--b--|           [b1,a2]  [b2,a2]     [a1,b2]
  33        |-a-|

  -----------------------------------------------------

  34     *-a-| |-b-*       error    a           error

  35     *-a-|-b-*         [a1,b2]  a           [a2,a2]

  36     *-a-|             [a1,b2]  [a1,b1]     [b1,a2]
  36        |-b-*

  -----------------------------------------------------

  37     *-b-| |-a-*       error    a           error

  38     *-b-|-a-*         [b1,a2]  a           [b2,b2]

  39     *-b-|             [b1,a2]  [a1,b1]     [a1,b2]
  39        |-a-*

  -----------------------------------------------------

  40     *-a-|             b        error       a
  40      *-b-|

  41     *-a-|             a        error       a
  41     *-b-|

  42     *-b-|             a        [b2,a2]     b
  42      *-a-|

  -----------------------------------------------------

  43     |-a-*             a        [a1,b1]     b
  43      |-b-*

  44     |-a-*             a        error       a
  44     |-b-*

  45     |-b-*             b        error       a
  45      |-a-*

  -----------------------------------------------------
  46     *-a-* |-b-|       a        error       b

  47     *-b-* |-a-|       b        error       b

  48     *-a-*             a        [b2,a2]     b
  48      *-b-|

  49     *-a-*             a        [a1,b1]     b
  49      |-b-*

  50     *-b-*             b        error       a
  50      *-a-|

  51     *-b-*             b        error       a
  51      |-a-*

  52     *-a-*             a        error       a
  52     *-b-*

 Attention: The difference operation has to be reconsidered in future
 concerning a discrete interpretation of the intervals.

 The closure operation defines an interval which is the smallest
 interval containing the two operands.
 The method intersectsWith() returns false in the error cases of the
 intersection operation and true otherwise.

 * @version $Revision: 1.15 $


 CHANGE HISTORY (append further entries):
 when        who         what
 ----------------------------------------------------------
 31-01-2000  Beinhofer   created


 COMMENTS:

 


Constructor Summary
RasMInterval()
          Default constructor.
RasMInterval(int dim)
          Constructor getting dimensionality for stream initializing.
RasMInterval(RasMInterval mInterval)
          Copy constructor.
RasMInterval(java.lang.String mIntStr)
          Constructor taking a string representation (for example "[1:255, 1:200]").
 
Method Summary
 RasMInterval add(RasMInterval mint)
          Deprecated. This methdod provides just another name for the createUnion method and might not be supported in future versions. Please use createUnion instead.
 RasMInterval addToSelf(RasMInterval mint)
          Deprecated. This methdod provides just another name for the unionWith method and might not be supported in future versions. Please use unionWith instead.
 RasMInterval closureOf(RasMInterval mint1, RasMInterval mint2)
          Calculates the closure of two MIntervals.
 RasMInterval closureWith(RasMInterval mint)
          Calculates the closure of the current MInterval and the given one.
 int covers(RasMInterval inter2)
          Method for testing if this interval covers the given interval.
 int covers(RasPoint pnt)
          Method for testing if this interval covers the given point.
 RasMInterval createClosure(RasMInterval mint)
          Returns a new MInterval calculated from the closure of the current MInterval and the given one.
 RasMInterval createDifference(RasMInterval mint)
          Returns a new MInterval calculated from a difference of the current MInterval and the given one.
 RasMInterval createIntersection(RasMInterval mint)
          Returns a new MInterval calculated from the intersection of the current MInterval and the given one.
 RasMInterval createTranslation(RasPoint t)
          This method returns a new MInterval resulting from a translation of the current MInterval by the given point.
 RasMInterval createUnion(RasMInterval mint)
          Returns a new MInterval calculated from a union of the current MInterval and the given one.
 RasMInterval diff(RasMInterval mint)
          Deprecated. This methdod provides just another name for the createDifference method and might not be supported in future versions. Please use createDifference instead.
 RasMInterval differenceOf(RasMInterval mint1, RasMInterval mint2)
          Calculates the difference of two MIntervals.
 RasMInterval differenceWith(RasMInterval mint)
          Calculates the difference of the current MInterval and the given one.
 RasMInterval diffFromSelf(RasMInterval mint)
          Deprecated. This methdod provides just another name for the differenceWith method and might not be supported in future versions. Please use differenceWith instead.
 int dimension()
          Gets the dimensionality of this MInterval.
 boolean equals(RasMInterval mint)
          Method for testing equality of two MIntervals.
 RasPoint getExtent()
          Gets the size of this MInterval as a point, that means the point specifies the extent of this MInterval ( i.e. high() - low() ) in each dimension.
 RasPoint getHigh()
          Gets the point with the highest coordinates in every dimension.
 RasPoint getOrigin()
          Gets the point with the lowest coordinates in every dimension.
 RasMInterval intersectionOf(RasMInterval mint1, RasMInterval mint2)
          This method calculates the intersection of two MIntervals.
 RasMInterval intersectionWith(RasMInterval mint)
          Calculates the intersection of the current MInterval and the given one.
 boolean intersectsWith(RasMInterval mInterval)
          Determines if the self mInterval intersects with the delivered one.
 boolean isMergeable(RasMInterval b)
          This method checks if this MInterval is mergeable with another MInterval.
 RasSInterval item(int i)
          Read access the i-th interval.
 RasMInterval mult(RasMInterval mint)
          Deprecated. This methdod provides just another name for the createIntersection method and might not be supported in future versions. Please use createIntersection instead.
 RasMInterval multWithSelf(RasMInterval mint)
          Deprecated. This methdod provides just another name for the intersectionWith method and might not be supported in future versions. Please use intersectionWith instead.
 boolean notEquals(RasMInterval mint)
          Method for testing inequality.
 void setItem(int i, RasSInterval value)
          Write access to the i-th interval.
 void stream(long p)
          Method for stream initialization with point intervals.
 void stream(RasSInterval newInterval)
          Method for stream initialization with intervals.
 java.lang.String toString()
          gives back the string representation
 RasMInterval translate(RasPoint t)
          This methods translates the current MInterval by a point.
 RasMInterval unionOf(RasMInterval mint1, RasMInterval mint2)
          Calculates the union of two MIntervals.
 RasMInterval unionWith(RasMInterval mint)
          Calculates the union of the current MIntervall with another one.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RasMInterval

public RasMInterval(int dim)
Constructor getting dimensionality for stream initializing.

Parameters:
dim - the dimensionality of this MInterval

RasMInterval

public RasMInterval(java.lang.String mIntStr)
             throws RasResultIsNoIntervalException
Constructor taking a string representation (for example "[1:255, 1:200]").

Parameters:
mIntStr - a string specifying the MInterval

RasMInterval

public RasMInterval()
Default constructor.


RasMInterval

public RasMInterval(RasMInterval mInterval)
             throws RasStreamInputOverflowException,
                    RasIndexOutOfBoundsException
Copy constructor.

Parameters:
mInterval - the MInterval that is to be copied
Method Detail

stream

public void stream(RasSInterval newInterval)
            throws RasStreamInputOverflowException
Method for stream initialization with intervals.

Parameters:
newInterval - the interval that has to be streamed
RasStreamInputOverflowException

stream

public void stream(long p)
            throws RasStreamInputOverflowException,
                   RasResultIsNoIntervalException
Method for stream initialization with point intervals.

Parameters:
p - the point interval that has to be streamed
RasStreamInputOverflowException
RasResultIsNoIntervalException

intersectsWith

public boolean intersectsWith(RasMInterval mInterval)
                       throws RasDimensionMismatchException,
                              RasIndexOutOfBoundsException
Determines if the self mInterval intersects with the delivered one.

Parameters:
mInterval - the MInterval to be intersected
RasDimensionMismatchException
RasIndexOutOfBoundsException

item

public RasSInterval item(int i)
                  throws RasIndexOutOfBoundsException
Read access the i-th interval.

Parameters:
i - the dimension to be read
RasIndexOutOfBoundsException

setItem

public void setItem(int i,
                    RasSInterval value)
             throws RasIndexOutOfBoundsException
Write access to the i-th interval.

Parameters:
i - the dimension that is to be accessed
value - the interval that is to be assigned to the specified dimension
RasIndexOutOfBoundsException

equals

public boolean equals(RasMInterval mint)
Method for testing equality of two MIntervals. Two domains are equal if they have the same number of dimensions and each dimension has the same lower and upper bounds.

Parameters:
mint - the MInterval that is compared to this MInterval
Returns:
true if the two MIntervals are equal

notEquals

public boolean notEquals(RasMInterval mint)
Method for testing inequality. This is the negation of the equals method.

Parameters:
mint - the MInterval that is compared to this MInterval
Returns:
true if the two MIntervals are not equal

covers

public final int covers(RasPoint pnt)
Method for testing if this interval covers the given point.

Parameters:
pnt - the point to be tested
Returns:
-1 if the point has not the same dimensionality
1 if the point is covered by this MInterval
0 if the point is not covered

covers

public int covers(RasMInterval inter2)
Method for testing if this interval covers the given interval.

Parameters:
inter2 - the MInterval to be tested
Returns:

dimension

public int dimension()
Gets the dimensionality of this MInterval.

Returns:
the dimensionality of this MInterval

getOrigin

public RasPoint getOrigin()
Gets the point with the lowest coordinates in every dimension.

Returns:
the origin of this MInterval (the point with the lowest coordinates)

getHigh

public RasPoint getHigh()
Gets the point with the highest coordinates in every dimension.

Returns:
the point with the highest coordinates in this MInterval

getExtent

public RasPoint getExtent()
Gets the size of this MInterval as a point, that means the point specifies the extent of this MInterval ( i.e. high() - low() ) in each dimension.

Returns:
the size of this MInterval

isMergeable

public boolean isMergeable(RasMInterval b)
This method checks if this MInterval is mergeable with another MInterval. Two RasMIntervals are "mergeable" if they have the same low() and high() values in all dimensions except in one where they differ by one point, this is, a.low()==b.high()+1 or b.low()==a.high()+1. For instance, the following two blocks are mergeable:
 +-------------+---------------------------------------+
 |      A      |                  B                    |
 +-------------|---------------------------------------|

 and the following two are not:

 +-------------+-------------------------+
 |             |            B            |
 |      A      +-------------------------+
 +-------------+

  

Parameters:
b - the MInterval to be checked
Returns:
true if the two intervalls are mergeable

translate

public RasMInterval translate(RasPoint t)
                       throws RasDimensionMismatchException,
                              RasResultIsNoIntervalException
This methods translates the current MInterval by a point. It adds the coordinates of the given point to the lower bounds of the current MInterval. This operation is only legal if all lower bounds are fixed and the point has the same dimension as the MInterval!

Note that this method modifies the current MInterval. If you want to get a new MInterval, use the createTranslation method instead.

Parameters:
t - the point to be added
Returns:
the current MInterval
RasDimensionMismatchException
RasResultIsNoIntervalException

createTranslation

public RasMInterval createTranslation(RasPoint t)
                               throws RasDimensionMismatchException,
                                      RasResultIsNoIntervalException
This method returns a new MInterval resulting from a translation of the current MInterval by the given point. It creates a copy of the current MInterval and adds the coordinates of the given point to its lower bounds.

This operation is only legal if all lower bounds are fixed and the point has the same dimension as the MInterval!

Parameters:
t - the point to be added
Returns:
the new MInterval
RasDimensionMismatchException
RasResultIsNoIntervalException

unionOf

public RasMInterval unionOf(RasMInterval mint1,
                            RasMInterval mint2)
                     throws RasDimensionMismatchException,
                            RasResultIsNoIntervalException
Calculates the union of two MIntervals. This is only possible for two MIntervals having the same dimensionality.

Note that this operation modifies the current object. If you want to get a new MInterval, use createUnion instead.

Parameters:
mint1 - the first MInterval
mint2 - the second MInterval
Returns:
the current MInterval (representing the union of mint1 and mint2)
RasDimensionMismatchException
RasResultIsNoIntervalException

unionWith

public RasMInterval unionWith(RasMInterval mint)
                       throws RasDimensionMismatchException,
                              RasResultIsNoIntervalException
Calculates the union of the current MIntervall with another one.

Note that this operation modifies the current object. If you want to get a new MInterval, use createUnion instead.

Parameters:
mint - the MInterval to be used for the union
Returns:
the current MInterval (after the union with mint)
RasDimensionMismatchException
RasResultIsNoIntervalException

addToSelf

public RasMInterval addToSelf(RasMInterval mint)
                       throws RasDimensionMismatchException,
                              RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the unionWith method and might not be supported in future versions. Please use unionWith instead.

Parameters:
mint - the MInterval to be added
Returns:
the current MInterval after adding mint
RasDimensionMismatchException
RasResultIsNoIntervalException

createUnion

public RasMInterval createUnion(RasMInterval mint)
                         throws RasDimensionMismatchException,
                                RasResultIsNoIntervalException
Returns a new MInterval calculated from a union of the current MInterval and the given one.

Parameters:
mint - the MInterval to be unioned with this MInterval
Returns:
the union of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

add

public RasMInterval add(RasMInterval mint)
                 throws RasDimensionMismatchException,
                        RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the createUnion method and might not be supported in future versions. Please use createUnion instead.

Parameters:
mint - the MInterval to be added
Returns:
the current MInterval after adding mint
RasDimensionMismatchException
RasResultIsNoIntervalException

differenceOf

public RasMInterval differenceOf(RasMInterval mint1,
                                 RasMInterval mint2)
                          throws RasDimensionMismatchException,
                                 RasResultIsNoIntervalException
Calculates the difference of two MIntervals.

Note that this operation modifies the current object. If you want to get a new MInterval, use createDifference instead.

Parameters:
mint1 - the first MInterval
mint2 - the second MInterval
Returns:
the current MInterval (representing the difference of mint1 and mint2)
RasDimensionMismatchException
RasResultIsNoIntervalException

differenceWith

public RasMInterval differenceWith(RasMInterval mint)
                            throws RasDimensionMismatchException,
                                   RasResultIsNoIntervalException
Calculates the difference of the current MInterval and the given one.

Note that this operation modifies the current object. If you want to get a new MInterval, use createDifference instead.

Parameters:
mint - the MInterval used for building the difference
Returns:
the current MInterval (representing the difference of this MInterval and mint)
RasDimensionMismatchException
RasResultIsNoIntervalException

diffFromSelf

public RasMInterval diffFromSelf(RasMInterval mint)
                          throws RasDimensionMismatchException,
                                 RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the differenceWith method and might not be supported in future versions. Please use differenceWith instead.

Returns:
the difference of this MInterval and mint2
RasDimensionMismatchException
RasResultIsNoIntervalException

createDifference

public RasMInterval createDifference(RasMInterval mint)
                              throws RasDimensionMismatchException,
                                     RasResultIsNoIntervalException
Returns a new MInterval calculated from a difference of the current MInterval and the given one.

Parameters:
mint - the MInterval used for calculating the difference with the current MInterval
Returns:
the difference of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

diff

public RasMInterval diff(RasMInterval mint)
                  throws RasDimensionMismatchException,
                         RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the createDifference method and might not be supported in future versions. Please use createDifference instead.

Parameters:
mint - the MInterval used for calculating the difference with the current MInterval
Returns:
the difference of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

intersectionOf

public RasMInterval intersectionOf(RasMInterval mint1,
                                   RasMInterval mint2)
                            throws RasDimensionMismatchException,
                                   RasResultIsNoIntervalException
This method calculates the intersection of two MIntervals. This is only possible if the two MIntervals have the same dimensionality.

Note that this operation modifies the current object. If you want to get a new MInterval, use createIntersection instead.

Parameters:
mint1 - the first MInterval
mint2 - the second MInterval
Returns:
the current MInterval (representing the intersection of mint1 and mint2)
RasDimensionMismatchException
RasResultIsNoIntervalException

intersectionWith

public RasMInterval intersectionWith(RasMInterval mint)
                              throws RasDimensionMismatchException,
                                     RasResultIsNoIntervalException
Calculates the intersection of the current MInterval and the given one.

Note that this operation modifies the current object. If you want to get a new MInterval, use createIntersection instead.

Parameters:
mint - the MInterval used for building the intersection
Returns:
the current MInterval (representing the intersection of this MInterval and mint)
RasDimensionMismatchException
RasResultIsNoIntervalException

multWithSelf

public RasMInterval multWithSelf(RasMInterval mint)
                          throws RasDimensionMismatchException,
                                 RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the intersectionWith method and might not be supported in future versions. Please use intersectionWith instead.

Parameters:
mint - the MInterval used for building the intersection
Returns:
the intersection of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

createIntersection

public RasMInterval createIntersection(RasMInterval mint)
                                throws RasDimensionMismatchException,
                                       RasResultIsNoIntervalException
Returns a new MInterval calculated from the intersection of the current MInterval and the given one.

Parameters:
mint - the MInterval used for calculating the intersection with the current MInterval
Returns:
the intersection of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

mult

public RasMInterval mult(RasMInterval mint)
                  throws RasDimensionMismatchException,
                         RasResultIsNoIntervalException
Deprecated. This methdod provides just another name for the createIntersection method and might not be supported in future versions. Please use createIntersection instead.

Parameters:
mint - the MInterval used for calculating the intersection with the current MInterval
Returns:
the intersection of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

closureOf

public RasMInterval closureOf(RasMInterval mint1,
                              RasMInterval mint2)
                       throws RasDimensionMismatchException,
                              RasResultIsNoIntervalException
Calculates the closure of two MIntervals.

Note that this operation modifies the current object. If you want to get a new MInterval, use createClosure instead.

Parameters:
mint1 - the first MInterval
mint2 - the second MInterval
Returns:
the current MInterval (representing the closure of mint1 and mint2)
RasDimensionMismatchException
RasResultIsNoIntervalException

closureWith

public RasMInterval closureWith(RasMInterval mint)
                         throws RasDimensionMismatchException,
                                RasResultIsNoIntervalException
Calculates the closure of the current MInterval and the given one.

Note that this operation modifies the current object. If you want to get a new MInterval, use createClosure instead.

Parameters:
mint - the MInterval used for building the closure
Returns:
the current MInterval (representing the closure of this MInterval and mint)
RasDimensionMismatchException
RasResultIsNoIntervalException

createClosure

public RasMInterval createClosure(RasMInterval mint)
                           throws RasDimensionMismatchException,
                                  RasResultIsNoIntervalException
Returns a new MInterval calculated from the closure of the current MInterval and the given one.

Parameters:
mint - the MInterval used for calculating the closure with the current MInterval
Returns:
the closure of this MInterval and mint
RasDimensionMismatchException
RasResultIsNoIntervalException

toString

public java.lang.String toString()
gives back the string representation

Overrides:
toString in class java.lang.Object

-1 if the point has not the same dimensionality
1 if the point is covered by this MInterval
0 if the point is not covered
rasdaman Java API Reference

Copyright © 2003- rasdaman GmbH