private void Replace(FormulaDecorator f) { if (f.Subformula is Var) { if (Substring.IsVar && (f.Subformula as Var).Value == Substring.Value) { (f.Subformula as Var).Value = (f.Subformula as Var).Value.Replace(Substring.Value, Replacement.Value); if (Replacement.IsConst) { var fConst = new Const((f.Subformula as Var).Value); f.Subformula = fConst; } } } else if (f.Subformula is Const) { if (Substring.IsConst && (Replacement.IsConst || (f.Subformula as Const).Value == Substring.Value)) { (f.Subformula as Const).Value = (f.Subformula as Const).Value.Replace(Substring.Value, Replacement.Value); if (Replacement.IsVar) { var fVar = new Var((f.Subformula as Const).Value); f.Subformula = fVar; } } else if (Substring.IsConst && Replacement.IsVar) { string value = (f.Subformula as Const).Value; f.Subformula = new Const(""); ReplaceEntries(f, value); } } }
public CharsFreqRemoveAdapter(Const value) { cfr = new CharsFreqRemover(value.Value); }
public ReplaceSubstringDecorator(Var source, Const dest) { rv = new ReplaceVisitorAdapter(source, dest); }
public ConcatDecorator(Const value) { ConcatValue = new ConstVar(value); }
public ReplaceVisitorAdapter(Var source, Const dest) { rv = new ReplaceFormulaVisitor (new ConstVar(source), new ConstVar(dest)); }