public abstract class AbstractContainer extends java.lang.Object implements IContainer
Modifier | Constructor and Description |
---|---|
protected |
AbstractContainer() |
protected |
AbstractContainer(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addItem(IItem... items)
Adds one or more items to this container.
|
void |
appendNameTo(java.lang.StringBuilder builder)
Adds the name representation (which might be more than just the name itself)) to the given builder.
|
protected void |
basicAdd(IItem item)
Adds the given item if it s not null and if it is not yet in the item list
and sets this container as the container of the given item.
|
protected boolean |
basicEquals(java.lang.Object obj)
Compares just the names of the objects.
|
protected int |
basicHashCode()
Calculates just the hash code from the underlying name.
|
protected void |
basicRemove(IItem item)
Adds the given item if it s not null and if it is not yet in the item list.
|
protected boolean |
contains(IItem item) |
boolean |
equals(java.lang.Object obj) |
protected java.util.List<IItem> |
getItemList() |
java.util.List<IItem> |
getItems()
Returns all items of this container.
|
java.lang.String |
getName()
Returns the name of the element.
|
int |
hashCode() |
boolean |
isEmpty()
Returns whether or not this container contains items.
|
void |
release()
Release any resources that should not be referred to anymore in order
to let the garbage collector take care of them.
|
void |
removeItem(IItem... items)
Removes one or more items from this container.
|
void |
setName(java.lang.String name) |
int |
size()
Returns the number of currently contained items;
|
java.lang.String |
toString()
This is a debug method and to intended to be used for business logic.
|
protected AbstractContainer()
protected AbstractContainer(java.lang.String name)
public java.util.List<IItem> getItems()
IContainer
getItems
in interface IContainer
public int size()
IContainer
size
in interface IContainer
public boolean isEmpty()
IContainer
isEmpty
in interface IContainer
public void addItem(IItem... items)
IContainer
addItem
in interface IContainer
items
- One or more items to be added.public void removeItem(IItem... items)
IContainer
IReleasable.release()
method.removeItem
in interface IContainer
items
- One or more items to be removed.public void release()
IReleasable
release
in interface IReleasable
public java.lang.String getName()
INamedElement
getName
in interface INamedElement
public void appendNameTo(java.lang.StringBuilder builder)
INamedElement
appendNameTo
in interface INamedElement
builder
- The builder to which the name representation must be added.public void setName(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected void basicAdd(IItem item)
item
- The item to add.protected void basicRemove(IItem item)
item
- The item to add.protected boolean contains(IItem item)
protected int basicHashCode()
protected boolean basicEquals(java.lang.Object obj)
protected java.util.List<IItem> getItemList()