Repository navigation
Expand file tree
/
Copy pathAPI.java
More file actions
63 lines (50 loc) · 1.61 KB
/
Copy pathAPI.java
File metadata and controls
63 lines (50 loc) · 1.61 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import CatalogManager.Attribute;
import CatalogManager.Index;
import CatalogManager.Table;
import RecordManager.ConditionNode;
import RecordManager.Tuple;
import java.io.File;
import java.io.IOException;
import java.util.List;
//todo
//Top APIs
public class API {
static public boolean createTable(Table newTable) {return false;}
static public boolean dropTable(String tableName) {return false;}
static public boolean createIndex(Index newIndex) {return false;}
static public boolean dropIndex(String IndexName) {return false;}
static public boolean insertTuples(String tableName, List<Tuple> tuples)
{return false;}
static public boolean deleteTuples(String tableName, List<ConditionNode> conditionNodes)
{return false;}
static public List<Tuple> selectFromTable(String tableName, List<Attribute> attributes, List<ConditionNode> conditionNodes)
{return null;}
static public void quit(){};
}
//Bottom APIs
//to be continue...
class FileAPI{
static public boolean fileExist(String fileName){
File f = new File(fileName);
return f.exists();
}
static public boolean createFileIfNotExist(String filename){
File f = new File(filename);
if(!(f.exists())){
try {
return f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
static public boolean deleteFile(String fileName){
File f = new File(fileName);
if(f.exists()){
return f.delete();
}else{
return false;
}
}
}