cz.cuni.amis.pogamut.sposh.elements
Class Arguments

Package class diagram package Arguments
java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<Arguments.Argument>
          extended by cz.cuni.amis.pogamut.sposh.elements.Arguments
All Implemented Interfaces:
Iterable<Arguments.Argument>, Collection<Arguments.Argument>, List<Arguments.Argument>

public class Arguments
extends AbstractList<Arguments.Argument>

This class represents the arguments of the PrimitiveCall. PrimitiveCall can reference either normal IAction, ActionPattern or Competence that will get these arguments, mix them with their own FormalParameters and create the values for the Action/C/AP. Arguments is stored as list of Arguments.Argument, each argument is basically (key; argument) pair. Arguments are sorted according to the key. What is the key? Either a variable name or index of the argument in the list or arguments. Variable names have '$' prefix, e.g. $name. The indexes are simply string representations of the numbers, e.g. index 3 is represented as "3". Calling convention: TODO: Properly document. TODO: Properly test. TODO: This probably doesn;t need to be abstract list Example: call run("street", speed=14.5) will create

Author:
Honza Havlicek

Nested Class Summary
static class Arguments.Argument
           
protected static class Arguments.ValueArgument
          This parameter is static value, neverchanging.
protected static class Arguments.VariableArgument
          This parameter is dependant on value of some kind of variable.
 
Field Summary
static Arguments EMPTY
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
  Arguments()
          Create a new list of call parameters.
protected Arguments(Arguments parameters)
          Copy constructor.
 
Method Summary
 void add(int index, Arguments.Argument element)
           
 boolean addFormal(Arguments.Argument element, FormalParameters formalParams)
           
 Arguments.Argument get(int index)
           
 int size()
           
 String toString()
          Get string representation of arguments (comma separated arguments, compatible with lap).
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

EMPTY

public static Arguments EMPTY
Constructor Detail

Arguments

public Arguments()
Create a new list of call parameters.

Every added variable parameter has to be checked against list of formal parameters.


Arguments

protected Arguments(Arguments parameters)
Copy constructor. Beware, this doesn't copy reference to the formal parameters.

Parameters:
parameters - orginal
Method Detail

get

public Arguments.Argument get(int index)
Specified by:
get in interface List<Arguments.Argument>
Specified by:
get in class AbstractList<Arguments.Argument>

size

public int size()
Specified by:
size in interface Collection<Arguments.Argument>
Specified by:
size in interface List<Arguments.Argument>
Specified by:
size in class AbstractCollection<Arguments.Argument>

add

public void add(int index,
                Arguments.Argument element)
Specified by:
add in interface List<Arguments.Argument>
Overrides:
add in class AbstractList<Arguments.Argument>

addFormal

public boolean addFormal(Arguments.Argument element,
                         FormalParameters formalParams)

toString

public String toString()
Get string representation of arguments (comma separated arguments, compatible with lap).

Overrides:
toString in class AbstractCollection<Arguments.Argument>
Returns:
arguments separated with comma (e.g. |"Friends of peace.", $when=now, $who=just_first_player|)


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.