throw new AssertionError("paragraph elements are expected to " + "be instances of " + "javax.swing.text.AbstractDocument.BranchElement"); }
{ removed = new Element[count - index]; newAdded = new Element[count - index]; added = new Element[]{result[0]}; } newAdded[0] = result[1]; for (int i = index; i < count; i++) { Element el2 = el.getElement(i); int ind = i - count + removed.length; removed[ind] = el2; if (ind != 0) newAdded[ind] = el2; }  ((BranchElement) el).replace(index, removed.length, added); addEdit(el, index, removed, added); BranchElement newPar = (BranchElement) createBranchElement(el.getParentElement(), el.getAttributes()); newPar.replace(0, 0, newAdded); res = new Element[]{ null, newPar };
    void split(Element el, int offset)    {      if (el instanceof AbstractElement)	{	  AbstractElement ael = (AbstractElement) el;	  int startOffset = ael.getStartOffset();	  int endOffset = ael.getEndOffset();	  int len = endOffset - startOffset;	  if (startOffset != offset && endOffset != offset)	    {	      Element paragraph = ael.getParentElement();	      if (paragraph instanceof BranchElement)		{		  BranchElement par = (BranchElement) paragraph;		  Element child1 = createLeafElement(par, ael, startOffset,						     offset);		  Element child2 = createLeafElement(par, ael, offset,						     endOffset);		  int index = par.getElementIndex(startOffset);          Element[] add = new Element[]{ child1, child2 };		  par.replace(index, 1, add);          documentEvent.addEdit(new ElementEdit(par, index,                                                new Element[]{ el },                                                add));		}              else                throw new AssertionError("paragraph elements are expected to "                                         + "be instances of "			  + "javax.swing.text.AbstractDocument.BranchElement");	    }	}      else	throw new AssertionError("content elements are expected to be "				 + "instances of "			+ "javax.swing.text.AbstractDocument.AbstractElement");    }