Prepare rule / formula classes to be ready for external API.

Since changes to external API requires extra review, we want to make the CL as
small as possible. So we make the changes in the internal directory first and
move them in one go. The class content is copied from http://ag/9652137.

Test: unit test.
Bug: 143689885
Change-Id: I00d4a782e2247b974c90a1cfe7ea151212e7b90d
12 files changed