Simple implementations of hashes, lists, numbers and scalars have been provided
as a convenience:
SimpleHash. All of the methods of
these models are synchronized. Unless you're doing something highly unusual,
you'll want to use a
SimpleHash for the root node.
In many cases, it will be sufficient to copy your data from its original
source into a tree of
SimpleHash objects. If you want to
implement lazy evaluation, or if you want to wrap existing data objects for
use with templates, you'll want to make adapter or wrapper classes that
TemplateModel interfaces. See the
sample code for an example.
In addition to the simple models above, there are also unsynchronized
To avoid excessive object creation, the values of
implemented as singletons.
Use the fast models when you are sure that there won't be any synchronization issues if you have multiple threads that can use the data model at the same time, or if you only use the data model within a single thread. Fast models will typically perform faster than their simple equivalents, due to the lack of synchronization blocks. The FM-Classic engine uses the fast models internally to hold intermediate results when evaluating expressions.
|Previous: Multiple Models||Next: Extended Models|