igeo

## Class IAgent

- java.lang.Object
- - igeo.IObject
  - - igeo.IAgent

- All Implemented Interfaces:
    IDynamics, ISubobject
  Direct Known Subclasses:
    IField, IFieldVisualizer, ILineAgent, ILinkedNodeMeshAgent, IMeshAgent, IPointAgent, IWall

      public class IAgent
      extends IObject
      implements IDynamics

  Class of an agent based on one point, extending IPoint and implements IDynamics
  Author:
    Satoru Sugihara

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `alive`
    `int` | `duration`
    `boolean` | `interactOverridden` check if a child class overrides void interact(IDynamics) or not
    `java.util.ArrayList<IDynamics>` | `localDynamics`
    `IObject` | `parent`
    `java.util.ArrayList<IObject>` | `targets` target objects to be updated by dynamic object
    `int` | `time`

    - ### Fields inherited from class igeo.IObject

      `attribute, dynamics, graphics, parameter, server, userData`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IAgent()`
    `IAgent(IObject parent)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDynamics(IDynamics dyna)` override IObject.addDynamics to manage dynamics locally.
    `boolean` | `alive()`
    `IAgent` | `clr(double dgray)`
    `IAgent` | `clr(double dgray, double dalpha)`
    `IAgent` | `clr(double dr, double dg, double db)`
    `IAgent` | `clr(double dr, double dg, double db, double da)`
    `IAgent` | `clr(float fgray)`
    `IAgent` | `clr(float fgray, float falpha)`
    `IAgent` | `clr(float fr, float fg, float fb)`
    `IAgent` | `clr(float fr, float fg, float fb, float fa)`
    `IAgent` | `clr(IColor c)` to set an object color
    `IAgent` | `clr(IColor c, double alpha)` to set color, with alpha value overwritten
    `IAgent` | `clr(IColor c, float alpha)` to set color, with alpha value overwritten
    `IAgent` | `clr(IColor c, int alpha)` to set color, with alpha value overwritten
    `IAgent` | `clr(int gray)`
    `IAgent` | `clr(int gray, int alpha)`
    `IAgent` | `clr(int r, int g, int b)`
    `IAgent` | `clr(int r, int g, int b, int a)`
    `IAgent` | `clr(IObject o)` to set the same color with the object
    `void` | `del()` delete agent and stop it by removing it from dynamics server
    `void` | `del(boolean deleteGeometry)` stop agent with option of deleting/keeping the geometry the agent owns
    `void` | `deletDynamics(int index)`
    `void` | `deleteDynamics()`
    `void` | `deleteDynamics(IDynamics dyn)`
    `int` | `duration()`
    `IAgent` | `duration(int dur)`
    `int` | `dynamicsNum()`
    `IDynamics` | `getDynamics(int i)`
    `IAgent` | `hide()`
    `IAgent` | `hsb(double h, double s, double b)`
    `IAgent` | `hsb(double h, double s, double b, double a)`
    `IAgent` | `hsb(float h, float s, float b)`
    `IAgent` | `hsb(float h, float s, float b, float a)`
    `void` | `initAgent()`
    `void` | `interact(java.util.ArrayList<IDynamics> agents)` behavior definition of interaction with other dynamic objects.
    `void` | `interact(IDynamics agent)`
    `IAgent` | `layer(ILayer l)` Set layer by ILayer object
    `java.util.ArrayList<IDynamics>` | `localDynamics()` local dynamics are updated by IDynamics server too but not show up in interact's argument.
    `IAgent` | `name(java.lang.String nm)` methods of IObject
    `IObject` | `parent()` getting parent object
    `ISubobject` | `parent(IObject par)` setting parent object
    `void` | `postinteract(java.util.ArrayList<IDynamics> agents)` executed after interact(ArrayList).
    `void` | `postupdate()` executed after update().
    `void` | `preinteract(java.util.ArrayList<IDynamics> agents)` executed before interact(ArrayList).
    `void` | `preupdate()` executed before update().
    `IAgent` | `removeTarget(int i)` remove target object.
    `IAgent` | `removeTarget(IObject obj)` remove target object.
    `IAgent` | `setColor(double dgray)`
    `IAgent` | `setColor(double dgray, double dalpha)`
    `IAgent` | `setColor(double dr, double dg, double db)`
    `IAgent` | `setColor(double dr, double dg, double db, double da)`
    `IAgent` | `setColor(float fgray)`
    `IAgent` | `setColor(float fgray, float falpha)`
    `IAgent` | `setColor(float fr, float fg, float fb)`
    `IAgent` | `setColor(float fr, float fg, float fb, float fa)`
    `IAgent` | `setColor(IColor c)`
    `IAgent` | `setColor(IColor c, double alpha)`
    `IAgent` | `setColor(IColor c, float alpha)`
    `IAgent` | `setColor(IColor c, int alpha)`
    `IAgent` | `setColor(int gray)`
    `IAgent` | `setColor(int gray, int alpha)`
    `IAgent` | `setColor(int r, int g, int b)`
    `IAgent` | `setColor(int r, int g, int b, int a)`
    `IAgent` | `setHSBColor(double h, double s, double b)`
    `IAgent` | `setHSBColor(double h, double s, double b, double a)`
    `IAgent` | `setHSBColor(float h, float s, float b)`
    `IAgent` | `setHSBColor(float h, float s, float b, float a)`
    `IAgent` | `show()`
    `IObject` | `target(int i)` get target object.
    `IAgent` | `target(IObject targetObj)` add terget object to be updated by this dynamic object.
    `int` | `targetNum()` get total target number.
    `java.util.ArrayList<IObject>` | `targets()` get all target objects.
    `int` | `time()`
    `IAgent` | `time(int tm)` not recommended to use.
    `void` | `update()` behavior definition of updating dynamics in each time frame
    `void` | `updateGraphic()` update graphic when control point location changes or some minor change.
    `void` | `updateTarget()` update all terget objects (should be called when the dynamic object is updated).
    `IAgent` | `weight(double w)`
    `IAgent` | `weight(float w)`

    - ### Methods inherited from class igeo.IObject

      `addUserData, addUserData, alpha, alphaInt, attr, attr, attr, awtColor, blue, blueInt, brightness, castStringHashMap, clearDynamics, clearGraphics, clr, clr, clr, clr, clr, cp, createGraphic, defaultAttribute, deleteGraphic, dup, getAWTColor, getColor, getGraphic, getGraphic, getParameter, graphicsNum, gray, grayInt, green, greenInt, grey, greyInt, hue, initGraphic, initObject, isValid, isVisible, layer, layer, name, red, redInt, resetGraphic, saturation, server, setColor, setColor, setColor, setColor, setParameter, syncColor, syncGraphic, syncVisibility, syncWeight, userData, userData, userData, userDataNum, visible, weight`

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

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

- - ### Field Detail

    - #### parent

          public IObject parent

    - #### targets

          public java.util.ArrayList<IObject> targets

      target objects to be updated by dynamic object

    - #### localDynamics

          public java.util.ArrayList<IDynamics> localDynamics

    - #### time

          public int time

    - #### duration

          public int duration

    - #### alive

          public boolean alive

    - #### interactOverridden

          public boolean interactOverridden

      check if a child class overrides void interact(IDynamics) or not

  - ### Constructor Detail

    - #### IAgent

          public IAgent()

    - #### IAgent

          public IAgent(IObject parent)

  - ### Method Detail

    - #### initAgent

          public void initAgent()

    - #### addDynamics

          public void addDynamics(IDynamics dyna)

      override IObject.addDynamics to manage dynamics locally. Only IAgent is added at IObject
      Overrides:
        `addDynamics` in class `IObject`

    - #### getDynamics

          public IDynamics getDynamics(int i)

      Overrides:
        `getDynamics` in class `IObject`

    - #### dynamicsNum

          public int dynamicsNum()

      Overrides:
        `dynamicsNum` in class `IObject`

    - #### deleteDynamics

          public void deleteDynamics()

      Overrides:
        `deleteDynamics` in class `IObject`

    - #### deletDynamics

          public void deletDynamics(int index)

      Overrides:
        `deletDynamics` in class `IObject`

    - #### deleteDynamics

          public void deleteDynamics(IDynamics dyn)

      Overrides:
        `deleteDynamics` in class `IObject`

    - #### del

          public void del()

      delete agent and stop it by removing it from dynamics server
      Overrides:
        `del` in class `IObject`

    - #### del

          public void del(boolean deleteGeometry)

      stop agent with option of deleting/keeping the geometry the agent owns

    - #### updateGraphic

          public void updateGraphic()

      Description copied from class: `IObject`
      update graphic when control point location changes or some minor change.
      Overrides:
        `updateGraphic` in class `IObject`

    - #### parent

          public IObject parent()

      Description copied from interface: `ISubobject`
      getting parent object
      Specified by:
        `parent` in interface `ISubobject`

    - #### parent

          public ISubobject parent(IObject par)

      Description copied from interface: `ISubobject`
      setting parent object
      Specified by:
        `parent` in interface `ISubobject`

    - #### localDynamics

          public java.util.ArrayList<IDynamics> localDynamics()

      local dynamics are updated by IDynamics server too but not show up in interact's argument. only its parent show up
      Specified by:
        `localDynamics` in interface `IDynamics`

    - #### target

          public IAgent target(IObject targetObj)

      add terget object to be updated by this dynamic object.
      Specified by:
        `target` in interface `IDynamics`

    - #### targetNum

          public int targetNum()

      get total target number.
      Specified by:
        `targetNum` in interface `IDynamics`

    - #### target

          public IObject target(int i)

      get target object.
      Specified by:
        `target` in interface `IDynamics`

    - #### targets

          public java.util.ArrayList<IObject> targets()

      get all target objects.
      Specified by:
        `targets` in interface `IDynamics`

    - #### removeTarget

          public IAgent removeTarget(int i)

      remove target object.
      Specified by:
        `removeTarget` in interface `IDynamics`

    - #### removeTarget

          public IAgent removeTarget(IObject obj)

      remove target object.
      Specified by:
        `removeTarget` in interface `IDynamics`

    - #### updateTarget

          public void updateTarget()

      update all terget objects (should be called when the dynamic object is updated).
      Specified by:
        `updateTarget` in interface `IDynamics`

    - #### alive

          public boolean alive()

    - #### time

          public int time()

    - #### time

          public IAgent time(int tm)

      not recommended to use. use carefully if you use

    - #### duration

          public int duration()

    - #### duration

          public IAgent duration(int dur)

    - #### preinteract

          public void preinteract(java.util.ArrayList<IDynamics> agents)

      Description copied from interface: `IDynamics`
      executed before interact(ArrayList). behavior can be changed by IConfig.enablePreinteract and IConfig.loopPreinteract.
      Specified by:
        `preinteract` in interface `IDynamics`

    - #### interact

          public void interact(java.util.ArrayList<IDynamics> agents)

      Description copied from interface: `IDynamics`
      behavior definition of interaction with other dynamic objects. The server puts all dynamic objects including itself.
      Specified by:
        `interact` in interface `IDynamics`

    - #### interact

          public void interact(IDynamics agent)

    - #### postinteract

          public void postinteract(java.util.ArrayList<IDynamics> agents)

      Description copied from interface: `IDynamics`
      executed after interact(ArrayList). behavior can be changed by IConfig.enablePostinteract and IConfig.loopPostinteract. If IConfig.loopPostinteract is false, preupdate is executed before post interact (updated 2012/08/26).
      Specified by:
        `postinteract` in interface `IDynamics`

    - #### preupdate

          public void preupdate()

      Description copied from interface: `IDynamics`
      executed before update(). behavior can be changed by IConfig.enablePreupdate and IConfig.loopPreupdate. If IConfig.loopPreupdate is false, preupdate is executed before post interact (updated 2012/08/26).
      Specified by:
        `preupdate` in interface `IDynamics`

    - #### update

          public void update()

      Description copied from interface: `IDynamics`
      behavior definition of updating dynamics in each time frame
      Specified by:
        `update` in interface `IDynamics`

    - #### postupdate

          public void postupdate()

      Description copied from interface: `IDynamics`
      executed after update(). behavior can be changed by IConfig.enablePostupdate and IConfig.loopPostupdate.
      Specified by:
        `postupdate` in interface `IDynamics`

    - #### name

          public IAgent name(java.lang.String nm)

      methods of IObject
      Overrides:
        `name` in class `IObject`

    - #### layer

          public IAgent layer(ILayer l)

      Description copied from class: `IObject`
      Set layer by ILayer object
      Overrides:
        `layer` in class `IObject`

    - #### hide

          public IAgent hide()

      Overrides:
        `hide` in class `IObject`

    - #### show

          public IAgent show()

      Overrides:
        `show` in class `IObject`

    - #### clr

          public IAgent clr(IColor c)

      Description copied from class: `IObject`
      to set an object color
      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(IColor c,
                   int alpha)

      Description copied from class: `IObject`
      to set color, with alpha value overwritten
      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(IColor c,
                   float alpha)

      Description copied from class: `IObject`
      to set color, with alpha value overwritten
      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(IColor c,
                   double alpha)

      Description copied from class: `IObject`
      to set color, with alpha value overwritten
      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(IObject o)

      Description copied from class: `IObject`
      to set the same color with the object
      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(int gray)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(float fgray)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(double dgray)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(int gray,
                   int alpha)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(float fgray,
                   float falpha)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(double dgray,
                   double dalpha)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(int r,
                   int g,
                   int b)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(float fr,
                   float fg,
                   float fb)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(double dr,
                   double dg,
                   double db)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(int r,
                   int g,
                   int b,
                   int a)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(float fr,
                   float fg,
                   float fb,
                   float fa)

      Overrides:
        `clr` in class `IObject`

    - #### clr

          public IAgent clr(double dr,
                   double dg,
                   double db,
                   double da)

      Overrides:
        `clr` in class `IObject`

    - #### hsb

          public IAgent hsb(float h,
                   float s,
                   float b,
                   float a)

      Overrides:
        `hsb` in class `IObject`

    - #### hsb

          public IAgent hsb(double h,
                   double s,
                   double b,
                   double a)

      Overrides:
        `hsb` in class `IObject`

    - #### hsb

          public IAgent hsb(float h,
                   float s,
                   float b)

      Overrides:
        `hsb` in class `IObject`

    - #### hsb

          public IAgent hsb(double h,
                   double s,
                   double b)

      Overrides:
        `hsb` in class `IObject`

    - #### weight

          public IAgent weight(float w)

      Overrides:
        `weight` in class `IObject`

    - #### weight

          public IAgent weight(double w)

      Overrides:
        `weight` in class `IObject`

    - #### setColor

          public IAgent setColor(IColor c)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(IColor c,
                        int alpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(IColor c,
                        float alpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(IColor c,
                        double alpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(int gray)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(float fgray)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(double dgray)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(int gray,
                        int alpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(float fgray,
                        float falpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(double dgray,
                        double dalpha)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(int r,
                        int g,
                        int b)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(float fr,
                        float fg,
                        float fb)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(double dr,
                        double dg,
                        double db)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(int r,
                        int g,
                        int b,
                        int a)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(float fr,
                        float fg,
                        float fb,
                        float fa)

      Overrides:
        `setColor` in class `IObject`

    - #### setColor

          public IAgent setColor(double dr,
                        double dg,
                        double db,
                        double da)

      Overrides:
        `setColor` in class `IObject`

    - #### setHSBColor

          public IAgent setHSBColor(float h,
                           float s,
                           float b,
                           float a)

      Overrides:
        `setHSBColor` in class `IObject`

    - #### setHSBColor

          public IAgent setHSBColor(double h,
                           double s,
                           double b,
                           double a)

      Overrides:
        `setHSBColor` in class `IObject`

    - #### setHSBColor

          public IAgent setHSBColor(float h,
                           float s,
                           float b)

      Overrides:
        `setHSBColor` in class `IObject`

    - #### setHSBColor

          public IAgent setHSBColor(double h,
                           double s,
                           double b)

      Overrides:
        `setHSBColor` in class `IObject`