public IList<DatabaseConstraint> Load(string tableName, string schemaName, ConstraintType constraintType)
        {
            if (string.IsNullOrEmpty(tableName)) throw new ArgumentNullException("tableName", "must have tableName");

            switch (constraintType)
            {
                case ConstraintType.PrimaryKey:
                    return PrimaryKeys(tableName, schemaName);

                case ConstraintType.ForeignKey:
                    return ForeignKeys(tableName, schemaName);

                case ConstraintType.UniqueKey:
                    return _ukConverter.Constraints(tableName, schemaName);

                case ConstraintType.Check:
                    return _ckConverter.Constraints(tableName, schemaName);

                case ConstraintType.Default:
                    return _dfConverter.Constraints(tableName, schemaName);

                default:
                    throw new ArgumentOutOfRangeException("constraintType");
            }
        }
Esempio n. 2
0
        public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable, IVariable rightVariable)
        {
            IVariable any = milpManager.CreateAnonymous(Domain.AnyInteger);
            leftVariable.Set(ConstraintType.Equal,any.Operation(OperationType.Multiplication, rightVariable));

            return leftVariable;
        }
Esempio n. 3
0
        /// <summary>
        /// 创建指定类型的多个 Binding 实例,ConstraintType 为 MULTIPLE,并返回 IBindingFactory
        /// </summary>
        virtual public IBindingFactory MultipleCreate(
            Type[] types,
            BindingType[] bindingType)
        {
            int length = types.Length;

            _bindings = new IBinding[length];

            for (int i = 0; i < length; i++)
            {
                ConstraintType cti = ConstraintType.MULTIPLE;
                if (bindingType[i] != BindingType.ADDRESS &&
                    bindingType[i] != BindingType.MULTITON)
                {
                    cti = ConstraintType.SINGLE;
                }

                bindings[i] = Create(
                    types[i],
                    bindingType[i],
                    cti);
            }

            return(this);
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor using only the Main Table.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="table"></param>
 /// <param name="col"></param>
 public Constraint(ConstraintType type, Table table, int[] col)
 {
     _type = type;
     _mainTable = table;
     _mainColumns = col;
     _len = col.Length;
 }
Esempio n. 5
0
 internal ConstraintMapInfo(MemberInfo member, string columnName, ConstraintType constraintType, string checkExpression)
 {
     Member          = member;
     ColumnName      = columnName;
     ConstraintType  = constraintType;
     CheckExpression = checkExpression;
 }
 public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable,
     IVariable rightVariable)
 {
     switch (type)
     {
         case ConstraintType.Equal:
             milpManager.SetEqual(leftVariable, rightVariable);
             leftVariable.ConstantValue = rightVariable.ConstantValue ?? leftVariable.ConstantValue;
             rightVariable.ConstantValue = leftVariable.ConstantValue ?? rightVariable.ConstantValue;
             break;
         case ConstraintType.LessOrEqual:
             milpManager.SetLessOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.GreaterOrEqual:
             milpManager.SetGreaterOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.LessThan:
             milpManager.Operation(OperationType.IsLessThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.GreaterThan:
             milpManager.Operation(OperationType.IsGreaterThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.NotEqual:
             milpManager.Operation(OperationType.IsNotEqual, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         default:
             throw new InvalidOperationException("Cannot set constraint");
     }
     return leftVariable;
 }
Esempio n. 7
0
        public ConstraintAttribute(ConstraintType type)
        {
            if (type == ConstraintType.ForeignKey)
                throw new NotImplementedException();

            Type = type;
        }
Esempio n. 8
0
 protected Constraint(ObjectName name, Table table, ConstraintType constraintType, IEnumerable<Column> keyColumns)
 {
     _name = name;
     _table = table;
     _constraintType = constraintType;
     _keyColumns = new List<Column>(keyColumns);
 }
        public ADBRuntimeConstraint[] GetConstraint(ConstraintType constrianttype)
        {
            switch (constrianttype)
            {
            case ConstraintType.Structural_Vertical:
                return(constraintsStructuralVertical.ToArray());

            case ConstraintType.Structural_Horizontal:
                return(constraintsStructuralHorizontal.ToArray());

            case ConstraintType.Shear:
                return(constraintsShear.ToArray());

            case ConstraintType.Bending_Vertical:
                return(constraintsBendingVertical.ToArray());

            case ConstraintType.Bending_Horizontal:
                return(constraintsBendingHorizontal.ToArray());

            case ConstraintType.Circumference:
                return(constraintsCircumference.ToArray());

            default:
                Debug.LogError("can not find the constraint");
                return(null);
            }
        }
Esempio n. 10
0
 public SqlConstraintExpression(ConstraintType constraintType, string constraintName, object[] constraintOptions)
     : base(typeof(void))
 {
     this.ConstraintType    = constraintType;
     this.ConstraintOptions = constraintOptions;
     this.ConstraintName    = constraintName;
 }
 public JacobianConstraint(
     IShapeCommon objectA,
     IShapeCommon objectB,
     int?contactReference,
     Vector3d?linearComponentA,
     Vector3d?linearComponentB,
     Vector3d angularComponentA,
     Vector3d angularComponentB,
     ConstraintType type,
     double constraintValue,
     double jacobianVelocity,
     double correctionValue,
     double cfm,
     double constraintLimit)
 {
     ObjectA           = objectA;
     ObjectB           = objectB;
     ContactReference  = contactReference;
     LinearComponentA  = linearComponentA;
     LinearComponentB  = linearComponentB;
     AngularComponentA = angularComponentA;
     AngularComponentB = angularComponentB;
     Type             = type;
     ConstraintValue  = constraintValue;
     JacobianVelocity = jacobianVelocity;
     CorrectionValue  = correctionValue;
     CFM             = cfm;
     ConstraintLimit = constraintLimit;
 }
Esempio n. 12
0
 internal ConstraintMapInfo(MemberInfo member, string columnName, ConstraintType constraintType, string checkExpression)
 {
     Member = member;
     ColumnName = columnName;
     ConstraintType = constraintType;
     CheckExpression = checkExpression;
 }
Esempio n. 13
0
        public Constraints(string owner, string tableName, ConstraintType constraintType)
        {
            _tableName      = tableName;
            _constraintType = constraintType;
            Owner           = owner;
            Sql             = @"SELECT cols.constraint_name,
cols.owner AS constraint_schema, 
cols.table_name, 
cols.column_name, 
cols.position AS ordinal_position, 
cons.r_constraint_name AS unique_constraint_name, 
cons2.table_name AS fk_table,
cons2.r_owner as fk_schema,
cons.delete_rule
FROM all_constraints cons
INNER JOIN all_cons_columns cols 
  ON cons.constraint_name = cols.constraint_name
  AND cons.owner = cols.owner
LEFT OUTER JOIN all_constraints cons2 
  ON cons.r_constraint_name = cons2.constraint_name
  AND cons.owner = cons2.owner
WHERE 
    cons.owner NOT IN ('SYS', 'SYSMAN', 'CTXSYS', 'MDSYS', 'OLAPSYS', 'ORDSYS', 'OUTLN', 'WKSYS', 'WMSYS', 'XDB', 'ORDPLUGINS', 'SYSTEM') AND
   (cols.table_name = :tableName OR :tableName IS NULL) AND 
   (cols.owner = :schemaOwner OR :schemaOwner IS NULL) AND 
    cons.constraint_type = :constraint_type
ORDER BY cols.constraint_name,cols.table_name, cols.position";
        }
Esempio n. 14
0
        /// <summary>
        /// Create a new constraint given type and constraint frames.
        /// </summary>
        /// <param name="type">Constraint type.</param>
        /// <param name="referenceFrame">Reference frame.</param>
        /// <param name="connectedFrame">Connected frame.</param>
        /// <returns>Constraint component, added to a new game object - null if unsuccessful.</returns>
        public static Constraint Create(ConstraintType type,
                                        ConstraintFrame referenceFrame,
                                        ConstraintFrame connectedFrame)
        {
            GameObject constraintGameObject = new GameObject(Factory.CreateName("AGXUnity." + type));

            try {
                Constraint constraint = constraintGameObject.AddComponent <Constraint>();
                constraint.Type = type;

                constraint.AttachmentPair.ReferenceFrame = referenceFrame ?? new ConstraintFrame();
                constraint.AttachmentPair.ConnectedFrame = connectedFrame ?? new ConstraintFrame();

                // Creating a temporary native instance of the constraint, including a rigid body and frames.
                // Given this native instance we copy the default configuration.
                using (var tmpNative = new TemporaryNative(constraint.NativeType, constraint.AttachmentPair))
                    constraint.TryAddElementaryConstraints(tmpNative.Instance);

                return(constraint);
            }
            catch (System.Exception e) {
                Debug.LogException(e);
                DestroyImmediate(constraintGameObject);
                return(null);
            }
        }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Constraint"/> class.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <param name="constraintColumnName">Name of the constraint column.</param>
 /// <param name="constraintQualifiedColumnName">Name of the constraint qualified column.</param>
 /// <param name="constraintConstructionFragment">The constraint construction fragment.</param>
 public Constraint(ConstraintType condition, string constraintColumnName, string constraintQualifiedColumnName, string constraintConstructionFragment)
 {
     Condition            = condition;
     ColumnName           = constraintColumnName;
     QualifiedColumnName  = constraintQualifiedColumnName;
     ConstructionFragment = constraintConstructionFragment;
 }
Esempio n. 16
0
 public SqlConstraintExpression(ConstraintType constraintType, string constraintName = null, IReadOnlyList <string> columnNames = null)
     : base(typeof(void))
 {
     this.ConstraintType = constraintType;
     this.ColumnNames    = columnNames;
     this.ConstraintName = constraintName;
 }
Esempio n. 17
0
 public SPCRJointDynamicsConstraint(ConstraintType Type, SPCRJointDynamicsPoint PointA, SPCRJointDynamicsPoint PointB)
 {
     _Type   = Type;
     _PointA = PointA;
     _PointB = PointB;
     UpdateLength();
 }
Esempio n. 18
0
 // Set all the parameters for this constraint to a fixed, non-movable constraint.
 public override void ResetLink()
 {
     // constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
     constraintType = ConstraintType.BS_FIXED_CONSTRAINT_TYPE;
     linearLimitLow = OMV.Vector3.Zero;
     linearLimitHigh = OMV.Vector3.Zero;
     angularLimitLow = OMV.Vector3.Zero;
     angularLimitHigh = OMV.Vector3.Zero;
     useFrameOffset = BSParam.LinkConstraintUseFrameOffset;
     enableTransMotor = BSParam.LinkConstraintEnableTransMotor;
     transMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
     transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
     cfm = BSParam.LinkConstraintCFM;
     erp = BSParam.LinkConstraintERP;
     solverIterations = BSParam.LinkConstraintSolverIterations;
     frameInAloc = OMV.Vector3.Zero;
     frameInArot = OMV.Quaternion.Identity;
     frameInBloc = OMV.Vector3.Zero;
     frameInBrot = OMV.Quaternion.Identity;
     useLinearReferenceFrameA = true;
     springAxisEnable = new bool[6];
     springDamping = new float[6];
     springStiffness = new float[6];
     for (int ii = 0; ii < springAxisEnable.Length; ii++)
     {
         springAxisEnable[ii] = false;
         springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
         springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
     }
     springLinearEquilibriumPoint = OMV.Vector3.Zero;
     springAngularEquilibriumPoint = OMV.Vector3.Zero;
     member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
 }
Esempio n. 19
0
        /// <summary>
        /// Change constraint type. Note that all values will be default
        /// when the type has changed.
        /// </summary>
        /// <param name="type">New type of the constraint.</param>
        /// <param name="onObjectCreated">Optional callback when an object has been created.</param>
        /// <param name="destroyObject">
        /// Optional callback to destroy an object - Object.DestroyImmediate
        /// is used by default.
        /// </param>
        public void ChangeType(ConstraintType type,
                               Action <UnityEngine.Object> onObjectCreated = null,
                               Action <UnityEngine.Object> destroyObject   = null)
        {
            if (Native != null)
            {
                Debug.LogWarning("Invalid to change type of an initialized constraint.", this);
                return;
            }

            foreach (var elementaryConstraint in m_elementaryConstraints)
            {
                if (destroyObject != null)
                {
                    destroyObject(elementaryConstraint);
                }
                else
                {
                    DestroyImmediate(elementaryConstraint);
                }
            }

            m_elementaryConstraints.Clear();

            SetType(type, true);

            if (type == ConstraintType.Unknown)
            {
                return;
            }

            using (var tempNative = new TemporaryNative(NativeType, AttachmentPair))
                TryAddElementaryConstraints(tempNative.Instance, onObjectCreated);
        }
Esempio n. 20
0
        void CreateRagdollConstraint(string boneName, string parentName, ConstraintType type,
            Vector3 axis, Vector3 parentAxis, Vector2 highLimit, Vector2 lowLimit, bool disableCollision = true)
        {
            Node boneNode = Node.GetChild(boneName, true);
            Node parentNode = Node.GetChild(parentName, true);
            if (boneNode == null)
            {
                Log.Warn($"Could not find bone {boneName} for creating ragdoll constraint");
                return;
            }
            if (parentNode == null)
            {
                Log.Warn($"Could not find bone {parentName} for creating ragdoll constraint");
                return;
            }

            Constraint constraint = boneNode.CreateComponent<Constraint>();
            constraint.ConstraintType = type;
            // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
            constraint.DisableCollision = disableCollision;
            // The connected body must be specified before setting the world position
            constraint.OtherBody = parentNode.GetComponent<RigidBody>();
            // Position the constraint at the child bone we are connecting
            constraint.SetWorldPosition(boneNode.WorldPosition);
            // Configure axes and limits
            constraint.SetAxis(axis);
            constraint.SetOtherAxis(parentAxis);
            constraint.HighLimit = highLimit;
            constraint.LowLimit = lowLimit;
        }
Esempio n. 21
0
 public string ToSelectText(ConstraintType constraintType)
 {
     using (DbTextWriter writer = new DbTextWriter())
     {
         return(ToSelectText(writer, constraintType));
     }
 }
        /// <summary>
        ///   Constructs a new nonlinear constraint.
        /// </summary>
        /// 
        /// <param name="objective">The objective function to which this constraint refers.</param>
        /// <param name="function">A lambda expression defining the left hand side of the 
        ///   constraint equation.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be 
        ///   compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation.</param>
        /// 
        public NonlinearConstraint(IObjectiveFunction objective,
            Func<double[], double> function, ConstraintType shouldBe, double value)
        {
            int n = objective.NumberOfVariables;

            this.Create(objective.NumberOfVariables, function, shouldBe, value, null, 0.0);
        }
Esempio n. 23
0
        public int CheckForSingletons(ConstraintType constraint)
        {
            int effectedSquares = 0;

            for (int i = 0; i < 9; i++)
            {
                Dictionary <int, List <SudokuSquare> > possibilities = ExtractPossibilities(constraint, i);

                foreach (int possibileValue in possibilities.Keys)
                {
                    if (possibilities[possibileValue].Count == 1)
                    {
                        if (IsValueValid(possibilities[possibileValue][0].Position, possibileValue, false))
                        {
                            Debug.Assert(!possibilities[possibileValue][0].ActualValue.HasValue, string.Format("Square {0} already has a value.", possibilities[possibileValue][0].Position));

                            //this only works if the value is valid
                            possibilities[possibileValue][0].ActualValue = possibileValue;
                            effectedSquares++;
                        }
                        else
                        {
                            //possibilities[possibileValue][0].UpdateDismissedValue(possibileValue, true); //cache for later
                            //effectedSquares++;
                        }
                    }
                }
            }

            return(effectedSquares);
        }
Esempio n. 24
0
        public Constraints(string owner, string tableName, ConstraintType constraintType)
        {
            _tableName      = tableName;
            _constraintType = constraintType;
            Owner           = owner;
            Sql             = @"SELECT
    KEYCOLUMNS.CONSTRAINT_NAME, 
    KEYCOLUMNS.TABLE_NAME, 
    KEYCOLUMNS.COLUMN_NAME, 
    KEYCOLUMNS.ORDINAL_POSITION,
    REFS.UNIQUE_CONSTRAINT_NAME, 
    REFS.UNIQUE_CONSTRAINT_TABLE_NAME AS FK_TABLE,
    REFS.DELETE_RULE,
    REFS.UPDATE_RULE
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS CONS
    INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KEYCOLUMNS
     ON CONS.CONSTRAINT_NAME = KEYCOLUMNS.CONSTRAINT_NAME
    LEFT OUTER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS REFS
     ON CONS.CONSTRAINT_NAME = REFS.CONSTRAINT_NAME
WHERE 
    (CONS.TABLE_NAME = @tableName OR @tableName IS NULL) AND 
    (@schemaOwner IS NOT NULL OR @schemaOwner IS NULL) AND 
    CONS.CONSTRAINT_TYPE = @constraint_type
ORDER BY
    KEYCOLUMNS.TABLE_NAME, KEYCOLUMNS.CONSTRAINT_NAME, KEYCOLUMNS.ORDINAL_POSITION";
        }
Esempio n. 25
0
        void CreateRagdollConstraint(string boneName, string parentName, ConstraintType type,
                                     Vector3 axis, Vector3 parentAxis, Vector2 highLimit, Vector2 lowLimit, bool disableCollision = true)
        {
            Node boneNode   = Node.GetChild(boneName, true);
            Node parentNode = Node.GetChild(parentName, true);

            if (boneNode == null)
            {
                Log.Warn($"Could not find bone {boneName} for creating ragdoll constraint");
                return;
            }
            if (parentNode == null)
            {
                Log.Warn($"Could not find bone {parentName} for creating ragdoll constraint");
                return;
            }

            Constraint constraint = boneNode.CreateComponent <Constraint>();

            constraint.ConstraintType = type;
            // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
            constraint.DisableCollision = disableCollision;
            // The connected body must be specified before setting the world position
            constraint.OtherBody = parentNode.GetComponent <RigidBody>();
            // Position the constraint at the child bone we are connecting
            constraint.SetWorldPosition(boneNode.WorldPosition);
            // Configure axes and limits
            constraint.SetAxis(axis);
            constraint.SetOtherAxis(parentAxis);
            constraint.HighLimit = highLimit;
            constraint.LowLimit  = lowLimit;
        }
Esempio n. 26
0
        private void VerifyConstraints(GraphDatabaseAPI db, ConstraintType expectedConstraintType)
        {
            using (Transaction tx = Db.beginTx())
            {
                // only one index
                IEnumerator <ConstraintDefinition> constraints = Db.schema().Constraints.GetEnumerator();
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertTrue("has one index", constraints.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                ConstraintDefinition constraint = constraints.next();
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                assertFalse("not more than one index", constraints.hasNext());

                Label          label          = constraint.Label;
                string         property       = constraint.PropertyKeys.GetEnumerator().next();
                ConstraintType constraintType = constraint.ConstraintType;

                // with correct pattern and provider
                assertEquals("correct label", "Person", label.Name());
                assertEquals("correct property", "name", property);
                assertEquals("correct constraint type", expectedConstraintType, constraintType);

                tx.Success();
            }
        }
Esempio n. 27
0
        public ColumnConstraintInfo(ConstraintType constraintType)
        {
            if (constraintType == ConstraintType.Check)
                throw new ArgumentException("Check is not a column-level constraint");

            ConstraintType = constraintType;
        }
Esempio n. 28
0
        private static void parse(Expression <Func <double[], bool> > constraint,
                                  out Func <double[], double> function, out ConstraintType shouldBe, out double value)
        {
            var expression = constraint.Body as BinaryExpression;

            var comparisonType = expression.NodeType;

            switch (comparisonType)
            {
            case ExpressionType.LessThanOrEqual:
                shouldBe = ConstraintType.LesserThanOrEqualTo;
                break;

            case ExpressionType.GreaterThanOrEqual:
                shouldBe = ConstraintType.GreaterThanOrEqualTo;
                break;

            case ExpressionType.Equal:
                shouldBe = ConstraintType.EqualTo;
                break;

            default:
                throw new NotSupportedException(comparisonType + " is not supported.");
            }

            var left  = expression.Left;
            var right = expression.Right as ConstantExpression;

            var functionExpression = Expression.Lambda(left, constraint.Parameters.ToArray());

            function = functionExpression.Compile() as Func <double[], double>;

            value = (Double)right.Value;
        }
Esempio n. 29
0
        public void Scribble(int x, int y, ConstraintType constraintType, int brushWidth)
        {
            if (CurrentNeuralProcess != null)
            {
                Interop.ConvergenceGap      = Constants.Parameters.GetFloat("MAX_CONVERGENCE_GAP");
                Interop.ConvergenceGapDelta = Constants.Parameters.GetFloat("MAX_CONVERGENCE_GAP_DELTA");

                switch (constraintType)
                {
                case ConstraintType.Foreground:
                    Interop.AddForegroundHardConstraint(
                        new Vector3(x, y, CurrentSlice),
                        new Vector3(mMousePreviousX, mMousePreviousY, CurrentSlice),
                        brushWidth,
                        HardConstraintMode.Scribble);
                    break;

                case ConstraintType.Background:
                    Interop.AddBackgroundHardConstraint(
                        new Vector3(x, y, CurrentSlice),
                        new Vector3(mMousePreviousX, mMousePreviousY, CurrentSlice),
                        brushWidth,
                        HardConstraintMode.Scribble);
                    break;

                default:
                    Release.Assert(false);
                    break;
                }

                mMousePreviousX = x;
                mMousePreviousY = y;
            }
        }
Esempio n. 30
0
        /// <summary>
        ///   Constructs a new nonlinear constraint.
        /// </summary>
        ///
        /// <param name="objective">The objective function to which this constraint refers.</param>
        /// <param name="function">A lambda expression defining the left hand side of the
        ///   constraint equation.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be
        ///   compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation. Default is 0.</param>
        ///
        public NonlinearConstraint(IObjectiveFunction objective,
                                   Func <double[], double> function, ConstraintType shouldBe, double value)
        {
            int n = objective.NumberOfVariables;

            this.Create(objective.NumberOfVariables, function, shouldBe, value, null, DEFAULT_TOL);
        }
Esempio n. 31
0
 internal void Relax()
 {
     if (IsRelaxable())
     {
         type = ConstraintType.Soft;
     }
 }
Esempio n. 32
0
        public IList <DatabaseConstraint> Load(string tableName, string schemaName, ConstraintType constraintType)
        {
            if (string.IsNullOrEmpty(tableName))
            {
                throw new ArgumentNullException("tableName", "must have tableName");
            }

            switch (constraintType)
            {
            case ConstraintType.PrimaryKey:
                return(PrimaryKeys(tableName, schemaName));

            case ConstraintType.ForeignKey:
                return(ForeignKeys(tableName, schemaName));

            case ConstraintType.UniqueKey:
                return(_ukConverter.Constraints(tableName, schemaName));

            case ConstraintType.Check:
                return(_ckConverter.Constraints(tableName, schemaName));

            case ConstraintType.Default:
                return(_dfConverter.Constraints(tableName, schemaName));

            default:
                throw new ArgumentOutOfRangeException("constraintType");
            }
        }
Esempio n. 33
0
        public Constraints(string owner, string tableName, ConstraintType constraintType)
        {
            _tableName      = tableName;
            _constraintType = constraintType;
            Owner           = owner;
            Sql             = @"SELECT 
rel.rdb$owner_name as owner,
rc.rdb$relation_name as table_name,
rc.rdb$constraint_name as constraint_name,
s.rdb$field_name as column_name,
rc.rdb$constraint_type as constraint_type,
i2.rdb$relation_name as fk_table,
s2.rdb$field_name as references_column,
refc.rdb$update_rule as update_rule,
refc.rdb$delete_rule as delete_rule,
(s.rdb$field_position + 1) as field_position
FROM rdb$index_segments s
LEFT JOIN rdb$indices i on i.rdb$index_name = s.rdb$index_name
LEFT JOIN rdb$relation_constraints rc on rc.rdb$index_name = s.rdb$index_name
LEFT JOIN rdb$ref_constraints refc on rc.rdb$constraint_name = refc.rdb$constraint_name
LEFT JOIN rdb$relation_constraints rc2 on rc2.rdb$constraint_name = refc.rdb$const_name_uq
LEFT JOIN rdb$indices i2 on i2.rdb$index_name = rc2.rdb$index_name
LEFT JOIN rdb$index_segments s2 on i2.rdb$index_name = s2.rdb$index_name
LEFT JOIN rdb$relations rel on rel.rdb$relation_name = rc.rdb$relation_name
WHERE
  rc.rdb$constraint_type IS NOT NULL AND
  rel.rdb$system_flag = 0 AND
  (@owner is null or @owner = rel.rdb$owner_name) AND
  (@table_name is null or @table_name = rc.rdb$relation_name) AND
  rc.rdb$constraint_type = @constraint_type
ORDER BY 
    rc.rdb$relation_name, rc.rdb$constraint_name, s.rdb$field_position
";
        }
Esempio n. 34
0
 /// <summary>
 /// Constraint to check a single value of the state of a group or single subsystem
 /// </summary>
 /// <param name="constraintXmlNode"></param>
 /// <param name="sub"></param>
 public SingleConstraint(XmlNode constraintXmlNode, Subsystem sub)
 {
     Subsystems = new List <Subsystem>()
     {
         sub
     };
     if (constraintXmlNode.ChildNodes[0] == null)
     {
         throw new MissingMemberException("Missing StateVarKey for Constraint!");
     }
     _key = new StateVarKey <T>(constraintXmlNode.ChildNodes[0], constraintXmlNode.ParentNode.Attributes["assetName"].Value.ToString());
     if (constraintXmlNode.Attributes["value"] == null)
     {
         throw new MissingFieldException("Missing Value Field for Constraint!");
     }
     _value = (T)Convert.ChangeType(constraintXmlNode.Attributes["value"].Value, typeof(T));
     if (constraintXmlNode.Attributes["type"] == null)
     {
         throw new MissingFieldException("Missing Type Field for Constraint!");
     }
     Type = (ConstraintType)Enum.Parse(typeof(ConstraintType), constraintXmlNode.Attributes["type"].Value);
     if (constraintXmlNode.Attributes["subsystemName"] == null)
     {
         throw new MissingMemberException("Missing Constraint Name");
     }
     Name = constraintXmlNode.Attributes["subsystemName"].Value.ToLower();
 }
Esempio n. 35
0
 /// <summary>
 /// Constructor using only the Main Table.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="table"></param>
 /// <param name="col"></param>
 public Constraint(ConstraintType type, Table table, int[] col)
 {
     _type        = type;
     _mainTable   = table;
     _mainColumns = col;
     _len         = col.Length;
 }
Esempio n. 36
0
 // Set all the parameters for this constraint to a fixed, non-movable constraint.
 public override void ResetLink()
 {
     // constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
     constraintType     = ConstraintType.BS_FIXED_CONSTRAINT_TYPE;
     linearLimitLow     = OMV.Vector3.Zero;
     linearLimitHigh    = OMV.Vector3.Zero;
     angularLimitLow    = OMV.Vector3.Zero;
     angularLimitHigh   = OMV.Vector3.Zero;
     useFrameOffset     = BSParam.LinkConstraintUseFrameOffset;
     enableTransMotor   = BSParam.LinkConstraintEnableTransMotor;
     transMotorMaxVel   = BSParam.LinkConstraintTransMotorMaxVel;
     transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
     cfm = BSParam.LinkConstraintCFM;
     erp = BSParam.LinkConstraintERP;
     solverIterations         = BSParam.LinkConstraintSolverIterations;
     frameInAloc              = OMV.Vector3.Zero;
     frameInArot              = OMV.Quaternion.Identity;
     frameInBloc              = OMV.Vector3.Zero;
     frameInBrot              = OMV.Quaternion.Identity;
     useLinearReferenceFrameA = true;
     springAxisEnable         = new bool[6];
     springDamping            = new float[6];
     springStiffness          = new float[6];
     for (int ii = 0; ii < springAxisEnable.Length; ii++)
     {
         springAxisEnable[ii] = false;
         springDamping[ii]    = BSAPITemplate.SPRING_NOT_SPECIFIED;
         springStiffness[ii]  = BSAPITemplate.SPRING_NOT_SPECIFIED;
     }
     springLinearEquilibriumPoint  = OMV.Vector3.Zero;
     springAngularEquilibriumPoint = OMV.Vector3.Zero;
     member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
 }
Esempio n. 37
0
 private static bool IsValidConstraintType(ConstraintType type)
 {
     return(IsValidConstraintType(type,
                                  ConstraintType.Hinge,
                                  ConstraintType.Prismatic,
                                  ConstraintType.DistanceJoint));
 }
Esempio n. 38
0
        /// <summary>
        ///   Constructs a new quadratic constraint in the form <c>x'Ax + x'b</c>.
        /// </summary>
        /// 
        /// <param name="objective">The objective function to which this constraint refers.</param>
        /// <param name="quadraticTerms">The matrix of <c>A</c> quadratic terms.</param>
        /// <param name="linearTerms">The vector <c>b</c> of linear terms.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation.</param>
        /// <param name="withinTolerance">The tolerance for violations of the constraint. Equality
        ///   constraints should set this to a small positive value. Default is 0.</param>
        ///
        public QuadraticConstraint(IObjectiveFunction objective,
            double[,] quadraticTerms, double[] linearTerms = null,
            ConstraintType shouldBe = ConstraintType.LesserThanOrEqualTo,
            double value = 0, double withinTolerance = 0.0)
        {
            int n = objective.NumberOfVariables;

            if (quadraticTerms == null)
                throw new ArgumentNullException("quadraticTerms");

            if (quadraticTerms.GetLength(0) != quadraticTerms.GetLength(1))
                throw new DimensionMismatchException("quadraticTerms", "Matrix must be square.");

            if (quadraticTerms.GetLength(0) != n)
                throw new DimensionMismatchException("quadraticTerms", 
                    "Matrix rows must match the number of variables in the objective function.");

            if (linearTerms != null)
            {
                if (linearTerms.Length != n)
                    throw new DimensionMismatchException("linearTerms",
                        "The length of the linear terms vector must match the "+
                        "number of variables in the objective function.");
            }
            else
            {
                linearTerms = new double[n];
            }

            this.QuadraticTerms = quadraticTerms;
            this.LinearTerms = linearTerms;

            Create(objective, function, shouldBe, value, gradient, withinTolerance);
        }
Esempio n. 39
0
        /// <summary>
        ///   Constructs a new nonlinear constraint.
        /// </summary>
        ///
        /// <param name="objective">The objective function to which this constraint refers.</param>
        ///
        /// <param name="function">A lambda expression defining the left hand side of the constraint equation.</param>
        /// <param name="gradient">A lambda expression defining the gradient of the <paramref name="function">
        /// left hand side of the constraint equation</paramref>.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation.</param>
        /// <param name="withinTolerance">The tolerance for violations of the constraint. Equality
        ///   constraints should set this to a small positive value. Default is 0.</param>
        ///
        ///
        public NonlinearConstraint(IObjectiveFunction objective,
                                   Expression <Func <double> > function, ConstraintType shouldBe, double value,
                                   Expression <Func <double[]> > gradient = null, double withinTolerance = 0.0)
        {
            this.NumberOfVariables = objective.NumberOfVariables;
            this.ShouldBe          = shouldBe;

            // Generate lambda functions
            var func = ExpressionParser.Replace(function, objective.Variables);

            this.Function  = func.Compile();
            this.Value     = value;
            this.Tolerance = withinTolerance;

            if (gradient != null)
            {
                var grad = ExpressionParser.Replace(gradient, objective.Variables);
                this.Gradient = grad.Compile();

                int      n     = NumberOfVariables;
                double[] probe = new double[n];
                double[] g     = Gradient(probe);
                if (g.Length != n)
                {
                    throw new DimensionMismatchException("gradient",
                                                         "The length of the gradient vector must match the number of variables in the objective function.");
                }
            }
        }
Esempio n. 40
0
        /// <summary>
        /// Creates constraint of given type given local position and rotation relative to <paramref name="rb1"/>.
        /// </summary>
        /// <param name="constraintType">Constraint type.</param>
        /// <param name="localPosition">Position in rb1 frame.</param>
        /// <param name="localRotation">Rotation in rb1 frame.</param>
        /// <param name="rb1">First rigid body instance.</param>
        /// <param name="rb2">Second rigid body instance (world if null).</param>
        /// <returns>Constraint game object if the configuration is valid.</returns>
        public static GameObject Create(ConstraintType constraintType, Vector3 localPosition, Quaternion localRotation, RigidBody rb1, RigidBody rb2)
        {
            if (rb1 == null)
            {
                Debug.LogWarning("Unable to create constraint. Reference object must contain a rigid body component.");
                return(null);
            }

            GameObject constraintGameObject = Create(constraintType);

            if (constraintGameObject == null)
            {
                return(null);
            }

            Constraint constraint = constraintGameObject.GetComponent <Constraint>();

            constraint.AttachmentPair.ReferenceObject = rb1.gameObject;
            constraint.AttachmentPair.ConnectedObject = rb2 != null ? rb2.gameObject : null;

            constraint.AttachmentPair.ReferenceFrame.LocalPosition = localPosition;
            constraint.AttachmentPair.ReferenceFrame.LocalRotation = localRotation;

            constraint.AttachmentPair.ConnectedFrame.Position = constraint.AttachmentPair.ReferenceFrame.Position;
            constraint.AttachmentPair.ConnectedFrame.Rotation = constraint.AttachmentPair.ReferenceFrame.Rotation;

            return(constraintGameObject);
        }
Esempio n. 41
0
 private void CheckDb2(DataTable dt, ConstraintType constraintType)
 {
     if (constraintType == ConstraintType.PrimaryKey && !dt.Columns.Contains(Key))
     {
         Key = "PK_NAME";
     }
     if (constraintType == ConstraintType.ForeignKey && !dt.Columns.Contains(Key))
     {
         Key = "FK_NAME";
     }
     if (!dt.Columns.Contains(TableKey))
     {
         TableKey = "FKTABLE_NAME";
     }
     if (!dt.Columns.Contains(RefersToTableKey))
     {
         RefersToTableKey = "PKTABLE_NAME";
     }
     if (!dt.Columns.Contains(RefersToKey))
     {
         RefersToKey = "PK_NAME";
     }
     if (!dt.Columns.Contains(ColumnKey))
     {
         ColumnKey = "FKCOLUMN_NAME";
     }
     if (!dt.Columns.Contains(OrdinalKey))
     {
         OrdinalKey = "KEY_SEQ";
     }
     if (!dt.Columns.Contains(ExpressionKey))
     {
         ExpressionKey = "CHECK_CLAUSE";
     }
 }
Esempio n. 42
0
        public static KeySchema GetKey2(
            this TableSchema table,
            ConstraintType keyType,
            string relTable,
            string relColumns)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            var rt = relTable != null?relTable.Trim() : null;

            var rc = relColumns != null?relColumns.Trim() : null;

            if (table.Keys == null || string.IsNullOrEmpty(rt) || string.IsNullOrEmpty(rc))
            {
                return(null);
            }

            return
                ((from key in table.Keys
                  where keyType == key.KeyType && relTable == key.RelTable
                  let rcols2 = new Collection <string>(key.RelColumns.Split(','))
                               let isf = relColumns.Split(',').All(rcols2.Contains)
                                         where isf
                                         select key).FirstOrDefault());
        }
Esempio n. 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Constraint"/> class.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <param name="constraintColumnName">Name of the constraint column.</param>
 public Constraint(ConstraintType condition, string constraintColumnName)
 {
     Condition = condition;
     ColumnName = constraintColumnName;
     QualifiedColumnName = constraintColumnName;
     ConstructionFragment = constraintColumnName;
 }
Esempio n. 44
0
 private void CheckFirebird(DataTable dt, ConstraintType constraintType)
 {
     if (constraintType == ConstraintType.PrimaryKey && !dt.Columns.Contains(Key)) Key = "PK_NAME";
     if (constraintType == ConstraintType.ForeignKey && !dt.Columns.Contains(Key)) Key = "UK_NAME";
     if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = "REFERENCED_TABLE_NAME";
     //a firebird typo!
     if (dt.Columns.Contains("CHECK_CLAUSULE")) ExpressionKey = "CHECK_CLAUSULE";
 }
Esempio n. 45
0
 public TestbedSetting(string argName, SettingType argType, bool argValue)
 {
     name = argName;
     settingsType = argType;
     enabled = argValue;
     constraintType = ConstraintType.BOOLEAN;
     min = max = value = 0;
 }
Esempio n. 46
0
 /// <summary>
 /// SqlQuery条件类构造函数
 /// </summary>
 /// <param name="ctype">查询类型,包括:Where、And、Or</param>
 /// <param name="columnname">条件列名</param>
 /// <param name="cparsion">条件表达式类型</param>
 /// <param name="value">条件值</param>
 /// <param name="isParentheses">是否加左括号</param>
 public SqlqueryCondition(ConstraintType ctype, string columnname, Comparison cparsion, object value, bool isParentheses = false)
 {
     SQConstraintType = ctype;
     SQColumnName = columnname;
     SQComparison = cparsion;
     SQValue = value;
     IsParentheses = isParentheses;
 }
 internal ForeignKeyConstraint(ObjectName name, Table table, ConstraintType constraintType, IEnumerable<Column> keyColumns,
     TableConstraint uniqueConstraint, ForeignKeyRule updateRule, ForeignKeyRule deleteRule, bool? isDisabled)
     : base(name, table, constraintType, keyColumns)
 {
     _uniqueConstraint = uniqueConstraint;
     _updateRule = updateRule;
     _deleteRule = deleteRule;
     _isDisabled = isDisabled;
 }
Esempio n. 48
0
 public Constraint(TableName tableName, string name, ConstraintType type, string[] columns, bool deferrable, bool deferred)
 {
     this.tableName = tableName;
     this.columns = (string[]) columns.Clone();
     this.type = type;
     this.name = name;
     this.deferrable = deferrable;
     this.deferred = deferred;
 }
Esempio n. 49
0
        public SqlTableConstraint(string constraintName, ConstraintType constraintType, string[] columns)
        {
            if (columns == null)
                columns = new string[0];

            ConstraintName = constraintName;
            ConstraintType = constraintType;
            Columns = columns;
        }
Esempio n. 50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Constraint" /> class
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="isDeferrable">if set to <c>true</c> [is deferrable].</param>
 /// <param name="initiallyDeferred">if set to <c>true</c> [initially deferred].</param>
 /// <exception cref="System.ArgumentNullException">table;table cannot be null</exception>
 public Constraint(string name, ConstraintType type, bool isDeferrable, bool initiallyDeferred)
 {
     // Populate member variables
     this.Name = name;
     this.ConstraintType = type;
     this.columns = new List<Column>();
     this.IsDeferrable = isDeferrable;
     this.InitiallyDeferred = initiallyDeferred;
 }
Esempio n. 51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Constraint"/> class.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <param name="lit">The string literal to be passed on the left side of the comparision</param>
 public Constraint(ConstraintType condition, LiteralQueryParam lit)
 {
     Condition = condition;
     ColumnName = lit.ColumnName;
     ColumnValue = lit.ColumnValue;
     QualifiedColumnName = lit.ColumnName;
     ConstructionFragment = lit.ColumnName;
     ColumnNameShouldBeParameterized = true;
     ParameterName = lit.ParameterName;
 }
Esempio n. 52
0
 public Constraint(SqlQuery query, ConstraintType condition, string sqlExpression) {
     this.query = query;
     this.sqlExpression = sqlExpression;
     Condition = condition;
     ColumnName = "##";
     QualifiedColumnName = "##";
     ConstructionFragment = "##";
     Comparison = Comparison.SqlExpression;
     this.query.Constraints.Add(this);
 }
        public ConstraintKeyMap(DataTable dt, ConstraintType constraintType)
        {
            //all same, my custom sql
            Key = "CONSTRAINT_NAME";
            SchemaKey = "CONSTRAINT_SCHEMA";
            TableKey = "TABLE_NAME";
            ColumnKey = "COLUMN_NAME";
            OrdinalKey = "ORDINAL_POSITION";
            RefersToKey = "UNIQUE_CONSTRAINT_NAME";
            RefersToTableKey = "FK_TABLE";
            RefersToSchemaKey = "FK_SCHEMA";
            ExpressionKey = "EXPRESSION";
            DeleteRuleKey = "DELETE_RULE";
            UpdateRuleKey = "UPDATE_RULE";
            //oracle
            if (!dt.Columns.Contains(Key)) Key = "FOREIGN_KEY_CONSTRAINT_NAME";
            if (!dt.Columns.Contains(TableKey)) TableKey = "FOREIGN_KEY_TABLE_NAME";
            if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = "PRIMARY_KEY_TABLE_NAME";
            if (!dt.Columns.Contains(RefersToKey)) RefersToKey = "PRIMARY_KEY_CONSTRAINT_NAME";
            //devart.data.postgresql
            if (!dt.Columns.Contains(Key)) Key = "NAME";
            if (!dt.Columns.Contains(TableKey)) TableKey = "TABLE";

            //firebird
            CheckFirebird(dt, constraintType);
            //sqlite
            CheckSqLite(dt);

            //db2
            CheckDb2(dt, constraintType);

            //oledb
            if (!dt.Columns.Contains(Key)) Key = "FK_NAME";
            if (!dt.Columns.Contains(OrdinalKey)) OrdinalKey = "ORDINAL";
            if (!dt.Columns.Contains(TableKey)) TableKey = "FK_TABLE_NAME";
            if (!dt.Columns.Contains(ColumnKey)) ColumnKey = "FK_COLUMN_NAME";
            if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = "PK_TABLE_NAME";
            if (!dt.Columns.Contains(RefersToKey)) RefersToKey = "PK_NAME";

            //oldedb schema. Thanks to safepage.
            if (!dt.Columns.Contains(SchemaKey)) SchemaKey = "TABLE_SCHEMA";
            if (!dt.Columns.Contains(SchemaKey)) SchemaKey = "PK_TABLE_SCHEMA";

            if (!dt.Columns.Contains(SchemaKey)) SchemaKey = null;
            if (!dt.Columns.Contains(RefersToKey)) RefersToKey = null;
            if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = null;
            if (!dt.Columns.Contains(DeleteRuleKey)) DeleteRuleKey = null;
            if (!dt.Columns.Contains(UpdateRuleKey)) UpdateRuleKey = null;
            //not present if separate foreign key columns
            if (!dt.Columns.Contains(ColumnKey)) ColumnKey = null;
            if (!dt.Columns.Contains(OrdinalKey)) OrdinalKey = null;
            if (!dt.Columns.Contains(ExpressionKey)) ExpressionKey = null;
            if (!dt.Columns.Contains(Key)) Key = null;
            if (!dt.Columns.Contains(RefersToSchemaKey)) RefersToSchemaKey = null;
        }
Esempio n. 54
0
 public ShiftRule(int id, int employeeId, string ruleName, string desc, IAssessor assessor, RuleType ruleType, ConstraintType constraintType, object refObject)
 {
     this.Id = id;
     this.EmployeeId = employeeId;
     this.Name = ruleName;
     this.Assessor = assessor;
     this.Description = desc;
     this.ConstraintType = constraintType;
     this.RuleType = ruleType;
     this.Value = refObject;
 }
Esempio n. 55
0
 private void CheckDb2(DataTable dt, ConstraintType constraintType)
 {
     if (constraintType == ConstraintType.PrimaryKey && !dt.Columns.Contains(Key)) Key = "PK_NAME";
     if (constraintType == ConstraintType.ForeignKey && !dt.Columns.Contains(Key)) Key = "FK_NAME";
     if (!dt.Columns.Contains(TableKey)) TableKey = "FKTABLE_NAME";
     if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = "PKTABLE_NAME";
     if (!dt.Columns.Contains(RefersToKey)) RefersToKey = "PK_NAME";
     if (!dt.Columns.Contains(ColumnKey)) ColumnKey = "FKCOLUMN_NAME";
     if (!dt.Columns.Contains(OrdinalKey)) OrdinalKey = "KEY_SEQ";
     if (!dt.Columns.Contains(ExpressionKey)) ExpressionKey = "CHECK_CLAUSE";
 }
        internal void SetConstraint(ConstraintType constraintType)
        {
            switch (constraintType)
            {
                case ConstraintType.PrimaryKey:
                    this._isKey = true;
                    return;

                case ConstraintType.UniqueKey:
                case ConstraintType.UniqueConstraint:
                    this._isUnique = this._isKey = true;
                    return;
            }
        }
Esempio n. 57
0
        public static JacobianContact[] FilterConstraints(
			JacobianContact[] list,
			ConstraintType typeA)
		{
			var result = new List<JacobianContact>();

			foreach (JacobianContact jc in list)
			{
				if (jc.Type == typeA)
					result.Add(jc);
			}

			return result.ToArray();
		}
 // Set all the parameters for this constraint to a fixed, non-movable constraint.
 public void ResetToFixedConstraint()
 {
     constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
     linearLimitLow = OMV.Vector3.Zero;
     linearLimitHigh = OMV.Vector3.Zero;
     angularLimitLow = OMV.Vector3.Zero;
     angularLimitHigh = OMV.Vector3.Zero;
     useFrameOffset = BSParam.LinkConstraintUseFrameOffset;
     enableTransMotor = BSParam.LinkConstraintEnableTransMotor;
     transMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
     transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
     cfm = BSParam.LinkConstraintCFM;
     erp = BSParam.LinkConstraintERP;
     solverIterations = BSParam.LinkConstraintSolverIterations;
 }
Esempio n. 59
0
        public ConstraintInfo(string constraintName, ConstraintType constraintType, ObjectName tableName, string[] columnNames)
        {
            if (tableName == null)
                throw new ArgumentNullException("tableName");
            if (columnNames == null)
                throw new ArgumentNullException("columnNames");

            if (columnNames.Length == 0)
                throw new ArgumentException("The provided column names for the constraint is empty.", "columnNames");

            ConstraintName = constraintName;
            ColumnNames = columnNames;
            TableName = tableName;
            ConstraintType = constraintType;
        }
        private Mock<ConstraintDefinition> CreateMockOfConstraint(ConstraintType constraintType, 
            Action<CreateConstraintExpressionBuilder> expressionBuilderAction)
        {
            var constraintMock = new Mock<ConstraintDefinition>(constraintType);

            var expressionMock = new Mock<CreateConstraintExpression>(constraintType);
            expressionMock.SetupProperty(e => e.Constraint);

            var expression = expressionMock.Object;
            expression.Constraint = constraintMock.Object;

            expressionBuilderAction(new CreateConstraintExpressionBuilder(expression));

            return constraintMock;
        }