-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctionalDependency.java
49 lines (41 loc) · 1.29 KB
/
FunctionalDependency.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
49
import java.util.Iterator;
/**
* Represents a functional dependency, namely the dependent attributes
* are determined by the independent set.
*
* Is mostly just an Immutable tuple with named fields.
**/
public class FunctionalDependency {
private final AttributeSet _independentAttributeSet;
private final AttributeSet _dependentAttributeSet;
//this FD represents independentSet -> dependentSet
public FunctionalDependency(AttributeSet ind, AttributeSet dep) {
_independentAttributeSet = new AttributeSet(ind);
_dependentAttributeSet = new AttributeSet(dep);
}
public AttributeSet independent() {
return new AttributeSet(_independentAttributeSet);
}
public AttributeSet dependent() {
return new AttributeSet(_dependentAttributeSet);
}
public AttributeSet getindependent(){
return this._independentAttributeSet;
}
public AttributeSet getdependent(){
return this._dependentAttributeSet;
}
public String toString() {
String out = "";
Iterator<Attribute> independ = this.independent().iterator();
while(independ.hasNext()) out += independ.next();
out += "->";
Iterator<Attribute> depend = this.dependent().iterator();
while (depend.hasNext()) out += depend.next();
return out;
}
<<<<<<< HEAD
}
=======
}
>>>>>>> 53d71a355a2c9e7ecbdac71628eca762aa22f824