public virtual IUmlConstraint Copy() { var copy = new DynamicConstraint <TTarget>(Name, Target, Condition) { LogType = LogType }; copy.RightConstraint = RightConstraint; copy.SuppressLogging = SuppressLogging; return(copy); }
/// <summary> /// Set an additional constraint to be OR-ed logically with this constraint. /// This uses a clone of the incoming constraint. /// </summary> /// <param name="orConstraint">The constraint to OR with this constraint</param> /// <returns>IUmlConstraint</returns> public IUmlConstraint OrWith(IUmlConstraint orConstraint) { if (orConstraint != null) { RightConstraint = orConstraint; var binaryOr = new DynamicConstraint <DynamicConstraint <TTarget> >(Name + " || " + RightConstraint.Name, this, (target) => target.IsTrue() || target.RightConstraint.IsTrue()) { LogType = LogType }; return(binaryOr); } return(this); }
/// <summary> /// Set an additional constraint to be AND-ed logically with this constraint. /// This uses a clone of the incoming constraint. /// </summary> /// <param name="andConstraint">The constraint to AND with this constraint</param> /// <returns>IUmlConstraint</returns> public IUmlConstraint AndWith(IUmlConstraint andConstraint) { if (andConstraint != null) { RightConstraint = andConstraint; var binaryAnd = new DynamicConstraint <DynamicConstraint <TTarget> >(Name + " && " + RightConstraint.Name, this, (target) => target.IsTrue() && target.RightConstraint.IsTrue()) { LogType = LogType }; return(binaryAnd); } return(this); }