Hi I am writing a satisifiability checker and I have a Literal
class
I need:
Literal
's details/states
Literal
.toString
method. Which one should I put in the toString
and which one should I create a new method for? Is there a convention for this type of stuff? If yes is there a reason?
Update
My details/states string looks like:
String.format("Full literal: %s, raw literal: %s, negated: %s, " +
"tautology: %s, contradiction: %s, assigned: %s",
this.fullLiteral, this.rawLiteral,
this.isNegated, this.isTautology,
this.isContradiction, this.isAssigned ? this.truthValue : "null");
My raw literal string looks like:
return String.format("Raw literal: %s", this.rawLiteral);
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
This may support my comment about using toString()
for getting a detailed string (and consequently having a different method, like getRaw()
for getting the raw data)