-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLiteral.java
48 lines (42 loc) · 1.01 KB
/
Literal.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//******************************************************************************
//
// File: Literal.java
//
//******************************************************************************
/**
* Class Literal acts as a model for the literals in a clause holding boolean
* variables.
*
* @author Harshad Paradkar
*
*/
public class Literal {
/**
* The variable in this literal.
*/
public Variable variable;
/**
* To indicate if this literal is a negation of it's variable.
*/
public boolean isNegated;
/**
* Construct a new Literal of the given variable.
*
* @param variable The variable of this literal.
* @param isNegated If true: Variable is negated; false: otherwise.
*/
public Literal(Variable variable, boolean isNegated) {
this.variable = variable;
this.isNegated = isNegated;
}
/**
* @return true: If literal's value is TRUE; false: otherwise.
*/
public boolean getValue() {
if(isNegated) {
return !(variable.value);
}else {
return variable.value;
}
}
}