Package com.bayesserver
Class VariableContext
- java.lang.Object
-
- com.bayesserver.VariableContext
-
public final class VariableContext extends Object
Represents a variable and associated information such as time, and whether it is marked as head or tail. AVariableContext
is used to store contextual information about a variable in a distribution, such as whether it is marked as head or tail, and time if the variable belongs to a temporal node. The same variable can appear more than once in a distribution if it appears at different times.
-
-
Constructor Summary
Constructors Constructor Description VariableContext(Variable variable)
Initializes a new instance of theVariableContext
class.VariableContext(VariableContext variableContext)
Initializes a new instance of theVariableContext
class, copying an existing instance.VariableContext(Variable variable, HeadTail headTail)
Initializes a new instance of theVariableContext
class.VariableContext(Variable variable, Integer time)
Initializes a new instance of theVariableContext
class.VariableContext(Variable variable, Integer time, HeadTail headTail)
Initializes a new instance of theVariableContext
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeadTail
getHeadTail()
Specifies whether the variable is marked as Head or Tail.Integer
getTime()
Gets the time associated with the variable if it belongs to a temporal node.Variable
getVariable()
Gets the variable.boolean
isHead()
Determines whether this instance is marked as Head.boolean
isTail()
Determines whether this instance is marked as Tail.
-
-
-
Constructor Detail
-
VariableContext
public VariableContext(VariableContext variableContext)
Initializes a new instance of theVariableContext
class, copying an existing instance.- Parameters:
variableContext
- The variable context to copy.
-
VariableContext
public VariableContext(Variable variable)
Initializes a new instance of theVariableContext
class. Time defaults to null and HeadTail to Head.- Parameters:
variable
- The variable.
-
VariableContext
public VariableContext(Variable variable, HeadTail headTail)
Initializes a new instance of theVariableContext
class. Time defaults to null.- Parameters:
variable
- The variable.headTail
- Indicates whether the variable is marked as head or tail.
-
VariableContext
public VariableContext(Variable variable, Integer time)
Initializes a new instance of theVariableContext
class. HeadTail defaults to Head.- Parameters:
variable
- The variable.time
- The time associated with the variable. Can be null.
-
VariableContext
public VariableContext(Variable variable, Integer time, HeadTail headTail)
Initializes a new instance of theVariableContext
class.- Parameters:
variable
- The variable.time
- The time associated with the variable. Can be null.headTail
- Indicates whether the variable is marked as head or tail.
-
-
Method Detail
-
getHeadTail
public HeadTail getHeadTail()
Specifies whether the variable is marked as Head or Tail.- Returns:
- Specified either Head or Tail.
- See Also:
HeadTail
-
getVariable
public Variable getVariable()
Gets the variable.- Returns:
- The variable.
-
getTime
public Integer getTime()
Gets the time associated with the variable if it belongs to a temporal node.- Returns:
- The time associated with the variable. Null if the variable does not belong to a temporal node.
-
isHead
public boolean isHead()
Determines whether this instance is marked as Head.- Returns:
true
if this instance is marked as Head; otherwise,false
.- See Also:
HeadTail
-
isTail
public boolean isTail()
Determines whether this instance is marked as Tail.- Returns:
true
if this instance is marked as Tail; otherwise,false
.- See Also:
HeadTail
-
-