package de.unisiegen.tpml.core.latex ;
/**
* Default implementation of the {@link LatexString} interface. Generated by the
* {@link DefaultLatexStringBuilder}s.
*
* @author Christian Fehler
* @see LatexString
* @see LatexStringBuilder
* @see DefaultLatexStringBuilder
*/
final class DefaultLatexString implements LatexString
{
/**
* The raw character content of the latex string.
*
* @see #toString()
*/
private String content ;
/**
* Allocates a new <code>DefaultLatexString</code> for the specified
* <code>pContent</code>.
*
* @param pContent The string representation of an expression.
* @see DefaultLatexStringBuilder#toLatexString()
*/
DefaultLatexString ( String pContent )
{
this.content = pContent ;
}
/**
* Returns <code>true</code> if the <code>pObject</code> is a
* <code>DefaultLatexString</code> with the same attribute values as this
* latex string instance.
*
* @param pObject Another object.
* @return <code>true</code> if <code>pObject</code> is equal to this
* latex string.
* @see Object#equals(Object)
*/
@ Override
public boolean equals ( Object pObject )
{
if ( pObject instanceof DefaultLatexString )
{
DefaultLatexString other = ( DefaultLatexString ) pObject ;
return this.content.equals ( other.content ) ;
}
return false ;
}
/**
* Returns a hash value for this latex string.
*
* @return a hash value for this latex string.
* @see Object#hashCode()
*/
@ Override
public int hashCode ( )
{
return this.content.hashCode ( ) ;
}
/**
* Returns the string representation of the latex string.
*
* @return The string representation of the latex string.
* @see Object#toString()
*/
@ Override
public String toString ( )
{
return this.content ;
}
}