blob: c3ac4092fa6aa5771e6c92b80c8ffbf94f8553e7 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (19) -->
<title>Optimization (Apache SIS 1.3 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="description" content="declaration: package: org.apache.sis.filter, class: Optimization">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.filter.Optimization class">
<meta name="keywords" content="getFeatureType()">
<meta name="keywords" content="setFeatureType()">
<meta name="keywords" content="apply()">
<meta name="keywords" content="applyAndDecompose()">
<meta name="keywords" content="literal()">
<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">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.6.0.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">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</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="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/Optimization.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#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>Field</li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li><a href="#constructor-detail">Constr</a></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:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</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="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.filter</a></div>
<h1 title="Class Optimization" class="title">Class Optimization</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance">Optimization</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Optimization</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Description of optimizations or simplifications to attempt on filters and expressions.
Optimizations can include the following changes:
<ul>
<li>Application of some logical identities such as <code>NOT(NOT(A)) == A</code>.</li>
<li>Application of logical short circuits such as <code>A &amp; FALSE == FALSE</code>.</li>
<li>Immediate evaluation of expressions where all parameters are literal values.</li>
</ul>
The following options can enable some additional optimizations:
<ul>
<li>The type of the <code>Feature</code> instances to be filtered.</li>
</ul>
<h2>Usage in multi-threads context</h2>
This class is <strong>not</strong> thread-safe.
A new instance shall be created for each thread applying optimizations. Example:
<blockquote><pre>Filter&lt;R&gt; filter = ...;
filter = <font color="green">new</font> <b>Optimization</b>().<b>apply</b>(filter);</pre></blockquote>
<h2>How optimizations are applied</h2>
Optimizations are specific to each expression and filter type.
For optimizations to happen, classes must implement the <a href="Optimization.OnExpression.html" title="interface in org.apache.sis.filter"><code>Optimization​.On­Expression</code></a> or <a href="Optimization.OnFilter.html" title="interface in org.apache.sis.filter"><code>Optimization​.On­Filter</code></a> interface.
The <a href="#apply(org.apache.sis.filter.Filter)"><code>apply(Filter)</code></a> and <a href="#apply(org.apache.sis.filter.Expression)"><code>apply(Expression)</code></a> methods in this <code>Optimization</code> class merely
delegate to the methods defined in above-cited interfaces, with safety guards against infinite recursivity.
<h2>Behavioral changes</h2>
Optimized filters shall produce the same results than non-optimized filters.
However side-effects may differ, in particular regarding exceptions that may be thrown.
For example if a filter tests <code>A &amp; B</code> and if <code>Optimization</code> determines that the <code>B</code>
condition will always evaluate to <code>false</code>, then the <code>A</code> condition will never be tested.
If that condition had side-effects or threw an exception,
those effects will disappear in the optimized filter.</div>
<dl class="notes">
<dt>Since:</dt>
<dd>1.1</dd>
<p><font size="-1">Defined in the <code>sis-feature</code> module</font></p>
</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="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static interface&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="Optimization.OnExpression.html" class="type-name-link" title="interface in org.apache.sis.filter">Optimization​.On­Expression</a>&lt;<a href="Optimization.OnExpression.html" title="type parameter in Optimization.OnExpression">R</a>,<wbr><a href="Optimization.OnExpression.html" title="type parameter in Optimization.OnExpression">V</a>&gt;</code></div>
<div class="col-last even-row-color">
<div class="block">Expression that can be optimized.</div>
</div>
<div class="col-first odd-row-color"><code>static interface&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="Optimization.OnFilter.html" class="type-name-link" title="interface in org.apache.sis.filter">Optimization​.On­Filter</a>&lt;<a href="Optimization.OnFilter.html" title="type parameter in Optimization.OnFilter">R</a>&gt;</code></div>
<div class="col-last odd-row-color">
<div class="block">Filter that can be optimized.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">Optimization</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a new instance.</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-tab2 method-summary-table-tab4"><code>&lt;R,<wbr>
V&gt;&nbsp;<a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;? super R,<wbr>? extends V&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#apply(org.apache.sis.filter.Expression)" class="member-name-link">apply</a><wbr>(<a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;R,<wbr>V&gt;&nbsp;expression)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Optimizes or simplifies the given expression.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;R&gt;&nbsp;<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;? super R&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#apply(org.apache.sis.filter.Filter)" class="member-name-link">apply</a><wbr>(<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;R&gt;&nbsp;filter)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Optimizes or simplifies the given filter.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;R&gt;&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;? super R&gt;&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#applyAndDecompose(org.apache.sis.filter.Filter)" class="member-name-link">apply­And­Decompose</a><wbr>(<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;R&gt;&nbsp;filter)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Optimizes or simplifies the given filter and returns it as a list of <code>AND</code> operands.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">Default­Feature­Type</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getFeatureType()" class="member-name-link">get­Feature­Type</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 the type of feature instances to be filtered, or <code>null</code> if unknown.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static &lt;R,<wbr>
V&gt;&nbsp;<a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;R,<wbr>V&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#literal(V)" class="member-name-link">literal</a><wbr>(V&nbsp;value)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Creates a constant, literal value that can be used in expressions.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setFeatureType(org.apache.sis.feature.DefaultFeatureType)" class="member-name-link">set­Feature­Type</a><wbr>(<a href="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">Default­Feature­Type</a>&nbsp;type)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets the type of feature instances to be filtered.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/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/16/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.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/16/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hash­Code</a>, <a href="https://docs.oracle.com/en/java/javase/16/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/16/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">to­String</a>, <a href="https://docs.oracle.com/en/java/javase/16/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/16/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/16/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">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>Optimization</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Optimization</span>()</div>
<div class="block">Creates a new instance.</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="getFeatureType()">
<h3>getFeatureType</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">DefaultFeatureType</a></span>&nbsp;<span class="element-name">getFeatureType</span>()</div>
<div class="block">Returns the type of feature instances to be filtered, or <code>null</code> if unknown.
This is the last value specified by a call to <a href="#setFeatureType(org.apache.sis.feature.DefaultFeatureType)"><code>set­Feature­Type(Default­Feature­Type)</code></a>.
The default value is <code>null</code>.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the type of feature instances to be filtered, or <code>null</code> if unknown.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setFeatureType(org.apache.sis.feature.DefaultFeatureType)">
<h3>setFeatureType</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setFeatureType</span><wbr><span class="parameters">(<a href="../feature/DefaultFeatureType.html" title="class in org.apache.sis.feature">DefaultFeatureType</a>&nbsp;type)</span></div>
<div class="block">Sets the type of feature instances to be filtered.
If this type is known in advance, specifying it may allow to compute more specific
<a href="../util/ObjectConverter.html" title="interface in org.apache.sis.util"><code>Object­Converter</code></a>s or to apply some geometry reprojection
in advance.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>type</code> - the type of feature instances to be filtered, or <code>null</code> if unknown.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="apply(org.apache.sis.filter.Filter)">
<h3>apply</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;R&gt;</span>&nbsp;<span class="return-type"><a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;? super R&gt;</span>&nbsp;<span class="element-name">apply</span><wbr><span class="parameters">(<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;R&gt;&nbsp;filter)</span></div>
<div class="block">Optimizes or simplifies the given filter. If the given instance implements the <a href="Optimization.OnFilter.html" title="interface in org.apache.sis.filter"><code>Optimization​.On­Filter</code></a> interface,
then its <code>optimize(this)</code> method is invoked. Otherwise this method returns the given filter as-is.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>R</code> - the type of resources (e.g. <code>Feature</code>) used as inputs.</dd>
<dt>Parameters:</dt>
<dd><code>filter</code> - the filter to optimize, or <code>null</code>.</dd>
<dt>Returns:</dt>
<dd>the optimized filter, or <code>null</code> if the given filter was null.
May be <code>filter</code> if no optimization or simplification has been applied.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if the given filter is already in process of being optimized
(i.e. there is a recursive call to <code>apply(…)</code> for the same filter).</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="apply(org.apache.sis.filter.Expression)">
<h3>apply</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;R,<wbr>
V&gt;</span>&nbsp;<span class="return-type"><a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;? super R,<wbr>? extends V&gt;</span>&nbsp;<span class="element-name">apply</span><wbr><span class="parameters">(<a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;R,<wbr>V&gt;&nbsp;expression)</span></div>
<div class="block">Optimizes or simplifies the given expression. If the given instance implements the <a href="Optimization.OnExpression.html" title="interface in org.apache.sis.filter"><code>Optimization​.On­Expression</code></a>
interface, then its <code>optimize(this)</code> method is invoked. Otherwise this method returns the given
expression as-is.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>R</code> - the type of resources (e.g. <code>Feature</code>) used as inputs.</dd>
<dd><code>V</code> - the type of values computed by the expression.</dd>
<dt>Parameters:</dt>
<dd><code>expression</code> - the expression to optimize, or <code>null</code>.</dd>
<dt>Returns:</dt>
<dd>the optimized expression, or <code>null</code> if the given expression was null.
May be <code>expression</code> if no optimization or simplification has been applied.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">Illegal­Argument­Exception</a></code> - if the given expression is already in process of being optimized
(i.e. there is a recursive call to <code>apply(…)</code> for the same expression).</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="applyAndDecompose(org.apache.sis.filter.Filter)">
<h3>applyAndDecompose</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;R&gt;</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;? super R&gt;&gt;</span>&nbsp;<span class="element-name">applyAndDecompose</span><wbr><span class="parameters">(<a href="Filter.html" title="interface in org.apache.sis.filter">Filter</a>&lt;R&gt;&nbsp;filter)</span></div>
<div class="block">Optimizes or simplifies the given filter and returns it as a list of <code>AND</code> operands.
If such list cannot be built, then this method returns the optimized filter in a singleton list.
<h4>Use case</h4>
This method tries to transform a filter into a <code>F₀ AND F₁ AND F₂ AND F₃ AND ...</code> sequence.
This transformation is useful when some operands can be handled by the storage engine
(for example a SQL database) and other operands cannot.
For example, when reading features from a relational database,
the implementation may choose to express the F₁ and F₃ operands as SQL statements
and apply the other operands in Java code.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>R</code> - the type of resources (e.g. <code>Feature</code>) used as inputs.</dd>
<dt>Parameters:</dt>
<dd><code>filter</code> - the filter to decompose.</dd>
<dt>Returns:</dt>
<dd>a sequence of <code>AND</code> operands, or an empty list if the given filter was null.</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/ClassCastException.html" title="class or interface in java.lang" class="external-link">Class­Cast­Exception</a></code> - if a filter declares the <code>AND</code>, <code>OR</code> or <code>NOT</code> type
without implementing the <code>Logical­Operator</code> interface.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="literal(V)">
<h3 id="literal(java.lang.Object)">literal</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="type-parameters">&lt;R,<wbr>
V&gt;</span>&nbsp;<span class="return-type"><a href="Expression.html" title="interface in org.apache.sis.filter">Expression</a>&lt;R,<wbr>V&gt;</span>&nbsp;<span class="element-name">literal</span><wbr><span class="parameters">(V&nbsp;value)</span></div>
<div class="block">Creates a constant, literal value that can be used in expressions.
This is a helper methods for optimizations which simplified an expression to a constant value.</div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>R</code> - the type of resources used as inputs.</dd>
<dd><code>V</code> - the type of the value of the literal.</dd>
<dt>Parameters:</dt>
<dd><code>value</code> - the literal value. May be <code>null</code>.</dd>
<dt>Returns:</dt>
<dd>a literal for the given value.</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list-long">
<li><a href="DefaultFilterFactory.html#literal(V)"><code>Default­Filter­Factory​.literal(Object)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2010&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>