private static void AddConstraintToDic(SemanticConstraint constraint, int key, Dictionary <int, List <SemanticConstraint> > dic)
        {
            if (key < 0)
            {
                return;
            }

            List <SemanticConstraint> list;

            if (dic.ContainsKey(key))
            {
                list = dic[key];
            }
            else
            {
                list = new List <SemanticConstraint>();
                dic.Add(key, list);
            }

            // Let's check if the constraint obj is already added to the list.
            if (!list.Contains(constraint))
            {
                list.Add(constraint);
            }
        }
 /// <summary>
 /// Register a constraint to this registry.
 /// </summary>
 public void RegisterConstraint(int elementTypeID, FileFormatVersions fileFormat, ApplicationType appType, SemanticConstraint constraint)
 {
     if ((fileFormat & _format) == _format && (appType & _appType) == _appType)
     {
         _semConstraintMap.Add(elementTypeID, constraint);
     }
 }
 /// <summary>
 /// Register a constraint to this registry.
 /// </summary>
 public void RegisterConstraint(int elementTypeID, int ancestorTypeID, FileFormatVersions fileFormat, ApplicationType appType, SemanticConstraint constraint)
 {
     if ((fileFormat & _format) == _format && (appType & _appType) == _appType)
     {
         AddConstraintToDic(constraint, ancestorTypeID, _cleanList);
         AddConstraintToDic(constraint, elementTypeID, _semConstraintMap);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Register a constraint to this registry.
 /// </summary>
 public void RegisterConstraint(Type type, FileFormatVersions fileFormat, ApplicationType appType, SemanticConstraint constraint)
 {
     if (_format.AtLeast(fileFormat) && (appType & _appType) == _appType)
     {
         _semConstraintMap.Add(type, constraint);
     }
 }