public class ModelInstance<T extends DataModelElement> extends Object implements DataModel<T>
| Constructor and Description |
|---|
ModelInstance(LocalModel<T> model) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T element)
Add a element to the model.
|
boolean |
contains(long elementId)
Check if the model contains a element by id.
|
void |
dispose() |
boolean |
equals(Object obj) |
Optional<T> |
get(long elementId)
Get a element by id.
|
Collection<T> |
getAll() |
long |
getId() |
int |
hashCode() |
boolean |
isEmpty() |
void |
register(DataModelChangeListener<T> listener)
Register a
DataModelChangeListener. |
void |
remove(long elementId)
Remove a element by id.
|
void |
remove(T element)
Remove a element by reference.
|
void |
removeAll()
Remove all elements.
|
int |
size() |
Stream<T> |
stream() |
void |
unregister(DataModelChangeListener<T> listener)
Unregister a
DataModelChangeListener. |
void |
update(T element)
Update the element.
|
public ModelInstance(LocalModel<T> model)
public void add(T element)
DataModeladd in interface DataModel<T extends DataModelElement>element - the elementpublic boolean contains(long elementId)
DataModelcontains in interface DataModel<T extends DataModelElement>elementId - the element idtrue if so, otherwise false.public void dispose()
public Optional<T> get(long elementId)
DataModelget in interface DataModel<T extends DataModelElement>elementId - the idOptionalpublic Collection<T> getAll()
getAll in interface DataModel<T extends DataModelElement>List of all elements.public long getId()
public boolean isEmpty()
isEmpty in interface DataModel<T extends DataModelElement>true if model is empty, otherwise false.public void register(DataModelChangeListener<T> listener)
DataModelDataModelChangeListener.register in interface DataModel<T extends DataModelElement>listener - the listenerpublic void remove(long elementId)
DataModelremove in interface DataModel<T extends DataModelElement>elementId - the idpublic void remove(T element)
DataModelremove in interface DataModel<T extends DataModelElement>element - the elementpublic void removeAll()
DataModelremoveAll in interface DataModel<T extends DataModelElement>public int size()
size in interface DataModel<T extends DataModelElement>public Stream<T> stream()
stream in interface DataModel<T extends DataModelElement>Stream of all elements.public void unregister(DataModelChangeListener<T> listener)
DataModelDataModelChangeListener.unregister in interface DataModel<T extends DataModelElement>listener - the listenerCopyright © 2017. All rights reserved.