source: src/main/java/weka/associations/tertius/Literal.java @ 16

Last change on this file since 16 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 2.1 KB
Line 
1/*
2 *    This program is free software; you can redistribute it and/or modify
3 *    it under the terms of the GNU General Public License as published by
4 *    the Free Software Foundation; either version 2 of the License, or
5 *    (at your option) any later version.
6 *
7 *    This program is distributed in the hope that it will be useful,
8 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 *    GNU General Public License for more details.
11 *
12 *    You should have received a copy of the GNU General Public License
13 *    along with this program; if not, write to the Free Software
14 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 *    Literal.java
19 *    Copyright (C) 2003 Peter A. Flach, Nicolas Lachiche
20 *
21 *    Thanks to Amelie Deltour for porting the original C code to Java
22 *    and integrating it into Weka.
23 *
24 */
25
26package weka.associations.tertius;
27
28import weka.core.Instance;
29import weka.core.RevisionHandler;
30
31import java.io.Serializable;
32
33/**
34 * @author Peter A. Flach
35 * @author Nicolas Lachiche
36 * @version $Revision: 1.5 $
37 */
38public abstract class Literal
39  implements Serializable, RevisionHandler {
40
41  /** for serialization */
42  private static final long serialVersionUID = 2675363669503575771L;
43 
44  private Predicate m_predicate;
45
46  public static final int NEG = 0;
47
48  public static final int POS = 1;
49
50  private int m_sign;
51
52  private Literal m_negation;
53
54  protected int m_missing;
55
56  public Literal(Predicate predicate, int sign, int missing) {
57
58    m_predicate = predicate;
59    m_sign = sign;
60    m_negation = null;
61    m_missing = missing;
62  }
63
64  public Predicate getPredicate() {
65
66    return m_predicate;
67  }
68
69  public Literal getNegation() {
70
71    return m_negation;
72  }
73
74  public void setNegation(Literal negation) {
75
76    m_negation = negation;
77  }
78
79  public boolean positive() {
80
81    return m_sign == POS;
82  }
83
84  public boolean negative() {
85
86    return m_sign == NEG;
87  }
88
89  public abstract boolean satisfies(Instance instance);
90 
91  public abstract boolean negationSatisfies(Instance instance);
92 
93  public abstract String toString();
94}
95
96
97
98
99
100
Note: See TracBrowser for help on using the repository browser.