void returnResponse() { try { int p = Math.min(initialPos, run.getDocument().getLength()); int l = Math.min(run.getDocument().getLength() - p, maxLen >= 0 ? maxLen : Integer.MAX_VALUE); resultQueue.offer(run.getText(p, l)); } catch (BadLocationException ex) { // this cannot happen resultQueue.offer(""); } }
public void setDot(FilterBypass fb, int dot, Bias bias) { if (dot < initialPos) { dot = Math.min(initialPos, run.getDocument().getLength()); } fb.setDot(dot, bias); }