M - the specific type of modelpublic class VersionedModelInfos<M extends IModel>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<ModelInfo<M>> |
infos |
private Version |
version |
| Constructor and Description |
|---|
VersionedModelInfos(Version version)
Creates a new versioned model information container.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ModelInfo<M> info)
Adds a model information object.
|
void |
clear()
Removes all stored model information objects.
|
static <M extends IModel> |
find(java.util.List<VersionedModelInfos<M>> infos,
Version version)
Retrieves the version model information container with the specified version.
|
ModelInfo<M> |
find(java.net.URI uri)
Finds a model information object based on a give URI.
|
ModelInfo<M> |
get(int index)
Returns the specified model information object.
|
ModelInfo<M> |
get(M model)
Returns the model information objects with
model as resolved model. |
ModelInfo<M> |
get(java.net.URI uri)
Returns the model information objects with
uri as location. |
static <M extends IModel> |
getByClosestUri(java.util.List<ModelInfo<M>> infos,
java.net.URI uri,
java.util.List<java.lang.String> modelPath)
Returns the model information from
infos with the closest match
to uri, i.e. in closest in the same hierarchy path. |
ModelInfo<M> |
getByClosestUri(java.net.URI uri,
java.util.List<java.lang.String> modelPath)
Returns the model information with the closest match
to
uri, i.e. in closest in the same hierarchy path. |
java.util.List<ModelInfo<M>> |
getByEqualUri(java.net.URI uri)
Returns the model information with the exact match to
uri. |
Version |
getVersion()
Returns the version all information objects in this instance
are assigned to.
|
static boolean |
isFileScheme(java.net.URI uri)
Returns whether the given URI is a file (file scheme).
|
private static boolean |
isMatching(java.lang.String searchUriText,
java.util.List<java.lang.String> modelPath,
java.lang.String importUriText,
boolean contained)
Checks whether the
searchUriText (with precedence) ore one of the
modelPath URI paths match importUri, i.e. whether
importUri is an appropriate URI for import. |
private static boolean |
isMatching(java.lang.String searchUriText,
java.lang.String importUriText,
boolean contained)
Checks whether the
searchUriText and importUri match. |
static boolean |
isSame(java.net.URI uri1,
java.net.URI uri2)
Checks two URIs for equality.
|
static <M extends IModel> |
maxVersion(java.util.List<ModelInfo<M>> list)
Returns the model information object with highest version number from
list. |
static java.lang.String |
pathWithoutLastFragment(java.net.URI uri)
Returns the prefix path of the given
uri without the last fragment. |
ModelInfo<M> |
remove(int index)
Removes the specified model information object.
|
boolean |
remove(ModelInfo<M> info)
Removes the specified model information object.
|
private static <M extends IModel> |
search(java.util.List<ModelInfo<M>> infos,
java.lang.String searchUriText,
java.util.List<java.lang.String> modelPath)
Searches for the best match according to the IVML search conventions, first down along the given
URI, then up along the hierarchy.
|
private static <M extends IModel> |
searchOnParentLevel(java.util.List<ModelInfo<M>> infos,
java.net.URI uri,
java.util.List<java.lang.String> modelPath)
Searches for the best match within the parent-parent folders of
uri if that folder starts with
".". |
private static <M extends IModel> |
searchOnSameFolderLevel(java.util.List<ModelInfo<M>> infos,
java.net.URI uri,
java.util.List<java.lang.String> modelPath)
Search in folders on the level of the parent folder of
uri. |
int |
size()
Returns the number of contained version information objects.
|
java.util.List<ModelInfo<M>> |
toList(java.util.List<ModelInfo<M>> list)
Adds all model information objects to the given
list. |
java.lang.String |
toString()
Returns the textual representation of this instance.
|
private Version version
public VersionedModelInfos(Version version)
version - the version of this container (may be null)public void add(ModelInfo<M> info)
info - the object to be addedjava.lang.IllegalArgumentException - if the version of info does
not match version or the name of info does not match
the name of the first stored model information object (if there is any)public static final boolean isSame(java.net.URI uri1,
java.net.URI uri2)
uri1 - the first URI (may be null)uri2 - the second URI (may be null)true if both are the same, false elsepublic ModelInfo<M> get(int index)
index - the index of the object to be returnedjava.lang.IndexOutOfBoundsException - if index<0
|| index>=size()public ModelInfo<M> get(M model)
model as resolved model.model - the (resolved) model to search forpublic ModelInfo<M> get(java.net.URI uri)
uri as location.uri - the URI to search forpublic int size()
public ModelInfo<M> remove(int index)
index - the index of the object to be returnedjava.lang.IndexOutOfBoundsException - if index<0
|| index>=size()public void clear()
public boolean remove(ModelInfo<M> info)
info - the information object to be removedtrue if successful false elsepublic Version getVersion()
public java.util.List<ModelInfo<M>> getByEqualUri(java.net.URI uri)
uri.uri - the URI to match with (may be null then the first
information object is returned)public ModelInfo<M> getByClosestUri(java.net.URI uri, java.util.List<java.lang.String> modelPath)
uri, i.e. in closest in the same hierarchy path.uri - the URI to match with (may be null then the first
information object is returned)modelPath - additional URIs prefixes which shall be considered for importing,
similar to the Java classpath, may be nullpublic static <M extends IModel> ModelInfo<M> getByClosestUri(java.util.List<ModelInfo<M>> infos, java.net.URI uri, java.util.List<java.lang.String> modelPath)
infos with the closest match
to uri, i.e. in closest in the same hierarchy path.M - the model typeinfos - the information objects to be considereduri - the URI to match with (may be null then the first
information object is returned)modelPath - additional URIs prefixes which shall be considered for importing,
similar to the Java classpath, may be nullprivate static <M extends IModel> ModelInfo<M> search(java.util.List<ModelInfo<M>> infos, java.lang.String searchUriText, java.util.List<java.lang.String> modelPath)
M - the model typeinfos - the information objects to be consideredsearchUriText - the search folder URI as textmodelPath - additional URIs prefixes which shall be considered for importing,
similar to the Java classpath, may be nullprivate static <M extends IModel> ModelInfo<M> searchOnParentLevel(java.util.List<ModelInfo<M>> infos, java.net.URI uri, java.util.List<java.lang.String> modelPath)
uri if that folder starts with
".". This enables cross-links among parent models according to the convention EASy places imported IVML files.M - the model typeinfos - the information objects to be considereduri - the URI to start searchingmodelPath - additional URIs prefixes which shall be considered for importing,
similar to the Java classpath, may be nullprivate static <M extends IModel> ModelInfo<M> searchOnSameFolderLevel(java.util.List<ModelInfo<M>> infos, java.net.URI uri, java.util.List<java.lang.String> modelPath)
uri.M - the model typeinfos - the information objects to be considereduri - the URI to start searchingmodelPath - additional URIs prefixes which shall be considered for importing,
similar to the Java classpath, may be nullpublic static boolean isFileScheme(java.net.URI uri)
uri - the URI to test fortrue if it is a file, false elseprivate static boolean isMatching(java.lang.String searchUriText,
java.util.List<java.lang.String> modelPath,
java.lang.String importUriText,
boolean contained)
searchUriText (with precedence) ore one of the
modelPath URI paths match importUri, i.e. whether
importUri is an appropriate URI for import.searchUriText - the textual URI of the model stating the importmodelPath - additional URI paths, may be nullimportUriText - the URI path of the model being considered for importcontained - prefer contained or containing URIstrue if the specified data match, false if notprivate static boolean isMatching(java.lang.String searchUriText,
java.lang.String importUriText,
boolean contained)
searchUriText and importUri match.searchUriText - the textual URI of the model stating the importimportUriText - the URI path of the model being considered for importcontained - prefer contained or containing URIstrue if the specified data match, false if notpublic static java.lang.String pathWithoutLastFragment(java.net.URI uri)
uri without the last fragment.uri - the URI to be considereduri elsepublic java.util.List<ModelInfo<M>> toList(java.util.List<ModelInfo<M>> list)
list.list - the list to be modified as a side effect (may be null
then a list is created)list or the created listpublic java.lang.String toString()
toString in class java.lang.Objectpublic ModelInfo<M> find(java.net.URI uri)
uri - the URI to find the information objectpublic static <M extends IModel> VersionedModelInfos<M> find(java.util.List<VersionedModelInfos<M>> infos, Version version)
M - the specific type of modelinfos - a list of model information containers (may be null)version - the version to retrievepublic static <M extends IModel> ModelInfo<M> maxVersion(java.util.List<ModelInfo<M>> list)
list.
Unspecified versions are treated as implicit minimum.M - the actual model typelist - the list of model information objects to determine the maximum from (may be null)Copyright © 2009 - 2018 SSE. All Rights Reserved.