| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (21) on Thu Oct 05 19:54:57 CEST 2023 --> |
| <title>ComparisonMode (Apache SIS 1.4 API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2023-10-05"> |
| <meta name="description" content="declaration: module: org.apache.sis.util, package: org.apache.sis.util, enum: ComparisonMode"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <meta name="keywords" content="org.apache.sis.util.ComparisonMode class"> |
| <meta name="keywords" content="values()"> |
| <meta name="keywords" content="valueOf()"> |
| <meta name="keywords" content="isIgnoringMetadata()"> |
| <meta name="keywords" content="isApproximate()"> |
| <meta name="keywords" content="equalityLevel()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span><span class="nav-bar-toggle-icon"> </span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</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#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li><a href="#nested-class-summary">Nested</a></li> |
| <li><a href="#enum-constant-summary">Enum Constants</a></li> |
| <li>Field</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li><a href="#enum-constant-detail">Enum Constants</a></li> |
| <li>Field</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li><a href="#nested-class-summary">Nested</a> | </li> |
| <li><a href="#enum-constant-summary">Enum Constants</a> | </li> |
| <li>Field | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#enum-constant-detail">Enum Constants</a> | </li> |
| <li>Field | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">org.apache.sis.util</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.sis.util</a></div> |
| <h1 title="Enum Class ComparisonMode" class="title">Enum Class ComparisonMode</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> |
| <div class="inheritance"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html" title="class or interface in java.lang" class="external-link">Enum</a><<a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a>> |
| <div class="inheritance">ComparisonMode</div> |
| </div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <dl class="notes"> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code>, <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Comparable.html" title="class or interface in java.lang" class="external-link">Comparable</a><<a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a>></code>, <code>Constable</code></dd> |
| </dl> |
| <hr> |
| <div class="type-signature"><span class="modifiers">public enum </span><span class="element-name type-name-label">ComparisonMode</span> |
| <span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html" title="class or interface in java.lang" class="external-link">Enum</a><<a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a>></span></div> |
| <div class="block">Specifies the level of strictness when comparing two <a href="LenientComparable.html" title="interface in org.apache.sis.util"><code>LenientComparable</code></a> objects |
| for equality. This enumeration allows users to specify which kind of differences can be |
| tolerated between two objects: differences in implementation class, differences in |
| some kinds of property, or slight difference in numerical values. |
| |
| <p>This enumeration is <em>ordered</em> from stricter to more lenient levels:</p> |
| |
| <ol> |
| <li><a href="#STRICT"><code>STRICT</code></a> – All attributes of the compared objects shall be strictly equal.</li> |
| <li><a href="#BY_CONTRACT"><code>BY_CONTRACT</code></a> – Only the attributes published in the interface contract need to be compared.</li> |
| <li><a href="#IGNORE_METADATA"><code>IGNORE_METADATA</code></a> – Only the attributes relevant to the object functionality are compared.</li> |
| <li><a href="#APPROXIMATE"><code>APPROXIMATE</code></a> – Only the attributes relevant to the object functionality are compared, |
| with some tolerance threshold on numerical values.</li> |
| <li><a href="#ALLOW_VARIANT"><code>ALLOW_VARIANT</code></a> – For objects not really equal but related (e.g. CRS using different axis order).</li> |
| <li><a href="#DEBUG"><code>DEBUG</code></a> – Special mode for figuring out why two objects expected to be equal are not.</li> |
| </ol> |
| |
| If two objects are equal at some level of strictness <var>E</var>, then they should also |
| be equal at all levels listed below <var>E</var> in the above list. For example if two objects |
| are equal at the <a href="#BY_CONTRACT"><code>BY_CONTRACT</code></a> level, then they should also be equal at the |
| <a href="#IGNORE_METADATA"><code>IGNORE_METADATA</code></a> level but not necessarily at the <a href="#STRICT"><code>STRICT</code></a> level.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.3</dd> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="LenientComparable.html#equals(java.lang.Object,org.apache.sis.util.ComparisonMode)"><code>LenientComparable.equals(Object, ComparisonMode)</code></a></li> |
| <li><a href="Utilities.html#deepEquals(java.lang.Object,java.lang.Object,org.apache.sis.util.ComparisonMode)"><code>Utilities.deepEquals(Object, Object, ComparisonMode)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <li> |
| <section class="nested-class-summary" id="nested-class-summary"> |
| <h2>Nested Class Summary</h2> |
| <div class="inherited-list"> |
| <h2 id="nested-classes-inherited-from-class-java.lang.Enum">Nested classes/interfaces inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html" title="class or interface in java.lang" class="external-link">Enum</a></h2> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.EnumDesc.html" title="class or interface in java.lang" class="external-link">Enum.EnumDesc</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.EnumDesc.html" title="class or interface in java.lang" class="external-link">E</a> extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html" title="class or interface in java.lang" class="external-link">Enum</a><<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.EnumDesc.html" title="class or interface in java.lang" class="external-link">E</a>>></code></div> |
| </section> |
| </li> |
| <!-- =========== ENUM CONSTANT SUMMARY =========== --> |
| <li> |
| <section class="constants-summary" id="enum-constant-summary"> |
| <h2>Enum Constant Summary</h2> |
| <div class="caption"><span>Enum Constants</span></div> |
| <div class="summary-table two-column-summary"> |
| <div class="table-header col-first">Enum Constant</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code><a href="#ALLOW_VARIANT" class="member-name-link">ALLOW_VARIANT</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Most but not all attributes relevant to the object functionality are compared.</div> |
| </div> |
| <div class="col-first odd-row-color"><code><a href="#APPROXIMATE" class="member-name-link">APPROXIMATE</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Only the attributes relevant to the object functionality are compared, with some tolerance |
| threshold on numerical values.</div> |
| </div> |
| <div class="col-first even-row-color"><code><a href="#BY_CONTRACT" class="member-name-link">BY_CONTRACT</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Only the attributes published in some contract (typically a GeoAPI interface) need to be compared.</div> |
| </div> |
| <div class="col-first odd-row-color"><code><a href="#DEBUG" class="member-name-link">DEBUG</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Same as <a href="#APPROXIMATE"><code>APPROXIMATE</code></a>, except that an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AssertionError.html" title="class or interface in java.lang" class="external-link"><code>AssertionError</code></a> is thrown if the two |
| objects are not equal and assertions are enabled.</div> |
| </div> |
| <div class="col-first even-row-color"><code><a href="#IGNORE_METADATA" class="member-name-link">IGNORE_METADATA</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Only the attributes relevant to the object functionality are compared.</div> |
| </div> |
| <div class="col-first odd-row-color"><code><a href="#STRICT" class="member-name-link">STRICT</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">All attributes of the compared objects shall be strictly equal.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#equalityLevel(java.lang.Object,java.lang.Object)" class="member-name-link">equalityLevel</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> o1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> o2)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">If the two given objects are equal according one of the modes enumerated in this class, |
| then returns that mode.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isApproximate()" class="member-name-link">isApproximate</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if this comparison uses a tolerance threshold.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isIgnoringMetadata()" class="member-name-link">isIgnoringMetadata</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"> |
| <div class="block">Returns <code>true</code> if this comparison ignores metadata.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#valueOf(java.lang.String)" class="member-name-link">valueOf</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> name)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns the enum constant of this class with the specified name.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a>[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#values()" class="member-name-link">values</a>()</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns an array containing the constants of this enum class, in |
| the order they are declared.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Enum">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html" title="class or interface in java.lang" class="external-link">Enum</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#compareTo(E)" title="class or interface in java.lang" class="external-link">compareTo</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#describeConstable()" title="class or interface in java.lang" class="external-link">describeConstable</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#getDeclaringClass()" title="class or interface in java.lang" class="external-link">getDeclaringClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#name()" title="class or interface in java.lang" class="external-link">name</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#ordinal()" title="class or interface in java.lang" class="external-link">ordinal</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Enum.html#valueOf(java.lang.Class,java.lang.String)" title="class or interface in java.lang" class="external-link">valueOf</a></code></div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-Object">Methods inherited from class <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ ENUM CONSTANT DETAIL =========== --> |
| <li> |
| <section class="constant-details" id="enum-constant-detail"> |
| <h2>Enum Constant Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="STRICT"> |
| <h3>STRICT</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">STRICT</span></div> |
| <div class="block">All attributes of the compared objects shall be strictly equal. This comparison mode |
| is equivalent to the <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link"><code>Object.equals(Object)</code></a> method, and must be compliant with |
| the contract documented in that method. In particular, this comparison mode shall be |
| consistent with <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link"><code>Object.hashCode()</code></a> and be symmetric (<code>A.equals(B)</code> implies |
| <code>B.equals(A)</code>). |
| |
| <h4 id="implementation-note-heading">Implementation note</h4> |
| In the SIS implementation, this comparison mode usually have the following |
| characteristics (not always, this is only typical): |
| |
| <ul> |
| <li>The objects being compared need to be the same implementation class.</li> |
| <li>Private fields are compared directly instead of invoking public getter methods.</li> |
| </ul></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list"> |
| <li><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link"><code>Object.equals(Object)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="BY_CONTRACT"> |
| <h3>BY_CONTRACT</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">BY_CONTRACT</span></div> |
| <div class="block">Only the attributes published in some contract (typically a GeoAPI interface) need to be compared. |
| The implementation classes do not need to be the same and some private attributes may be ignored. |
| |
| <p>Note that this comparison mode does <strong>not</strong> guaranteed <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link"><code>Object.hashCode()</code></a> |
| consistency, neither comparison symmetry (i.e. <code>A.equals(B)</code> and <code>B.equals(A)</code> may |
| return different results if the <code>equals</code> methods are implemented differently).</p> |
| |
| <h4 id="implementation-note-heading1">Implementation note</h4> |
| In the SIS implementation, this comparison mode usually have the following |
| characteristics (not always, this is only typical): |
| |
| <ul> |
| <li>The objects being compared need to implement the same GeoAPI interfaces.</li> |
| <li>Public getter methods are used (no direct access to private fields).</li> |
| </ul></div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="IGNORE_METADATA"> |
| <h3>IGNORE_METADATA</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">IGNORE_METADATA</span></div> |
| <div class="block">Only the attributes relevant to the object functionality are compared. Attributes that |
| are only informative can be ignored. This comparison mode is typically less strict than |
| <a href="#BY_CONTRACT"><code>BY_CONTRACT</code></a>. |
| |
| <h4 id="application-to-coordinate-reference-systems-heading">Application to coordinate reference systems</h4> |
| If the objects being compared are <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/crs/CoordinateReferenceSystem.html" title="class or interface in org.opengis.referencing.crs" class="external-link"><code>CoordinateReferenceSystem</code></a> instances, |
| then only the properties relevant to the coordinate localization shall be compared. |
| Metadata like the <a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/AbstractIdentifiedObject.html#getIdentifiers()">identifiers</a> |
| or the <a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/AbstractReferenceSystem.html#getDomainOfValidity()">domain of validity</a>, |
| which have no impact on the coordinates being calculated, shall be ignored. |
| |
| <h4 id="application-to-coordinate-operations-heading">Application to coordinate operations</h4> |
| If the objects being compared are <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>MathTransform</code></a> instances, |
| then two transforms defined in a different way may be considered equivalent. For example, it is possible |
| to define a Mercator projection in different ways, named "variant A", "variant B" and "variant C" |
| in EPSG dataset, each having their own set of parameters. |
| The <a href="#STRICT"><code>STRICT</code></a> or <a href="#BY_CONTRACT"><code>BY_CONTRACT</code></a> modes shall consider two projections as equal only if their |
| <a href="../../../../../org.apache.sis.referencing/org/apache/sis/referencing/operation/transform/AbstractMathTransform.html#getParameterValues()">parameter values</a> are strictly identical, while the <code>IGNORE_METADATA</code> mode can consider |
| those objects as equivalent despite difference in the set of parameters, as long as coordinate |
| transformations still produce the same results. |
| |
| <h4 id="example-heading">Example</h4> |
| A <cite>"Mercator (variant B)"</cite> projection with a <cite>standard parallel</cite> value of 60° produces the |
| same results than a <cite>"Mercator (variant A)"</cite> projection with a <cite>scale factor</cite> value of 0.5.</div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="tag-list-long"> |
| <li><a href="Utilities.html#equalsIgnoreMetadata(java.lang.Object,java.lang.Object)"><code>Utilities.equalsIgnoreMetadata(Object, Object)</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="APPROXIMATE"> |
| <h3>APPROXIMATE</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">APPROXIMATE</span></div> |
| <div class="block">Only the attributes relevant to the object functionality are compared, with some tolerance |
| threshold on numerical values. |
| |
| <h4 id="application-to-coordinate-operations-heading1">Application to coordinate operations</h4> |
| If two <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>MathTransform</code></a> objects are considered equal according this mode, |
| then for any given identical source position, the two compared transforms shall compute at least approximately |
| the same target position. |
| A small difference is tolerated between the target coordinates calculated by the two math transforms. |
| How small is “small” is implementation dependent — the threshold cannot be specified in the current |
| implementation, because of the non-linear nature of map projections.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>1.0</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="ALLOW_VARIANT"> |
| <h3>ALLOW_VARIANT</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">ALLOW_VARIANT</span></div> |
| <div class="block">Most but not all attributes relevant to the object functionality are compared. |
| This comparison mode is equivalent to <a href="#APPROXIMATE"><code>APPROXIMATE</code></a>, except that it |
| ignores some attributes that may differ between objects not equal but related. |
| |
| <p>The main purpose of this method is to verify if two Coordinate Reference Systems (CRS) |
| are approximately equal ignoring axis order.</p> |
| |
| <h4 id="example-heading1">Example</h4> |
| Consider two geographic coordinate reference systems with the same attributes except axis order, |
| where one CRS uses (<var>latitude</var>, <var>longitude</var>) axes |
| and the other CRS uses (<var>longitude</var>, <var>latitude</var>) axes. |
| All comparison modes (even <code>APPROXIMATE</code>) will consider those two CRS as different, |
| except this <code>ALLOW_VARIANT</code> mode which will consider one CRS to be a variant of the other.</div> |
| <dl class="notes"> |
| <dt>Since:</dt> |
| <dd>0.7</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="DEBUG"> |
| <h3>DEBUG</h3> |
| <div class="member-signature"><span class="annotations"><a href="Debug.html" title="annotation interface in org.apache.sis.util">@Debug</a> |
| </span><span class="modifiers">public static final</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">DEBUG</span></div> |
| <div class="block">Same as <a href="#APPROXIMATE"><code>APPROXIMATE</code></a>, except that an <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/AssertionError.html" title="class or interface in java.lang" class="external-link"><code>AssertionError</code></a> is thrown if the two |
| objects are not equal and assertions are enabled. The exception message and stack trace help |
| to locate which attributes are not equal. This mode is typically used in assertions like below: |
| |
| |
| <div class="snippet-container"><button class="copy snippet-copy" aria-label="Copy snippet" onclick="copySnippet(this)"><span data-copied="Copied!">Copy</span><img src="../../../../../copy.svg" alt="Copy snippet"></button> |
| <pre class="snippet"><code class="language-java">assert Utilities.deepEquals(object1, object2, ComparisonMode.DEBUG); |
| </code></pre> |
| </div> |
| |
| |
| Note that a comparison in <code>DEBUG</code> mode may still return <code>false</code> without |
| throwing an exception, since not all corner cases are tested. The exception is only |
| intended to provide more details for some common cases.</div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="values()"> |
| <h3>values</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a>[]</span> <span class="element-name">values</span>()</div> |
| <div class="block">Returns an array containing the constants of this enum class, in |
| the order they are declared.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>an array containing the constants of this enum class, in the order they are declared</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="valueOf(java.lang.String)"> |
| <h3>valueOf</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">valueOf</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> name)</span></div> |
| <div class="block">Returns the enum constant of this class with the specified name. |
| The string must match <i>exactly</i> an identifier used to declare an |
| enum constant in this class. (Extraneous whitespace characters are |
| not permitted.)</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>name</code> - the name of the enum constant to be returned.</dd> |
| <dt>Returns:</dt> |
| <dd>the enum constant with the specified name</dd> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if this enum class has no constant with the specified name</dd> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if the argument is null</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isIgnoringMetadata()"> |
| <h3>isIgnoringMetadata</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isIgnoringMetadata</span>()</div> |
| <div class="block">Returns <code>true</code> if this comparison ignores metadata. |
| This method currently returns <code>true</code> for <code>IGNORE_METADATA</code>, <code>APPROXIMATE</code> |
| or <code>DEBUG</code> only, but this list may be extended in future SIS versions.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>whether this comparison ignore metadata.</dd> |
| <dt>Since:</dt> |
| <dd>0.6</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="isApproximate()"> |
| <h3>isApproximate</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">boolean</span> <span class="element-name">isApproximate</span>()</div> |
| <div class="block">Returns <code>true</code> if this comparison uses a tolerance threshold. |
| This method currently returns <code>true</code> for <code>APPROXIMATE</code> or <code>DEBUG</code> only, |
| but this list may be extended in future SIS versions.</div> |
| <dl class="notes"> |
| <dt>Returns:</dt> |
| <dd>whether this comparison uses a tolerance threshold.</dd> |
| <dt>Since:</dt> |
| <dd>1.0</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="equalityLevel(java.lang.Object,java.lang.Object)"> |
| <h3>equalityLevel</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="ComparisonMode.html" title="enum class in org.apache.sis.util">ComparisonMode</a></span> <span class="element-name">equalityLevel</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> o1, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a> o2)</span></div> |
| <div class="block">If the two given objects are equal according one of the modes enumerated in this class, |
| then returns that mode. Otherwise returns <code>null</code>. |
| |
| <p><b>Note:</b> this method never return the <a href="#DEBUG"><code>DEBUG</code></a> mode.</p></div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>o1</code> - the first object to compare, or <code>null</code>.</dd> |
| <dd><code>o2</code> - the second object to compare, or <code>null</code>.</dd> |
| <dt>Returns:</dt> |
| <dd>the most suitable comparison mode, or <code>null</code> if the two given objects |
| are not equal according any mode in this enumeration.</dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| </div> |
| </div> |
| </body> |
| </html> |