Package edu.tufts.hrilab.action.db
Class DBEntry
java.lang.Object
edu.tufts.hrilab.action.db.DBEntry
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActionDBEntry
,OperatorDBEntry
TODO: this class (and all sub-classes) are meant to be immutable, but currently several methods
return ActionBindings which are not immutable, which breaks the immutability of this class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
The description is human-readable text describing the entry.protected final boolean
protected final List<ActionBinding>
Roles indicates the list of arguments expected for this entry.protected final String
Each entry in the database has an associated type. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DBEntry
(String type, String description, List<ActionBinding> roles, boolean isVarArgs) -
Method Summary
Modifier and TypeMethodDescriptionboolean
conflictsWith
(DBEntry that) Checks if another DBEntry conflicts with this one (same type, name and role types).Get the descriptionGet the ?actor role (for Actions, not Operators), all required roles, and optional input roles (e.g., those with a default value).Get the list of input role types when calling this DBEntry.Get the local roles of this DBEntry.getName()
Get the name of this entry (same as type)int
Get the number of roles for this entry.Get optional roles.Get the list of optional role types when calling this DBEntry.Get required roles.Get the list of required role types when calling this DBEntry.Get the return roles of this DBEntry.Get the list of return role types of this DBEntry.Return role with matching role name, and null otherwise.getRoleDefault
(int pos) boolean
getRoleIsVarArg
(int pos) Class<?>
getRoleJavaType
(int pos) Get a role's Java type.boolean
getRoleLocal
(int pos) getRoleName
(int pos) Get a role's nameboolean
getRoleReturn
(int pos) getRoles()
Get roles.getRoleSemanticType
(int pos) Get a role's semantic type.getType()
Get the type of this entry.boolean
Returns whether the underlying Java method is a varargs method.toString()
-
Field Details
-
type
Each entry in the database has an associated type. The type may be a name of an action or an operator. For example, the type could be "liftup". The type is also used to define a type hierarchy. The action with a type "liftup" may have a parent type of "action". The type hierarchy is used by isA. -
description
The description is human-readable text describing the entry. The description is optional and an empty string by default. -
roles
Roles indicates the list of arguments expected for this entry. Default values may be provided and used when it is invoked if no other value is provided. -
isVarArgs
protected final boolean isVarArgs
-
-
Constructor Details
-
DBEntry
-
-
Method Details
-
getType
Get the type of this entry.- Returns:
- the type
-
getName
Get the name of this entry (same as type)- Returns:
- the name
-
getDescription
Get the description- Returns:
- the description
-
getRoleName
Get a role's name- Parameters:
pos
- the argument position- Returns:
- that role's type
-
getRoleJavaType
Get a role's Java type.- Parameters:
pos
- the argument position- Returns:
- that role's type
-
getRoleSemanticType
Get a role's semantic type.- Parameters:
pos
- the argument position- Returns:
- that role's semantic type
-
getRoleDefault
-
getRoleReturn
public boolean getRoleReturn(int pos) -
getRoleLocal
public boolean getRoleLocal(int pos) -
getRoleIsVarArg
public boolean getRoleIsVarArg(int pos) -
getNumRoles
public int getNumRoles()Get the number of roles for this entry.- Returns:
- the number of roles
-
getRoles
Get roles.- Returns:
- roles (read only)
-
getRole
Return role with matching role name, and null otherwise.- Parameters:
name
-- Returns:
-
isVarArgs
public boolean isVarArgs()Returns whether the underlying Java method is a varargs method.- Returns:
-
getRequiredInputRoles
Get required roles. The required input roles, excluding the ?actor role.- Returns:
- required roles (read only)
-
getOptionalInputRoles
Get optional roles. This consists of optional input roles that have a default value.- Returns:
- optional roles (read only)
-
getInputRoles
Get the ?actor role (for Actions, not Operators), all required roles, and optional input roles (e.g., those with a default value). This INCLUDES the ?actor role for Actions, not Operators.- Returns:
- all input roles roles (read only)
-
getReturnRoles
Get the return roles of this DBEntry.- Returns:
- list of return ActionBindings
-
getLocalRoles
Get the local roles of this DBEntry.- Returns:
- list of return ActionBindings
-
getRequiredInputRolesTypes
Get the list of required role types when calling this DBEntry. Required roles are the arguments that have to be provided when calling this DBEntry. This excludes the ?actor role.- Returns:
- list of role types required when calling this DBEntry.
-
getInputRolesTypes
Get the list of input role types when calling this DBEntry. Input roles are all the arguments that can be provided when calling this DBEntry. This includes the ?actor role, all required roles, and all optional input roles that have a default value. This INCLUDES the ?actor role.- Returns:
- list of role types (required and optional) when calling this DBEntry.
-
getOptionalInputRolesTypes
Get the list of optional role types when calling this DBEntry. Optional roles are either return variables or roles with default values. They do not have to be provided when calling this DBEntry.- Returns:
- list of optional role types.
-
getReturnRolesTypes
Get the list of return role types of this DBEntry.- Returns:
- list of return role types
-
toString
-
conflictsWith
Checks if another DBEntry conflicts with this one (same type, name and role types). Two DBEntries are conflicting when it is not possible to identify which one is being called in an eventspec, because they have the same type, name and roles.- Parameters:
that
- other DBEntry- Returns:
- true if they conflict
-