protected void writeChangeRecord() throws IOException {
  boolean hasNewStyles=hasStyle && (fillStyles.size() > 0 || lineStyles.size() > 0);
  boolean hasMoveTo=(moveXY != null);
  boolean hasFillStyle0=fill0Index >= 0;
  boolean hasFillStyle1=fill1Index >= 0;
  boolean hasLineStyle=lineIndex >= 0;
  if ((!hasStyle) && hasFillStyle0) {
    hasFillStyle1=false;
  }
  if (hasNewStyles) {
    out.writeUBits(1,0);
    out.writeUBits(1,1);
    out.writeUBits(1,1);
    out.writeUBits(1,1);
    out.writeUBits(1,1);
    out.writeUBits(1,1);
    writeMoveXY(0,0);
    out.writeUBits(fillBits,0);
    out.writeUBits(fillBits,0);
    out.writeUBits(lineBits,0);
    if (fill0Index == 0) {
      fill0Index=-1;
    }
    if (fill1Index == 0) {
      fill1Index=-1;
    }
    if (lineIndex == 0) {
      lineIndex=-1;
    }
    fillBits=OutStream.determineUnsignedBitSize(fillStyles.size());
    lineBits=OutStream.determineUnsignedBitSize(lineStyles.size());
    writeStyles(fillStyles);
    writeStyles(lineStyles);
    out.writeUBits(4,fillBits);
    out.writeUBits(4,lineBits);
    writeChangeRecord();
    return;
  }
  if (hasFillStyle0 || hasFillStyle1 || hasLineStyle|| hasMoveTo) {
    out.writeUBits(1,0);
    out.writeUBits(1,0);
    out.writeUBits(1,hasLineStyle ? 1 : 0);
    out.writeUBits(1,hasFillStyle1 ? 1 : 0);
    out.writeUBits(1,hasFillStyle0 ? 1 : 0);
    out.writeUBits(1,hasMoveTo ? 1 : 0);
    if (hasMoveTo) {
      int moveX=moveXY[0];
      int moveY=moveXY[1];
      writeMoveXY(moveX,moveY);
    }
    if (hasFillStyle0) {
      out.writeUBits(fillBits,fill0Index);
    }
    if (hasFillStyle1) {
      out.writeUBits(fillBits,fill1Index);
    }
    if (hasLineStyle) {
      out.writeUBits(lineBits,lineIndex);
    }
    moveXY=null;
    fill0Index=-1;
    fill1Index=-1;
    lineIndex=-1;
  }
}

protected void writeChangeRecord ( ) throws IOException { boolean hasNewStyles = hasStyle && ( fillStyles . size ( ) > 0 || lineStyles . size ( ) > 0 ) ; boolean hasMoveTo = ( moveXY != null ) ; boolean hasFillStyle0 = fill0Index >= 0 ; boolean hasFillStyle1 = fill1Index >= 0 ; boolean hasLineStyle = lineIndex >= 0 ; if ( ( ! hasStyle ) && hasFillStyle0 ) { hasFillStyle1 = false ; } if ( hasNewStyles ) { out . writeUBits ( 1 , 0 ) ; out . writeUBits ( 1 , 1 ) ; out . writeUBits ( 1 , 1 ) ; out . writeUBits ( 1 , 1 ) ; out . writeUBits ( 1 , 1 ) ; out . writeUBits ( 1 , 1 ) ; writeMoveXY ( 0 , 0 ) ; out . writeUBits ( fillBits , 0 ) ; out . writeUBits ( fillBits , 0 ) ; out . writeUBits ( lineBits , 0 ) ; if ( fill0Index == 0 ) { fill0Index = - 1 ; } if ( fill1Index == 0 ) { fill1Index = - 1 ; } if ( lineIndex == 0 ) { lineIndex = - 1 ; } fillBits = OutStream . determineUnsignedBitSize ( fillStyles . size ( ) ) ; lineBits = OutStream . determineUnsignedBitSize ( lineStyles . size ( ) ) ; writeStyles ( fillStyles ) ; writeStyles ( lineStyles ) ; out . writeUBits ( 4 , fillBits ) ; out . writeUBits ( 4 , lineBits ) ; writeChangeRecord ( ) ; return ; } if ( hasFillStyle0 || hasFillStyle1 || hasLineStyle || hasMoveTo ) { out . writeUBits ( 1 , 0 ) ; out . writeUBits ( 1 , 0 ) ; out . writeUBits ( 1 , hasLineStyle ? 1 : 0 ) ; out . writeUBits ( 1 , hasFillStyle1 ? 1 : 0 ) ; out . writeUBits ( 1 , hasFillStyle0 ? 1 : 0 ) ; out . writeUBits ( 1 , hasMoveTo ? 1 : 0 ) ; if ( hasMoveTo ) { int moveX = moveXY [ 0 ] ; int moveY = moveXY [ 1 ] ; writeMoveXY ( moveX , moveY ) ; } if ( hasFillStyle0 ) { out . writeUBits ( fillBits , fill0Index ) ; } if ( hasFillStyle1 ) { out . writeUBits ( fillBits , fill1Index ) ; } if ( hasLineStyle ) { out . writeUBits ( lineBits , lineIndex ) ; } moveXY = null ; fill0Index = - 1 ; fill1Index = - 1 ; lineIndex = - 1 ; } }
description of the method
