[go: up one dir, main page]

Menu

[r19]: / cell / CellLinkDown.java  Maximize  Restore  History

Download this file

36 lines (35 with data), 1.0 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
package cell;
abstract class CellLinkDown extends CellFile
{
abstract CellBase boot(String fileName);
String fileName;
CellLinkDown(String fileName)
{
super(fileName);
this.fileName = fileName.toUpperCase();
}
void transmit(short row, String dest, float diff, byte shifted, float frac)
{
CellBase d = boot(dest);
float old = d.af(shifted, row);
float answer = old + (diff * frac);
d.so( shifted, row, new Float(answer));
}
static String match(String reg, String fix, String src)
// returns the dest file name, or null
{
String mat = "";
for (int i = 0; i < reg.length(); i++)
if (reg.charAt(i) == '*') mat += fix.charAt(i);
else if (reg.charAt(i) == '+') mat += src.charAt(i);
else mat += reg.charAt(i);
reg = mat;
mat = "";
for (int i = 0; i < fix.length(); i++)
if (fix.charAt(i) == '+') mat += reg.charAt(i);
else mat += fix.charAt(i);
fix = mat;
if (!reg.equalsIgnoreCase(fix)) return null;
return reg;
}
}