summaryrefslogtreecommitdiff
path: root/docs/jacoco-ut/bjc.everge/StringUtils.java.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/jacoco-ut/bjc.everge/StringUtils.java.html')
-rw-r--r--docs/jacoco-ut/bjc.everge/StringUtils.java.html172
1 files changed, 89 insertions, 83 deletions
diff --git a/docs/jacoco-ut/bjc.everge/StringUtils.java.html b/docs/jacoco-ut/bjc.everge/StringUtils.java.html
index f701116..3b48c10 100644
--- a/docs/jacoco-ut/bjc.everge/StringUtils.java.html
+++ b/docs/jacoco-ut/bjc.everge/StringUtils.java.html
@@ -19,12 +19,12 @@ import java.util.regex.Pattern;
* Split a string on every occurrence of a string not preceded by an escape.
*
* @param escape
- * The escape that stops splitting.
+ * The escape that stops splitting.
* @param splat
- * The string to split on. If this starts with the escape sequence, things will work
- * poorly.
+ * The string to split on. If this starts with the escape
+ * sequence, things will work poorly.
* @param inp
- * The string to split.
+ * The string to split.
* @return The string split as specified above.
*/
public static String[] escapeSplit(String escape, String splat, String inp) {
@@ -34,185 +34,191 @@ import java.util.regex.Pattern;
// No input
<span class="pc bpc" id="L36" title="2 of 4 branches missed."> if (inp == null || inp.equals(&quot;&quot;)) {</span>
-<span class="nc" id="L37"> return new String[] {inp};</span>
+<span class="nc" id="L37"> return new String[] {</span>
+ inp
+ };
}
// Input does not contain any delimiters
-<span class="fc bfc" id="L41" title="All 2 branches covered."> if (!inp.contains(splat)) {</span>
-<span class="fc" id="L42"> return new String[] {inp};</span>
+<span class="fc bfc" id="L43" title="All 2 branches covered."> if (!inp.contains(splat)) {</span>
+<span class="fc" id="L44"> return new String[] {</span>
+ inp
+ };
}
// No escape, so we can just split normally
-<span class="pc bpc" id="L46" title="1 of 4 branches missed."> if (escape == null || escape.equals(&quot;&quot;)) {</span>
-<span class="fc" id="L47"> return inp.split(Pattern.quote(splat));</span>
+<span class="pc bpc" id="L50" title="1 of 4 branches missed."> if (escape == null || escape.equals(&quot;&quot;)) {</span>
+<span class="fc" id="L51"> return inp.split(Pattern.quote(splat));</span>
}
-<span class="fc" id="L50"> List&lt;String&gt; ret = new ArrayList&lt;&gt;();</span>
+<span class="fc" id="L54"> List&lt;String&gt; ret = new ArrayList&lt;&gt;();</span>
/*
* Set up working variables
*/
// Copy of parameters
-<span class="fc" id="L57"> String wrk = inp;</span>
+<span class="fc" id="L61"> String wrk = inp;</span>
// Index of first occurrence of split string
-<span class="fc" id="L60"> int sidx = wrk.indexOf(splat);</span>
+<span class="fc" id="L64"> int sidx = wrk.indexOf(splat);</span>
// Index of first occurrence of escaped string
-<span class="fc" id="L62"> int eidx = wrk.indexOf(escape);</span>
+<span class="fc" id="L66"> int eidx = wrk.indexOf(escape);</span>
// Was the last thing we saw an escape?
- // This is used to enable the handling of escaping escapes
-<span class="fc" id="L66"> boolean hadEscape = false;</span>
+ // This is used to enable the handling of escaping escapes
+<span class="fc" id="L70"> boolean hadEscape = false;</span>
// As long as there an occurrence of either the split/escape
-<span class="fc bfc" id="L69" title="All 4 branches covered."> while (sidx != -1 || eidx != -1) {</span>
+<span class="fc bfc" id="L73" title="All 4 branches covered."> while (sidx != -1 || eidx != -1) {</span>
// If there is an escape before a split
-<span class="fc bfc" id="L71" title="All 4 branches covered."> if (eidx &gt; 0 &amp;&amp; eidx &lt; sidx) {</span>
-<span class="pc bpc" id="L72" title="1 of 2 branches missed."> if (isDebug) System.err.printf(&quot;[TRACE] Considering escape\n&quot;);</span>
+<span class="fc bfc" id="L75" title="All 4 branches covered."> if (eidx &gt; 0 &amp;&amp; eidx &lt; sidx) {</span>
+<span class="pc bpc" id="L76" title="1 of 2 branches missed."> if (isDebug)</span>
+<span class="nc" id="L77"> System.err.printf(&quot;[TRACE] Considering escape\n&quot;);</span>
/*
- * We potentially have an escaped sequence:
- * - either an escaped split
- * - or an escaped escape
+ * We potentially have an escaped sequence: - either an escaped split - or
+ * an escaped escape
*/
// Check for an escaped split
-<span class="fc" id="L81"> boolean hasEscapedSplit = wrk.startsWith(splat, eidx + escape.length());</span>
-<span class="fc bfc" id="L82" title="All 2 branches covered."> if (hasEscapedSplit) {</span>
+<span class="fc" id="L85"> boolean hasEscapedSplit = wrk.startsWith(splat, eidx + escape.length());</span>
+<span class="fc bfc" id="L86" title="All 2 branches covered."> if (hasEscapedSplit) {</span>
// Skip over it
-<span class="fc" id="L84"> int ofst = eidx + splat.length();</span>
+<span class="fc" id="L88"> int ofst = eidx + splat.length();</span>
-<span class="fc" id="L86"> wrk = sliceStringL(wrk, eidx, escape.length());</span>
+<span class="fc" id="L90"> wrk = sliceStringL(wrk, eidx, escape.length());</span>
// Recalculate indexes
-<span class="fc" id="L89"> sidx = wrk.indexOf(splat, ofst);</span>
-<span class="fc" id="L90"> eidx = wrk.indexOf(escape, ofst);</span>
+<span class="fc" id="L93"> sidx = wrk.indexOf(splat, ofst);</span>
+<span class="fc" id="L94"> eidx = wrk.indexOf(escape, ofst);</span>
-<span class="pc bpc" id="L92" title="1 of 2 branches missed."> if (isDebug) {</span>
-<span class="nc" id="L93"> System.err.printf(&quot;[TRACE] After esc. split (%s) %d/%d\n&quot;,</span>
-<span class="nc" id="L94"> wrk, sidx, eidx);</span>
+<span class="pc bpc" id="L96" title="1 of 2 branches missed."> if (isDebug) {</span>
+<span class="nc" id="L97"> System.err.printf(&quot;[TRACE] After esc. split (%s) %d/%d\n&quot;, wrk,</span>
+<span class="nc" id="L98"> sidx, eidx);</span>
}
// No pending escape
-<span class="fc" id="L98"> hadEscape = false;</span>
-<span class="fc" id="L99"> continue;</span>
+<span class="fc" id="L102"> hadEscape = false;</span>
+<span class="fc" id="L103"> continue;</span>
}
// Check for an escaped escape
-<span class="fc" id="L103"> boolean hasEscapedEscape = wrk.startsWith(escape, eidx + escape.length());</span>
-<span class="pc bpc" id="L104" title="1 of 2 branches missed."> if (hasEscapedEscape) {</span>
+<span class="fc" id="L107"> boolean hasEscapedEscape = wrk.startsWith(escape, eidx + escape.length());</span>
+<span class="pc bpc" id="L108" title="1 of 2 branches missed."> if (hasEscapedEscape) {</span>
// Skip over it
-<span class="fc" id="L106"> int ofst = eidx + escape.length();</span>
+<span class="fc" id="L110"> int ofst = eidx + escape.length();</span>
-<span class="fc" id="L108"> wrk = sliceStringL(wrk, eidx, escape.length());</span>
+<span class="fc" id="L112"> wrk = sliceStringL(wrk, eidx, escape.length());</span>
// Recalculate indexes
-<span class="fc" id="L111"> sidx = wrk.indexOf(splat, ofst);</span>
-<span class="fc" id="L112"> eidx = wrk.indexOf(escape, ofst);</span>
+<span class="fc" id="L115"> sidx = wrk.indexOf(splat, ofst);</span>
+<span class="fc" id="L116"> eidx = wrk.indexOf(escape, ofst);</span>
-<span class="pc bpc" id="L114" title="1 of 2 branches missed."> if (isDebug) {</span>
-<span class="nc" id="L115"> System.err.printf(&quot;[TRACE] After esc. escape (%s)/(%s) %d/%d\n&quot;,</span>
-<span class="nc" id="L116"> wrk, wrk.substring(ofst), sidx, eidx);</span>
+<span class="pc bpc" id="L118" title="1 of 2 branches missed."> if (isDebug) {</span>
+<span class="nc" id="L119"> System.err.printf(&quot;[TRACE] After esc. escape (%s)/(%s) %d/%d\n&quot;,</span>
+<span class="nc" id="L120"> wrk, wrk.substring(ofst), sidx, eidx);</span>
}
// There's a pending escape
-<span class="fc" id="L120"> hadEscape = true;</span>
-<span class="fc" id="L121"> continue;</span>
+<span class="fc" id="L124"> hadEscape = true;</span>
+<span class="fc" id="L125"> continue;</span>
}
}
// Calculate whether there is currently an escape
-<span class="fc" id="L126"> boolean hasEscape = false;</span>
+<span class="fc" id="L130"> boolean hasEscape = false;</span>
{
-<span class="fc" id="L128"> boolean tmp = wrk.startsWith(escape, sidx - escape.length());</span>
+<span class="fc" id="L132"> boolean tmp = wrk.startsWith(escape, sidx - escape.length());</span>
// boolean tmp = wrk.regionMatches(lo, escape, 0, escape.length());
-<span class="fc bfc" id="L131" title="All 2 branches covered."> hasEscape = hadEscape ? false : tmp;</span>
+<span class="fc bfc" id="L135" title="All 2 branches covered."> hasEscape = hadEscape ? false : tmp;</span>
}
// Handle anything that the pending escape may be applied to
-<span class="pc bpc" id="L135" title="1 of 4 branches missed."> while (sidx != -1 &amp;&amp; hasEscape) {</span>
-<span class="nc" id="L136"> int oidx = wrk.indexOf(splat, sidx + escape.length());</span>
+<span class="pc bpc" id="L139" title="1 of 4 branches missed."> while (sidx != -1 &amp;&amp; hasEscape) {</span>
+<span class="nc" id="L140"> int oidx = wrk.indexOf(splat, sidx + escape.length());</span>
-<span class="nc bnc" id="L138" title="All 2 branches missed."> if (oidx == -1) break;</span>
+<span class="nc bnc" id="L142" title="All 2 branches missed."> if (oidx == -1)</span>
+<span class="nc" id="L143"> break;</span>
-<span class="nc" id="L140"> wrk = sliceStringL(wrk, oidx, escape.length());</span>
+<span class="nc" id="L145"> wrk = sliceStringL(wrk, oidx, escape.length());</span>
-<span class="nc" id="L142"> sidx = oidx;</span>
+<span class="nc" id="L147"> sidx = oidx;</span>
-<span class="nc" id="L144"> hasEscape = wrk.startsWith(escape, sidx - escape.length());</span>
-<span class="nc" id="L145"> }</span>
+<span class="nc" id="L149"> hasEscape = wrk.startsWith(escape, sidx - escape.length());</span>
+<span class="nc" id="L150"> }</span>
-<span class="fc bfc" id="L147" title="All 2 branches covered."> if (sidx == -1) {</span>
-<span class="fc" id="L148"> break;</span>
+<span class="fc bfc" id="L152" title="All 2 branches covered."> if (sidx == -1) {</span>
+<span class="fc" id="L153"> break;</span>
}
-<span class="fc" id="L151"> String tmp = wrk.substring(0, sidx);</span>
+<span class="fc" id="L156"> String tmp = wrk.substring(0, sidx);</span>
-<span class="pc bpc" id="L153" title="1 of 2 branches missed."> if (isDebug) {</span>
-<span class="nc" id="L154"> System.err.printf(&quot;[TRACE] Adding (%s) to returned splits; (%s)\n&quot;,</span>
-<span class="nc" id="L155"> tmp, wrk.substring(sidx));</span>
+<span class="pc bpc" id="L158" title="1 of 2 branches missed."> if (isDebug) {</span>
+<span class="nc" id="L159"> System.err.printf(&quot;[TRACE] Adding (%s) to returned splits; (%s)\n&quot;, tmp,</span>
+<span class="nc" id="L160"> wrk.substring(sidx));</span>
}
-<span class="fc" id="L158"> ret.add(tmp);</span>
-<span class="pc bpc" id="L159" title="1 of 4 branches missed."> if (!tmp.equals(&quot;&quot;) &amp;&amp; wrk.endsWith(tmp)) {</span>
-<span class="nc" id="L160"> wrk = &quot;&quot;;</span>
+<span class="fc" id="L163"> ret.add(tmp);</span>
+<span class="pc bpc" id="L164" title="1 of 4 branches missed."> if (!tmp.equals(&quot;&quot;) &amp;&amp; wrk.endsWith(tmp)) {</span>
+<span class="nc" id="L165"> wrk = &quot;&quot;;</span>
} else {
-<span class="pc bpc" id="L162" title="1 of 2 branches missed."> if (wrk.indexOf(splat, sidx) != -1) {</span>
-<span class="fc" id="L163"> wrk = wrk.substring(sidx + splat.length());</span>
+<span class="pc bpc" id="L167" title="1 of 2 branches missed."> if (wrk.indexOf(splat, sidx) != -1) {</span>
+<span class="fc" id="L168"> wrk = wrk.substring(sidx + splat.length());</span>
} else {
-<span class="nc" id="L165"> wrk = wrk.substring(sidx);</span>
+<span class="nc" id="L170"> wrk = wrk.substring(sidx);</span>
}
}
-<span class="fc" id="L169"> sidx = wrk.indexOf(splat);</span>
-<span class="fc" id="L170"> eidx = wrk.indexOf(escape);</span>
+<span class="fc" id="L174"> sidx = wrk.indexOf(splat);</span>
+<span class="fc" id="L175"> eidx = wrk.indexOf(escape);</span>
-<span class="fc" id="L172"> hadEscape = false;</span>
-<span class="fc" id="L173"> }</span>
+<span class="fc" id="L177"> hadEscape = false;</span>
+<span class="fc" id="L178"> }</span>
-<span class="fc bfc" id="L175" title="All 2 branches covered."> if (!wrk.equals(&quot;&quot;)) ret.add(wrk);</span>
+<span class="fc bfc" id="L180" title="All 2 branches covered."> if (!wrk.equals(&quot;&quot;))</span>
+<span class="fc" id="L181"> ret.add(wrk);</span>
-<span class="fc" id="L177"> return ret.toArray(new String[0]);</span>
+<span class="fc" id="L183"> return ret.toArray(new String[0]);</span>
}
/**
* Slice a substring out of another string.
*
* @param strang
- * The string to remove a substring from.
+ * The string to remove a substring from.
* @param lft
- * The left-side of the substring to remove.
+ * The left-side of the substring to remove.
* @param rft
- * The right-side of the substring to remove.
+ * The right-side of the substring to remove.
*
* @return The string, with the substring removed.
*/
public static String sliceString(String strang, int lft, int rft) {
-<span class="fc" id="L193"> String leftSide = strang.substring(0, lft);</span>
-<span class="fc" id="L194"> String rightSide = strang.substring(rft);</span>
+<span class="fc" id="L199"> String leftSide = strang.substring(0, lft);</span>
+<span class="fc" id="L200"> String rightSide = strang.substring(rft);</span>
-<span class="fc" id="L196"> return leftSide + rightSide;</span>
+<span class="fc" id="L202"> return leftSide + rightSide;</span>
}
/**
* Slice a substring out of another string.
*
* @param strang
- * The string to remove a substring from.
+ * The string to remove a substring from.
* @param lft
- * The left-side of the substring to remove.
+ * The left-side of the substring to remove.
* @param len
- * The length of the substring to remove.
+ * The length of the substring to remove.
*
* @return The string, with the substring removed.
*/
public static String sliceStringL(String strang, int lft, int len) {
-<span class="fc" id="L212"> String leftSide = strang.substring(0, lft);</span>
-<span class="fc" id="L213"> String rightSide = strang.substring(lft + len);</span>
+<span class="fc" id="L218"> String leftSide = strang.substring(0, lft);</span>
+<span class="fc" id="L219"> String rightSide = strang.substring(lft + len);</span>
-<span class="fc" id="L215"> return leftSide + rightSide;</span>
+<span class="fc" id="L221"> return leftSide + rightSide;</span>
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.2.201808211720</span></div></body></html> \ No newline at end of file