public class InMemorySpace extends java.lang.Object implements Space
Space
interface.
The provided implementation is immutable and, therefore, instances can be freely shared. Moreover, the class keeps track of all the instances created so far that are still alive, reusing them when it is possible or, in other words, avoiding the creation of new instances unless it is strictly necessary.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static InMemorySpace |
getInstance(java.lang.String text)
Returns an
InMemorySpace with the given text. |
java.lang.String |
getText()
Returns the text that forms this element.
|
int |
hashCode() |
java.lang.String |
toString() |
public static InMemorySpace getInstance(java.lang.String text)
InMemorySpace
with the given text.text
- the text that the space to create should consist of.InMemorySpace
with the given text.public java.lang.String getText()
LeafElement
getText
in interface LeafElement
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object