public boolean meetsCondition(IntervalDescription desc, double condMin, double condMax, double condAvg, double condMedian, interval interval)
    {
    	for(Condition condition: desc.conditions)
		{
			if(condition.conditionType.equalsIgnoreCase("Compare stat vs stat"))
			{
				
				double stat1 = 0.0;
				double stat2 = 0.0;
				
				if(condition.stat1 == StatValue.MAX)
				{
					stat1 = condMax;
				}
				else if(condition.stat1 == StatValue.MIN)
				{
					stat1 = condMin;
				}
				else if(condition.stat1 == StatValue.MEAN)
				{
					stat1 = condAvg;
				}
				else if(condition.stat1 == StatValue.MEDIAN)
				{
					stat1 = condMedian;
				}
				
				if(condition.stat2 == StatValue.MAX)
				{
					stat2 = condMax;
				}
				else if(condition.stat2 == StatValue.MIN)
				{
					stat2 = condMin;
				}
				else if(condition.stat2 == StatValue.MEAN)
				{
					stat2 = condAvg;
				}
				else if(condition.stat2 == StatValue.MEDIAN)
				{
					stat2 = condMedian;
				}
				
				if(condition.comparer.equalsIgnoreCase("<"))
				{
					if(stat1 < stat2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("<="))
				{
					if(stat1 <= stat2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("="))
				{
					if(stat1 == stat2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">"))
				{
					if(stat1 > stat2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">="))
				{
					if(stat1 >= stat2 * condition.multiplier)
					{
						return true;
					}
				}
			}
			else if(condition.conditionType.equalsIgnoreCase("Compare stat vs fixed value"))
			{
				double stat1 = 0.0;
				double condValue = condition.value;
				
				if(condition.stat1 == StatValue.MAX)
				{
					stat1 = condMax;
				}
				else if(condition.stat1 == StatValue.MIN)
				{
					stat1 = condMin;
				}
				else if(condition.stat1 == StatValue.MEAN)
				{
					stat1 = condAvg;
				}
				else if(condition.stat1 == StatValue.MEDIAN)
				{
					stat1 = condMedian;
				}
				
				if(condition.comparer.equalsIgnoreCase("<"))
				{
					if(stat1 < condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("<="))
				{
					if(stat1 <= condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("="))
				{
					if(stat1 == condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">"))
				{
					if(stat1 > condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">="))
				{
					if(stat1 >= condValue)
					{
						return true;
					}
				}
				
			}
			else if(condition.conditionType.equalsIgnoreCase("Compare stat vs instant"))
			{
				double stat1 = 0.0;
				double instantValue = 0.0;
				
				if(condition.stat1 == StatValue.MAX)
				{
					stat1 = condMax;
				}
				else if(condition.stat1 == StatValue.MIN)
				{
					stat1 = condMin;
				}
				else if(condition.stat1 == StatValue.MEAN)
				{
					stat1 = condAvg;
				}
				else if(condition.stat1 == StatValue.MEDIAN)
				{
					stat1 = condMedian;
				}
				
				if(condition.instant1.equalsIgnoreCase("First"))
				{
					instantValue = interval.Results.getFirst().result;
				}
				else
				{
					instantValue = interval.Results.getLast().result;
				}
				
				if(condition.comparer.equalsIgnoreCase("<"))
				{
					if(stat1 < instantValue * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("<="))
				{
					if(stat1 <= instantValue * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("="))
				{
					if(stat1 == instantValue * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">"))
				{
					if(stat1 > instantValue * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">="))
				{
					if(stat1 >= instantValue * condition.multiplier)
					{
						return true;
					}
				}
			}
			else if(condition.conditionType.equalsIgnoreCase("Compare instant vs fixed value"))
			{
				double instantValue = 0.0;
				double condValue = condition.value;
				
				if(condition.instant1.equalsIgnoreCase("First"))
				{
					instantValue = interval.Results.getFirst().result;
				}
				else
				{
					instantValue = interval.Results.getLast().result;
				}
				
				if(condition.comparer.equalsIgnoreCase("<"))
				{
					if(instantValue < condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("<="))
				{
					if(instantValue <= condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("="))
				{
					if(instantValue == condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">"))
				{
					if(instantValue > condValue)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">="))
				{
					if(instantValue >= condValue)
					{
						return true;
					}
				}
			}
			else if(condition.conditionType.equalsIgnoreCase("Compare instant vs instant"))
			{
				double instantValue1 = 0.0;
				double instantValue2 = 0.0;
				
				
				if(condition.instant1.equalsIgnoreCase("First"))
				{
					instantValue1 = interval.Results.getFirst().result;
				}
				else
				{
					instantValue1 = interval.Results.getLast().result;
				}
				
				if(condition.instant2.equalsIgnoreCase("First"))
				{
					instantValue2 = interval.Results.getFirst().result;
				}
				else
				{
					instantValue2 = interval.Results.getLast().result;
				}
				
				if(condition.comparer.equalsIgnoreCase("<"))
				{
					if(instantValue1 < instantValue2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("<="))
				{
					if(instantValue1 <= instantValue2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase("="))
				{
					if(instantValue1 == instantValue2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">"))
				{
					if(instantValue1 > instantValue2 * condition.multiplier)
					{
						return true;
					}
				}
				else if(condition.comparer.equalsIgnoreCase(">="))
				{
					if(instantValue1 >= instantValue2 * condition.multiplier)
					{
						return true;
					}
				}
			}
		}
    	return false;
    }