public LinkedList<interval> getBoundedIntervals(LinkedList<instant>[] instants, String name, IntervalDescription desc)
    {
    	LinkedList<interval> newIntervals = new LinkedList<interval>();
    	
    	for(instant startInstant: instants[0])
    	{
    		for(instant endInstant: instants[1])
    		{
    			if(startInstant != null && endInstant != null)
    			{
    				if(startInstant.date != null && endInstant.date != null)
    				{
    					if(startInstant.date.before(endInstant.date) || startInstant.date.equals(endInstant.date))
    					{
    						boolean complies = true;
    						if(desc.hasMaxDistance)
    						{
    							double diff = Math.abs(startInstant.date.getTime() - endInstant.date.getTime());
    							//Minutes to milliseconds
    							double maxThreshold = desc.boundedMaxDistance*1000*60;
    							if(desc.boundedMaxUnit.equalsIgnoreCase("Hours"))
    							{
    								maxThreshold *= 60;
    							}
    							else if(desc.boundedMaxUnit.equalsIgnoreCase("Days"))
    							{
    								maxThreshold *= 24*60;
    							}
    							else if(desc.boundedMaxUnit.equalsIgnoreCase("Months"))
    							{
    								maxThreshold *= 30*24*60;
    							}
    							else if(desc.boundedMaxUnit.equalsIgnoreCase("Years"))
    							{
    								maxThreshold *= 12*30*24*60;
    							}
    							
    							if(diff > maxThreshold)
    							{
    								complies = false;
    							}
    							
    						}
    						if(desc.hasMinDistance)
    						{
    							double diff = Math.abs(startInstant.date.getTime() - endInstant.date.getTime());
    							//Minutes to milliseconds
    							double minThreshold = desc.boundedMinDistance*1000*60;
    							if(desc.boundedMinUnit.equalsIgnoreCase("Hours"))
    							{
    								minThreshold *= 60;
    							}
    							else if(desc.boundedMinUnit.equalsIgnoreCase("Days"))
    							{
    								minThreshold *= 24*60;
    							}
    							else if(desc.boundedMinUnit.equalsIgnoreCase("Months"))
    							{
    								minThreshold *= 30*24*60;
    							}
    							else if(desc.boundedMinUnit.equalsIgnoreCase("Years"))
    							{
    								minThreshold *= 12*30*24*60;
    							}
    							
    							if(diff < minThreshold)
    							{
    								complies = false;
    							}
    							
    						}
    						
    						if(complies)
    						{
    							interval newInterval = new interval(this.id, name, null, startInstant.date, endInstant.date, desc);
    			    			newIntervals.add(newInterval);
    						}
    						
    					}
    				}
    			}
    		}
    	}
    	
    	/*for(int i=0; i<instants[0].size(); i++)
    	{
    		instant startInstant = instants[0].get(i);
    		instant endInstant = instants[1].get(i);
    		interval newInterval = new interval(this.id, name, null, startInstant.date, endInstant.date);
    		newIntervals.add(newInterval);
    	}*/
    	intervalsList.add(newIntervals);
    	return newIntervals;
    }