Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package jadex.bdi.planlib.protocols;
  
  
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
 import java.util.Map;

The state of the execution of an interaction.
 
 public class InteractionState
 {
 	//-------- constants --------
 	
Interaction state initial (not yet started).
 
 	public static final String INTERACTION_INITIAL = "initial";

Interaction state running.
 
 	public static final String INTERACTION_RUNNING = "running";

Interaction state cancelled.
 
 	public static final String INTERACTION_CANCELLED = "cancelled";

Interaction state finished.
 
 	public static final String INTERACTION_FINISHED = "finished";

Constant identifying successful cancellation of interaction.
 
 	public static final String	CANCELLATION_SUCCEEDED"cancellation-succeeded";

Constant identifying failed cancellation of interaction (failure explicitly stated by receiver side).
 
 	public static final String	CANCELLATION_FAILED"cancellation-failed";

Constant identifying unknown state of cancellation of interaction (no response from receiver side within timeout).
 
 	public static final String	CANCELLATION_UNKNOWN"cancellation-unknown";
 	
 	//-------- attributes --------
 	
The interaction state.
 
 	protected String interaction_state;

The failure (if any).
 
 	protected Object failure;

The received cancel responses (if any).
 
 	protected Map	cancel_responses;

The cancel response contents (if any).
 
 	
 	//-------- constructors --------
 	
Create a new interaction state in default initial state "running".
 
 	public InteractionState()
 	{
 	}
 	
 	//-------- methods --------
 
Get the failure description.

Returns:
The failure description (if any).
 
 	public Object getFailure()
 	{
 		return ;
 	}

Set the failure description.

Parameters:
failure The failure description to set.
 
 	public void setFailure(Object failure)
 	{
 		this. = failure;
 	}

Get the interaction state.

Returns:
The interaction state.
 
 	{
 	}

Set the interaction state.

Parameters:
interaction state The interaction state to set.
 
 	public void setInteractionState(String interaction_state)
 	{
		this. = interaction_state;
	}
	//-------- cancel-related meta-information --------
Add a cancel response.
	public void	addCancelResponse(IComponentIdentifier responderString responseObject content)
	{
		{
		}
		.put(responderresponse);
		.put(respondercontent);
	}

Get all agents with a specific cancel response.
	{
		{
			List	listnew ArrayList();
			{
				Object	agentit.next();
				if(response.equals(.get(agent)))
				{
					list.add(agent);
				}
			}
		}
		else
		{
			retnew IComponentIdentifier[0];
		}
		return ret;
	}

Get the cancel response of an agent.
	{
		String	retnull;
		{
			ret	= (String).get(responder);
		}
		return ret;
	}


Get the details of a cancel response of a given agent. This will be any information that the agent sent as content of the cancel response.
	{
		Object	retnull;
		{
			ret.get(responder);
		}
		return ret;
	}
New to GrepCode? Check out our FAQ X