Thursday, April 4, 2013

Comparing RPN Lists

Eventually, the program model will hold the program lines in an internal incrementally compiled format the will be ready to run.  To detect when a line has changed, either the new line needs to be fully encoded into this internal format, the internal line needs to be converted (recreated) back into text, or both need to be converted to an intermediate comparable format.

I'm not sure at this moment which is best, but recreating the internal line back into text will not work because the recreated lines will not necessarily match the original lines.  For example, the line "C=3" and "C = 3" don't match as text, but the internal lines are identical.  Therefore, using text to compare is not an option unless the new line is compiled and then recreated (which is wasteful).

For now, the RPN lists will be compared.  This required comparison operator functions (for the == and != operators) to be implemented for the Token, RpnItem and RpnList classes.  Only the == operator function was fully implemented, with the != operator implemented as the opposite of the == operator.  The program line string list member of the program model was moved since it is no longer needed (second commit).

[commit f33bb20df2] [commit 3a2317910c]

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)