Question
using the code below fill in the question marks in the coding using java also have the following code pull information from a file called
using the code below fill in the question marks in the coding using java also have the following code pull information from a file called im sure you call the file somewhere in the main but not entirely sure.
example3_23.txt
the contents of the text file is as follows
ABCD A B B C CD A
import java.io.*; import java.util.*;
public class DB7{
class FD{ HashSet
HashSet
public DB7(String[] args){ // 1. split FDs so each FD has a single attribute on the right Scanner in = null; try { in = new Scanner(new File(args[0])); } catch (FileNotFoundException e){ System.err.println(args[0] + " not found"); System.exit(1); } String line = in.nextLine(); cols = line.length(); attributes = new char[cols]; for (int i = 0; i < cols; i++){ attributes[i] = line.charAt(i); R.add(attributes[i]); att2col.put(attributes[i], i); } while (in.hasNextLine()){ HashSet
void printTableau(){ for (int i = 0; i < cols; i++) System.out.print(attributes[i] + "\t"); System.out.println(); for (int i = 0; i < rows; i++){ for (int j = 0; j < cols; j++) System.out.print(tableau[i][j] + "\t"); System.out.println(); } System.out.println(); }
void chase(){ // Your code needed do { changed = false; F.forEach(fd -> { fd.print(); for (m = 1; m < rows; m++) for (l = 0; l < m; l++){ n = 0; fd.lhs.forEach(c -> { int col = att2col.get(c); if (tableau[m][col] == tableau[l][col]) n++; }); if (n == fd.lhs.size()){ // tuples m and l agree on all shared attributes int col = att2col.get(fd.rhs); // they should also agree on col if (tableau[m][col] != tableau[l][col]){ if (tableau[m][col] == -1) tableau[l][col] = ???; else if (tableau[l][col] == -1) tableau[m][col] = ???; else tableau[m][col] = ???; changed = true; printTableau(); } } } }); } while (changed == true); }
void conclusion(){ // Your code to idensity whether the decomposition is lossless if (???) System.out.println("lossless"); else System.out.println("not lossless"); }
public static void main(String[] args){ if (args.length < 3){ System.err.println("Usage: java DB7 FDs schema1 schema2 ..."); return; } DB7 db7 = new DB7(args); db7.chase(); db7.conclusion(); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started