getModel()
last analyzed

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 1
c 0
b 0
f 0
1
package it.cnr.istc.pst.cognition.koala.reasoner.environment;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.apache.jena.rdf.model.Model;
7
8
/**
9
 * 
10
 * @author alessandro
11
 *
12
 */
13
public abstract class EnvironmentReasoner 
14
{
15
	private final List<EnvironmentListener> listeners;
16
	
17
	/**
18
	 * 
19
	 */
20
	public EnvironmentReasoner() {
21
		this.listeners = new ArrayList<EnvironmentListener>();
22
	}
23
	
24
	/**
25
	 * 
26
	 * @param listener
27
	 */
28
	public void subscribe(EnvironmentListener listener) {
29
		synchronized (this.listeners) {
30
			this.listeners.add(listener);
31
		}
32
	}
33
	
34
	/**
35
	 * 
36
	 */
37
	protected void publish() {
38
		// check subscribers
39
		synchronized (this.listeners) {
40
			for (EnvironmentListener listener : this.listeners) {
41
				// update listener
42
				listener.update();
43
			}
44
		}
45
	}
46
	
47
	/**
48
	 * 
49
	 * @param envFilePath
50
	 */
51
	public abstract void init(String envFilePath);
52
	
53
	/**
54
	 * 
55
	 * @return
56
	 */
57
	public abstract Model getModel();
58
}
59