commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject svn commit: r1008161 [15/44] - in /websites/production/commons/content/proper/commons-text: ./ apidocs/ apidocs/org/apache/commons/text/ apidocs/org/apache/commons/text/class-use/ apidocs/org/apache/commons/text/diff/ apidocs/org/apache/commons/text/di...
Date Sun, 12 Mar 2017 02:08:05 GMT
Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/LookupTranslator.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/LookupTranslator.html (original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/LookupTranslator.html Sun Mar 12 02:08:01 2017
@@ -13,9 +13,9 @@
 <span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
 <span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
 <span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * <a name="line.8"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
 <span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
-<span class="sourceLineNo">010</span> * <a name="line.10"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
 <span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
 <span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
 <span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
@@ -39,73 +39,77 @@
 <span class="sourceLineNo">031</span> */<a name="line.31"></a>
 <span class="sourceLineNo">032</span>public class LookupTranslator extends CharSequenceTranslator {<a name="line.32"></a>
 <span class="sourceLineNo">033</span><a name="line.33"></a>
-<span class="sourceLineNo">034</span>    private final Map&lt;String, String&gt; lookupMap;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>    private final HashSet&lt;Character&gt; prefixSet;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>    private final int shortest;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>    private final int longest;<a name="line.37"></a>
-<span class="sourceLineNo">038</span><a name="line.38"></a>
-<span class="sourceLineNo">039</span>    /**<a name="line.39"></a>
-<span class="sourceLineNo">040</span>     * Define the lookup table to be used in translation<a name="line.40"></a>
-<span class="sourceLineNo">041</span>     *<a name="line.41"></a>
-<span class="sourceLineNo">042</span>     * Note that, as of Lang 3.1 (the orgin of this code), the key to the lookup<a name="line.42"></a>
-<span class="sourceLineNo">043</span>     * table is converted to a java.lang.String. This is because we need the key<a name="line.43"></a>
-<span class="sourceLineNo">044</span>     * to support hashCode and equals(Object), allowing it to be the key for a<a name="line.44"></a>
-<span class="sourceLineNo">045</span>     * HashMap. See LANG-882.<a name="line.45"></a>
-<span class="sourceLineNo">046</span>     *<a name="line.46"></a>
-<span class="sourceLineNo">047</span>     * @param lookupMap Map&amp;lt;CharSequence, CharSequence&amp;gt; table of translator<a name="line.47"></a>
-<span class="sourceLineNo">048</span>     *                  mappings<a name="line.48"></a>
-<span class="sourceLineNo">049</span>     */<a name="line.49"></a>
-<span class="sourceLineNo">050</span>    public LookupTranslator(final Map&lt;CharSequence, CharSequence&gt; lookupMap) {<a name="line.50"></a>
-<span class="sourceLineNo">051</span>        if (lookupMap == null) {<a name="line.51"></a>
-<span class="sourceLineNo">052</span>            throw new InvalidParameterException("lookupMap cannot be null");<a name="line.52"></a>
-<span class="sourceLineNo">053</span>        }<a name="line.53"></a>
-<span class="sourceLineNo">054</span>        this.lookupMap = new HashMap&lt;&gt;();<a name="line.54"></a>
-<span class="sourceLineNo">055</span>        prefixSet = new HashSet&lt;&gt;();<a name="line.55"></a>
-<span class="sourceLineNo">056</span>        int _shortest = Integer.MAX_VALUE;<a name="line.56"></a>
-<span class="sourceLineNo">057</span>        int _longest = 0;<a name="line.57"></a>
-<span class="sourceLineNo">058</span>        Iterator&lt;Map.Entry&lt;CharSequence, CharSequence&gt;&gt; it = lookupMap.entrySet().iterator();<a name="line.58"></a>
-<span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>        while (it.hasNext()) {<a name="line.60"></a>
-<span class="sourceLineNo">061</span>            Map.Entry&lt;CharSequence, CharSequence&gt; pair = it.next();<a name="line.61"></a>
-<span class="sourceLineNo">062</span>            this.lookupMap.put(pair.getKey().toString(), pair.getValue().toString());<a name="line.62"></a>
-<span class="sourceLineNo">063</span>            this.prefixSet.add((pair.getKey()).charAt(0));<a name="line.63"></a>
-<span class="sourceLineNo">064</span>            final int sz = pair.getKey().length();<a name="line.64"></a>
-<span class="sourceLineNo">065</span>            if (sz &lt; _shortest) {<a name="line.65"></a>
-<span class="sourceLineNo">066</span>                _shortest = sz;<a name="line.66"></a>
-<span class="sourceLineNo">067</span>            }<a name="line.67"></a>
-<span class="sourceLineNo">068</span>            if (sz &gt; _longest) {<a name="line.68"></a>
-<span class="sourceLineNo">069</span>                _longest = sz;<a name="line.69"></a>
-<span class="sourceLineNo">070</span>            }<a name="line.70"></a>
-<span class="sourceLineNo">071</span>        }<a name="line.71"></a>
-<span class="sourceLineNo">072</span>        shortest = _shortest;<a name="line.72"></a>
-<span class="sourceLineNo">073</span>        longest = _longest;<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    }<a name="line.74"></a>
-<span class="sourceLineNo">075</span><a name="line.75"></a>
-<span class="sourceLineNo">076</span>    /**<a name="line.76"></a>
-<span class="sourceLineNo">077</span>     * {@inheritDoc}<a name="line.77"></a>
-<span class="sourceLineNo">078</span>     */<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    @Override<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>        // check if translation exists for the input at position index<a name="line.81"></a>
-<span class="sourceLineNo">082</span>        if (prefixSet.contains(input.charAt(index))) {<a name="line.82"></a>
-<span class="sourceLineNo">083</span>            int max = longest;<a name="line.83"></a>
-<span class="sourceLineNo">084</span>            if (index + longest &gt; input.length()) {<a name="line.84"></a>
-<span class="sourceLineNo">085</span>                max = input.length() - index;<a name="line.85"></a>
-<span class="sourceLineNo">086</span>            }<a name="line.86"></a>
-<span class="sourceLineNo">087</span>            // implement greedy algorithm by trying maximum match first<a name="line.87"></a>
-<span class="sourceLineNo">088</span>            for (int i = max; i &gt;= shortest; i--) {<a name="line.88"></a>
-<span class="sourceLineNo">089</span>                final CharSequence subSeq = input.subSequence(index, index + i);<a name="line.89"></a>
-<span class="sourceLineNo">090</span>                final String result = lookupMap.get(subSeq.toString());<a name="line.90"></a>
-<span class="sourceLineNo">091</span><a name="line.91"></a>
-<span class="sourceLineNo">092</span>                if (result != null) {<a name="line.92"></a>
-<span class="sourceLineNo">093</span>                    out.write(result);<a name="line.93"></a>
-<span class="sourceLineNo">094</span>                    return i;<a name="line.94"></a>
-<span class="sourceLineNo">095</span>                }<a name="line.95"></a>
-<span class="sourceLineNo">096</span>            }<a name="line.96"></a>
-<span class="sourceLineNo">097</span>        }<a name="line.97"></a>
-<span class="sourceLineNo">098</span>        return 0;<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
-<span class="sourceLineNo">100</span>}<a name="line.100"></a>
+<span class="sourceLineNo">034</span>    /** The mapping to be used in translation. */<a name="line.34"></a>
+<span class="sourceLineNo">035</span>    private final Map&lt;String, String&gt; lookupMap;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>    /** The first character of each key in the lookupMap. */<a name="line.36"></a>
+<span class="sourceLineNo">037</span>    private final HashSet&lt;Character&gt; prefixSet;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>    /** The length of the shortest key in the lookupMap. */<a name="line.38"></a>
+<span class="sourceLineNo">039</span>    private final int shortest;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>    /** The length of the longest key in the lookupMap. */<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    private final int longest;<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>    /**<a name="line.43"></a>
+<span class="sourceLineNo">044</span>     * Define the lookup table to be used in translation<a name="line.44"></a>
+<span class="sourceLineNo">045</span>     *<a name="line.45"></a>
+<span class="sourceLineNo">046</span>     * Note that, as of Lang 3.1 (the orgin of this code), the key to the lookup<a name="line.46"></a>
+<span class="sourceLineNo">047</span>     * table is converted to a java.lang.String. This is because we need the key<a name="line.47"></a>
+<span class="sourceLineNo">048</span>     * to support hashCode and equals(Object), allowing it to be the key for a<a name="line.48"></a>
+<span class="sourceLineNo">049</span>     * HashMap. See LANG-882.<a name="line.49"></a>
+<span class="sourceLineNo">050</span>     *<a name="line.50"></a>
+<span class="sourceLineNo">051</span>     * @param lookupMap Map&amp;lt;CharSequence, CharSequence&amp;gt; table of translator<a name="line.51"></a>
+<span class="sourceLineNo">052</span>     *                  mappings<a name="line.52"></a>
+<span class="sourceLineNo">053</span>     */<a name="line.53"></a>
+<span class="sourceLineNo">054</span>    public LookupTranslator(final Map&lt;CharSequence, CharSequence&gt; lookupMap) {<a name="line.54"></a>
+<span class="sourceLineNo">055</span>        if (lookupMap == null) {<a name="line.55"></a>
+<span class="sourceLineNo">056</span>            throw new InvalidParameterException("lookupMap cannot be null");<a name="line.56"></a>
+<span class="sourceLineNo">057</span>        }<a name="line.57"></a>
+<span class="sourceLineNo">058</span>        this.lookupMap = new HashMap&lt;&gt;();<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        prefixSet = new HashSet&lt;&gt;();<a name="line.59"></a>
+<span class="sourceLineNo">060</span>        int _shortest = Integer.MAX_VALUE;<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        int _longest = 0;<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        Iterator&lt;Map.Entry&lt;CharSequence, CharSequence&gt;&gt; it = lookupMap.entrySet().iterator();<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>        while (it.hasNext()) {<a name="line.64"></a>
+<span class="sourceLineNo">065</span>            Map.Entry&lt;CharSequence, CharSequence&gt; pair = it.next();<a name="line.65"></a>
+<span class="sourceLineNo">066</span>            this.lookupMap.put(pair.getKey().toString(), pair.getValue().toString());<a name="line.66"></a>
+<span class="sourceLineNo">067</span>            this.prefixSet.add(pair.getKey().charAt(0));<a name="line.67"></a>
+<span class="sourceLineNo">068</span>            final int sz = pair.getKey().length();<a name="line.68"></a>
+<span class="sourceLineNo">069</span>            if (sz &lt; _shortest) {<a name="line.69"></a>
+<span class="sourceLineNo">070</span>                _shortest = sz;<a name="line.70"></a>
+<span class="sourceLineNo">071</span>            }<a name="line.71"></a>
+<span class="sourceLineNo">072</span>            if (sz &gt; _longest) {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>                _longest = sz;<a name="line.73"></a>
+<span class="sourceLineNo">074</span>            }<a name="line.74"></a>
+<span class="sourceLineNo">075</span>        }<a name="line.75"></a>
+<span class="sourceLineNo">076</span>        shortest = _shortest;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>        longest = _longest;<a name="line.77"></a>
+<span class="sourceLineNo">078</span>    }<a name="line.78"></a>
+<span class="sourceLineNo">079</span><a name="line.79"></a>
+<span class="sourceLineNo">080</span>    /**<a name="line.80"></a>
+<span class="sourceLineNo">081</span>     * {@inheritDoc}<a name="line.81"></a>
+<span class="sourceLineNo">082</span>     */<a name="line.82"></a>
+<span class="sourceLineNo">083</span>    @Override<a name="line.83"></a>
+<span class="sourceLineNo">084</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.84"></a>
+<span class="sourceLineNo">085</span>        // check if translation exists for the input at position index<a name="line.85"></a>
+<span class="sourceLineNo">086</span>        if (prefixSet.contains(input.charAt(index))) {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>            int max = longest;<a name="line.87"></a>
+<span class="sourceLineNo">088</span>            if (index + longest &gt; input.length()) {<a name="line.88"></a>
+<span class="sourceLineNo">089</span>                max = input.length() - index;<a name="line.89"></a>
+<span class="sourceLineNo">090</span>            }<a name="line.90"></a>
+<span class="sourceLineNo">091</span>            // implement greedy algorithm by trying maximum match first<a name="line.91"></a>
+<span class="sourceLineNo">092</span>            for (int i = max; i &gt;= shortest; i--) {<a name="line.92"></a>
+<span class="sourceLineNo">093</span>                final CharSequence subSeq = input.subSequence(index, index + i);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>                final String result = lookupMap.get(subSeq.toString());<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>                if (result != null) {<a name="line.96"></a>
+<span class="sourceLineNo">097</span>                    out.write(result);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>                    return i;<a name="line.98"></a>
+<span class="sourceLineNo">099</span>                }<a name="line.99"></a>
+<span class="sourceLineNo">100</span>            }<a name="line.100"></a>
+<span class="sourceLineNo">101</span>        }<a name="line.101"></a>
+<span class="sourceLineNo">102</span>        return 0;<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
+<span class="sourceLineNo">104</span>}<a name="line.104"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityEscaper.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityEscaper.html (original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityEscaper.html Sun Mar 12 02:08:01 2017
@@ -34,96 +34,99 @@
 <span class="sourceLineNo">026</span> */<a name="line.26"></a>
 <span class="sourceLineNo">027</span>public class NumericEntityEscaper extends CodePointTranslator {<a name="line.27"></a>
 <span class="sourceLineNo">028</span><a name="line.28"></a>
-<span class="sourceLineNo">029</span>    private final int below;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>    private final int above;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>    private final boolean between;<a name="line.31"></a>
-<span class="sourceLineNo">032</span><a name="line.32"></a>
-<span class="sourceLineNo">033</span>    /**<a name="line.33"></a>
-<span class="sourceLineNo">034</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; for the specified range. This is<a name="line.34"></a>
-<span class="sourceLineNo">035</span>     * the underlying method for the other constructors/builders. The &lt;code&gt;below&lt;/code&gt;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>     * and &lt;code&gt;above&lt;/code&gt; boundaries are inclusive when &lt;code&gt;between&lt;/code&gt; is<a name="line.36"></a>
-<span class="sourceLineNo">037</span>     * &lt;code&gt;true&lt;/code&gt; and exclusive when it is &lt;code&gt;false&lt;/code&gt;. &lt;/p&gt;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>     *<a name="line.38"></a>
-<span class="sourceLineNo">039</span>     * @param below int value representing the lowest codepoint boundary<a name="line.39"></a>
-<span class="sourceLineNo">040</span>     * @param above int value representing the highest codepoint boundary<a name="line.40"></a>
-<span class="sourceLineNo">041</span>     * @param between whether to escape between the boundaries or outside them<a name="line.41"></a>
-<span class="sourceLineNo">042</span>     */<a name="line.42"></a>
-<span class="sourceLineNo">043</span>    private NumericEntityEscaper(final int below, final int above, final boolean between) {<a name="line.43"></a>
-<span class="sourceLineNo">044</span>        this.below = below;<a name="line.44"></a>
-<span class="sourceLineNo">045</span>        this.above = above;<a name="line.45"></a>
-<span class="sourceLineNo">046</span>        this.between = between;<a name="line.46"></a>
-<span class="sourceLineNo">047</span>    }<a name="line.47"></a>
-<span class="sourceLineNo">048</span><a name="line.48"></a>
-<span class="sourceLineNo">049</span>    /**<a name="line.49"></a>
-<span class="sourceLineNo">050</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; for all characters. &lt;/p&gt;<a name="line.50"></a>
-<span class="sourceLineNo">051</span>     */<a name="line.51"></a>
-<span class="sourceLineNo">052</span>    public NumericEntityEscaper() {<a name="line.52"></a>
-<span class="sourceLineNo">053</span>        this(0, Integer.MAX_VALUE, true);<a name="line.53"></a>
-<span class="sourceLineNo">054</span>    }<a name="line.54"></a>
-<span class="sourceLineNo">055</span><a name="line.55"></a>
-<span class="sourceLineNo">056</span>    /**<a name="line.56"></a>
-<span class="sourceLineNo">057</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; below the specified value (exclusive). &lt;/p&gt;<a name="line.57"></a>
-<span class="sourceLineNo">058</span>     *<a name="line.58"></a>
-<span class="sourceLineNo">059</span>     * @param codepoint below which to escape<a name="line.59"></a>
-<span class="sourceLineNo">060</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.60"></a>
-<span class="sourceLineNo">061</span>     */<a name="line.61"></a>
-<span class="sourceLineNo">062</span>    public static NumericEntityEscaper below(final int codepoint) {<a name="line.62"></a>
-<span class="sourceLineNo">063</span>        return outsideOf(codepoint, Integer.MAX_VALUE);<a name="line.63"></a>
-<span class="sourceLineNo">064</span>    }<a name="line.64"></a>
-<span class="sourceLineNo">065</span><a name="line.65"></a>
-<span class="sourceLineNo">066</span>    /**<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; above the specified value (exclusive). &lt;/p&gt;<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     *<a name="line.68"></a>
-<span class="sourceLineNo">069</span>     * @param codepoint above which to escape<a name="line.69"></a>
-<span class="sourceLineNo">070</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.70"></a>
-<span class="sourceLineNo">071</span>     */<a name="line.71"></a>
-<span class="sourceLineNo">072</span>    public static NumericEntityEscaper above(final int codepoint) {<a name="line.72"></a>
-<span class="sourceLineNo">073</span>        return outsideOf(0, codepoint);<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    }<a name="line.74"></a>
-<span class="sourceLineNo">075</span><a name="line.75"></a>
-<span class="sourceLineNo">076</span>    /**<a name="line.76"></a>
-<span class="sourceLineNo">077</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; between the specified values (inclusive). &lt;/p&gt;<a name="line.77"></a>
-<span class="sourceLineNo">078</span>     *<a name="line.78"></a>
-<span class="sourceLineNo">079</span>     * @param codepointLow above which to escape<a name="line.79"></a>
-<span class="sourceLineNo">080</span>     * @param codepointHigh below which to escape<a name="line.80"></a>
-<span class="sourceLineNo">081</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.81"></a>
-<span class="sourceLineNo">082</span>     */<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    public static NumericEntityEscaper between(final int codepointLow, final int codepointHigh) {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>        return new NumericEntityEscaper(codepointLow, codepointHigh, true);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span><a name="line.86"></a>
-<span class="sourceLineNo">087</span>    /**<a name="line.87"></a>
-<span class="sourceLineNo">088</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; outside of the specified values (exclusive). &lt;/p&gt;<a name="line.88"></a>
-<span class="sourceLineNo">089</span>     *<a name="line.89"></a>
-<span class="sourceLineNo">090</span>     * @param codepointLow below which to escape<a name="line.90"></a>
-<span class="sourceLineNo">091</span>     * @param codepointHigh above which to escape<a name="line.91"></a>
-<span class="sourceLineNo">092</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.92"></a>
-<span class="sourceLineNo">093</span>     */<a name="line.93"></a>
-<span class="sourceLineNo">094</span>    public static NumericEntityEscaper outsideOf(final int codepointLow, final int codepointHigh) {<a name="line.94"></a>
-<span class="sourceLineNo">095</span>        return new NumericEntityEscaper(codepointLow, codepointHigh, false);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>    }<a name="line.96"></a>
-<span class="sourceLineNo">097</span><a name="line.97"></a>
-<span class="sourceLineNo">098</span>    /**<a name="line.98"></a>
-<span class="sourceLineNo">099</span>     * {@inheritDoc}<a name="line.99"></a>
-<span class="sourceLineNo">100</span>     */<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    @Override<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    public boolean translate(final int codepoint, final Writer out) throws IOException {<a name="line.102"></a>
-<span class="sourceLineNo">103</span>        if(between) {<a name="line.103"></a>
-<span class="sourceLineNo">104</span>            if (codepoint &lt; below || codepoint &gt; above) {<a name="line.104"></a>
-<span class="sourceLineNo">105</span>                return false;<a name="line.105"></a>
-<span class="sourceLineNo">106</span>            }<a name="line.106"></a>
-<span class="sourceLineNo">107</span>        } else {<a name="line.107"></a>
-<span class="sourceLineNo">108</span>            if (codepoint &gt;= below &amp;&amp; codepoint &lt;= above) {<a name="line.108"></a>
-<span class="sourceLineNo">109</span>                return false;<a name="line.109"></a>
-<span class="sourceLineNo">110</span>            }<a name="line.110"></a>
-<span class="sourceLineNo">111</span>        }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>        out.write("&amp;#");<a name="line.113"></a>
-<span class="sourceLineNo">114</span>        out.write(Integer.toString(codepoint, 10));<a name="line.114"></a>
-<span class="sourceLineNo">115</span>        out.write(';');<a name="line.115"></a>
-<span class="sourceLineNo">116</span>        return true;<a name="line.116"></a>
-<span class="sourceLineNo">117</span>    }<a name="line.117"></a>
-<span class="sourceLineNo">118</span>}<a name="line.118"></a>
+<span class="sourceLineNo">029</span>    /** int value representing the lowest codepoint boundary. */<a name="line.29"></a>
+<span class="sourceLineNo">030</span>    private final int below;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>    /** int value representing the highest codepoint boundary. */<a name="line.31"></a>
+<span class="sourceLineNo">032</span>    private final int above;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>    /** whether to escape between the boundaries or outside them. */<a name="line.33"></a>
+<span class="sourceLineNo">034</span>    private final boolean between;<a name="line.34"></a>
+<span class="sourceLineNo">035</span><a name="line.35"></a>
+<span class="sourceLineNo">036</span>    /**<a name="line.36"></a>
+<span class="sourceLineNo">037</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; for the specified range. This is<a name="line.37"></a>
+<span class="sourceLineNo">038</span>     * the underlying method for the other constructors/builders. The &lt;code&gt;below&lt;/code&gt;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>     * and &lt;code&gt;above&lt;/code&gt; boundaries are inclusive when &lt;code&gt;between&lt;/code&gt; is<a name="line.39"></a>
+<span class="sourceLineNo">040</span>     * &lt;code&gt;true&lt;/code&gt; and exclusive when it is &lt;code&gt;false&lt;/code&gt;. &lt;/p&gt;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>     *<a name="line.41"></a>
+<span class="sourceLineNo">042</span>     * @param below int value representing the lowest codepoint boundary<a name="line.42"></a>
+<span class="sourceLineNo">043</span>     * @param above int value representing the highest codepoint boundary<a name="line.43"></a>
+<span class="sourceLineNo">044</span>     * @param between whether to escape between the boundaries or outside them<a name="line.44"></a>
+<span class="sourceLineNo">045</span>     */<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    private NumericEntityEscaper(final int below, final int above, final boolean between) {<a name="line.46"></a>
+<span class="sourceLineNo">047</span>        this.below = below;<a name="line.47"></a>
+<span class="sourceLineNo">048</span>        this.above = above;<a name="line.48"></a>
+<span class="sourceLineNo">049</span>        this.between = between;<a name="line.49"></a>
+<span class="sourceLineNo">050</span>    }<a name="line.50"></a>
+<span class="sourceLineNo">051</span><a name="line.51"></a>
+<span class="sourceLineNo">052</span>    /**<a name="line.52"></a>
+<span class="sourceLineNo">053</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; for all characters. &lt;/p&gt;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>     */<a name="line.54"></a>
+<span class="sourceLineNo">055</span>    public NumericEntityEscaper() {<a name="line.55"></a>
+<span class="sourceLineNo">056</span>        this(0, Integer.MAX_VALUE, true);<a name="line.56"></a>
+<span class="sourceLineNo">057</span>    }<a name="line.57"></a>
+<span class="sourceLineNo">058</span><a name="line.58"></a>
+<span class="sourceLineNo">059</span>    /**<a name="line.59"></a>
+<span class="sourceLineNo">060</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; below the specified value (exclusive). &lt;/p&gt;<a name="line.60"></a>
+<span class="sourceLineNo">061</span>     *<a name="line.61"></a>
+<span class="sourceLineNo">062</span>     * @param codepoint below which to escape<a name="line.62"></a>
+<span class="sourceLineNo">063</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.63"></a>
+<span class="sourceLineNo">064</span>     */<a name="line.64"></a>
+<span class="sourceLineNo">065</span>    public static NumericEntityEscaper below(final int codepoint) {<a name="line.65"></a>
+<span class="sourceLineNo">066</span>        return outsideOf(codepoint, Integer.MAX_VALUE);<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    }<a name="line.67"></a>
+<span class="sourceLineNo">068</span><a name="line.68"></a>
+<span class="sourceLineNo">069</span>    /**<a name="line.69"></a>
+<span class="sourceLineNo">070</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; above the specified value (exclusive). &lt;/p&gt;<a name="line.70"></a>
+<span class="sourceLineNo">071</span>     *<a name="line.71"></a>
+<span class="sourceLineNo">072</span>     * @param codepoint above which to escape<a name="line.72"></a>
+<span class="sourceLineNo">073</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.73"></a>
+<span class="sourceLineNo">074</span>     */<a name="line.74"></a>
+<span class="sourceLineNo">075</span>    public static NumericEntityEscaper above(final int codepoint) {<a name="line.75"></a>
+<span class="sourceLineNo">076</span>        return outsideOf(0, codepoint);<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>    /**<a name="line.79"></a>
+<span class="sourceLineNo">080</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; between the specified values (inclusive). &lt;/p&gt;<a name="line.80"></a>
+<span class="sourceLineNo">081</span>     *<a name="line.81"></a>
+<span class="sourceLineNo">082</span>     * @param codepointLow above which to escape<a name="line.82"></a>
+<span class="sourceLineNo">083</span>     * @param codepointHigh below which to escape<a name="line.83"></a>
+<span class="sourceLineNo">084</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.84"></a>
+<span class="sourceLineNo">085</span>     */<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    public static NumericEntityEscaper between(final int codepointLow, final int codepointHigh) {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>        return new NumericEntityEscaper(codepointLow, codepointHigh, true);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>    }<a name="line.88"></a>
+<span class="sourceLineNo">089</span><a name="line.89"></a>
+<span class="sourceLineNo">090</span>    /**<a name="line.90"></a>
+<span class="sourceLineNo">091</span>     * &lt;p&gt;Constructs a &lt;code&gt;NumericEntityEscaper&lt;/code&gt; outside of the specified values (exclusive). &lt;/p&gt;<a name="line.91"></a>
+<span class="sourceLineNo">092</span>     *<a name="line.92"></a>
+<span class="sourceLineNo">093</span>     * @param codepointLow below which to escape<a name="line.93"></a>
+<span class="sourceLineNo">094</span>     * @param codepointHigh above which to escape<a name="line.94"></a>
+<span class="sourceLineNo">095</span>     * @return the newly created {@code NumericEntityEscaper} instance<a name="line.95"></a>
+<span class="sourceLineNo">096</span>     */<a name="line.96"></a>
+<span class="sourceLineNo">097</span>    public static NumericEntityEscaper outsideOf(final int codepointLow, final int codepointHigh) {<a name="line.97"></a>
+<span class="sourceLineNo">098</span>        return new NumericEntityEscaper(codepointLow, codepointHigh, false);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>    /**<a name="line.101"></a>
+<span class="sourceLineNo">102</span>     * {@inheritDoc}<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     */<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    @Override<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    public boolean translate(final int codepoint, final Writer out) throws IOException {<a name="line.105"></a>
+<span class="sourceLineNo">106</span>        if (between) {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>            if (codepoint &lt; below || codepoint &gt; above) {<a name="line.107"></a>
+<span class="sourceLineNo">108</span>                return false;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>            }<a name="line.109"></a>
+<span class="sourceLineNo">110</span>        } else {<a name="line.110"></a>
+<span class="sourceLineNo">111</span>            if (codepoint &gt;= below &amp;&amp; codepoint &lt;= above) {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>                return false;<a name="line.112"></a>
+<span class="sourceLineNo">113</span>            }<a name="line.113"></a>
+<span class="sourceLineNo">114</span>        }<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span>        out.write("&amp;#");<a name="line.116"></a>
+<span class="sourceLineNo">117</span>        out.write(Integer.toString(codepoint, 10));<a name="line.117"></a>
+<span class="sourceLineNo">118</span>        out.write(';');<a name="line.118"></a>
+<span class="sourceLineNo">119</span>        return true;<a name="line.119"></a>
+<span class="sourceLineNo">120</span>    }<a name="line.120"></a>
+<span class="sourceLineNo">121</span>}<a name="line.121"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.OPTION.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.OPTION.html (original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.OPTION.html Sun Mar 12 02:08:01 2017
@@ -13,9 +13,9 @@
 <span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
 <span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
 <span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * <a name="line.8"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
 <span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
-<span class="sourceLineNo">010</span> * <a name="line.10"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
 <span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
 <span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
 <span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
@@ -30,7 +30,7 @@
 <span class="sourceLineNo">022</span>import java.util.EnumSet;<a name="line.22"></a>
 <span class="sourceLineNo">023</span><a name="line.23"></a>
 <span class="sourceLineNo">024</span>/**<a name="line.24"></a>
-<span class="sourceLineNo">025</span> * Translate XML numeric entities of the form &amp;amp;#[xX]?\d+;? to <a name="line.25"></a>
+<span class="sourceLineNo">025</span> * Translate XML numeric entities of the form &amp;amp;#[xX]?\d+;? to<a name="line.25"></a>
 <span class="sourceLineNo">026</span> * the specific codepoint.<a name="line.26"></a>
 <span class="sourceLineNo">027</span> *<a name="line.27"></a>
 <span class="sourceLineNo">028</span> * Note that the semi-colon is optional.<a name="line.28"></a>
@@ -39,111 +39,112 @@
 <span class="sourceLineNo">031</span> */<a name="line.31"></a>
 <span class="sourceLineNo">032</span>public class NumericEntityUnescaper extends CharSequenceTranslator {<a name="line.32"></a>
 <span class="sourceLineNo">033</span><a name="line.33"></a>
-<span class="sourceLineNo">034</span>    public static enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }<a name="line.34"></a>
-<span class="sourceLineNo">035</span><a name="line.35"></a>
-<span class="sourceLineNo">036</span>    // TODO?: Create an OptionsSet class to hide some of the conditional logic below<a name="line.36"></a>
-<span class="sourceLineNo">037</span>    private final EnumSet&lt;OPTION&gt; options;<a name="line.37"></a>
-<span class="sourceLineNo">038</span><a name="line.38"></a>
-<span class="sourceLineNo">039</span>    /**<a name="line.39"></a>
-<span class="sourceLineNo">040</span>     * Create a UnicodeUnescaper.<a name="line.40"></a>
-<span class="sourceLineNo">041</span>     *<a name="line.41"></a>
-<span class="sourceLineNo">042</span>     * The constructor takes a list of options, only one type of which is currently <a name="line.42"></a>
-<span class="sourceLineNo">043</span>     * available (whether to allow, error or ignore the semi-colon on the end of a <a name="line.43"></a>
-<span class="sourceLineNo">044</span>     * numeric entity to being missing).<a name="line.44"></a>
-<span class="sourceLineNo">045</span>     *<a name="line.45"></a>
-<span class="sourceLineNo">046</span>     * For example, to support numeric entities without a ';':<a name="line.46"></a>
-<span class="sourceLineNo">047</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)<a name="line.47"></a>
-<span class="sourceLineNo">048</span>     * and to throw an IllegalArgumentException when they're missing:<a name="line.48"></a>
-<span class="sourceLineNo">049</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)<a name="line.49"></a>
-<span class="sourceLineNo">050</span>     *<a name="line.50"></a>
-<span class="sourceLineNo">051</span>     * Note that the default behaviour is to ignore them. <a name="line.51"></a>
-<span class="sourceLineNo">052</span>     *<a name="line.52"></a>
-<span class="sourceLineNo">053</span>     * @param options to apply to this unescaper<a name="line.53"></a>
-<span class="sourceLineNo">054</span>     */<a name="line.54"></a>
-<span class="sourceLineNo">055</span>    public NumericEntityUnescaper(final OPTION... options) {<a name="line.55"></a>
-<span class="sourceLineNo">056</span>        if(options.length &gt; 0) {<a name="line.56"></a>
-<span class="sourceLineNo">057</span>            this.options = EnumSet.copyOf(Arrays.asList(options));<a name="line.57"></a>
-<span class="sourceLineNo">058</span>        } else {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>            this.options = EnumSet.copyOf(Arrays.asList(new OPTION[] { OPTION.semiColonRequired }));<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        }<a name="line.60"></a>
-<span class="sourceLineNo">061</span>    }<a name="line.61"></a>
-<span class="sourceLineNo">062</span><a name="line.62"></a>
-<span class="sourceLineNo">063</span>    /**<a name="line.63"></a>
-<span class="sourceLineNo">064</span>     * Whether the passed in option is currently set.<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     *<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     * @param option to check state of<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @return whether the option is set<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    public boolean isSet(final OPTION option) { <a name="line.69"></a>
-<span class="sourceLineNo">070</span>        return options == null ? false : options.contains(option);<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    }<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    /**<a name="line.73"></a>
-<span class="sourceLineNo">074</span>     * {@inheritDoc}<a name="line.74"></a>
-<span class="sourceLineNo">075</span>     */<a name="line.75"></a>
-<span class="sourceLineNo">076</span>    @Override<a name="line.76"></a>
-<span class="sourceLineNo">077</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>        final int seqEnd = input.length();<a name="line.78"></a>
-<span class="sourceLineNo">079</span>        // Uses -2 to ensure there is something after the &amp;#<a name="line.79"></a>
-<span class="sourceLineNo">080</span>        if(input.charAt(index) == '&amp;' &amp;&amp; index &lt; seqEnd - 2 &amp;&amp; input.charAt(index + 1) == '#') {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>            int start = index + 2;<a name="line.81"></a>
-<span class="sourceLineNo">082</span>            boolean isHex = false;<a name="line.82"></a>
-<span class="sourceLineNo">083</span><a name="line.83"></a>
-<span class="sourceLineNo">084</span>            final char firstChar = input.charAt(start);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>            if(firstChar == 'x' || firstChar == 'X') {<a name="line.85"></a>
-<span class="sourceLineNo">086</span>                start++;<a name="line.86"></a>
-<span class="sourceLineNo">087</span>                isHex = true;<a name="line.87"></a>
-<span class="sourceLineNo">088</span><a name="line.88"></a>
-<span class="sourceLineNo">089</span>                // Check there's more than just an x after the &amp;#<a name="line.89"></a>
-<span class="sourceLineNo">090</span>                if(start == seqEnd) {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>                    return 0;<a name="line.91"></a>
-<span class="sourceLineNo">092</span>                }<a name="line.92"></a>
-<span class="sourceLineNo">093</span>            }<a name="line.93"></a>
-<span class="sourceLineNo">094</span><a name="line.94"></a>
-<span class="sourceLineNo">095</span>            int end = start;<a name="line.95"></a>
-<span class="sourceLineNo">096</span>            // Note that this supports character codes without a ; on the end<a name="line.96"></a>
-<span class="sourceLineNo">097</span>            while(end &lt; seqEnd &amp;&amp; ( input.charAt(end) &gt;= '0' &amp;&amp; input.charAt(end) &lt;= '9' ||<a name="line.97"></a>
-<span class="sourceLineNo">098</span>                                    input.charAt(end) &gt;= 'a' &amp;&amp; input.charAt(end) &lt;= 'f' ||<a name="line.98"></a>
-<span class="sourceLineNo">099</span>                                    input.charAt(end) &gt;= 'A' &amp;&amp; input.charAt(end) &lt;= 'F' ) )<a name="line.99"></a>
-<span class="sourceLineNo">100</span>            {<a name="line.100"></a>
+<span class="sourceLineNo">034</span>    /** NumericEntityUnescaper option enum. */<a name="line.34"></a>
+<span class="sourceLineNo">035</span>    public enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }<a name="line.35"></a>
+<span class="sourceLineNo">036</span><a name="line.36"></a>
+<span class="sourceLineNo">037</span>    /** EnumSet of OPTIONS, given from the constructor. */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>    private final EnumSet&lt;OPTION&gt; options;<a name="line.38"></a>
+<span class="sourceLineNo">039</span><a name="line.39"></a>
+<span class="sourceLineNo">040</span>    /**<a name="line.40"></a>
+<span class="sourceLineNo">041</span>     * Create a UnicodeUnescaper.<a name="line.41"></a>
+<span class="sourceLineNo">042</span>     *<a name="line.42"></a>
+<span class="sourceLineNo">043</span>     * The constructor takes a list of options, only one type of which is currently<a name="line.43"></a>
+<span class="sourceLineNo">044</span>     * available (whether to allow, error or ignore the semi-colon on the end of a<a name="line.44"></a>
+<span class="sourceLineNo">045</span>     * numeric entity to being missing).<a name="line.45"></a>
+<span class="sourceLineNo">046</span>     *<a name="line.46"></a>
+<span class="sourceLineNo">047</span>     * For example, to support numeric entities without a ';':<a name="line.47"></a>
+<span class="sourceLineNo">048</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)<a name="line.48"></a>
+<span class="sourceLineNo">049</span>     * and to throw an IllegalArgumentException when they're missing:<a name="line.49"></a>
+<span class="sourceLineNo">050</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)<a name="line.50"></a>
+<span class="sourceLineNo">051</span>     *<a name="line.51"></a>
+<span class="sourceLineNo">052</span>     * Note that the default behaviour is to ignore them.<a name="line.52"></a>
+<span class="sourceLineNo">053</span>     *<a name="line.53"></a>
+<span class="sourceLineNo">054</span>     * @param options to apply to this unescaper<a name="line.54"></a>
+<span class="sourceLineNo">055</span>     */<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    public NumericEntityUnescaper(final OPTION... options) {<a name="line.56"></a>
+<span class="sourceLineNo">057</span>        if (options.length &gt; 0) {<a name="line.57"></a>
+<span class="sourceLineNo">058</span>            this.options = EnumSet.copyOf(Arrays.asList(options));<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        } else {<a name="line.59"></a>
+<span class="sourceLineNo">060</span>            this.options = EnumSet.copyOf(Arrays.asList(new OPTION[] {OPTION.semiColonRequired}));<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        }<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
+<span class="sourceLineNo">065</span>     * Whether the passed in option is currently set.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     *<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * @param option to check state of<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @return whether the option is set<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     */<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    public boolean isSet(final OPTION option) {<a name="line.70"></a>
+<span class="sourceLineNo">071</span>        return options != null &amp;&amp; options.contains(option);<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    }<a name="line.72"></a>
+<span class="sourceLineNo">073</span><a name="line.73"></a>
+<span class="sourceLineNo">074</span>    /**<a name="line.74"></a>
+<span class="sourceLineNo">075</span>     * {@inheritDoc}<a name="line.75"></a>
+<span class="sourceLineNo">076</span>     */<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    @Override<a name="line.77"></a>
+<span class="sourceLineNo">078</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.78"></a>
+<span class="sourceLineNo">079</span>        final int seqEnd = input.length();<a name="line.79"></a>
+<span class="sourceLineNo">080</span>        // Uses -2 to ensure there is something after the &amp;#<a name="line.80"></a>
+<span class="sourceLineNo">081</span>        if (input.charAt(index) == '&amp;' &amp;&amp; index &lt; seqEnd - 2 &amp;&amp; input.charAt(index + 1) == '#') {<a name="line.81"></a>
+<span class="sourceLineNo">082</span>            int start = index + 2;<a name="line.82"></a>
+<span class="sourceLineNo">083</span>            boolean isHex = false;<a name="line.83"></a>
+<span class="sourceLineNo">084</span><a name="line.84"></a>
+<span class="sourceLineNo">085</span>            final char firstChar = input.charAt(start);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>            if (firstChar == 'x' || firstChar == 'X') {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>                start++;<a name="line.87"></a>
+<span class="sourceLineNo">088</span>                isHex = true;<a name="line.88"></a>
+<span class="sourceLineNo">089</span><a name="line.89"></a>
+<span class="sourceLineNo">090</span>                // Check there's more than just an x after the &amp;#<a name="line.90"></a>
+<span class="sourceLineNo">091</span>                if (start == seqEnd) {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>                    return 0;<a name="line.92"></a>
+<span class="sourceLineNo">093</span>                }<a name="line.93"></a>
+<span class="sourceLineNo">094</span>            }<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>            int end = start;<a name="line.96"></a>
+<span class="sourceLineNo">097</span>            // Note that this supports character codes without a ; on the end<a name="line.97"></a>
+<span class="sourceLineNo">098</span>            while (end &lt; seqEnd &amp;&amp; (input.charAt(end) &gt;= '0' &amp;&amp; input.charAt(end) &lt;= '9'<a name="line.98"></a>
+<span class="sourceLineNo">099</span>                                    || input.charAt(end) &gt;= 'a' &amp;&amp; input.charAt(end) &lt;= 'f'<a name="line.99"></a>
+<span class="sourceLineNo">100</span>                                    || input.charAt(end) &gt;= 'A' &amp;&amp; input.charAt(end) &lt;= 'F')) {<a name="line.100"></a>
 <span class="sourceLineNo">101</span>                end++;<a name="line.101"></a>
 <span class="sourceLineNo">102</span>            }<a name="line.102"></a>
 <span class="sourceLineNo">103</span><a name="line.103"></a>
 <span class="sourceLineNo">104</span>            final boolean semiNext = end != seqEnd &amp;&amp; input.charAt(end) == ';';<a name="line.104"></a>
 <span class="sourceLineNo">105</span><a name="line.105"></a>
-<span class="sourceLineNo">106</span>            if(!semiNext) {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>                if(isSet(OPTION.semiColonRequired)) {<a name="line.107"></a>
+<span class="sourceLineNo">106</span>            if (!semiNext) {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>                if (isSet(OPTION.semiColonRequired)) {<a name="line.107"></a>
 <span class="sourceLineNo">108</span>                    return 0;<a name="line.108"></a>
-<span class="sourceLineNo">109</span>                } else<a name="line.109"></a>
-<span class="sourceLineNo">110</span>                if(isSet(OPTION.errorIfNoSemiColon)) {<a name="line.110"></a>
-<span class="sourceLineNo">111</span>                    throw new IllegalArgumentException("Semi-colon required at end of numeric entity");<a name="line.111"></a>
-<span class="sourceLineNo">112</span>                }<a name="line.112"></a>
-<span class="sourceLineNo">113</span>            }<a name="line.113"></a>
-<span class="sourceLineNo">114</span><a name="line.114"></a>
-<span class="sourceLineNo">115</span>            int entityValue;<a name="line.115"></a>
-<span class="sourceLineNo">116</span>            try {<a name="line.116"></a>
-<span class="sourceLineNo">117</span>                if(isHex) {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16);<a name="line.118"></a>
-<span class="sourceLineNo">119</span>                } else {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10);<a name="line.120"></a>
-<span class="sourceLineNo">121</span>                }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>            } catch(final NumberFormatException nfe) {<a name="line.122"></a>
-<span class="sourceLineNo">123</span>                return 0;<a name="line.123"></a>
-<span class="sourceLineNo">124</span>            }<a name="line.124"></a>
-<span class="sourceLineNo">125</span><a name="line.125"></a>
-<span class="sourceLineNo">126</span>            if(entityValue &gt; 0xFFFF) {<a name="line.126"></a>
-<span class="sourceLineNo">127</span>                final char[] chrs = Character.toChars(entityValue);<a name="line.127"></a>
-<span class="sourceLineNo">128</span>                out.write(chrs[0]);<a name="line.128"></a>
-<span class="sourceLineNo">129</span>                out.write(chrs[1]);<a name="line.129"></a>
-<span class="sourceLineNo">130</span>            } else {<a name="line.130"></a>
-<span class="sourceLineNo">131</span>                out.write(entityValue);<a name="line.131"></a>
-<span class="sourceLineNo">132</span>            }<a name="line.132"></a>
-<span class="sourceLineNo">133</span><a name="line.133"></a>
-<span class="sourceLineNo">134</span>            return 2 + end - start + (isHex ? 1 : 0) + (semiNext ? 1 : 0);<a name="line.134"></a>
-<span class="sourceLineNo">135</span>        }<a name="line.135"></a>
-<span class="sourceLineNo">136</span>        return 0;<a name="line.136"></a>
-<span class="sourceLineNo">137</span>    }<a name="line.137"></a>
-<span class="sourceLineNo">138</span>}<a name="line.138"></a>
+<span class="sourceLineNo">109</span>                } else {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>                    if (isSet(OPTION.errorIfNoSemiColon)) {<a name="line.110"></a>
+<span class="sourceLineNo">111</span>                        throw new IllegalArgumentException("Semi-colon required at end of numeric entity");<a name="line.111"></a>
+<span class="sourceLineNo">112</span>                    }<a name="line.112"></a>
+<span class="sourceLineNo">113</span>                }<a name="line.113"></a>
+<span class="sourceLineNo">114</span>            }<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span>            int entityValue;<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            try {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>                if (isHex) {<a name="line.118"></a>
+<span class="sourceLineNo">119</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16);<a name="line.119"></a>
+<span class="sourceLineNo">120</span>                } else {<a name="line.120"></a>
+<span class="sourceLineNo">121</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10);<a name="line.121"></a>
+<span class="sourceLineNo">122</span>                }<a name="line.122"></a>
+<span class="sourceLineNo">123</span>            } catch (final NumberFormatException nfe) {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>                return 0;<a name="line.124"></a>
+<span class="sourceLineNo">125</span>            }<a name="line.125"></a>
+<span class="sourceLineNo">126</span><a name="line.126"></a>
+<span class="sourceLineNo">127</span>            if (entityValue &gt; 0xFFFF) {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>                final char[] chrs = Character.toChars(entityValue);<a name="line.128"></a>
+<span class="sourceLineNo">129</span>                out.write(chrs[0]);<a name="line.129"></a>
+<span class="sourceLineNo">130</span>                out.write(chrs[1]);<a name="line.130"></a>
+<span class="sourceLineNo">131</span>            } else {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>                out.write(entityValue);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>            }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>            return 2 + end - start + (isHex ? 1 : 0) + (semiNext ? 1 : 0);<a name="line.135"></a>
+<span class="sourceLineNo">136</span>        }<a name="line.136"></a>
+<span class="sourceLineNo">137</span>        return 0;<a name="line.137"></a>
+<span class="sourceLineNo">138</span>    }<a name="line.138"></a>
+<span class="sourceLineNo">139</span>}<a name="line.139"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.html (original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/NumericEntityUnescaper.html Sun Mar 12 02:08:01 2017
@@ -13,9 +13,9 @@
 <span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
 <span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
 <span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * <a name="line.8"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
 <span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
-<span class="sourceLineNo">010</span> * <a name="line.10"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
 <span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
 <span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
 <span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
@@ -30,7 +30,7 @@
 <span class="sourceLineNo">022</span>import java.util.EnumSet;<a name="line.22"></a>
 <span class="sourceLineNo">023</span><a name="line.23"></a>
 <span class="sourceLineNo">024</span>/**<a name="line.24"></a>
-<span class="sourceLineNo">025</span> * Translate XML numeric entities of the form &amp;amp;#[xX]?\d+;? to <a name="line.25"></a>
+<span class="sourceLineNo">025</span> * Translate XML numeric entities of the form &amp;amp;#[xX]?\d+;? to<a name="line.25"></a>
 <span class="sourceLineNo">026</span> * the specific codepoint.<a name="line.26"></a>
 <span class="sourceLineNo">027</span> *<a name="line.27"></a>
 <span class="sourceLineNo">028</span> * Note that the semi-colon is optional.<a name="line.28"></a>
@@ -39,111 +39,112 @@
 <span class="sourceLineNo">031</span> */<a name="line.31"></a>
 <span class="sourceLineNo">032</span>public class NumericEntityUnescaper extends CharSequenceTranslator {<a name="line.32"></a>
 <span class="sourceLineNo">033</span><a name="line.33"></a>
-<span class="sourceLineNo">034</span>    public static enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }<a name="line.34"></a>
-<span class="sourceLineNo">035</span><a name="line.35"></a>
-<span class="sourceLineNo">036</span>    // TODO?: Create an OptionsSet class to hide some of the conditional logic below<a name="line.36"></a>
-<span class="sourceLineNo">037</span>    private final EnumSet&lt;OPTION&gt; options;<a name="line.37"></a>
-<span class="sourceLineNo">038</span><a name="line.38"></a>
-<span class="sourceLineNo">039</span>    /**<a name="line.39"></a>
-<span class="sourceLineNo">040</span>     * Create a UnicodeUnescaper.<a name="line.40"></a>
-<span class="sourceLineNo">041</span>     *<a name="line.41"></a>
-<span class="sourceLineNo">042</span>     * The constructor takes a list of options, only one type of which is currently <a name="line.42"></a>
-<span class="sourceLineNo">043</span>     * available (whether to allow, error or ignore the semi-colon on the end of a <a name="line.43"></a>
-<span class="sourceLineNo">044</span>     * numeric entity to being missing).<a name="line.44"></a>
-<span class="sourceLineNo">045</span>     *<a name="line.45"></a>
-<span class="sourceLineNo">046</span>     * For example, to support numeric entities without a ';':<a name="line.46"></a>
-<span class="sourceLineNo">047</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)<a name="line.47"></a>
-<span class="sourceLineNo">048</span>     * and to throw an IllegalArgumentException when they're missing:<a name="line.48"></a>
-<span class="sourceLineNo">049</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)<a name="line.49"></a>
-<span class="sourceLineNo">050</span>     *<a name="line.50"></a>
-<span class="sourceLineNo">051</span>     * Note that the default behaviour is to ignore them. <a name="line.51"></a>
-<span class="sourceLineNo">052</span>     *<a name="line.52"></a>
-<span class="sourceLineNo">053</span>     * @param options to apply to this unescaper<a name="line.53"></a>
-<span class="sourceLineNo">054</span>     */<a name="line.54"></a>
-<span class="sourceLineNo">055</span>    public NumericEntityUnescaper(final OPTION... options) {<a name="line.55"></a>
-<span class="sourceLineNo">056</span>        if(options.length &gt; 0) {<a name="line.56"></a>
-<span class="sourceLineNo">057</span>            this.options = EnumSet.copyOf(Arrays.asList(options));<a name="line.57"></a>
-<span class="sourceLineNo">058</span>        } else {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>            this.options = EnumSet.copyOf(Arrays.asList(new OPTION[] { OPTION.semiColonRequired }));<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        }<a name="line.60"></a>
-<span class="sourceLineNo">061</span>    }<a name="line.61"></a>
-<span class="sourceLineNo">062</span><a name="line.62"></a>
-<span class="sourceLineNo">063</span>    /**<a name="line.63"></a>
-<span class="sourceLineNo">064</span>     * Whether the passed in option is currently set.<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     *<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     * @param option to check state of<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @return whether the option is set<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    public boolean isSet(final OPTION option) { <a name="line.69"></a>
-<span class="sourceLineNo">070</span>        return options == null ? false : options.contains(option);<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    }<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    /**<a name="line.73"></a>
-<span class="sourceLineNo">074</span>     * {@inheritDoc}<a name="line.74"></a>
-<span class="sourceLineNo">075</span>     */<a name="line.75"></a>
-<span class="sourceLineNo">076</span>    @Override<a name="line.76"></a>
-<span class="sourceLineNo">077</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>        final int seqEnd = input.length();<a name="line.78"></a>
-<span class="sourceLineNo">079</span>        // Uses -2 to ensure there is something after the &amp;#<a name="line.79"></a>
-<span class="sourceLineNo">080</span>        if(input.charAt(index) == '&amp;' &amp;&amp; index &lt; seqEnd - 2 &amp;&amp; input.charAt(index + 1) == '#') {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>            int start = index + 2;<a name="line.81"></a>
-<span class="sourceLineNo">082</span>            boolean isHex = false;<a name="line.82"></a>
-<span class="sourceLineNo">083</span><a name="line.83"></a>
-<span class="sourceLineNo">084</span>            final char firstChar = input.charAt(start);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>            if(firstChar == 'x' || firstChar == 'X') {<a name="line.85"></a>
-<span class="sourceLineNo">086</span>                start++;<a name="line.86"></a>
-<span class="sourceLineNo">087</span>                isHex = true;<a name="line.87"></a>
-<span class="sourceLineNo">088</span><a name="line.88"></a>
-<span class="sourceLineNo">089</span>                // Check there's more than just an x after the &amp;#<a name="line.89"></a>
-<span class="sourceLineNo">090</span>                if(start == seqEnd) {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>                    return 0;<a name="line.91"></a>
-<span class="sourceLineNo">092</span>                }<a name="line.92"></a>
-<span class="sourceLineNo">093</span>            }<a name="line.93"></a>
-<span class="sourceLineNo">094</span><a name="line.94"></a>
-<span class="sourceLineNo">095</span>            int end = start;<a name="line.95"></a>
-<span class="sourceLineNo">096</span>            // Note that this supports character codes without a ; on the end<a name="line.96"></a>
-<span class="sourceLineNo">097</span>            while(end &lt; seqEnd &amp;&amp; ( input.charAt(end) &gt;= '0' &amp;&amp; input.charAt(end) &lt;= '9' ||<a name="line.97"></a>
-<span class="sourceLineNo">098</span>                                    input.charAt(end) &gt;= 'a' &amp;&amp; input.charAt(end) &lt;= 'f' ||<a name="line.98"></a>
-<span class="sourceLineNo">099</span>                                    input.charAt(end) &gt;= 'A' &amp;&amp; input.charAt(end) &lt;= 'F' ) )<a name="line.99"></a>
-<span class="sourceLineNo">100</span>            {<a name="line.100"></a>
+<span class="sourceLineNo">034</span>    /** NumericEntityUnescaper option enum. */<a name="line.34"></a>
+<span class="sourceLineNo">035</span>    public enum OPTION { semiColonRequired, semiColonOptional, errorIfNoSemiColon }<a name="line.35"></a>
+<span class="sourceLineNo">036</span><a name="line.36"></a>
+<span class="sourceLineNo">037</span>    /** EnumSet of OPTIONS, given from the constructor. */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>    private final EnumSet&lt;OPTION&gt; options;<a name="line.38"></a>
+<span class="sourceLineNo">039</span><a name="line.39"></a>
+<span class="sourceLineNo">040</span>    /**<a name="line.40"></a>
+<span class="sourceLineNo">041</span>     * Create a UnicodeUnescaper.<a name="line.41"></a>
+<span class="sourceLineNo">042</span>     *<a name="line.42"></a>
+<span class="sourceLineNo">043</span>     * The constructor takes a list of options, only one type of which is currently<a name="line.43"></a>
+<span class="sourceLineNo">044</span>     * available (whether to allow, error or ignore the semi-colon on the end of a<a name="line.44"></a>
+<span class="sourceLineNo">045</span>     * numeric entity to being missing).<a name="line.45"></a>
+<span class="sourceLineNo">046</span>     *<a name="line.46"></a>
+<span class="sourceLineNo">047</span>     * For example, to support numeric entities without a ';':<a name="line.47"></a>
+<span class="sourceLineNo">048</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional)<a name="line.48"></a>
+<span class="sourceLineNo">049</span>     * and to throw an IllegalArgumentException when they're missing:<a name="line.49"></a>
+<span class="sourceLineNo">050</span>     *    new NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)<a name="line.50"></a>
+<span class="sourceLineNo">051</span>     *<a name="line.51"></a>
+<span class="sourceLineNo">052</span>     * Note that the default behaviour is to ignore them.<a name="line.52"></a>
+<span class="sourceLineNo">053</span>     *<a name="line.53"></a>
+<span class="sourceLineNo">054</span>     * @param options to apply to this unescaper<a name="line.54"></a>
+<span class="sourceLineNo">055</span>     */<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    public NumericEntityUnescaper(final OPTION... options) {<a name="line.56"></a>
+<span class="sourceLineNo">057</span>        if (options.length &gt; 0) {<a name="line.57"></a>
+<span class="sourceLineNo">058</span>            this.options = EnumSet.copyOf(Arrays.asList(options));<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        } else {<a name="line.59"></a>
+<span class="sourceLineNo">060</span>            this.options = EnumSet.copyOf(Arrays.asList(new OPTION[] {OPTION.semiColonRequired}));<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        }<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
+<span class="sourceLineNo">065</span>     * Whether the passed in option is currently set.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     *<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * @param option to check state of<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @return whether the option is set<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     */<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    public boolean isSet(final OPTION option) {<a name="line.70"></a>
+<span class="sourceLineNo">071</span>        return options != null &amp;&amp; options.contains(option);<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    }<a name="line.72"></a>
+<span class="sourceLineNo">073</span><a name="line.73"></a>
+<span class="sourceLineNo">074</span>    /**<a name="line.74"></a>
+<span class="sourceLineNo">075</span>     * {@inheritDoc}<a name="line.75"></a>
+<span class="sourceLineNo">076</span>     */<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    @Override<a name="line.77"></a>
+<span class="sourceLineNo">078</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.78"></a>
+<span class="sourceLineNo">079</span>        final int seqEnd = input.length();<a name="line.79"></a>
+<span class="sourceLineNo">080</span>        // Uses -2 to ensure there is something after the &amp;#<a name="line.80"></a>
+<span class="sourceLineNo">081</span>        if (input.charAt(index) == '&amp;' &amp;&amp; index &lt; seqEnd - 2 &amp;&amp; input.charAt(index + 1) == '#') {<a name="line.81"></a>
+<span class="sourceLineNo">082</span>            int start = index + 2;<a name="line.82"></a>
+<span class="sourceLineNo">083</span>            boolean isHex = false;<a name="line.83"></a>
+<span class="sourceLineNo">084</span><a name="line.84"></a>
+<span class="sourceLineNo">085</span>            final char firstChar = input.charAt(start);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>            if (firstChar == 'x' || firstChar == 'X') {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>                start++;<a name="line.87"></a>
+<span class="sourceLineNo">088</span>                isHex = true;<a name="line.88"></a>
+<span class="sourceLineNo">089</span><a name="line.89"></a>
+<span class="sourceLineNo">090</span>                // Check there's more than just an x after the &amp;#<a name="line.90"></a>
+<span class="sourceLineNo">091</span>                if (start == seqEnd) {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>                    return 0;<a name="line.92"></a>
+<span class="sourceLineNo">093</span>                }<a name="line.93"></a>
+<span class="sourceLineNo">094</span>            }<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>            int end = start;<a name="line.96"></a>
+<span class="sourceLineNo">097</span>            // Note that this supports character codes without a ; on the end<a name="line.97"></a>
+<span class="sourceLineNo">098</span>            while (end &lt; seqEnd &amp;&amp; (input.charAt(end) &gt;= '0' &amp;&amp; input.charAt(end) &lt;= '9'<a name="line.98"></a>
+<span class="sourceLineNo">099</span>                                    || input.charAt(end) &gt;= 'a' &amp;&amp; input.charAt(end) &lt;= 'f'<a name="line.99"></a>
+<span class="sourceLineNo">100</span>                                    || input.charAt(end) &gt;= 'A' &amp;&amp; input.charAt(end) &lt;= 'F')) {<a name="line.100"></a>
 <span class="sourceLineNo">101</span>                end++;<a name="line.101"></a>
 <span class="sourceLineNo">102</span>            }<a name="line.102"></a>
 <span class="sourceLineNo">103</span><a name="line.103"></a>
 <span class="sourceLineNo">104</span>            final boolean semiNext = end != seqEnd &amp;&amp; input.charAt(end) == ';';<a name="line.104"></a>
 <span class="sourceLineNo">105</span><a name="line.105"></a>
-<span class="sourceLineNo">106</span>            if(!semiNext) {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>                if(isSet(OPTION.semiColonRequired)) {<a name="line.107"></a>
+<span class="sourceLineNo">106</span>            if (!semiNext) {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>                if (isSet(OPTION.semiColonRequired)) {<a name="line.107"></a>
 <span class="sourceLineNo">108</span>                    return 0;<a name="line.108"></a>
-<span class="sourceLineNo">109</span>                } else<a name="line.109"></a>
-<span class="sourceLineNo">110</span>                if(isSet(OPTION.errorIfNoSemiColon)) {<a name="line.110"></a>
-<span class="sourceLineNo">111</span>                    throw new IllegalArgumentException("Semi-colon required at end of numeric entity");<a name="line.111"></a>
-<span class="sourceLineNo">112</span>                }<a name="line.112"></a>
-<span class="sourceLineNo">113</span>            }<a name="line.113"></a>
-<span class="sourceLineNo">114</span><a name="line.114"></a>
-<span class="sourceLineNo">115</span>            int entityValue;<a name="line.115"></a>
-<span class="sourceLineNo">116</span>            try {<a name="line.116"></a>
-<span class="sourceLineNo">117</span>                if(isHex) {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16);<a name="line.118"></a>
-<span class="sourceLineNo">119</span>                } else {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10);<a name="line.120"></a>
-<span class="sourceLineNo">121</span>                }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>            } catch(final NumberFormatException nfe) {<a name="line.122"></a>
-<span class="sourceLineNo">123</span>                return 0;<a name="line.123"></a>
-<span class="sourceLineNo">124</span>            }<a name="line.124"></a>
-<span class="sourceLineNo">125</span><a name="line.125"></a>
-<span class="sourceLineNo">126</span>            if(entityValue &gt; 0xFFFF) {<a name="line.126"></a>
-<span class="sourceLineNo">127</span>                final char[] chrs = Character.toChars(entityValue);<a name="line.127"></a>
-<span class="sourceLineNo">128</span>                out.write(chrs[0]);<a name="line.128"></a>
-<span class="sourceLineNo">129</span>                out.write(chrs[1]);<a name="line.129"></a>
-<span class="sourceLineNo">130</span>            } else {<a name="line.130"></a>
-<span class="sourceLineNo">131</span>                out.write(entityValue);<a name="line.131"></a>
-<span class="sourceLineNo">132</span>            }<a name="line.132"></a>
-<span class="sourceLineNo">133</span><a name="line.133"></a>
-<span class="sourceLineNo">134</span>            return 2 + end - start + (isHex ? 1 : 0) + (semiNext ? 1 : 0);<a name="line.134"></a>
-<span class="sourceLineNo">135</span>        }<a name="line.135"></a>
-<span class="sourceLineNo">136</span>        return 0;<a name="line.136"></a>
-<span class="sourceLineNo">137</span>    }<a name="line.137"></a>
-<span class="sourceLineNo">138</span>}<a name="line.138"></a>
+<span class="sourceLineNo">109</span>                } else {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>                    if (isSet(OPTION.errorIfNoSemiColon)) {<a name="line.110"></a>
+<span class="sourceLineNo">111</span>                        throw new IllegalArgumentException("Semi-colon required at end of numeric entity");<a name="line.111"></a>
+<span class="sourceLineNo">112</span>                    }<a name="line.112"></a>
+<span class="sourceLineNo">113</span>                }<a name="line.113"></a>
+<span class="sourceLineNo">114</span>            }<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span>            int entityValue;<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            try {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>                if (isHex) {<a name="line.118"></a>
+<span class="sourceLineNo">119</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16);<a name="line.119"></a>
+<span class="sourceLineNo">120</span>                } else {<a name="line.120"></a>
+<span class="sourceLineNo">121</span>                    entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10);<a name="line.121"></a>
+<span class="sourceLineNo">122</span>                }<a name="line.122"></a>
+<span class="sourceLineNo">123</span>            } catch (final NumberFormatException nfe) {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>                return 0;<a name="line.124"></a>
+<span class="sourceLineNo">125</span>            }<a name="line.125"></a>
+<span class="sourceLineNo">126</span><a name="line.126"></a>
+<span class="sourceLineNo">127</span>            if (entityValue &gt; 0xFFFF) {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>                final char[] chrs = Character.toChars(entityValue);<a name="line.128"></a>
+<span class="sourceLineNo">129</span>                out.write(chrs[0]);<a name="line.129"></a>
+<span class="sourceLineNo">130</span>                out.write(chrs[1]);<a name="line.130"></a>
+<span class="sourceLineNo">131</span>            } else {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>                out.write(entityValue);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>            }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>            return 2 + end - start + (isHex ? 1 : 0) + (semiNext ? 1 : 0);<a name="line.135"></a>
+<span class="sourceLineNo">136</span>        }<a name="line.136"></a>
+<span class="sourceLineNo">137</span>        return 0;<a name="line.137"></a>
+<span class="sourceLineNo">138</span>    }<a name="line.138"></a>
+<span class="sourceLineNo">139</span>}<a name="line.139"></a>
 
 
 

Modified: websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/OctalUnescaper.html
==============================================================================
--- websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/OctalUnescaper.html (original)
+++ websites/production/commons/content/proper/commons-text/apidocs/src-html/org/apache/commons/text/translate/OctalUnescaper.html Sun Mar 12 02:08:01 2017
@@ -13,9 +13,9 @@
 <span class="sourceLineNo">005</span> * The ASF licenses this file to You under the Apache License, Version 2.0<a name="line.5"></a>
 <span class="sourceLineNo">006</span> * (the "License"); you may not use this file except in compliance with<a name="line.6"></a>
 <span class="sourceLineNo">007</span> * the License.  You may obtain a copy of the License at<a name="line.7"></a>
-<span class="sourceLineNo">008</span> * <a name="line.8"></a>
+<span class="sourceLineNo">008</span> *<a name="line.8"></a>
 <span class="sourceLineNo">009</span> *      http://www.apache.org/licenses/LICENSE-2.0<a name="line.9"></a>
-<span class="sourceLineNo">010</span> * <a name="line.10"></a>
+<span class="sourceLineNo">010</span> *<a name="line.10"></a>
 <span class="sourceLineNo">011</span> * Unless required by applicable law or agreed to in writing, software<a name="line.11"></a>
 <span class="sourceLineNo">012</span> * distributed under the License is distributed on an "AS IS" BASIS,<a name="line.12"></a>
 <span class="sourceLineNo">013</span> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<a name="line.13"></a>
@@ -32,7 +32,7 @@
 <span class="sourceLineNo">024</span> *<a name="line.24"></a>
 <span class="sourceLineNo">025</span> * For example, "\45" should go back to being the specific value (a %).<a name="line.25"></a>
 <span class="sourceLineNo">026</span> *<a name="line.26"></a>
-<span class="sourceLineNo">027</span> * Note that this currently only supports the viable range of octal for Java; namely <a name="line.27"></a>
+<span class="sourceLineNo">027</span> * Note that this currently only supports the viable range of octal for Java; namely<a name="line.27"></a>
 <span class="sourceLineNo">028</span> * 1 to 377. This is because parsing Java is the main use case.<a name="line.28"></a>
 <span class="sourceLineNo">029</span> *<a name="line.29"></a>
 <span class="sourceLineNo">030</span> * @since 1.0<a name="line.30"></a>
@@ -46,7 +46,7 @@
 <span class="sourceLineNo">038</span>    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {<a name="line.38"></a>
 <span class="sourceLineNo">039</span>        final int remaining = input.length() - index - 1; // how many characters left, ignoring the first \<a name="line.39"></a>
 <span class="sourceLineNo">040</span>        final StringBuilder builder = new StringBuilder();<a name="line.40"></a>
-<span class="sourceLineNo">041</span>        if(input.charAt(index) == '\\' &amp;&amp; remaining &gt; 0 &amp;&amp; isOctalDigit(input.charAt(index + 1)) ) {<a name="line.41"></a>
+<span class="sourceLineNo">041</span>        if (input.charAt(index) == '\\' &amp;&amp; remaining &gt; 0 &amp;&amp; isOctalDigit(input.charAt(index + 1))) {<a name="line.41"></a>
 <span class="sourceLineNo">042</span>            final int next = index + 1;<a name="line.42"></a>
 <span class="sourceLineNo">043</span>            final int next2 = index + 2;<a name="line.43"></a>
 <span class="sourceLineNo">044</span>            final int next3 = index + 3;<a name="line.44"></a>
@@ -54,14 +54,14 @@
 <span class="sourceLineNo">046</span>            // we know this is good as we checked it in the if block above<a name="line.46"></a>
 <span class="sourceLineNo">047</span>            builder.append(input.charAt(next));<a name="line.47"></a>
 <span class="sourceLineNo">048</span><a name="line.48"></a>
-<span class="sourceLineNo">049</span>            if(remaining &gt; 1 &amp;&amp; isOctalDigit(input.charAt(next2))) {<a name="line.49"></a>
+<span class="sourceLineNo">049</span>            if (remaining &gt; 1 &amp;&amp; isOctalDigit(input.charAt(next2))) {<a name="line.49"></a>
 <span class="sourceLineNo">050</span>                builder.append(input.charAt(next2));<a name="line.50"></a>
-<span class="sourceLineNo">051</span>                if(remaining &gt; 2 &amp;&amp; isZeroToThree(input.charAt(next)) &amp;&amp; isOctalDigit(input.charAt(next3))) {<a name="line.51"></a>
+<span class="sourceLineNo">051</span>                if (remaining &gt; 2 &amp;&amp; isZeroToThree(input.charAt(next)) &amp;&amp; isOctalDigit(input.charAt(next3))) {<a name="line.51"></a>
 <span class="sourceLineNo">052</span>                    builder.append(input.charAt(next3));<a name="line.52"></a>
 <span class="sourceLineNo">053</span>                }<a name="line.53"></a>
 <span class="sourceLineNo">054</span>            }<a name="line.54"></a>
 <span class="sourceLineNo">055</span><a name="line.55"></a>
-<span class="sourceLineNo">056</span>            out.write( Integer.parseInt(builder.toString(), 8) );<a name="line.56"></a>
+<span class="sourceLineNo">056</span>            out.write(Integer.parseInt(builder.toString(), 8));<a name="line.56"></a>
 <span class="sourceLineNo">057</span>            return 1 + builder.length();<a name="line.57"></a>
 <span class="sourceLineNo">058</span>        }<a name="line.58"></a>
 <span class="sourceLineNo">059</span>        return 0;<a name="line.59"></a>



Mime
View raw message