public class ModelMakerImpl extends Object implements ModelMaker
| Constructor and Description |
|---|
ModelMakerImpl(GraphMaker maker) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the factory - no more requests need be honoured, and any clean-up
can be done.
|
Model |
createDefaultModel()
Answer this ModelSource's default model.
|
Model |
createFreshModel()
Answer a Model that satisfies this ModelSource's shape.
|
Model |
createModel(String name)
Create a Model with the given name if no such model exists.
|
Model |
createModel(String name,
boolean strict)
Create a new Model associated with the given name.
|
Model |
createModelOver(String name) |
GraphMaker |
getGraphMaker()
Answer a GraphMaker that makes graphs the same way this ModelMaker
makes models.
|
Model |
getModel(String URL)
ModelGetter implementation component.
|
Model |
getModel(String URL,
ModelReader loadIfAbsent)
Answer a model appropriate for
URL, If none is to hand,
and it's possible to create one, create it and load it using loadIfAbsent. |
boolean |
hasModel(String name)
return true iff the factory has a Model with the given name
|
ExtendedIterator<String> |
listModels()
Answer an [extended] iterator where each element is the name of a model in
the maker, and the complete sequence exhausts the set of names.
|
Model |
openModel() |
Model |
openModel(String name)
Answer a model.
|
Model |
openModel(String name,
boolean strict)
Find an existing Model that this factory knows about under the given
name.
|
Model |
openModelIfPresent(String name)
Answer the model named by
string in this ModelSource,
if it [still] has one, or null if there isn't one. |
void |
removeModel(String name)
Remove the association between the name and the Model.
|
public ModelMakerImpl(GraphMaker maker)
public GraphMaker getGraphMaker()
ModelMakergetGraphMaker in interface ModelMakerpublic void close()
ModelMakerclose in interface ModelMakerpublic Model openModel()
public Model openModelIfPresent(String name)
ModelSourcestring in this ModelSource,
if it [still] has one, or null if there isn't one.
The ModelSource should not create a fresh model if it
doesn't already have one.openModelIfPresent in interface ModelSourcepublic Model openModel(String name, boolean strict)
ModelMakerstrict
is false, create a new Model, associate it with the name, and return it.
Otherwise throw a DoesNotExistException.
When called with strict=false, is equivalent to the
ancestor openModel(String) method.
openModel in interface ModelMakername - the name of the Model to find and returnstrict - false to create a new one if one doesn't already existpublic Model openModel(String name)
ModelSourceIt is expected that uses of different names will answer different models (different in the strong sense of not having the same underlying graph, too).
If the ModelSource does not have a model with this name,
and if it is not prepared to create one, it should throw a
DoesNotExistException. This method never returns null.
openModel in interface ModelSourcepublic Model createModel(String name, boolean strict)
ModelMakerstrict
is false, return the associated Model. Otherwise throw an AlreadyExistsException.createModel in interface ModelMakername - the name to give to the new Modelstrict - true to cause existing bindings to throw an exceptionpublic Model createModel(String name)
ModelMakercreateModel( name, false ).createModel in interface ModelMakerpublic Model createFreshModel()
ModelSourcenull.createFreshModel in interface ModelSourcepublic Model createDefaultModel()
ModelSourcenull.createDefaultModel in interface ModelSourcepublic void removeModel(String name)
ModelMakerremoveModel in interface ModelMakername - the name to disassociatepublic boolean hasModel(String name)
ModelMakerhasModel in interface ModelMakername - the name of the Model to look forpublic ExtendedIterator<String> listModels()
ModelMakerlistModels in interface ModelMakerpublic Model getModel(String URL)
getModel in interface ModelGetterpublic Model getModel(String URL, ModelReader loadIfAbsent)
ModelGetterURL, If none is to hand,
and it's possible to create one, create it and load it using loadIfAbsent.
Otherwise throw CannotCreateException. This method never returns null.getModel in interface ModelGetterLicenced under the Apache License, Version 2.0