Agent System POND 1.0 (1.7.2000)

PkgAgentSystem.Experiences
Class AgentModel

java.lang.Object
  |
  +--PkgAgentSystem.Experiences.AgentModel

public class AgentModel
extends Object
implements Serializable

Represents a single agent in the experiences model. Stores references to all statements this agent made and which were made about this agent. Also includes our general trust in the agent and the last location we knew/heard of this agent. Most important, our own opinion on all characteristics of this agent are stored here also.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
Experiences, Serialized Form

Field Summary
(package private)  boolean changed
          Used for the internal recalculation of trust.
 
Constructor Summary
AgentModel(AgentIdentity identity)
          Creates a new model for the agent whose identity is provided as parameter.
AgentModel(AgentIdentity identity, double initialTrust, URL location)
          Creates a new model for the agent whose identity is provided as parameter.
 
Method Summary
 void addOnAgentStatement(Statement stat)
          Add a statement from this agent on another one.
 void addSourceStatement(Statement stat)
          Add a statement from another agent on this one.
 URL currentLocation()
          Retrieve the location, where this agent is currently expected to be (might be wrong).
 boolean equals(Object obj)
          Compares two agent models for equality by comparing the identity of the contained agent.
 String[] getCharacteristicsListSource()
          Retrieve a list of all characteristics for which we have statements on this agent.
 double getGeneralTrust()
          Retrieve the general trust we set in the agent with this identity.
 AgentIdentity getIdentity()
          Retrieve the identity of the agent this object represents
 Statement getOnAgentStatement(AgentIdentity onAgent, String characteristic)
          Retrieve the last statement of the given characteristic, which this agent made on the given agent.
 StatementEnumeration getOnAgentStatements(String filter)
          Retrieve an enumeration of all statements this agent made on others concerning a certain characteristic.
 Statement getSourceStatement(AgentIdentity source, String characteristic)
          Retrieve the last statement of the given characteristic, which was made on this agent by the given source.
 StatementEnumeration getSourceStatements(String filter)
          Retrieve an enumeration of all statements on this agent made by others concerning a certain characteristic.
 double getTransitiveTrust()
          Retrieve the transitive trust we set in the agent with this identity.
 double getTrustInValue(String characteristic)
          Retrieve the trust we have in our own opinion on a characteristic of this agent.
 double getValue(String characteristic)
          Retrieve our own opinion on a characteristic of this agent.
 int hashCode()
          Returns a hash code value for the object.
 boolean isTransitiveOnly()
          Returns true if we only have a transitive but no general trust towards this agent.
protected  void setGeneralTrust(double newTrust)
          Sets the general trust towards this agent.
protected  void setTransitiveTrust(double newTransitiveTrust)
          Sets the transitive trust towards this agent.
 void setValue(String characteristic, double value, double trustInValue)
          Store the value of our opinion and the trust in it of a given characteristic of this agent.
 String toString()
          Retrieve a string representation of this object.
 URL updateLocation(URL newLocation)
          Update the location, where this agent is currently expected to be.
 void writeTo(PrintWriter out)
          Writes this model to a stream.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

changed

boolean changed
Used for the internal recalculation of trust. Package access for class Experiences (this object was change in the current phase).
Constructor Detail

AgentModel

public AgentModel(AgentIdentity identity)
Creates a new model for the agent whose identity is provided as parameter.
Parameters:
identity - of the agent to represent

AgentModel

public AgentModel(AgentIdentity identity,
                  double initialTrust,
                  URL location)
Creates a new model for the agent whose identity is provided as parameter.
Parameters:
identity - of the agent to represent
initialTrust - the initial value for the general trust in this agent (must be in range 0.0 - 1.0)
location - the current location of this agent (may be null)
Method Detail

getGeneralTrust

public double getGeneralTrust()
Retrieve the general trust we set in the agent with this identity.
Returns:
the general trust in this agent

getTransitiveTrust

public double getTransitiveTrust()
Retrieve the transitive trust we set in the agent with this identity. If we have a general trust, this will be returned.
Returns:
the transitive trust in this agent

isTransitiveOnly

public boolean isTransitiveOnly()
Returns true if we only have a transitive but no general trust towards this agent.
Returns:
true if only transitive trust exists

setGeneralTrust

protected void setGeneralTrust(double newTrust)
Sets the general trust towards this agent. Must be in range 0.0 - 1.0, so removing it is not possible.
Parameters:
newTrust - the new general trust towards the agent with this identity

setTransitiveTrust

protected void setTransitiveTrust(double newTransitiveTrust)
Sets the transitive trust towards this agent. Must be in range 0.0 - 1.0.
Parameters:
newTransitiveTrust - the new transitive trust towards the agent with this identity

getIdentity

public AgentIdentity getIdentity()
Retrieve the identity of the agent this object represents
Returns:
the identity of this agent

currentLocation

public URL currentLocation()
Retrieve the location, where this agent is currently expected to be (might be wrong).
Returns:
URL of the agent system where we last knew/heard the agent to be

updateLocation

public URL updateLocation(URL newLocation)
Update the location, where this agent is currently expected to be.
Parameters:
URL - of the agent system where we now believe the agent to be (may be null if we know it is no longer at this location but know not where it is now)
Returns:
URL of the agent system where we last knew/heard the agent to be

addSourceStatement

public void addSourceStatement(Statement stat)
Add a statement from another agent on this one.
Parameters:
the - statement on this agent

addOnAgentStatement

public void addOnAgentStatement(Statement stat)
Add a statement from this agent on another one.
Parameters:
the - statement by this agent

getSourceStatement

public Statement getSourceStatement(AgentIdentity source,
                                    String characteristic)
Retrieve the last statement of the given characteristic, which was made on this agent by the given source.
Parameters:
source - the agent, whichs statement on this agent we want to retrieve
characteristic - the characteristic the statement is about
Returns:
the statement from an agent on this one about a certain characteristic

getOnAgentStatement

public Statement getOnAgentStatement(AgentIdentity onAgent,
                                     String characteristic)
Retrieve the last statement of the given characteristic, which this agent made on the given agent.
Parameters:
onAgent - the agent, on which the statement by this agent was made
characteristic - the characteristic the statement is about
Returns:
the statement from this agent on the other one about a certain characteristic

getSourceStatements

public StatementEnumeration getSourceStatements(String filter)
Retrieve an enumeration of all statements on this agent made by others concerning a certain characteristic.
Parameters:
filter - the characteristic we which to retrieve statements about

getOnAgentStatements

public StatementEnumeration getOnAgentStatements(String filter)
Retrieve an enumeration of all statements this agent made on others concerning a certain characteristic.
Parameters:
filter - the characteristic we which to retrieve statements about

getValue

public double getValue(String characteristic)
Retrieve our own opinion on a characteristic of this agent.
Parameters:
characteristic - the characteristic, we want to know the opinion we have on
Returns:
our own opinion about this agent concerning the characteristic. Returns -1.0 if none known.

getTrustInValue

public double getTrustInValue(String characteristic)
Retrieve the trust we have in our own opinion on a characteristic of this agent.
Parameters:
characteristic - the characteristic, we want to know the trust we have in our opinion
Returns:
the trust in our own opinion about this agent concerning the characteristic. Returns -1.0 if none known.

setValue

public void setValue(String characteristic,
                     double value,
                     double trustInValue)
Store the value of our opinion and the trust in it of a given characteristic of this agent.
Parameters:
characteristic - the characteristic we want to store our opinion about
value - our opinion of this characteristic of this agent
trustInValue - the trust in our own opinion about this agent concerning the characteristic

getCharacteristicsListSource

public String[] getCharacteristicsListSource()
Retrieve a list of all characteristics for which we have statements on this agent. Trust statements are excluded.
Returns:
a list of all characteristics excluding "TRUST"

toString

public String toString()
Retrieve a string representation of this object. Contains the identity and the current expected location as well as the general trust towards this agent.
Returns:
a string representation of this object
Overrides:
toString in class Object

hashCode

public int hashCode()
Returns a hash code value for the object.
Returns:
a hash code value for this object
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Compares two agent models for equality by comparing the identity of the contained agent.
Parameters:
obj - the reference object with which to compare
Returns:
true if this model contains the same identity as the obj argument; false otherwise
Overrides:
equals in class Object

writeTo

public void writeTo(PrintWriter out)
Writes this model to a stream. Includes the general or transitive trust and our own opinion on all characteristics including the trust in them.
Parameters:
out - the stream to dump this object to

Agent System POND 1.0 (1.7.2000)

Submit a bug

Copyright 2000 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.