Add tern class

This class handles ternary logic with true, false and uncertain values.