org.mars_sim.msp.simulation.person.ai.social
Class Relationship

java.lang.Object
  extended by org.mars_sim.msp.simulation.person.ai.social.Relationship
All Implemented Interfaces:
java.io.Serializable

public class Relationship
extends java.lang.Object
implements java.io.Serializable

The Relationship class represents a social relationship between two people.

See Also:
Serialized Form

Field Summary
static java.lang.String EXISTING_RELATIONSHIP
           
static java.lang.String FIRST_IMPRESSION
           
 
Method Summary
 Person[] getPeople()
          Gets the two people in relationship.
 double getPersonOpinion(Person person)
          Gets one of the two people's opinion of the other.
 boolean hasPerson(Person person)
          Checks if a given person is in this relationship.
 void setPersonOpinion(Person person, double opinion)
          Sets one of the two people's opinion of the other.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST_IMPRESSION

public static final java.lang.String FIRST_IMPRESSION
See Also:
Constant Field Values

EXISTING_RELATIONSHIP

public static final java.lang.String EXISTING_RELATIONSHIP
See Also:
Constant Field Values
Method Detail

getPeople

public Person[] getPeople()
Gets the two people in relationship.

Returns:
array of two people

hasPerson

public boolean hasPerson(Person person)
Checks if a given person is in this relationship.

Parameters:
person - the person to check
Returns:
true if person is in this relationship

getPersonOpinion

public double getPersonOpinion(Person person)
                        throws java.lang.IllegalArgumentException
Gets one of the two people's opinion of the other.

Parameters:
person - the person to get an opinion from.
Returns:
the person's opinion of the other person as a value from 0 to 100.
Throws:
java.lang.IllegalArgumentException - if person is not one of the two people in the relationship.

setPersonOpinion

public void setPersonOpinion(Person person,
                             double opinion)
                      throws java.lang.IllegalArgumentException
Sets one of the two people's opinion of the other.

Parameters:
person - the person to set the opinion for.
opinion - the person's opinion of the other person as a value from 0 to 100.
Throws:
java.lang.IllegalArgumentException - if person is not one of the two people in the relationship.