52 lines
1001 B
Java
52 lines
1001 B
Java
import java.util.ArrayList;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @author Lublena
|
|
*
|
|
*/
|
|
public class FDependency extends Dependency
|
|
{
|
|
//ArrayList<String> left;
|
|
//ArrayList<String> right; // the column name on the right hand side of the dependency
|
|
|
|
ArrayList left;
|
|
ArrayList right; // the column name on the right hand side of the dependency
|
|
|
|
public FDependency()
|
|
{
|
|
type = 0;
|
|
//left = new ArrayList<String>();
|
|
//right = new ArrayList<String>();
|
|
|
|
left = new ArrayList();
|
|
right = new ArrayList();
|
|
}
|
|
|
|
/* (non-Javadoc)
|
|
* @see Dependency#toString()
|
|
*/
|
|
public String toString()
|
|
{
|
|
if (left.isEmpty() || right.isEmpty())
|
|
{
|
|
return null;
|
|
}
|
|
|
|
StringBuffer sb = new StringBuffer(left.get(0).toString());
|
|
|
|
|
|
for (int i = 1; i < left.size(); ++i)
|
|
{
|
|
sb.append(", " + left.get(i).toString());
|
|
}
|
|
|
|
// Append the right side of the functional dependency
|
|
sb.append(" -> " + right.get(0).toString());
|
|
return sb.toString();
|
|
}
|
|
}
|