-
Notifications
You must be signed in to change notification settings - Fork 13
/
EdgeField.java
115 lines (94 loc) · 2.82 KB
/
EdgeField.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import java.util.StringTokenizer;
public class EdgeField {
private int numFigure, tableID, tableBound, fieldBound, dataType, varcharValue;
private String name, defaultValue;
private boolean disallowNull, isPrimaryKey;
private static String[] strDataType = {"Varchar", "Boolean", "Integer", "Double"};
public static final int VARCHAR_DEFAULT_LENGTH = 1;
public EdgeField(String inputString) {
StringTokenizer st = new StringTokenizer(inputString, EdgeConvertFileParser.DELIM);
numFigure = Integer.parseInt(st.nextToken());
name = st.nextToken();
tableID = 0;
tableBound = 0;
fieldBound = 0;
disallowNull = false;
isPrimaryKey = false;
defaultValue = "";
varcharValue = VARCHAR_DEFAULT_LENGTH;
dataType = 0;
}
public int getNumFigure() {
return numFigure;
}
public String getName() {
return name;
}
public int getTableID() {
return tableID;
}
public void setTableID(int value) {
tableID = value;
}
public int getTableBound() {
return tableBound;
}
public void setTableBound(int value) {
tableBound = value;
}
public int getFieldBound() {
return fieldBound;
}
public void setFieldBound(int value) {
fieldBound = value;
}
public boolean getDisallowNull() {
return disallowNull;
}
public void setDisallowNull(boolean value) {
disallowNull = value;
}
public boolean getIsPrimaryKey() {
return isPrimaryKey;
}
public void setIsPrimaryKey(boolean value) {
isPrimaryKey = value;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String value) {
defaultValue = value;
}
public int getVarcharValue() {
return varcharValue;
}
public void setVarcharValue(int value) {
if (value > 0) {
varcharValue = value;
}
}
public int getDataType() {
return dataType;
}
public void setDataType(int value) {
if (value >= 0 && value < strDataType.length) {
dataType = value;
}
}
public static String[] getStrDataType() {
return strDataType;
}
public String toString() {
return numFigure + EdgeConvertFileParser.DELIM +
name + EdgeConvertFileParser.DELIM +
tableID + EdgeConvertFileParser.DELIM +
tableBound + EdgeConvertFileParser.DELIM +
fieldBound + EdgeConvertFileParser.DELIM +
dataType + EdgeConvertFileParser.DELIM +
varcharValue + EdgeConvertFileParser.DELIM +
isPrimaryKey + EdgeConvertFileParser.DELIM +
disallowNull + EdgeConvertFileParser.DELIM +
defaultValue;
}
}