public void NegateOperator_ShouldImplement_ValueEquality() { var unaryOperatory = new NegateOperator ( position: 0, right: new Identifier(0, "right") ); Assert.That(unaryOperatory.Equals(null), Is.False); Assert.That(unaryOperatory.Equals(new NotOperator ( position: 0, right: new Identifier(0, "right") )), Is.False); Assert.That(unaryOperatory.Equals(new NegateOperator ( position: 0, right: new Identifier(0, "wrong") )), Is.False); Assert.That(unaryOperatory.Equals(new NegateOperator ( position: 0, right: new Identifier(0, "right") )), Is.True); }
public void Visit(NegateOperator node) { builder.AppendLine($"Negate"); builder.Indent(); node.Right.Accept(this); builder.Outdent(); }
public void Visit(NegateOperator negate) { negate.Right.Accept(this); var rightOperand = tacs.Last().Result; tacs.Add(Tac.Negate(rightOperand, MakeNewTemp())); }
public void NegateOperatorTest() { string path = @"negatetest.txt"; File.WriteAllText(path, "9"); NegateOperator negate = new NegateOperator(File.OpenText(path)); Assert.AreEqual(negate.Evaluate(), -9); Assert.AreEqual(negate.ToString(), "-(9)"); }
public void NegateOperator_ShouldPrint() { var ast = new NegateOperator ( position: 0, right: new Identifier(0, "y") ); Assert.That(PrettyPrinter.ToString(ast), Is.EqualTo( @"Negate Identifier(y) ")); }
public override int GetHashCode() { int hash = 1; hash ^= elements_.GetHashCode(); if (NegateOperator != false) { hash ^= NegateOperator.GetHashCode(); } if (Operator != global::LukeKennedy.LSQL.Net.GroupOperator.UnknownGroupoperator) { hash ^= Operator.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
// operator overloaded //! not (FuzzySet) //* scale (double, FuzzySet) //- cut (double, FuzzySet) //- cut (FuzzySet) //& and min intersection(FuzzySet, FuzzySet) //| or max union(FuzzySet, FuzzySet) // "/" public static FuzzySet operator !(FuzzySet fs) { UnaryFSOperator op = new NegateOperator(); return(new UnaryOperatedFuzzySet(fs, op)); }