/** * Gets the token representation of this item in RPN * * @return the bytes applicable to this formula */ byte[] getBytes() { // Get the data for the operands 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 + 3]; System.arraycopy(data, 0, newdata, 0, data.length); newdata[data.length] = !useAlternateCode() ? Token.FUNCTION.getCode() : Token.FUNCTION.getCode2(); IntegerHelper.getTwoBytes(function.getCode(), newdata, data.length + 1); return newdata; }
/** * Gets the token representation of this item in RPN * * @return the bytes applicable to this formula */ byte[] getBytes() { // Get the data for the operands 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 + 3]; System.arraycopy(data, 0, newdata, 0, data.length); newdata[data.length] = !useAlternateCode() ? Token.FUNCTION.getCode() : Token.FUNCTION.getCode2(); IntegerHelper.getTwoBytes(function.getCode(), newdata, data.length + 1); return newdata; }