Ejemplo n.º 1
0
    public bool Includes(Interval <T> interval)
    {
        var leftEdge = LeftEdge;

        if (leftEdge != Edge.Unbounded)
        {
            if (
                leftEdge == Edge.Open &&
                interval.LeftEdge == Edge.Closed &&
                interval._left.Equals(_left)
                )
            {
                return(false);
            }
            if (interval.CompareLeft(_left.Value) == CompareResult.Inside)
            {
                return(false);
            }
        }
        var rightEdge = RightEdge;

        if (rightEdge != Edge.Unbounded)
        {
            if (
                rightEdge == Edge.Open &&
                interval.RightEdge == Edge.Closed &&
                interval._right.Equals(_right)
                )
            {
                return(false);
            }
            if (interval.CompareRight(_right.Value) == CompareResult.Inside)
            {
                return(false);
            }
        }
        return(true);
    }