28 |
/** A simple hierarchical implementation of VobMatcher. |
/** A simple hierarchical implementation of VobMatcher. |
29 |
*/ |
*/ |
30 |
public class DefaultVobMatcher implements VobMatcher { |
public class DefaultVobMatcher implements VobMatcher { |
31 |
|
private static final String rcsid = "$Id$"; |
32 |
public static boolean dbg = false; |
public static boolean dbg = false; |
33 |
private static void pa(String s) { System.err.println(s); } |
private static void pa(String s) { System.err.println(s); } |
34 |
|
|
136 |
DefaultVobMatcher other = (DefaultVobMatcher)other0; |
DefaultVobMatcher other = (DefaultVobMatcher)other0; |
137 |
int[] interpList = new int[maxcs+1]; |
int[] interpList = new int[maxcs+1]; |
138 |
if(dbg) pa("interplist: "+interpList[0]); |
if(dbg) pa("interplist: "+interpList[0]); |
139 |
|
int[] toOther = null; |
140 |
|
if(towardsOther) { // Construct inverse forced matches |
141 |
|
toOther = new int[maxcs+1]; |
142 |
|
for(int i=0; i<other.maxcs+1; i++) { |
143 |
|
if(other.keyByCs[i] != null && |
144 |
|
other.keyByCs[i].interpolateTo > 0) { |
145 |
|
toOther[other.keyByCs[i].interpolateTo] = i; |
146 |
|
} |
147 |
|
} |
148 |
|
} |
149 |
for(int i=1; i<maxcs+1; i++) { |
for(int i=1; i<maxcs+1; i++) { |
150 |
if(keyByCs[i] == null) |
if(keyByCs[i] == null) |
151 |
interpList[i] = -1; |
interpList[i] = -1; |
152 |
else { |
else { |
153 |
Key k = keyByCs[i]; |
Key k = keyByCs[i]; |
154 |
if(!towardsOther && k.interpolateTo > 0) { |
if(towardsOther) { |
155 |
int csTo = k.interpolateTo; |
if(toOther[i] > 0) { |
156 |
Key kOther = other.keyByCs[csTo]; |
if(dbg) pa("Inverse overridden: "+i+" "+ |
157 |
// Need to check; otherwise can get core dumps |
toOther[i]); |
158 |
if(kOther == null) { |
interpList[i] = toOther[i]; |
159 |
pa("??!!! interp wrong"); |
continue; |
160 |
} else { |
} |
161 |
if(dbg) pa(i+" overridden into "+csTo); |
} else { |
162 |
interpList[i] = csTo; |
if(k.interpolateTo > 0) { |
163 |
|
int csTo = k.interpolateTo; |
164 |
|
Key kOther = other.keyByCs[csTo]; |
165 |
|
// Need to check; otherwise can get core dumps |
166 |
|
if(kOther == null) { |
167 |
|
pa("??!!! interp wrong"); |
168 |
|
} else { |
169 |
|
if(dbg) pa(i+" overridden into "+csTo); |
170 |
|
interpList[i] = csTo; |
171 |
|
} |
172 |
|
continue; |
173 |
} |
} |
|
continue; |
|
174 |
} |
} |
175 |
|
|
176 |
if(k.parent < 0 || k.parent >= i) |
if(k.parent < 0 || k.parent >= i) |