예제 #1
0
    private void Add(T rangeItem, bool wantOverwrite)
    {
        //ranges ordered from low start to high start
        int insertIndex = 0;

        for (int i = 0; i < _ranges.Count; ++i)
        {
            iRange r = _ranges[i];
            //if r is 'beyond' rangeItem
            //insert at the curr insert index
            if (rangeItem.startP > r.extent())
            {
                insertIndex++;
                continue;
            }
            if (rangeItem.extent() < r.startP)
            {
                break;
            }
            OverlapState overlState = rangeItem.overlapStateWith(r);
            if (OverLapUtil.OverlapExists(overlState))
            {
                //want overwrite??
                _ranges.RemoveAt(i);
                insertIndex = i;
//				throw new Exception("Discrete Domain Range List doesn't put up with flush or overlapping ranges");
            }
        }
        this.Insert(insertIndex, rangeItem);
    }
예제 #2
0
    public List <LightColumn> lightColumnsAdjacentToAndFlushWithSimpleRangeAndPoint(SimpleRange colmRange, PTwo coord)
    {
//		PTwo coord = colm.coord;
        List <LightColumn> result = new List <LightColumn>();

        foreach (PTwo surroundingCo in DirectionUtil.SurroundingPTwoCoordsFromPTwo(coord))
        {
            DiscreteDomainRangeList <LightColumn> adjRangeList = this.lightColumnListAtOrNull(surroundingCo.s, surroundingCo.t);
            if (adjRangeList == null)
            {
                continue;
            }
            for (int i = 0; i < adjRangeList.Count; ++i)
            {
                LightColumn adjLightColumn = adjRangeList[i];

                OverlapState overlap = colmRange.overlapStateWith(adjLightColumn.range);
                if (OverLapUtil.OverlapExists(overlap))
                {
                    result.Add(adjLightColumn);
                }
            }
        }
        return(result);
    }