| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> |
| <title>OrderedTuple (Apache Commons Math 3.3 API)</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="OrderedTuple (Apache Commons Math 3.3 API)"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar_top"> |
| <!-- --> |
| </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/OrderedTuple.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.Node.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities"><span class="strong">Prev Class</span></a></li> |
| <li>Next Class</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" target="_top">Frames</a></li> |
| <li><a href="OrderedTuple.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.commons.math3.geometry.partitioning.utilities</div> |
| <h2 title="Class OrderedTuple" class="title">Class OrderedTuple</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.commons.math3.geometry.partitioning.utilities.OrderedTuple</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a><<a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities">OrderedTuple</a>></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="strong">OrderedTuple</span> |
| extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> |
| implements <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a><<a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities">OrderedTuple</a>></pre> |
| <div class="block">This class implements an ordering operation for T-uples. |
| |
| <p>Ordering is done by encoding all components of the T-uple into a |
| single scalar value and using this value as the sorting |
| key. Encoding is performed using the method invented by Georg |
| Cantor in 1877 when he proved it was possible to establish a |
| bijection between a line and a plane. The binary representations of |
| the components of the T-uple are mixed together to form a single |
| scalar. This means that the 2<sup>k</sup> bit of component 0 is |
| followed by the 2<sup>k</sup> bit of component 1, then by the |
| 2<sup>k</sup> bit of component 2 up to the 2<sup>k</sup> bit of |
| component <code>t</code>, which is followed by the 2<sup>k-1</sup> |
| bit of component 0, followed by the 2<sup>k-1</sup> bit of |
| component 1 ... The binary representations are extended as needed |
| to handle numbers with different scales and a suitable |
| 2<sup>p</sup> offset is added to the components in order to avoid |
| negative numbers (this offset is adjusted as needed during the |
| comparison operations).</p> |
| |
| <p>The more interesting property of the encoding method for our |
| purpose is that it allows to select all the points that are in a |
| given range. This is depicted in dimension 2 by the following |
| picture:</p> |
| |
| <img src="doc-files/OrderedTuple.png" /> |
| |
| <p>This picture shows a set of 100000 random 2-D pairs having their |
| first component between -50 and +150 and their second component |
| between -350 and +50. We wanted to extract all pairs having their |
| first component between +30 and +70 and their second component |
| between -120 and -30. We built the lower left point at coordinates |
| (30, -120) and the upper right point at coordinates (70, -30). All |
| points smaller than the lower left point are drawn in red and all |
| points larger than the upper right point are drawn in blue. The |
| green points are between the two limits. This picture shows that |
| all the desired points are selected, along with spurious points. In |
| this case, we get 15790 points, 4420 of which really belonging to |
| the desired rectangle. It is possible to extract very small |
| subsets. As an example extracting from the same 100000 points set |
| the points having their first component between +30 and +31 and |
| their second component between -91 and -90, we get a subset of 11 |
| points, 2 of which really belonging to the desired rectangle.</p> |
| |
| <p>the previous selection technique can be applied in all |
| dimensions, still using two points to define the interval. The |
| first point will have all its components set to their lower bounds |
| while the second point will have all its components set to their |
| upper bounds.</p> |
| |
| <p>T-uples with negative infinite or positive infinite components |
| are sorted logically.</p> |
| |
| <p>Since the specification of the <code>Comparator</code> interface |
| allows only <code>ClassCastException</code> errors, some arbitrary |
| choices have been made to handle specific cases. The rationale for |
| these choices is to keep <em>regular</em> and consistent T-uples |
| together.</p> |
| <ul> |
| <li>instances with different dimensions are sorted according to |
| their dimension regardless of their components values</li> |
| <li>instances with <code>Double.NaN</code> components are sorted |
| after all other ones (even after instances with positive infinite |
| components</li> |
| <li>instances with both positive and negative infinite components |
| are considered as if they had <code>Double.NaN</code> |
| components</li> |
| </ul></div> |
| <dl><dt><span class="strong">Since:</span></dt> |
| <dd>3.0</dd> |
| <dt><span class="strong">Version:</span></dt> |
| <dd>$Id: OrderedTuple.java 1591835 2014-05-02 09:04:01Z tn $</dd></dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><strong><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html#OrderedTuple(double...)">OrderedTuple</a></strong>(double... components)</code> |
| <div class="block">Build an ordered T-uple from its components.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span>Methods</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html#compareTo(org.apache.commons.math3.geometry.partitioning.utilities.OrderedTuple)">compareTo</a></strong>(<a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities">OrderedTuple</a> ot)</code> |
| <div class="block">Compares this ordered T-uple with the specified object.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html#equals(java.lang.Object)">equals</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> other)</code></td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html#getComponents()">getComponents</a></strong>()</code> |
| <div class="block">Get the components array.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html#hashCode()">hashCode</a></strong>()</code></td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor_detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="OrderedTuple(double...)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>OrderedTuple</h4> |
| <pre>public OrderedTuple(double... components)</pre> |
| <div class="block">Build an ordered T-uple from its components.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>components</code> - double components of the T-uple</dd></dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="compareTo(org.apache.commons.math3.geometry.partitioning.utilities.OrderedTuple)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>compareTo</h4> |
| <pre>public int compareTo(<a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities">OrderedTuple</a> ot)</pre> |
| <div class="block">Compares this ordered T-uple with the specified object. |
| |
| <p>The ordering method is detailed in the general description of |
| the class. Its main property is to be consistent with distance: |
| geometrically close T-uples stay close to each other when stored |
| in a sorted collection using this comparison method.</p> |
| |
| <p>T-uples with negative infinite, positive infinite are sorted |
| logically.</p> |
| |
| <p>Some arbitrary choices have been made to handle specific |
| cases. The rationale for these choices is to keep |
| <em>normal</em> and consistent T-uples together.</p> |
| <ul> |
| <li>instances with different dimensions are sorted according to |
| their dimension regardless of their components values</li> |
| <li>instances with <code>Double.NaN</code> components are sorted |
| after all other ones (evan after instances with positive infinite |
| components</li> |
| <li>instances with both positive and negative infinite components |
| are considered as if they had <code>Double.NaN</code> |
| components</li> |
| </ul></div> |
| <dl> |
| <dt><strong>Specified by:</strong></dt> |
| <dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true#compareTo(T)" title="class or interface in java.lang">compareTo</a></code> in interface <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a><<a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities">OrderedTuple</a>></code></dd> |
| <dt><span class="strong">Parameters:</span></dt><dd><code>ot</code> - T-uple to compare instance with</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>a negative integer if the instance is less than the |
| object, zero if they are equal, or a positive integer if the |
| instance is greater than the object</dd></dl> |
| </li> |
| </ul> |
| <a name="equals(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>equals</h4> |
| <pre>public boolean equals(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> other)</pre> |
| <dl> |
| <dt><strong>Overrides:</strong></dt> |
| <dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a></code> in class <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hashCode()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hashCode</h4> |
| <pre>public int hashCode()</pre> |
| <dl> |
| <dt><strong>Overrides:</strong></dt> |
| <dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a></code> in class <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getComponents()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getComponents</h4> |
| <pre>public double[] getComponents()</pre> |
| <div class="block">Get the components array.</div> |
| <dl><dt><span class="strong">Returns:</span></dt><dd>array containing the T-uple components</dd></dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar_bottom"> |
| <!-- --> |
| </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/OrderedTuple.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../../../org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.Node.html" title="class in org.apache.commons.math3.geometry.partitioning.utilities"><span class="strong">Prev Class</span></a></li> |
| <li>Next Class</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../../../index.html?org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.html" target="_top">Frames</a></li> |
| <li><a href="OrderedTuple.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor_summary">Constr</a> | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor_detail">Constr</a> | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2003–2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |