/** * Gets the token representation of this item in RPN * * @return the bytes applicable to this formula */ byte[] getBytes() { handleSpecialCases(); // Get the data for the operands - in the correct order ParseItem[] operands = getOperands(); byte[] data = new byte[0]; for (int i = 0 ; i < operands.length ; i++) { byte[] opdata = operands[i].getBytes(); // Grow the array byte[] newdata = new byte[data.length + opdata.length]; System.arraycopy(data, 0, newdata, 0, data.length); System.arraycopy(opdata, 0, newdata, data.length, opdata.length); data = newdata; } // Add on the operator byte byte[] newdata = new byte[data.length + 4]; System.arraycopy(data, 0, newdata, 0, data.length); newdata[data.length] = !useAlternateCode() ? Token.FUNCTIONVARARG.getCode() : Token.FUNCTIONVARARG.getCode2() ; newdata[data.length+1] = (byte) arguments; IntegerHelper.getTwoBytes(function.getCode(), newdata, data.length+2); return newdata; }
/** * Gets the token representation of this item in RPN * * @return the bytes applicable to this formula */ byte[] getBytes() { handleSpecialCases(); // Get the data for the operands - in the correct order ParseItem[] operands = getOperands(); byte[] data = new byte[0]; for (int i = 0 ; i < operands.length ; i++) { byte[] opdata = operands[i].getBytes(); // Grow the array byte[] newdata = new byte[data.length + opdata.length]; System.arraycopy(data, 0, newdata, 0, data.length); System.arraycopy(opdata, 0, newdata, data.length, opdata.length); data = newdata; } // Add on the operator byte byte[] newdata = new byte[data.length + 4]; System.arraycopy(data, 0, newdata, 0, data.length); newdata[data.length] = !useAlternateCode() ? Token.FUNCTIONVARARG.getCode() : Token.FUNCTIONVARARG.getCode2() ; newdata[data.length+1] = (byte) arguments; IntegerHelper.getTwoBytes(function.getCode(), newdata, data.length+2); return newdata; }