public class Zone extends java.lang.Object implements java.lang.Iterable<Resource>
Zone class is a blueprint of a zone present in the network.
Zone can be created using
Network.createZone(String, Network.NetworkManagementStatusListener),
deleted using Network.deleteZone(Zone, Network.NetworkManagementStatusListener),
modified using
Network.moveResources(Zone, Zone, Resource[], Network.NetworkManagementStatusListener)
by user. All networks by default contain the default zone,
which is identified by DEFAULT_ZONE_ID.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_ZONE_ID
ID of default zone.
|
static java.lang.String |
defaultZoneName
Name of the default zone.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Zone(int zoneId,
Network parent)
The constructor of the current class.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
containsResource(Resource resource)
A function to check if a
Resource exists in the zone. |
int |
getId()
A function to get the zoneId of the zone.
|
java.lang.String |
getName()
A function to get the name of the zone.
|
Network |
getParent()
A function to get the parent Network of the zone.
|
java.util.Set<Resource> |
getResources()
A function to get the set of resources of the current zone.
|
int |
hashCode() |
protected void |
internalAddResource(Resource resource)
A function that would be triggered when a
Resource is added to this zone. |
protected void |
internalMarkAsReady()
A function that would be triggered to mark this zone as ready.
|
protected void |
internalRemoveResource(Resource resource)
A function that would be triggered when a
Resource is removed from this zone. |
protected void |
internalSetName(java.lang.String name)
A function that would be triggered when
zoneName is updated. |
protected void |
internalSetParent(Network parent)
A function that would be triggered when
parent is updated. |
boolean |
isReady()
A function suggesting if the zone is created from
NativeCallbacks.zoneInfoCallback(boolean, java.lang.String, int, java.lang.String, long[], java.lang.String[], java.lang.String[], java.lang.Object)
or retrieved from cache. |
java.util.Iterator<Resource> |
iterator() |
void |
setName(java.lang.String name,
Network.NetworkManagementStatusListener listener)
A function to set the name of the current zone.
|
java.lang.String |
toString() |
public static java.lang.String defaultZoneName
public static final int DEFAULT_ZONE_ID
protected Zone(int zoneId,
Network parent)
zoneId - The unique id of the zoneparent - The parent network of the zonepublic int getId()
public java.lang.String getName()
public java.util.Set<Resource> getResources()
public Network getParent()
public void setName(java.lang.String name,
Network.NetworkManagementStatusListener listener)
livingRoom
.setName(newName, (commandStatus, throwable) -> {
if (null != throwable) {
// client specific code.
}
});
name - The name that has to be set.listener - Listener which will get called with response.protected void internalAddResource(Resource resource)
Resource is added to this zone.resource - Resource that is added to this zone.protected void internalRemoveResource(Resource resource)
Resource is removed from this zone.resource - Resource that is removed from the zone.protected boolean containsResource(Resource resource)
Resource exists in the zone.protected void internalSetName(java.lang.String name)
zoneName is updated.name - Updated name of the zone.protected void internalMarkAsReady()
protected void internalSetParent(Network parent)
parent is updated.parent - parent network of the zone.public final int hashCode()
hashCode in class java.lang.Objectpublic boolean isReady()
NativeCallbacks.zoneInfoCallback(boolean, java.lang.String, int, java.lang.String, long[], java.lang.String[], java.lang.String[], java.lang.Object)
or retrieved from cache.public java.util.Iterator<Resource> iterator()
iterator in interface java.lang.Iterable<Resource>public java.lang.String toString()
toString in class java.lang.Object