Ejemplo n.º 1
0
 /// <summary>
 /// Determines whether the specified <see cref="object" />, is equal to this instance.
 /// </summary>
 /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public override bool Equals(object obj)
 {
     if (obj is MosfetVariables <T> mv)
     {
         if (!Drain.Equals(mv.Drain))
         {
             return(false);
         }
         if (!DrainPrime.Equals(mv.DrainPrime))
         {
             return(false);
         }
         if (!Source.Equals(mv.Source))
         {
             return(false);
         }
         if (!SourcePrime.Equals(mv.SourcePrime))
         {
             return(false);
         }
         if (!Gate.Equals(mv.Gate))
         {
             return(false);
         }
         if (!Bulk.Equals(mv.Bulk))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (!(obj is StructField))
            {
                return(false);
            }
            StructField other = (StructField)obj;

            return(StructFieldDecl == other.StructFieldDecl && Base.Equals(other.Base));
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (!(obj is Pointer))
            {
                return(false);
            }
            Pointer other = (Pointer)obj;

            return(Base.Equals(other.Base));
        }
Ejemplo n.º 4
0
 public IExpr /*!*/ ThrowOnUnableToInline(IVariable /*!*/ othervar)
 //throws EquivalentExprException;
 {
     Contract.Requires(othervar != null);
     Contract.Ensures(Contract.Result <IExpr>() != null);
     Contract.EnsuresOnThrow <EquivalentExprException>(true);
     if (othervar.Equals(var))
     {
         throw new EquivalentExprException();
     }
     else
     {
         return(othervar);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
 /// </summary>
 /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public override bool Equals(object obj)
 {
     if (obj is OnePort <T> op)
     {
         if (!Positive.Equals(op.Positive))
         {
             return(false);
         }
         if (!Negative.Equals(op.Negative))
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
        public static SubExpression GetVariableProductSubExpression(this Expression source, IVariable variable)
        {
            List <IToken> collection = new List <IToken>();

            collection.Add(variable);

            IToken current = variable;
            IToken left    = Token.None;

            while (true)
            {
                left    = source.LeftOfToken(current);
                current = source.LeftOfToken(left);
                if (current.Equals(Token.None) || left.Contents != "*")
                {
                    break;
                }
                collection.Insert(0, left);
                collection.Insert(0, current);
            }

            current = variable;
            IToken right = Token.None;

            while (true)
            {
                right   = source.RightOfToken(variable);
                current = source.RightOfToken(right);
                if (current.Equals(Token.None) || right.Contents != "*")
                {
                    break;
                }
                collection.Add(right);
                collection.Add(current);
            }


            SubExpression result = new SubExpression(collection.ToArray());

            int start = source.IndexOf(collection.First());
            int count = collection.Count;

            source.RemoveRange(start, count);
            source.InsertRange(start, result);

            return(result);
        }
Ejemplo n.º 7
0
            public override void VisitThrowStatement(ThrowStatement throwStatement)
            {
                base.VisitThrowStatement(throwStatement);

                if (variableWritten)
                {
                    return;
                }

                var argumentResolveResult = ctx.Resolve(throwStatement.Expression) as LocalResolveResult;

                if (argumentResolveResult == null)
                {
                    return;
                }
                if (parameter.Equals(argumentResolveResult.Variable))
                {
                    OffendingThrows.Add(throwStatement);
                }
            }
Ejemplo n.º 8
0
 /// <summary>
 /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
 /// </summary>
 /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
 /// <returns>
 ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
 /// </returns>
 public override bool Equals(object obj)
 {
     if (obj is DiodeVariables <T> dv)
     {
         if (!Positive.Equals(dv.Positive))
         {
             return(false);
         }
         if (!Negative.Equals(dv.Negative))
         {
             return(false);
         }
         if (!PosPrime.Equals(dv.PosPrime))
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 9
0
 public IExpr/*!*/ ThrowOnUnableToInline(IVariable/*!*/ othervar)
   //throws EquivalentExprException;
 {
   Contract.Requires(othervar != null);
   Contract.Ensures(Contract.Result<IExpr>() != null);
   Contract.EnsuresOnThrow<EquivalentExprException>(true);
   if (othervar.Equals(var))
     throw new EquivalentExprException();
   else
     return othervar;
 }