public MetricRelationPart(int value, GKOIntDomain metricDomainVal) { if (metricDomainVal == null) { throw new NullReferenceException("The metric domain should be specified!"); } this.metricDomain = metricDomainVal; this.SetValue(value); }
/// <summary> /// Checks if a value is in the integer domain /// </summary> /// <param name="intDomain"></param> /// <param name="value">The value to check</param> /// <returns>True if the value is in the domain, false otherwise</returns> public static bool ValueInDomain(this GKOIntDomain intDomain, int value) { return(value >= intDomain.MinValue && value <= intDomain.MaxValue && (intDomain.MinValue - value) % intDomain.StepWidth == 0); // derived from: start + n*step = value }