Skip to content

Commit

Permalink
Use the ready-made field, instead of a custom class.
Browse files Browse the repository at this point in the history
  • Loading branch information
izrik committed Nov 12, 2021
1 parent e92100a commit e0b1357
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
14 changes: 1 addition & 13 deletions Expressions/ColorExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,6 @@ public override void AcceptVisitor(IExpressionVisitor visitor)
throw new NotImplementedException();
}

public override IMathObject Result { get; } = new ResultC();
private class ResultC : IMathObject
{
public bool? IsScalar(SolusEnvironment env) => true;
public bool? IsVector(SolusEnvironment env) => false;
public bool? IsMatrix(SolusEnvironment env) => false;
public int? GetTensorRank(SolusEnvironment env) => 0;
public bool? IsString(SolusEnvironment env) => false;
public int? GetDimension(SolusEnvironment env, int index) => null;
public int[] GetDimensions(SolusEnvironment env) => null;
public int? GetVectorLength(SolusEnvironment env) => null;
public bool IsConcrete => false;
}
public override IMathObject Result => ScalarMathObject.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public void ResultIsScalar()
Assert.IsFalse(result.IsMatrix(env));
Assert.AreEqual(0, result.GetTensorRank(env));
Assert.IsFalse(result.IsString(env));
Assert.IsNull(result.GetDimension(env, 0));
Assert.IsNull(result.GetDimensions(env));
Assert.IsNull(result.GetVectorLength(env));
}
}
}
}

0 comments on commit e0b1357

Please sign in to comment.