// reset (for reuse) public void Reset(BitMap defaultBitmap) { DefaultBitmap = defaultBitmap; for (int i = 0; i < MAX_AND_BITMAPS; i++) { AndBitmaps[i] = null; } for (int i = 0; i < MAX_OR_BITMAPS; i++) { OrBitmaps[i] = OrBitmaps2[i] = null; } andBitmapCount = orBitmapCount = orBitmapCount2 = 0; conditions.Clear(); }
// add a bitmap to the 'and' group public void AndBitmap(BitMap bitMap) { if (andBitmapCount == MAX_AND_BITMAPS) { Log.Error("Too many AND-bitmaps in Finder"); return; } if (bitMap == null) { DefaultBitmap = null; } else { AndBitmaps[andBitmapCount++] = bitMap; } }
// copy constructor public Finder(Finder source) { DefaultBitmap = source.DefaultBitmap; andBitmapCount = source.andBitmapCount; for (int i = 0; i < andBitmapCount; i++) { AndBitmaps[i] = source.AndBitmaps[i]; } orBitmapCount = source.orBitmapCount; for (int i = 0; i < orBitmapCount; i++) { OrBitmaps[i] = source.OrBitmaps[i]; } orBitmapCount2 = source.orBitmapCount2; for (int i = 0; i < orBitmapCount2; i++) { OrBitmaps2[i] = source.OrBitmaps2[i]; } conditions.AddRange(source.conditions); }
// replace a bitmap from the 'and' group public void SetBitmap(int index, BitMap bitMap) { AndBitmaps[index] = bitMap; }
// constructor public Finder(BitMap defaultBitmap) { DefaultBitmap = defaultBitmap; }
// helper to (re)set forward and reverse bitmaps private void updateBitmapPair(int id, BitMap positive, BitMap negative, bool isPositive) { positive.Set(id, isPositive); negative.Set(id, !isPositive); }