Class Entity
java.lang.Object
edu.uky.cs.nil.sabre.Entity
- All Implemented Interfaces:
Expression, Logical, Parameter, Simplifiable, Typed, Value, Unique, Serializable, Comparable<Logical>
- Direct Known Subclasses:
Character
An entity represents a discrete object in a
problem.
Entities are unique symbols defined in a universe, which
means entity objects are only the same if they are from the same universe.
Entities with the same ID number and name are different entities if they
come from different universes. This means entities can be compared using
==. The ID number of an entity corresponds with its index in Universe.entities.
Entities should not be constructed directly. They should be defined by a
UniverseBuilder.
- Author:
- Stephen G. Ware
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringThe comment associated with this entity from the problem definitionfinal intThe unique sequential ID number of this entity in its universefinal StringThe unique name of this entity in this universefinal ImmutableSet<Type> The direct parent types of this entityfinal UniverseThe universe in which this entity is defined -
Method Summary
Modifier and TypeMethodDescriptionApplies a given function to every part of this logical formula and then creates a new logical formula of this same type using the results returned from the function.intinthashCode()booleanTests whether this formula is of a giventype.booleanTests whether this formula is of typeboolean.booleanTests whether this formula is of typecharacter.booleanisEntity()Tests whether this formula is of typeentity.booleanisNumber()Tests whether this formula is of typenumber.Returns an expression which represents a character's beliefs about this expression.simplify()Returns a logically equivalent but smaller, simpler, or more convenient form of this logical formula.toString()Methods inherited from class Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface Expression
mustBeValued, negate, toEffect, toPreconditionMethods inherited from interface Logical
collect, collect, collect, distinguish, find, find, find, mustBeGround, occurs, substitute, substituteMethods inherited from interface Typed
mustBe, mustBeBoolean, mustBeCharacter, mustBeEntity, mustBeNumber, mustNotBe, mustNotBeBoolean, mustNotBeCharacter, mustNotBeEntity, mustNotBeNumber
-
Field Details
-
universe
The universe in which this entity is defined -
id
public final int idThe unique sequential ID number of this entity in its universe -
name
The unique name of this entity in this universe -
types
The direct parent types of this entity -
comment
The comment associated with this entity from the problem definition
-
-
Method Details
-
hashCode
-
toString
-
compareTo
-
apply
Description copied from interface:LogicalApplies a given function to every part of this logical formula and then creates a new logical formula of this same type using the results returned from the function. If, for every part of this formula, the function always returns its input as output with no changes, this method should return this object (not just any object that isequal tothis object).- Specified by:
applyin interfaceExpression- Specified by:
applyin interfaceLogical- Specified by:
applyin interfaceParameter- Specified by:
applyin interfaceSimplifiable- Specified by:
applyin interfaceValue- Parameters:
function- the function to apply to all parts of this formula- Returns:
- a logical formula of the same type as this formula made from the returned objects, or this object if no parts were changed by the function
-
isBoolean
-
isNumber
-
isEntity
-
isCharacter
public boolean isCharacter()Description copied from interface:TypedTests whether this formula is of typecharacter.- Specified by:
isCharacterin interfaceTyped- Returns:
- true if the formula is of type character, false otherwise
-
is
-
simplify
Description copied from interface:SimplifiableReturns a logically equivalent but smaller, simpler, or more convenient form of this logical formula.- Specified by:
simplifyin interfaceExpression- Specified by:
simplifyin interfaceParameter- Specified by:
simplifyin interfaceSimplifiable- Specified by:
simplifyin interfaceValue- Returns:
- a smaller, simpler, or more convenient logical formula which is equivalent to this formula
-
evaluate
Description copied from interface:Expression- Specified by:
evaluatein interfaceExpression- Specified by:
evaluatein interfaceValue- Parameters:
state- the state in which this expression will be evaluated- Returns:
- the value of this expression
-
prepend
Description copied from interface:ExpressionReturns an expression which represents a character's beliefs about this expression.
-