-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRowInfo.java
More file actions
58 lines (51 loc) · 1.02 KB
/
Copy pathRowInfo.java
File metadata and controls
58 lines (51 loc) · 1.02 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
import java.util.ArrayList;
public class RowInfo {
public ArrayList<CellInfo> cells;
String cache;
public RowInfo()
{
cells = new ArrayList<CellInfo>();
cache = null;
}
public RowInfo(ArrayList<CellInfo> cil)
{
cells = cil;
cache = null;
}
public CellInfo get(int index) {
return cells.get(index);
}
// warning : toString() uses cache, after changing cell call carefully
public String toString()
{
if (cache == null)
{
cache = "Row(" + Integer.toString(cells.size()) + ") "
+ DBInterface.composeRow(this);
}
return cache;
}
public boolean equalRow(RowInfo other)
{
return this.toString().equals(other.toString());
}
public static ArrayList<RowInfo> intersect(ArrayList<RowInfo> al, ArrayList<RowInfo> bl)
{
ArrayList<RowInfo> ret = new ArrayList<RowInfo>();
for (RowInfo arow : al)
{
boolean exist = false;
for (RowInfo brow : bl)
{
if (arow.equalRow(brow))
{
exist = true;
break;
}
}
if (exist)
ret.add(arow);
}
return ret;
}
}