if (parent != null) { startPos = parent.getDocument().createPosition(start); endPos = parent.getDocument().createPosition(end); } else { startPos = createPosition(start); endPos = createPosition(end); }
startPos = createPosition(start - startDelta); endPos = createPosition(end - endDelta);
    public LeafElement(Element parent, AttributeSet attributes, int start,                       int end)    {      super(parent, attributes);	{	  try	    {	      if (parent != null)		{		  startPos = parent.getDocument().createPosition(start);		  endPos = parent.getDocument().createPosition(end);		}	      else		{		  startPos = createPosition(start);		  endPos = createPosition(end);		}	    }	  catch (BadLocationException ex)	    {	      AssertionError as;	      as = new AssertionError("BadLocationException thrown "				      + "here. start=" + start				      + ", end=" + end				      + ", length=" + getLength());	      as.initCause(ex);	      throw as;	    }	}    }