Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright 2019 Regents of the University of California. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be found in the LICENSE.txt file at the root of the project.
******************************************************************************/
package edu.cavsat.model.bean;

import java.util.HashSet;
import java.util.Set;

public class Dependency {
private Set<Integer> left;
private Set<Integer> right;

public Dependency() {
super();
this.left = new HashSet<Integer>();
this.right = new HashSet<Integer>();
}

public Set<Integer> getLeft() {
return left;
}

public void setLeft(Set<Integer> left) {
this.left = left;
}

public Set<Integer> getRight() {
return right;
}

public void setRight(Set<Integer> right) {
this.right = right;
}

public void addToLeft(int attributeIndex) {
this.left.add(attributeIndex);
}

public void addToRight(int attributeIndex) {
this.right.add(attributeIndex);
}

@Override
public String toString() {
// TODO Auto-generated method stub
if(this.equals(null))
return null;
String result = "";
for (int i : left) {
result += i + ",";
}
result = result.substring(0, result.length() - 1) + "->";
for (int i : right) {
result += i + ",";
}
result = result.substring(0, result.length() - 1);
return result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
public class Relation {
private String name;
private List<String> attributes;
private List<String> types;
private Set<Integer> keyAttributes;
private Dependency dependency;
private Set<String> relevantAttributes;

@Override
Expand All @@ -37,7 +39,8 @@ public Relation(String name) {
this.name = name;
this.keyAttributes = new HashSet<Integer>();
this.attributes = new ArrayList<String>();
// this.dependency = new Dependency();
this.types = new ArrayList<String>();
this.dependency = new Dependency();
this.relevantAttributes = new HashSet<String>();
}

Expand All @@ -60,6 +63,14 @@ public List<String> getAttributes() {
public void setAttributes(List<String> attributes) {
this.attributes = attributes;
}

public List<String> getTypes() {
return types;
}

public void setTypes(List<String> types) {
this.types = types;
}

public Set<Integer> getKeyAttributes() {
return keyAttributes;
Expand All @@ -72,6 +83,14 @@ public List<String> getKeyAttributesList() {
}
return list;
}

public Dependency getDependency() {
return dependency;
}

public void setDependency(Dependency dependency) {
this.dependency = dependency;
}

public void setKeyAttributes(Set<Integer> keyAttributes) {
this.keyAttributes = keyAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ public String getSQLSyntax() {
public String getSQLSyntaxWithoutAggregates() {
return getSQLSyntaxWithoutAggregates("");
}

public List<String> getFrom() {
return from;
}

public void setFrom(List<String> from) {
this.from = from;
}

public SQLQuery getQueryWithoutAggregates() {
SQLQuery noAggQuery = new SQLQuery(this);
Expand Down
Loading