Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/08 18:05:14 (16 years ago)
Author:
gkronber
Message:

merged FunctionsAndStructIdRefactoring-branch (r142, r143, r144, r145, r146, r147, r148, r149, r152, r153) back into the trunk (ticket #112)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/Substraction.cs

    r2 r155  
    3333    public override string Description {
    3434      get {
    35         return @"Substracts the results of sub-operators 2..n from the result of the first sub-operator.
     35        return @"Substracts the results of sub-tree 2..n from the result of the first sub-tree.
    3636    (- 3) => -3
    3737    (- 2 3) => -1
     
    4646    }
    4747
    48     public Substraction(Substraction source, IDictionary<Guid, object> clonedObjects)
    49       : base(source, clonedObjects) {
    50     }
    5148
    52 
    53     public override double Evaluate(Dataset dataset, int sampleIndex) {
    54 
    55       if(SubFunctions.Count == 1) {
    56         return -SubFunctions[0].Evaluate(dataset, sampleIndex);
     49    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
     50      if(args.Length == 1) {
     51        return -args[0];
    5752      } else {
    58         double result = SubFunctions[0].Evaluate(dataset, sampleIndex);
    59         for(int i = 1; i < SubFunctions.Count; i++) {
    60           result -= SubFunctions[i].Evaluate(dataset, sampleIndex);
     53        double result = args[0];
     54        for(int i = 1; i < args.Length; i++) {
     55          result -= args[i];
    6156        }
    6257        return result;
    6358      }
    64     }
    65 
    66     public override object Clone(IDictionary<Guid, object> clonedObjects) {
    67       Substraction clone = new Substraction(this, clonedObjects);
    68       clonedObjects.Add(clone.Guid, clone);
    69       return clone;
    7059    }
    7160
Note: See TracChangeset for help on using the changeset viewer.