ai.planning.strips
Class Domain

java.lang.Object
  extended by ai.planning.strips.Domain
All Implemented Interfaces:
Domain<ai.krr.fol.Atom>, inf.compilers.SyntaxAdaptable

public class Domain
extends java.lang.Object
implements Domain<ai.krr.fol.Atom>, inf.compilers.SyntaxAdaptable


Nested Class Summary
static class Domain.DomainType
           
protected static class Domain.DomainTypeSystem
           
protected static class Domain.PredicateArgNrPair
           
 
Field Summary
protected  java.util.Map<java.lang.Class<? extends ai.planning.strips.extensible.Extension>,ai.planning.strips.extensible.Extension> extensions
          the Extensions used by this Domain
protected  java.util.Set<ai.krr.NamedSymbol> fluentRelations
          the set of relations that represent fluents in this domain
protected  ai.krr.NamedSymbol name
          the name given to this Domain
protected  java.util.List<ActionType> operators
          the List of ActionTypes that define this Domain
protected  java.util.Set<ai.krr.NamedSymbol> staticRelations
          the set of relations that represent fluents in this domain
protected  Domain.DomainTypeSystem types
          the inferred DomainTypes for this Domain (computed on demand)
 
Constructor Summary
Domain(ai.krr.NamedSymbol name, ActionType... ops)
           This constructor creates a new Domain that has the given name and is defined by the given ActionTypes.
Domain(ai.krr.NamedSymbol name, java.util.List<ActionType> ops)
           This constructor creates a new Domain that has the given name and is defined by the given ActionTypes.
 
Method Summary
protected  ActionType clone()
          This class does not support cloning and an Exception will be thrown if this method is called.
 boolean equals(java.lang.Object obj)
           This function tests whether this and the given domain are the same Object.
static Domain forName(ai.krr.NamedSymbol name)
           This function returns the Domain that has been associated with the given name.
 java.util.Set<Domain.DomainType> getDomainTypes()
           This function returns the derived set of domain types that have been defined for this Domain.
protected  Domain.DomainTypeSystem getDomainTypeSystem()
           This function returns the inferred types for this Domain.
 ai.planning.strips.extensible.Extension getExtension(java.lang.Class<? extends ai.planning.strips.extensible.Extension> type)
           This function retrieves the extension of the given type that may be used by this Domain.
 java.util.Set<ai.krr.NamedSymbol> getFluentRelations()
           This function returns the Set of all the NamedSymbols that appear as relations in effects of the operators.
 ai.krr.NamedSymbol getName()
           This function returns the name of this Domain.
 ActionType<ai.krr.fol.Atom> getOperator(ai.krr.NamedSymbol name)
           This function can be used to retrieve a specific ActionType defined in this Domain.
 java.util.List<ActionType> getOperators()
           This function returns the List of ActionTypes that define this Domain.
 Domain.DomainType[] getSignature(ai.krr.NamedSymbol relation)
           This function returns the signature for the given relation in this Domain.
 java.util.Set<ai.krr.NamedSymbol> getStaticRelations()
           This function returns the Set of all the NamedSymbols that appear as relations in preconditions of the operators, but do not appear in any of the effects.
 int hashCode()
           This function returns a hash value for this domain.
 void prettyPrint(int indent, java.io.Writer w, inf.compilers.SyntaxAdaptor sa)
          This function can be used write this SyntaxAdaptable object to the given Writer.
static Domain read(java.io.Reader r, inf.compilers.SyntaxAdaptor<Domain> sa)
           This function attempts to read and parse a Domain from the given Reader.
 java.lang.String toString()
           This function creates a String representation for this Domain.
 void useExtension(ai.planning.strips.extensible.Extension extension)
           This function add the given extension to this Domain.
 void write(java.io.Writer w, inf.compilers.SyntaxAdaptor sa)
          This function can be used write this logical Sentence to the given Writer.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected ai.krr.NamedSymbol name
the name given to this Domain


operators

protected java.util.List<ActionType> operators
the List of ActionTypes that define this Domain


fluentRelations

protected java.util.Set<ai.krr.NamedSymbol> fluentRelations
the set of relations that represent fluents in this domain


staticRelations

protected java.util.Set<ai.krr.NamedSymbol> staticRelations
the set of relations that represent fluents in this domain


extensions

protected java.util.Map<java.lang.Class<? extends ai.planning.strips.extensible.Extension>,ai.planning.strips.extensible.Extension> extensions
the Extensions used by this Domain


types

protected Domain.DomainTypeSystem types
the inferred DomainTypes for this Domain (computed on demand)

Constructor Detail

Domain

public Domain(ai.krr.NamedSymbol name,
              java.util.List<ActionType> ops)

This constructor creates a new Domain that has the given name and is defined by the given ActionTypes.

Parameters:
name - the Symbol representing the name of this Domain
ops - the ActionTypes in this Domain

Domain

public Domain(ai.krr.NamedSymbol name,
              ActionType... ops)

This constructor creates a new Domain that has the given name and is defined by the given ActionTypes.

Parameters:
name - the Symbol representing the name of this Domain
ops - the ActionTypes in this Domain
Method Detail

clone

protected ActionType clone()
                    throws java.lang.CloneNotSupportedException

This class does not support cloning and an Exception will be thrown if this method is called.

Overrides:
clone in class java.lang.Object
Returns:
nothing
Throws:
java.lang.CloneNotSupportedException - will be thrown

write

public void write(java.io.Writer w,
                  inf.compilers.SyntaxAdaptor sa)
           throws inf.compilers.ExpressivenessException,
                  java.io.IOException

This function can be used write this logical Sentence to the given Writer. The syntax in which it is written is defined by the SyntaxAdaptor that is also given to this function.

Specified by:
write in interface inf.compilers.SyntaxAdaptable
Parameters:
w - the Writer to which this Sentence is written
sa - the SyntaxAdaptor that determines the syntax
Throws:
inf.compilers.ExpressivenessException - if the syntax does not support every construct occurring in this Sentence
java.io.IOException - if writing to the Writer fails

prettyPrint

public void prettyPrint(int indent,
                        java.io.Writer w,
                        inf.compilers.SyntaxAdaptor sa)
                 throws inf.compilers.ExpressivenessException,
                        java.io.IOException

This function can be used write this SyntaxAdaptable object to the given Writer. The syntax is the same as for normal writing. The only difference is the inclusion of extra space and newlines for better readability.

Specified by:
prettyPrint in interface inf.compilers.SyntaxAdaptable
Parameters:
indent - the amount of indentation for the first line
w - the Writer to which this Sentence is written
sa - the SyntaxAdaptor that determines the syntax
Throws:
inf.compilers.ExpressivenessException - if the syntax does not support every construct occurring in this Sentence
java.io.IOException - if writing to the Writer fails

getName

public ai.krr.NamedSymbol getName()

This function returns the name of this Domain.

Specified by:
getName in interface Domain<ai.krr.fol.Atom>
Returns:
the symbolic name of this Domain

getOperators

public java.util.List<ActionType> getOperators()

This function returns the List of ActionTypes that define this Domain.

Specified by:
getOperators in interface Domain<ai.krr.fol.Atom>
Returns:
the ActionTypes in this Domain

getOperator

public ActionType<ai.krr.fol.Atom> getOperator(ai.krr.NamedSymbol name)

This function can be used to retrieve a specific ActionType defined in this Domain. If there is no ActionTpye with the given name, this function returns null.

Specified by:
getOperator in interface Domain<ai.krr.fol.Atom>
Parameters:
name - the name identifying the ActionType
Returns:
the ActionType in this Domain that has the given name

getStaticRelations

public java.util.Set<ai.krr.NamedSymbol> getStaticRelations()

This function returns the Set of all the NamedSymbols that appear as relations in preconditions of the operators, but do not appear in any of the effects.

Returns:
the Set of static relations used in the operators

getFluentRelations

public java.util.Set<ai.krr.NamedSymbol> getFluentRelations()

This function returns the Set of all the NamedSymbols that appear as relations in effects of the operators. They may also appear in the preconditions.

Returns:
the Set of dynamic relations used in the operators

getExtension

public ai.planning.strips.extensible.Extension getExtension(java.lang.Class<? extends ai.planning.strips.extensible.Extension> type)

This function retrieves the extension of the given type that may be used by this Domain. If there is no such extension this function returns null.

Parameters:
type - the Class of the extension
Returns:
an instance of the given Class or null

useExtension

public void useExtension(ai.planning.strips.extensible.Extension extension)

This function add the given extension to this Domain.

Parameters:
extension - an extension to this Domain

getDomainTypes

public java.util.Set<Domain.DomainType> getDomainTypes()

This function returns the derived set of domain types that have been defined for this Domain.

Returns:
the set of DomainTypes that exist in this Domain

getSignature

public Domain.DomainType[] getSignature(ai.krr.NamedSymbol relation)

This function returns the signature for the given relation in this Domain. The returned array describes the DomainTypes used for the arguments of the given relation in this Domain.

Parameters:
relation - the NamedSymbol idetifying the relation
Returns:
an array describing the expected argument DomainTypes

equals

public boolean equals(java.lang.Object obj)

This function tests whether this and the given domain are the same Object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object this Domain is compared to
Returns:
whether they are identical

hashCode

public int hashCode()

This function returns a hash value for this domain.

Overrides:
hashCode in class java.lang.Object
Returns:
an integer that can be used for hashing

toString

public java.lang.String toString()

This function creates a String representation for this Domain. This is basically the String representing the contained List of ActionTypes.

Overrides:
toString in class java.lang.Object
Returns:
the String representing this Domain

getDomainTypeSystem

protected Domain.DomainTypeSystem getDomainTypeSystem()

This function returns the inferred types for this Domain. These will have to be computed the first time this function is called, but are then stored for future re-use.

Returns:
the DomainTypes that can be created for this Domain

forName

public static Domain forName(ai.krr.NamedSymbol name)

This function returns the Domain that has been associated with the given name.

Returns:
the Domain that has the given name

read

public static Domain read(java.io.Reader r,
                          inf.compilers.SyntaxAdaptor<Domain> sa)
                   throws inf.compilers.ExpressivenessException,
                          java.text.ParseException,
                          java.io.IOException

This function attempts to read and parse a Domain from the given Reader. The syntax used for parsing the Domain is determined by the given SyntaxAdaptor.

Parameters:
r - the Reader from which the Domain definition is taken
sa - the SyntaxAdaptor that performs the parsing of the Domain
Returns:
a Domain corresponding to the input from the Reader
Throws:
inf.compilers.ExpressivenessException
java.text.ParseException
java.io.IOException