public double getLengths(IntervalDescription intDesc, String option)
    {
    	double length = 0.0;
    	double minLength = -1.0;
		double maxLength = -1.0;
		double sumLength = 0.0;
		double intervalsCount = 0.0;
    	
    	for(int i=0; i < intervalsList.size(); i++)
    	{
    		LinkedList<interval> currentList = intervalsList.get(i);
    		if(!currentList.isEmpty())
    		{
    			interval firstInt = currentList.getFirst();
    			if(firstInt.intervalDescription == intDesc)
    			{ 				
    				for(interval interval: currentList)
    				{
    					intervalsCount++;
    					double duration = (interval.End.getTime() - interval.Start.getTime())/(1000*60*60);
    					sumLength += duration;
    					if(minLength == -1.0)
    					{
    						minLength = duration;
    					}
    					else
    					{
    						if (duration < minLength)
    						{
    							minLength = duration;
    						}
    					}
    					if(maxLength == -1.0)
    					{
    						maxLength = duration;
    					}
    					else
    					{
    						if (duration > maxLength)
    						{
    							maxLength = duration;
    						}
    					}
    				}
    				
    				break;
    				
    			}
    		}
    	}
    	
    	if(intervalsCount == 0.0)
    	{
    		return 0.0;
    	}
    	else
    	{
    		if(option.equalsIgnoreCase("Max"))
    		{
    			return maxLength;
    		}
    		else if(option.equalsIgnoreCase("Min"))
    		{
    			return minLength;
    		}
    		else if(option.equalsIgnoreCase("Avg"))
    		{
    			double avg = (double)(sumLength/intervalsCount);
    			return avg;
    		}
    	}
    	
    	return length;
    }