public void Update()
	{
		for (int j = 1; j < endPoints.size(); ++j)
		{
			Endpoint key = new Endpoint(endPoints.get(j));
			int i = j - 1;
			
			while (i >= 0 && key.compareTo(endPoints.get(i)) == -1)
			{
				Endpoint end0 = new Endpoint(endPoints.get(i));
				Endpoint end1 = new Endpoint(endPoints.get(i+1));
				
				if (end0.type == Endpoint.Type.BEGIN)
				{
					if (end1.type == Endpoint.Type.END)
					{
						overLaps.remove(new Pair(end0.index, end1.index));
						
					}
				}
				else
				{
					if (end1.type == Endpoint.Type.BEGIN)
					{
						Interval interval0 = new Interval(intervals.get(end0.index));
						Interval interval1 = new Interval(intervals.get(end1.index));
						
						if (interval0.end[0].compareTo(interval1.end[1]) <= 0)
						{
							overLaps.add(new Pair(end0.index, end1.index));
							
						}
					}
				}
				
				endPoints.set(i, end1);
				endPoints.set(i + 1, end0);
				
				lookUp.set(2*end1.index + end1.type.ordinal(), new Integer(i));
				lookUp.set(2*end0.index + end0.type.ordinal(), new Integer(i+1));
				
				--i;
			}
			
			endPoints.set(i+1, key);
			lookUp.set(2*key.index + key.type.ordinal(), new Integer(i+1));
		}
	}