示例#1
0
 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);
         }
     }
 }
示例#2
0
 public CharsFreqRemoveAdapter(Const value)
 {
     cfr = new CharsFreqRemover(value.Value);
 }
示例#3
0
 public ReplaceSubstringDecorator(Var source, Const dest)
 {
     rv = new ReplaceVisitorAdapter(source, dest);
 }
示例#4
0
 public ConcatDecorator(Const value)
 {
     ConcatValue = new ConstVar(value);
 }
 public ReplaceVisitorAdapter(Var source, Const dest)
 {
     rv = new ReplaceFormulaVisitor
              (new ConstVar(source), new ConstVar(dest));
 }