| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 --> |
| <title>RangeFormat (Apache SIS 1.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2019-09-20"> |
| <meta name="keywords" content="org.apache.sis.measure.RangeFormat class"> |
| <meta name="keywords" content="elementType"> |
| <meta name="keywords" content="elementFormat"> |
| <meta name="keywords" content="unitFormat"> |
| <meta name="keywords" content="getLocale()"> |
| <meta name="keywords" content="getElementPattern()"> |
| <meta name="keywords" content="setElementPattern()"> |
| <meta name="keywords" content="isAlternateForm()"> |
| <meta name="keywords" content="setAlternateForm()"> |
| <meta name="keywords" content="format()"> |
| <meta name="keywords" content="formatToCharacterIterator()"> |
| <meta name="keywords" content="parseObject()"> |
| <meta name="keywords" content="parse()"> |
| <meta name="keywords" content="clone()"> |
| <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="../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="RangeFormat (Apache SIS 1.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = false; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/RangeFormat.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> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </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><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.sis.measure</a></div> |
| <h2 title="Class RangeFormat" class="title">Class RangeFormat</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>RangeFormat</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io" class="externalLink">Serializable</a></code>, <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Cloneable</a></code>, <code><a href="../util/Localized.html" title="interface in org.apache.sis.util">Localized</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public class <span class="typeNameLabel">RangeFormat</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a> |
| implements <a href="../util/Localized.html" title="interface in org.apache.sis.util">Localized</a></pre> |
| <div class="block">Parses and formats <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a> instances according the given locale. |
| This class complies to the format described in the <a href="http://en.wikipedia.org/wiki/ISO_31-11">ISO 31-11</a> |
| standard, except that the minimal and maximal values are separated by the "<code>…</code>" character |
| instead than coma. More specifically, the format is defined as below: |
| |
| <ul> |
| <li>If the range <a href="Range.html#isEmpty()">is empty</a>, then the range is represented by "<code>{}</code>".</li> |
| <li>Otherwise if the <a href="Range.html#getMinValue()">minimal value</a> is equals to the |
| <a href="Range.html#getMaxValue()">maximal value</a>, then that single value is formatted |
| inside braces as in "<code>{value}</code>".</li> |
| <li>Otherwise the minimal and maximal values are formatted inside bracket or parenthesis, |
| depending on whether each endpoint is inclusive or exclusive: |
| <ul> |
| <li>"<code>[min … max]</code>" if both endpoints are inclusive (<cite>closed interval</cite>);</li> |
| <li>"<code>(min … max)</code>" if both endpoints are exclusive (<cite>open interval</cite>);</li> |
| <li>or a mix of both styles if an endpoint is inclusive while the other is exclusive.</li> |
| </ul> |
| The "<code>∞</code>" symbol is used in place of <code>min</code> or <code>max</code> for unbounded ranges.</li> |
| </ul> |
| |
| If the range to format is an instance of <a href="MeasurementRange.html" title="class in org.apache.sis.measure"><code>MeasurementRange</code></a>, then the |
| <a href="http://unitsofmeasurement.github.io/unit-api/site/apidocs/javax/measure/Unit.html?is-external=true" title="class or interface in javax.measure" class="externalLink">unit of measurement</a> is appended except for empty ranges. |
| |
| <div class="section">Lenient parsing</div> |
| At parsing time, the above formatting rules are relaxed as below: |
| |
| <ul> |
| <li>Empty ranges can be represented by "<code>[]</code>"or "<code>()</code>" in addition to the |
| standard "<code>{}</code>".</li> |
| <li>The braces are optional for singleton values, i.e. "<code>value</code>" is accepted |
| as well as "<code>{value}</code>".</li> |
| </ul> |
| |
| <div class="section">Range type and type of range elements</div> |
| The kind of ranges created by the <a href="#parse(java.lang.String)"><code>parse(…)</code></a> methods is determined |
| by the type of range elements: |
| |
| <ul> |
| <li>If the elements type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>Date</code></a>, then the <code>parse(…)</code> methods |
| will create <code>Range<Date></code> objects.</li> |
| <li>If the elements type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Number</code></a>, then: |
| <ul> |
| <li>If the text to parse contains a <a href="http://unitsofmeasurement.github.io/unit-api/site/apidocs/javax/measure/Unit.html?is-external=true" title="class or interface in javax.measure" class="externalLink">unit of measurement</a>, then |
| the <code>parse(…)</code> methods will create <a href="MeasurementRange.html" title="class in org.apache.sis.measure"><code>MeasurementRange</code></a> objects.</li> |
| <li>Otherwise the <code>parse(…)</code> methods will create <a href="NumberRange.html" title="class in org.apache.sis.measure"><code>NumberRange</code></a> objects.</li> |
| </ul> |
| </li> |
| </ul></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.3</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="Range.html#toString()"><code>Range.toString()</code></a>, |
| <a href="http://en.wikipedia.org/wiki/ISO_31-11">Wikipedia: ISO 31-11</a>, |
| <a href="../../../../serialized-form.html#org.apache.sis.measure.RangeFormat">Serialized Form</a></dd> |
| |
| <p><font size="-1">Defined in the <code>sis-utility</code> module</font></p> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Class</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="RangeFormat.Field.html" title="class in org.apache.sis.measure">RangeFormat.Field</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">Constants that are used as attribute keys in the iterator returned from |
| <a href="#formatToCharacterIterator(java.lang.Object)"><code>formatToCharacterIterator(Object)</code></a>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Field</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#elementFormat">elementFormat</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The format to use for parsing and formatting the range components.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#elementType">elementType</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The type of the range components.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected <a href="UnitFormat.html" title="class in org.apache.sis.measure">UnitFormat</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unitFormat">unitFormat</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The format for unit of measurement, or <code>null</code> if none.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">RangeFormat</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a new format for parsing and formatting <a href="NumberRange.html" title="class in org.apache.sis.measure">number ranges</a> |
| using the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util" class="externalLink">default locale</a>.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.util.Locale)">RangeFormat</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a new format for parsing and formatting <a href="NumberRange.html" title="class in org.apache.sis.measure">number ranges</a> |
| using the given locale.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.util.Locale,java.lang.Class)">RangeFormat</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> elementType)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a new format for parsing and formatting <a href="Range.html" title="class in org.apache.sis.measure">ranges</a> of |
| the given element type using the given locale.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.util.Locale,java.util.TimeZone)">RangeFormat</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util" class="externalLink">TimeZone</a> timezone)</code></th> |
| <td class="colLast"> |
| <div class="block">Creates a new format for parsing and formatting <code>Range<Date></code> |
| using the given locale and timezone.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="RangeFormat.html" title="class in org.apache.sis.measure">RangeFormat</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clone()">clone</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a clone of this range format.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html?is-external=true" title="class or interface in java.lang" class="externalLink">StringBuffer</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#format(java.lang.Object,java.lang.StringBuffer,java.text.FieldPosition)">format</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> range, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html?is-external=true" title="class or interface in java.lang" class="externalLink">StringBuffer</a> toAppendTo, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/FieldPosition.html?is-external=true" title="class or interface in java.text" class="externalLink">FieldPosition</a> pos)</code></th> |
| <td class="colLast"> |
| <div class="block">Formats a <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a> and appends the resulting text to a given string buffer.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/AttributedCharacterIterator.html?is-external=true" title="class or interface in java.text" class="externalLink">AttributedCharacterIterator</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#formatToCharacterIterator(java.lang.Object)">formatToCharacterIterator</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> range)</code></th> |
| <td class="colLast"> |
| <div class="block">Formats a range as an attributed character iterator.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getElementPattern(boolean)">getElementPattern</a></span>​(boolean localized)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the pattern used by <a href="#elementFormat"><code>elementFormat</code></a> for formatting the minimum and |
| maximum values.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLocale()">getLocale</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns this formatter locale.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isAlternateForm()">isAlternateForm</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns <code>true</code> if this <code>RangeFormat</code> shall use the alternate form at |
| formatting time.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="Range.html" title="class in org.apache.sis.measure">Range</a><?></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parse(java.lang.String)">parse</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source)</code></th> |
| <td class="colLast"> |
| <div class="block">Parses text from the given string to produce a range.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="Range.html" title="class in org.apache.sis.measure">Range</a><?></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parse(java.lang.String,java.text.ParsePosition)">parse</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParsePosition.html?is-external=true" title="class or interface in java.text" class="externalLink">ParsePosition</a> pos)</code></th> |
| <td class="colLast"> |
| <div class="block">Parses text from a string to produce a range.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseObject(java.lang.String)">parseObject</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source)</code></th> |
| <td class="colLast"> |
| <div class="block">Parses text from a string to produce a range.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseObject(java.lang.String,java.text.ParsePosition)">parseObject</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParsePosition.html?is-external=true" title="class or interface in java.text" class="externalLink">ParsePosition</a> pos)</code></th> |
| <td class="colLast"> |
| <div class="block">Parses text from a string to produce a range.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setAlternateForm(boolean)">setAlternateForm</a></span>​(boolean alternateForm)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets whether this <code>RangeFormat</code> shall use the alternate form at formatting time.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setElementPattern(java.lang.String,boolean)">setElementPattern</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> pattern, |
| boolean localized)</code></th> |
| <td class="colLast"> |
| <div class="block">Sets the pattern to be used by <a href="#elementFormat"><code>elementFormat</code></a> for formatting the minimum and |
| maximum values.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.Format"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class <a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#format(java.lang.Object)" title="class or interface in java.text" class="externalLink">format</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a id="elementType"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>elementType</h4> |
| <pre>protected final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> elementType</pre> |
| <div class="block">The type of the range components. Valid types are <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Number</code></a>, <a href="Angle.html" title="class in org.apache.sis.measure"><code>Angle</code></a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>Date</code></a> or a subclass of those types. This value determines the kind of range |
| to be created by the parse method: |
| |
| <ul> |
| <li><code>NumberRange<?></code> if the element type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Number</code></a> or <a href="Angle.html" title="class in org.apache.sis.measure"><code>Angle</code></a>.</li> |
| <li><code>Range<Date></code> if the element type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>Date</code></a>.</li> |
| </ul></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="Range.html#getElementType()"><code>Range.getElementType()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="elementFormat"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>elementFormat</h4> |
| <pre>protected final <a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a> elementFormat</pre> |
| <div class="block">The format to use for parsing and formatting the range components. |
| The format is determined from the <a href="#elementType">element type</a>: |
| |
| <ul> |
| <li><a href="AngleFormat.html" title="class in org.apache.sis.measure"><code>AngleFormat</code></a> if the element type is assignable to <a href="Angle.html" title="class in org.apache.sis.measure"><code>Angle</code></a>.</li> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>NumberFormat</code></a> if the element type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Number</code></a>.</li> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/text/DateFormat.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>DateFormat</code></a> if the element type is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink"><code>Date</code></a>.</li> |
| </ul></div> |
| </li> |
| </ul> |
| <a id="unitFormat"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>unitFormat</h4> |
| <pre>protected final <a href="UnitFormat.html" title="class in org.apache.sis.measure">UnitFormat</a> unitFormat</pre> |
| <div class="block">The format for unit of measurement, or <code>null</code> if none. This is non-null if and |
| only if <a href="#elementType"><code>elementType</code></a> is assignable to <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Number</code></a> but not to <a href="Angle.html" title="class in org.apache.sis.measure"><code>Angle</code></a>.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>RangeFormat</h4> |
| <pre>public RangeFormat()</pre> |
| <div class="block">Creates a new format for parsing and formatting <a href="NumberRange.html" title="class in org.apache.sis.measure">number ranges</a> |
| using the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util" class="externalLink">default locale</a>.</div> |
| </li> |
| </ul> |
| <a id="<init>(java.util.Locale)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>RangeFormat</h4> |
| <pre>public RangeFormat​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale)</pre> |
| <div class="block">Creates a new format for parsing and formatting <a href="NumberRange.html" title="class in org.apache.sis.measure">number ranges</a> |
| using the given locale.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>locale</code> - the locale for parsing and formatting range components.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="<init>(java.util.Locale,java.util.TimeZone)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>RangeFormat</h4> |
| <pre>public RangeFormat​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html?is-external=true" title="class or interface in java.util" class="externalLink">TimeZone</a> timezone)</pre> |
| <div class="block">Creates a new format for parsing and formatting <code>Range<Date></code> |
| using the given locale and timezone.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>locale</code> - the locale for parsing and formatting range components.</dd> |
| <dd><code>timezone</code> - the timezone for the date to be formatted.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="<init>(java.util.Locale,java.lang.Class)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>RangeFormat</h4> |
| <pre>public RangeFormat​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> locale, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> elementType) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></pre> |
| <div class="block">Creates a new format for parsing and formatting <a href="Range.html" title="class in org.apache.sis.measure">ranges</a> of |
| the given element type using the given locale. The element type is typically |
| <code>Date.class</code> or some subclass of <code>Number.class</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>locale</code> - the locale for parsing and formatting range components.</dd> |
| <dd><code>elementType</code> - the type of range components.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the given type is not recognized by this constructor.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getLocale()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLocale</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a> getLocale()</pre> |
| <div class="block">Returns this formatter locale. This is the locale specified at construction time if any, |
| or the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util" class="externalLink">default locale</a> at construction time otherwise.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../util/Localized.html#getLocale()">getLocale</a></code> in interface <code><a href="../util/Localized.html" title="interface in org.apache.sis.util">Localized</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this formatter locale (never <code>null</code>).</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getElementPattern(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getElementPattern</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> getElementPattern​(boolean localized)</pre> |
| <div class="block">Returns the pattern used by <a href="#elementFormat"><code>elementFormat</code></a> for formatting the minimum and |
| maximum values. If the element format does not use pattern, returns <code>null</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>localized</code> - <code>true</code> for returning the localized pattern, or <code>false</code> for the unlocalized one.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the pattern, or <code>null</code> if the <a href="#elementFormat"><code>elementFormat</code></a> doesn't use pattern.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html?is-external=true#toPattern()" title="class or interface in java.text" class="externalLink"><code>DecimalFormat.toPattern()</code></a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html?is-external=true#toPattern()" title="class or interface in java.text" class="externalLink"><code>SimpleDateFormat.toPattern()</code></a>, |
| <a href="AngleFormat.html#toPattern()"><code>AngleFormat.toPattern()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setElementPattern(java.lang.String,boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setElementPattern</h4> |
| <pre class="methodSignature">public void setElementPattern​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> pattern, |
| boolean localized)</pre> |
| <div class="block">Sets the pattern to be used by <a href="#elementFormat"><code>elementFormat</code></a> for formatting the minimum and |
| maximum values.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>pattern</code> - the new pattern.</dd> |
| <dd><code>localized</code> - <code>true</code> if the given pattern is localized.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code> - if the <a href="#elementFormat"><code>elementFormat</code></a> does not use pattern.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html?is-external=true#applyPattern(java.lang.String)" title="class or interface in java.text" class="externalLink"><code>DecimalFormat.applyPattern(String)</code></a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html?is-external=true#applyPattern(java.lang.String)" title="class or interface in java.text" class="externalLink"><code>SimpleDateFormat.applyPattern(String)</code></a>, |
| <a href="AngleFormat.html#applyPattern(java.lang.String)"><code>AngleFormat.applyPattern(String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isAlternateForm()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isAlternateForm</h4> |
| <pre class="methodSignature">public boolean isAlternateForm()</pre> |
| <div class="block">Returns <code>true</code> if this <code>RangeFormat</code> shall use the alternate form at |
| formatting time. The alternate form expresses open intervals like <code>]a…b[</code> |
| instead of <code>(a…b)</code>. |
| |
| <p>This flag has no effect on parsing, since the parser accepts both forms.</p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><code>true</code> for using the alternate format instead of the default format.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setAlternateForm(boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setAlternateForm</h4> |
| <pre class="methodSignature">public void setAlternateForm​(boolean alternateForm)</pre> |
| <div class="block">Sets whether this <code>RangeFormat</code> shall use the alternate form at formatting time. |
| The alternate form expresses open intervals like <code>]a…b[</code> instead of <code>(a…b)</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>alternateForm</code> - <code>true</code> for using the alternate format, or <code>false</code> for using the default format.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="format(java.lang.Object,java.lang.StringBuffer,java.text.FieldPosition)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>format</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html?is-external=true" title="class or interface in java.lang" class="externalLink">StringBuffer</a> format​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> range, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html?is-external=true" title="class or interface in java.lang" class="externalLink">StringBuffer</a> toAppendTo, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/FieldPosition.html?is-external=true" title="class or interface in java.text" class="externalLink">FieldPosition</a> pos)</pre> |
| <div class="block">Formats a <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a> and appends the resulting text to a given string buffer. |
| See the <a href="#skip-navbar_top">class javadoc</a> for a description of the format.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#format(java.lang.Object,java.lang.StringBuffer,java.text.FieldPosition)" title="class or interface in java.text" class="externalLink">format</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>range</code> - the <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a> object to format.</dd> |
| <dd><code>toAppendTo</code> - where the text is to be appended.</dd> |
| <dd><code>pos</code> - identifies a field in the formatted text, or <code>null</code> if none.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the string buffer passed in as <code>toAppendTo</code>, with formatted text appended.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if this formatter can not format the given object.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="formatToCharacterIterator(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>formatToCharacterIterator</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/text/AttributedCharacterIterator.html?is-external=true" title="class or interface in java.text" class="externalLink">AttributedCharacterIterator</a> formatToCharacterIterator​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> range)</pre> |
| <div class="block">Formats a range as an attributed character iterator. |
| Callers can iterate and queries the attribute values as in the following example: |
| |
| <blockquote><pre>AttributedCharacterIterator it = rangeFormat.<b>formatToCharacterIterator</b>(myRange); |
| <font color="green">for</font> (<font color="green">char</font> c=it.<b>first</b>(); c!=AttributedCharacterIterator.DONE; c=c.<b>next</b>()) { |
| <i><font color="gray">// 'c' is a character from the formatted string.</font></i> |
| <font color="green">if</font> (it.<b>getAttribute</b>(RangeFormat.Field.MIN_VALUE) != <font color="green">null</font>) { |
| <i><font color="gray">// If we enter this block, then the character 'c' is part of the minimal value,</font></i> |
| <i><font color="gray">// This field extends from it.getRunStart(MIN_VALUE) to it.getRunLimit(MIN_VALUE).</font></i> |
| } |
| }</pre></blockquote> |
| |
| Alternatively, if the current <a href="https://docs.oracle.com/javase/8/docs/api/java/text/CharacterIterator.html?is-external=true#getIndex()" title="class or interface in java.text" class="externalLink">iterator |
| index</a> is before the start of the minimum value field, then the starting position of that |
| field can be obtained directly by <code>it.getRunLimit(MIN_VALUE)</code>. If the current iterator |
| index is inside the minimum value field, then the above method call will rather returns the |
| end of that field. The same strategy works for other all fields too. |
| |
| <p>The returned character iterator contains all <a href="https://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.Field.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>NumberFormat.Field</code></a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/DateFormat.Field.html?is-external=true" title="class or interface in java.text" class="externalLink"><code>DateFormat.Field</code></a> or <a href="AngleFormat.Field.html" title="class in org.apache.sis.measure"><code>AngleFormat.Field</code></a> |
| attributes in addition to the <a href="RangeFormat.Field.html" title="class in org.apache.sis.measure"><code>RangeFormat.Field</code></a> ones. Consequently the same character may |
| have more than one attribute.</p> |
| |
| <p>In Apache SIS implementation, the returned character iterator also implements the |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>CharSequence</code></a> interface for convenience.</p></div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#formatToCharacterIterator(java.lang.Object)" title="class or interface in java.text" class="externalLink">formatToCharacterIterator</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>range</code> - the <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a> object to format.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a character iterator together with the attributes describing the formatted value.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if <code>value</code> if not an instance of <a href="Range.html" title="class in org.apache.sis.measure"><code>Range</code></a>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="parseObject(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseObject</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> parseObject​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParseException.html?is-external=true" title="class or interface in java.text" class="externalLink">ParseException</a></pre> |
| <div class="block">Parses text from a string to produce a range. The default implementation delegates to |
| <a href="#parse(java.lang.String)"><code>parse(String)</code></a> with no additional work.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#parseObject(java.lang.String)" title="class or interface in java.text" class="externalLink">parseObject</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>source</code> - the text, part of which should be parsed.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a range parsed from the string.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParseException.html?is-external=true" title="class or interface in java.text" class="externalLink">ParseException</a></code> - if the given string can not be fully parsed.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="parseObject(java.lang.String,java.text.ParsePosition)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parseObject</h4> |
| <pre class="methodSignature">public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> parseObject​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParsePosition.html?is-external=true" title="class or interface in java.text" class="externalLink">ParsePosition</a> pos)</pre> |
| <div class="block">Parses text from a string to produce a range. The default implementation delegates to |
| <a href="#parse(java.lang.String,java.text.ParsePosition)"><code>parse(String, ParsePosition)</code></a> with no additional work.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#parseObject(java.lang.String,java.text.ParsePosition)" title="class or interface in java.text" class="externalLink">parseObject</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>source</code> - the text, part of which should be parsed.</dd> |
| <dd><code>pos</code> - index and error index information as described above.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a range parsed from the string, or <code>null</code> in case of error.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="parse(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parse</h4> |
| <pre class="methodSignature">public <a href="Range.html" title="class in org.apache.sis.measure">Range</a><?> parse​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParseException.html?is-external=true" title="class or interface in java.text" class="externalLink">ParseException</a></pre> |
| <div class="block">Parses text from the given string to produce a range. This method use the full string. |
| If there is some unparsed characters after the parsed range, then this method thrown an |
| exception.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>source</code> - the text to parse.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the parsed range (never <code>null</code>).</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParseException.html?is-external=true" title="class or interface in java.text" class="externalLink">ParseException</a></code> - if the given string can not be fully parsed.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="parse(java.lang.String,java.text.ParsePosition)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>parse</h4> |
| <pre class="methodSignature">public <a href="Range.html" title="class in org.apache.sis.measure">Range</a><?> parse​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> source, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/text/ParsePosition.html?is-external=true" title="class or interface in java.text" class="externalLink">ParsePosition</a> pos)</pre> |
| <div class="block">Parses text from a string to produce a range. The method attempts to parse text starting |
| at the index given by <code>pos</code>. If parsing succeeds, then the index of <code>pos</code> is |
| updated to the index after the last character used, and the parsed range is returned. If |
| an error occurs, then the index of <code>pos</code> is not changed, the error index of <code>pos</code> |
| is set to the index of the character where the error occurred, and <code>null</code> is returned.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>source</code> - the text, part of which should be parsed.</dd> |
| <dd><code>pos</code> - index and error index information as described above.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a range parsed from the string, or <code>null</code> in case of error.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="clone()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>clone</h4> |
| <pre class="methodSignature">public <a href="RangeFormat.html" title="class in org.apache.sis.measure">RangeFormat</a> clone()</pre> |
| <div class="block">Returns a clone of this range format.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true#clone()" title="class or interface in java.text" class="externalLink">clone</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/text/Format.html?is-external=true" title="class or interface in java.text" class="externalLink">Format</a></code></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a clone of this range format.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/RangeFormat.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> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </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><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2010–2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |