public class ConcreteCommitmentProcessor extends CommitmentProcessor implements Comparable<ConcreteCommitmentProcessor>
Title: CASA Agent Infrastructure
Description:
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, University of Calgary
Modifier and Type | Field and Description |
---|---|
protected static long |
expiredMemoryTime
Remember expired and fulfilled commitments for an hour
|
protected SocialCommitmentsStore |
store |
protected long |
StoreTransactionCount
Use for debugging.
|
agent
Constructor and Description |
---|
ConcreteCommitmentProcessor(PolicyAgentInterface agent,
SocialCommitmentsStore store) |
Modifier and Type | Method and Description |
---|---|
protected SocialCommitment |
choose() |
protected SocialCommitment |
choose(List<SocialCommitment> coll)
Choose a commitment to focus on by first calling the owner agent's
TransientAgent.chooseSC(Collection) method; if that method
returns null (indicating it doesn't want to make the decision) then
choose the first commitment that has a priority higher or equal to and
other commitment. |
protected SocialCommitment |
chooseWithoutMarking() |
protected SocialCommitment |
chooseWithoutMarking(List<SocialCommitment> coll) |
int |
compareTo(ConcreteCommitmentProcessor o) |
protected SocialCommitment |
findMoreSpecific(SocialCommitment chosen,
Collection<SocialCommitment> coll) |
protected List<SocialCommitment> |
getActiveCommitments() |
SocialCommitmentsStore |
getStore()
Return the social commitment store.
|
boolean |
hasActiveCommitments() |
boolean |
isStoppable()
determines if this process can be stopped.
|
private boolean |
isSubsumedBy(SocialCommitment c1,
SocialCommitment c2) |
SocialCommitment |
peek() |
protected PerformDescriptor |
perform(SocialCommitment commitment,
PolicyAgentInterface agent) |
SocialCommitment |
processCommitment(SocialCommitment sc) |
SocialCommitment |
processCommitments()
If there are active social commitments in the store, choose one, and
execute it and return true.
|
String |
toString() |
notifyMessageSent
protected SocialCommitmentsStore store
protected long StoreTransactionCount
protected static final long expiredMemoryTime
public ConcreteCommitmentProcessor(PolicyAgentInterface agent, SocialCommitmentsStore store)
public SocialCommitment processCommitments()
#choose(Collection)
.processCommitments
in class CommitmentProcessor
public SocialCommitment processCommitment(SocialCommitment sc)
processCommitment
in class CommitmentProcessor
public boolean hasActiveCommitments()
hasActiveCommitments
in class CommitmentProcessor
protected List<SocialCommitment> getActiveCommitments()
protected SocialCommitment choose()
choose
in class CommitmentProcessor
getActiveCommitments()
,
choose(List)
protected SocialCommitment choose(List<SocialCommitment> coll)
TransientAgent.chooseSC(Collection)
method; if that method
returns null (indicating it doesn't want to make the decision) then
choose the first commitment that has a priority higher or equal to and
other commitment. But if there is a more specific commitment than this
one choose that one instead. Care is taken to mark previously chosen
commitments so that if this method is called repeatedly with the same
argument collection, it will not keep choosing the same commitment, but
will iterate through the collection. In the event all the commitments
have been marked, it unmarks them all, and proceeds as usual.coll
- The collection of commitments to pick fromprotected SocialCommitment chooseWithoutMarking()
protected SocialCommitment chooseWithoutMarking(List<SocialCommitment> coll)
protected SocialCommitment findMoreSpecific(SocialCommitment chosen, Collection<SocialCommitment> coll)
chosen
- the current candidate commitmentcoll
- the list of other possible candidate commitments to considerprivate boolean isSubsumedBy(SocialCommitment c1, SocialCommitment c2)
c1
- the candidate child commitmentc2
- the candidate parent commitmentprotected PerformDescriptor perform(SocialCommitment commitment, PolicyAgentInterface agent)
public boolean isStoppable()
CommitmentProcessor
isStoppable
in class CommitmentProcessor
public SocialCommitment peek()
peek
in class CommitmentProcessor
public SocialCommitmentsStore getStore()
getStore
in class CommitmentProcessor
CommitmentProcessor.getStore()
public int compareTo(ConcreteCommitmentProcessor o)
compareTo
in interface Comparable<ConcreteCommitmentProcessor>