public override bool Equals(object obj) { AnyIn other = obj as AnyIn; if (other == null) { return(false); } else { if (AAString != other.AAString || FeatureCollection.Length != other.FeatureCollection.Length) { Debug.Assert(obj.ToString() != ToString()); // real assert return(false); } if (FeatureCollection.Length > 0) { bool b = FeatureCollection[0].Equals(other.FeatureCollection[0]); Debug.Assert(b == (obj.ToString() == ToString())); // real assert return(b); } Debug.Assert(obj.ToString() == ToString()); // real assert return(true); } }
public static IEnumerable <IHashableFeature> GetNFlankAny1AndNTermEAny2(NEC nec, string nflankAny, string nTermEAny) { NFlank nFlankFeature = NFlank.GetInstance(); string nFlankRegion = nFlankFeature.FeatureFunction(nec); if (-1 == nFlankRegion.IndexOfAny(nflankAny.ToCharArray())) { yield break; } NTermE nTermEFeature = NTermE.GetInstance(); string nTermERegion = nTermEFeature.FeatureFunction(nec); if (-1 == nTermERegion.IndexOfAny(nTermEAny.ToCharArray())) { yield break; } AnyIn anyFeature1 = AnyIn.GetInstance(nflankAny, nFlankFeature); AnyIn anyFeature2 = AnyIn.GetInstance(nTermEAny, nTermEFeature); And andFeature = And.GetInstance(anyFeature1, anyFeature2); Debug.Assert((bool)andFeature.Evaluate(nec)); // real assert - must only generate true features yield return(andFeature); }
static public AnyIn GetInstance(string aaString, Feature feature) { AnyIn anyInFeature = new AnyIn(); anyInFeature.AAString = aaString; anyInFeature.FeatureCollection = new Feature[] { (Feature)feature }; return(anyInFeature); }