protected override ReducedCartesianAbstractDomain <StripeWithIntervals <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> >, LinearEqualitiesEnvironment <BoxedExpression> > Factory(StripeWithIntervals <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> > left, LinearEqualitiesEnvironment <BoxedExpression> right)
                {
                    StripeWithIntervalsForUnsafeCode l;

                    if (left is StripeWithIntervalsForUnsafeCode)
                    {
                        l = (StripeWithIntervalsForUnsafeCode)left;
                    }
                    else
                    {
                        l = new StripeWithIntervalsForUnsafeCode((IntervalsForUnsafeCode)left.Left, (StripeForUnsafeCode)left.Right, this.decoder, this.context, this.mdDecoder);
                    }

                    LinearEqualitiesForUnsafeCode r;

                    if (right is LinearEqualitiesForUnsafeCode)
                    {
                        r = (LinearEqualitiesForUnsafeCode)right;
                    }
                    else
                    {
                        r = new LinearEqualitiesForUnsafeCode(right, this.decoder, this.context, this.mdDecoder);
                    }
                    StripeIntervalsKarrForUnsafeCode result = new StripeIntervalsKarrForUnsafeCode(l, r, decoder, encoder, context, this.mdDecoder);

                    foreach (BoxedExpression exp in this.nullPointers)
                    {
                        result.nullPointers.Add(exp);
                    }
                    return(result);
                }
                /// <summary>
                /// Join that performs trickery to keep bounds on pointers if one side is null
                /// </summary>
                /// <param name="pc">PC of join point</param>
                public StripeWithIntervalsForUnsafeCode Join(StripeWithIntervalsForUnsafeCode prevState, APC pc)
                {
                    IntervalsForUnsafeCode thisInterval = (IntervalsForUnsafeCode)this.Left.Clone();

                    IntervalsForUnsafeCode prevInterval = (IntervalsForUnsafeCode)prevState.Left.Clone();

                    IntervalsForUnsafeCode joinLeftPart = (IntervalsForUnsafeCode)((IntervalsForUnsafeCode)this.Left).Join(prevState.Left, this.nullPointers.Union(prevState.nullPointers), pc);

                    // Pietro's
                    // if (!light)
                    if (true)
                    {
                        //Before permorming the join, it refines the information contained in the domain
                        StripeForUnsafeCode thisRightRefined = (StripeForUnsafeCode)((StripeForUnsafeCode)this.Right).RefineInternally();
                        StripeForUnsafeCode prevRightRefined = (StripeForUnsafeCode)((StripeForUnsafeCode)prevState.Right).RefineInternally();
                        StripeForUnsafeCode joinRightPart    = (StripeForUnsafeCode)thisRightRefined.Join(prevRightRefined, this.nullPointers.Union(prevState.nullPointers), thisInterval, prevInterval, pc);

                        //It resets the set of the bottom pointers
                        nullPointers = new Set <BoxedExpression>();
                        return((StripeWithIntervalsForUnsafeCode)prevState.Reduce(joinLeftPart, joinRightPart));
                    }
                    //else
                    //{
                    //  StripeForUnsafeCode joinRightPart = (StripeForUnsafeCode)this.Right.Join(prevState.Right, this.nullPointers.Union(prevState.nullPointers));
                    //  nullPointers = new Set<BoxedExpression>();
                    //  return (StripeWithIntervalsForUnsafeCode)prevState.Reduce(joinLeftPart, joinRightPart);
                    //}
                }
                protected override ReducedCartesianAbstractDomain <IntervalEnvironment <BoxedExpression>, Stripe <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> > > Factory(IntervalEnvironment <BoxedExpression> left, Stripe <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> > right)
                {
                    StripeWithIntervalsForUnsafeCode result = new StripeWithIntervalsForUnsafeCode((IntervalsForUnsafeCode)left, (StripeForUnsafeCode)right, decoder, context, this.mdDecoder);

                    foreach (BoxedExpression exp in this.nullPointers)
                    {
                        result.nullPointers.Add(exp);
                    }
                    return(result);
                }
 public StripeIntervalsKarrForUnsafeCode(
     StripeWithIntervalsForUnsafeCode /*!*/ left,
     LinearEqualitiesForUnsafeCode /*!*/ right,
     BoxedExpressionDecoder <Type, ExternalExpression> decoder,
     IExpressionEncoder <BoxedExpression> encoder,
     IExpressionContext <APC, Local, Parameter, Method, Field, Type, ExternalExpression, Variable> context,
     IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> mdDecoder
     )
     : base(left, right, decoder, encoder)
 {
     this.decoder   = decoder;
     this.context   = context;
     this.mdDecoder = mdDecoder;
 }
                /// <summary>
                /// It dispatches the join operator to the improved version in order to manage pointers that are null in one of the two branches
                /// </summary>
                public StripeIntervalsKarrForUnsafeCode Join(StripeIntervalsKarrForUnsafeCode prevState, APC pc)
                {
                    StripeWithIntervalsForUnsafeCode thisState_Left = this.Left as StripeWithIntervalsForUnsafeCode;
                    StripeWithIntervalsForUnsafeCode prevState_Left = prevState.Left as StripeWithIntervalsForUnsafeCode;

                    LinearEqualitiesForUnsafeCode thisState_Right = this.Right as LinearEqualitiesForUnsafeCode;
                    LinearEqualitiesForUnsafeCode prevState_Right = prevState.Right as LinearEqualitiesForUnsafeCode;

                    Debug.Assert(thisState_Left != null & thisState_Right != null & prevState_Left != null & prevState_Right != null);

                    // thisState_Right = PropagateConstants(thisState_Left.Left, thisState_Right);

                    StripeWithIntervalsForUnsafeCode joinLeftPart  = (StripeWithIntervalsForUnsafeCode)thisState_Left.Join(prevState_Left, pc);
                    LinearEqualitiesForUnsafeCode    joinRightPart = (LinearEqualitiesForUnsafeCode)thisState_Right.Join(prevState_Right, this.nullPointers.Union(prevState.nullPointers), pc);

                    nullPointers = new Set <BoxedExpression>();
                    return((StripeIntervalsKarrForUnsafeCode)prevState.Reduce(joinLeftPart, joinRightPart));
                }
                /// <summary>
                /// It checks for each dropped constraints if it can be validated by the intervals domain state
                /// </summary>
                private void addConstraints(IntervalsForUnsafeCode intervalsPrev, StripeForUnsafeCode thiscloned, StripeForUnsafeCode result)
                {
                    StripeForUnsafeCode dropped = (StripeForUnsafeCode)this.Factory();

                    ExtractDroppedConstraints(thiscloned, result, dropped);

                    foreach (BoxedExpression key in dropped.Keys)
                    {
                        foreach (AtMostTwoExpressions <BoxedExpression> constr in dropped[key].EmbeddedValues_Unsafe)
                        {
                            if (!constr.IsTop && !constr.IsBottom)
                            {
                                BoxedExpression           toBeChecked = StripeWithIntervalsForUnsafeCode.MakeCondition(key, constr, this.mdDecoder);
                                FlatAbstractDomain <bool> test        = intervalsPrev.CheckIfHolds(toBeChecked);
                                if (!test.IsBottom && !test.IsTop && test.BoxedElement == true)
                                {
                                    result.AddConstraint(key, constr);
                                }
                            }
                        }
                    }
                }
                private IAbstractDomainForEnvironments <BoxedExpression> RefineTest(StripeWithIntervalsForUnsafeCode result)
                {
                    //For each variable whose value has been modified we check if it is possible to refine the state of the intervals with the relational domain
                    Set <BoxedExpression>  modified = ((IntervalsForUnsafeCode)result.Left).NewValues;
                    IntervalsForUnsafeCode intres   = (IntervalsForUnsafeCode)result.Left;

                    foreach (BoxedExpression val in modified)
                    {
                        StripeForUnsafeCode left = (StripeForUnsafeCode) new StripeForUnsafeCode(((StripeForUnsafeCode)result.Right).GetConstraintsOfAVariable(val), this.context);
                        foreach (BoxedExpression key in left.Keys)
                        {
                            foreach (AtMostTwoExpressions <BoxedExpression> constr in left[key].EmbeddedValues_Unsafe)
                            {
                                intres = RefineIntervalsWithConstraint(intres, key, constr, this.mdDecoder);
                            }
                        }
                    }

                    //We reset the modified values
                    ((IntervalsForUnsafeCode)this.Left).NewValues = new Set <BoxedExpression>();
                    return((IAbstractDomainForEnvironments <BoxedExpression>) this.Factory(intres, result.Right));
                }
                public StripeWithIntervalsForUnsafeCode Widening(StripeWithIntervalsForUnsafeCode prevState, APC pc)
                {
                    IntervalsForUnsafeCode thisInterval = (IntervalsForUnsafeCode)this.Left.Clone();

                    IntervalsForUnsafeCode prevInterval = (IntervalsForUnsafeCode)prevState.Left.Clone();

                    if (this.IsBottom)
                    {
                        return(prevState);
                    }
                    if (prevState.IsBottom)
                    {
                        return(this);
                    }

                    IntervalsForUnsafeCode joinLeftPart = (IntervalsForUnsafeCode)((IntervalsForUnsafeCode)this.Left).Widening(prevState.Left);

                    // Pietro's
                    //if (!light)
                    if (true)
                    {
                        //Since our domain is of finite height, we can use the version of join operator improved with the information abount null pointers
                        StripeForUnsafeCode thisRightRefined = (StripeForUnsafeCode)((StripeForUnsafeCode)this.Right).RefineInternally();
                        StripeForUnsafeCode prevRightRefined = (StripeForUnsafeCode)((StripeForUnsafeCode)prevState.Right).RefineInternally();
                        StripeForUnsafeCode joinRightPart    = (StripeForUnsafeCode)thisRightRefined.Join(prevRightRefined, this.nullPointers.Union(prevState.nullPointers), thisInterval, prevInterval, pc);

                        //It resets the set of the bottom pointers
                        nullPointers = new Set <BoxedExpression>();
                        return((StripeWithIntervalsForUnsafeCode)prevState.Reduce(joinLeftPart, joinRightPart));
                    }
                    //else
                    //{
                    //  StripeForUnsafeCode joinRightPart = (StripeForUnsafeCode)this.Right.Join(prevState.Right, this.nullPointers.Union(prevState.nullPointers));
                    //  nullPointers = new Set<BoxedExpression>();
                    //  return (StripeWithIntervalsForUnsafeCode)prevState.Reduce(joinLeftPart, joinRightPart);
                    //}
                }
                /// <summary>
                /// The refined version of the TestFalse function
                /// </summary>
                public override IAbstractDomainForEnvironments <BoxedExpression> TestFalse(BoxedExpression guard)
                {
                    StripeWithIntervalsForUnsafeCode result = (StripeWithIntervalsForUnsafeCode)base.TestFalse(guard);

                    return(RefineTest(result));
                }