62 |
return c.s(d_2, dir); |
return c.s(d_2, dir); |
63 |
} |
} |
64 |
|
|
65 |
public void test(Space s) { |
public void testInsertRow(Space s) { |
66 |
Cell home = s.getHomeCell(); |
Cell home = s.getHomeCell(); |
67 |
Dim d_1 = s.getDim(Ids.d_1); |
Dim d_1 = s.getDim(Ids.d_1); |
68 |
Dim d_2 = s.getDim(Ids.d_2); |
Dim d_2 = s.getDim(Ids.d_2); |
99 |
throw new Error(); |
throw new Error(); |
100 |
|
|
101 |
} |
} |
102 |
|
|
103 |
|
public Cell deleteRow(Cell c) { |
104 |
|
Dim d_1 = c.space.getDim(Ids.d_1); |
105 |
|
Dim d_2 = c.space.getDim(Ids.d_2); |
106 |
|
|
107 |
|
Cell x = c.s(d_2, -1); |
108 |
|
if(x == null) x = c.s(d_2, 1); |
109 |
|
if(x == null) x = c.space.getHomeCell(); |
110 |
|
|
111 |
|
while(c.s(d_1, -1) != null) { |
112 |
|
c.s(d_1, -1).delete(); |
113 |
|
} |
114 |
|
|
115 |
|
while(c.s(d_1, 1) != null) { |
116 |
|
c.s(d_1, 1).delete(); |
117 |
|
} |
118 |
|
|
119 |
|
c.delete(); |
120 |
|
|
121 |
|
return x; |
122 |
|
} |
123 |
|
|
124 |
|
public void testDeleteRow(Space s) { |
125 |
|
Cell home = s.getHomeCell(); |
126 |
|
Dim d_1 = s.getDim(Ids.d_1); |
127 |
|
Dim d_2 = s.getDim(Ids.d_2); |
128 |
|
|
129 |
|
Cell a = home.N(d_1, 1); |
130 |
|
Cell b = home.N(d_2, 1); |
131 |
|
Cell c = b.N(d_2, 1); |
132 |
|
Cell d = a.N(d_2, 1); |
133 |
|
Cell e = b.N(d_1, 1); |
134 |
|
|
135 |
|
d.connect(d_2, 1, e); |
136 |
|
d.connect(d_1, -1, c); |
137 |
|
|
138 |
|
Cell x = deleteRow(e); |
139 |
|
|
140 |
|
if(!x.equals(d)) |
141 |
|
throw new Error(); |
142 |
|
|
143 |
|
if(!x.s(d_1, -1).equals(c)) |
144 |
|
throw new Error(); |
145 |
|
|
146 |
|
if(!c.s(d_2, -1).equals(home)) |
147 |
|
throw new Error(); |
148 |
|
|
149 |
|
if(!home.s(d_1, 1).equals(a)) |
150 |
|
throw new Error(); |
151 |
|
|
152 |
|
if(!a.s(d_2, 1).equals(d)) |
153 |
|
throw new Error(); |
154 |
|
|
155 |
|
if(c.s(d_2, 1) != null) |
156 |
|
throw new Error(); |
157 |
|
|
158 |
|
if(d.s(d_2, 1) != null) |
159 |
|
throw new Error(); |
160 |
|
} |
161 |
} |
} |