classes

## Class HolonObject

- java.lang.Object
- - classes.AbstractCpsObject
  - - classes.HolonObject

    public class HolonObject
    extends AbstractCpsObject

The class HolonObject represents any Object on the system which capability of injecting or consuming energy on the network, for instance a house or a power plant.

Author:
  Gruppe14

### Constructor Summary

Constructors
Constructor and Description
`HolonObject(AbstractCpsObject obj)` Contructor of a copy of an Object.
`HolonObject(java.lang.String objName)` Constructor Set by default the name of the object equals to the category name, until the user changes it.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addElements(HolonElement element)` adds an Element to the Object.
`boolean` `checkIfPartiallySupplied(int x)` Check if Partially Supplied.
`java.util.ArrayList<HolonElement>` `copyElements(java.util.ArrayList<HolonElement> arr)` Copy all Elements into a New Array.
`void` `deleteElement(int idx)` deletes Element at a given index.
`java.awt.Color` `getColor()` Get the Color.
`float` `getCurrentEnergy()` Doesn't take into account which timestep is watched, calculates the max values.
`float` `getCurrentEnergyAtTimeStep(int x)` Getter for the current energy at a given timestep.
`java.util.HashMap<java.lang.String,java.lang.Integer>` `getEleIdx()` Getter index of all elements in the HolonObject.
`java.util.ArrayList<HolonElement>` `getElements()` Getter for all Elements in the HolonObject.
`int` `getState()` Get the state of the Object.
`HolonElement` `searchElement(java.lang.String name)` Search for the element with the name.
`HolonElement` `searchElementById(int id)` Search for the element with the id.
`void` `setColor(java.awt.Color color)` Set the State Color.
`void` `setEleIdx(java.util.HashMap<java.lang.String,java.lang.Integer> eleIdx)` Set the indexes of all elements.
`void` `setElements(java.util.ArrayList<HolonElement> elements)` Set a new ArrayList with HolonElements into the HolonObject.
`void` `setState()` sets the State, wether object is a producer, zero Energy, supplied or not.
`void` `setState(int state)` Set the state of the Object.
`java.lang.String` `toStringElements()` String of all consumers in this HolonObject.

### Methods inherited from class classes.AbstractCpsObject

`addConnection, addPseudoTag, addTag, getBorderColor, getConnectedTo, getConnections, getID, getImage, getName, getObjName, getPosition, getPseudoTags, getSav, getTag, resetTags, setBorderColor, setConnections, setID, setImage, setName, setObjName, setPosition, setPosition, setPseudoTags, setSav, setTags`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HolonObject

    public HolonObject(java.lang.String objName)

Constructor Set by default the name of the object equals to the category name, until the user changes it.

Parameters:
  `objName` - name of the Object

#### HolonObject

    public HolonObject(AbstractCpsObject obj)

Contructor of a copy of an Object.

Parameters:
  `obj` - object to be copied

### Method Detail

#### setState

    public void setState()

sets the State, wether object is a producer, zero Energy, supplied or not.

#### getElements

    public java.util.ArrayList<HolonElement> getElements()

Getter for all Elements in the HolonObject.

Returns:
  the elements ArrayList

#### setElements

    public void setElements(java.util.ArrayList<HolonElement> elements)

Set a new ArrayList with HolonElements into the HolonObject.

Parameters:
  `elements` - the elements to set

#### addElements

    public void addElements(HolonElement element)

adds an Element to the Object.

Parameters:
  `element` - the Element to add

#### getCurrentEnergy

    public float getCurrentEnergy()

Doesn't take into account which timestep is watched, calculates the max values.

Returns:
  the currentEnergy

#### getCurrentEnergyAtTimeStep

    public float getCurrentEnergyAtTimeStep(int x)

Getter for the current energy at a given timestep.

Parameters:
  `x` - timestep
Returns:
  corresponding energy

#### deleteElement

    public void deleteElement(int idx)

deletes Element at a given index.

Parameters:
  `idx` - index

#### toStringElements

    public java.lang.String toStringElements()

String of all consumers in this HolonObject.

Returns:
  all the names of this HolonObject separated by "," each object

#### getEleIdx

    public java.util.HashMap<java.lang.String,java.lang.Integer> getEleIdx()

Getter index of all elements in the HolonObject.

Returns:
  the eleIdx

#### setEleIdx

    public void setEleIdx(java.util.HashMap<java.lang.String,java.lang.Integer> eleIdx)

Set the indexes of all elements.

Parameters:
  `eleIdx` - the eleIdx to set

#### copyElements

    public java.util.ArrayList<HolonElement> copyElements(java.util.ArrayList<HolonElement> arr)

Copy all Elements into a New Array.

Parameters:
  `arr` - to copy
Returns:
  the copy of arr

#### getState

    public int getState()

Get the state of the Object.

Returns:
  state the State of the Element

#### setState

    public void setState(int state)

Set the state of the Object.

Parameters:
  `state` - boolean if the Object is fully supplied

#### searchElement

    public HolonElement searchElement(java.lang.String name)

Search for the element with the name.

Parameters:
  `name` - name of the object to be searched
Returns:
  the searched HolonElement

#### searchElementById

    public HolonElement searchElementById(int id)

Search for the element with the id.

Parameters:
  `id` - id of the element to be founded
Returns:
  the element

#### checkIfPartiallySupplied

    public boolean checkIfPartiallySupplied(int x)

Check if Partially Supplied.

Parameters:
  `x` - current Iteration
Returns:
  boolean is partially supplied

#### setColor

    public void setColor(java.awt.Color color)

Set the State Color.

Parameters:
  `color` - the Color

#### getColor

    public java.awt.Color getColor()

Get the Color.

Returns:
  stateColor the Color