public T As <T>(Constraint.ControllerType controllerType) where T : ElementaryConstraintController { bool typeMatch = GetType() == typeof(T); return(typeMatch && IsControllerTypeMatch(controllerType) ? this as T : null); }
private bool IsControllerTypeMatch(Constraint.ControllerType controllerType) { return(controllerType == Constraint.ControllerType.Primary || (controllerType == Constraint.ControllerType.Translational && NativeName.EndsWith("T")) || (controllerType == Constraint.ControllerType.Rotational && NativeName.EndsWith("R"))); }