public static ISelectQuery <TEntity> CreateParentRestriction(IRestriction <TEntity> leftChild, LogicOperator logicOperator, ISelectQuery <TEntity> query, IRestriction <TEntity> rightChild)
        {
            var parentRestriction = new ParentRestriction <TEntity>(leftChild, logicOperator, query, rightChild);

            query.Restriction = parentRestriction;
            return(query);
        }
        public void Load(Type t, Serializer serializer)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(t);
            IList <ISerializableObject> list = serializer.Connector.LoadList(t, r);

            addList(list);
        }
Esempio n. 3
0
        public static Stack <ISquarePiece> GetNeighbours(IRestriction restriction, ISquarePiece piece)
        {
            var neighbours = new Stack <ISquarePiece>();

            var x = piece.Position.x;
            var y = piece.Position.y;

            bool DiagonalAllowed = !(restriction is DiagonalRestriction);
            bool StraightAllowed = !(restriction is DiagonalOnlyRestriction);

            if (StraightAllowed)
            {
                AddIfNeighbour(restriction, ref neighbours, piece, x + 1, y);
                AddIfNeighbour(restriction, ref neighbours, piece, x - 1, y);
                AddIfNeighbour(restriction, ref neighbours, piece, x, y + 1);
                AddIfNeighbour(restriction, ref neighbours, piece, x, y - 1);
            }

            if (DiagonalAllowed)
            {
                AddIfNeighbour(restriction, ref neighbours, piece, x + 1, y + 1);
                AddIfNeighbour(restriction, ref neighbours, piece, x - 1, y + 1);
                AddIfNeighbour(restriction, ref neighbours, piece, x + 1, y - 1);
                AddIfNeighbour(restriction, ref neighbours, piece, x - 1, y - 1);
            }

            return(neighbours);
        }
Esempio n. 4
0
        void Start()
        {
            var currentLevel = LevelManager.Instance.GetNextLevel();

            Restriction = currentLevel.GetCurrentRestriction();
            GameLimit   = currentLevel.GetCurrentLimit();
        }
Esempio n. 5
0
        private void DisplayRestrictionTextAndImage(IRestriction restriction, IHasSprite restrictionSprite)
        {
            Image.gameObject.SetActive(true);

            Text.text    = ShowLiveInfo ? restriction.GetRestrictionText() : restriction.GetRestrictionDescription();
            Image.sprite = restrictionSprite.GetSprite();
        }
Esempio n. 6
0
            public IRestriction GetQueryRestriction()
            {
                IRestriction projectRestriction    = RestrictionFactory.Eq(typeof(CollectionProject), "_ProjectID", ConnectionsAccess.Profile.ProjectID);
                IRestriction selectionRestrictions = null;

                foreach (var restrictionSpecification in Restrictions)
                {
                    var currentRestriction = restrictionSpecification.GetRestrictionForType(ObjectType);
                    if (currentRestriction != null)
                    {
                        if (selectionRestrictions != null)
                        {
                            selectionRestrictions = RestrictionFactory.And().Add(selectionRestrictions).Add(currentRestriction);
                        }
                        else
                        {
                            selectionRestrictions = currentRestriction;
                        }
                    }
                }
                if (selectionRestrictions != null)
                {
                    return(RestrictionFactory.And().Add(projectRestriction).Add(selectionRestrictions));
                }
                else
                {
                    return(projectRestriction);
                }
            }
Esempio n. 7
0
        public CollectionEvent getEventForIU(int iuID)
        {
            IdentificationUnit iu;

            try
            {
                IRestriction restrict = RestrictionFactory.Eq(typeof(IdentificationUnit), "_IdentificationUnitID", iuID);
                iu = con.Load <IdentificationUnit>(restrict);
            }
            catch (Exception)
            {
                return(null);
            }

            //SERIALIZER.ConnectOneToMany(iu, cs);
            //return this.getEventForSpecimen((int)iu.CollectionSpecimenID);
            if (iu != null)
            {
                return(iu.CollectionSpecimen.CollectionEvent);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        private SyncItem FetchSyncItem(Guid guid)
        {
            IRestriction r        = RestrictionFactory.Eq(typeof(SyncItem), "_SyncGuid", guid);
            SyncItem     siSource = (SyncItem)_syncSerializer.Connector.Load(typeof(SyncItem), r);

            return(siSource);
        }
Esempio n. 9
0
        private UserProfiles()
        {
            IRestriction restrict = RestrictionFactory.TypeRestriction(typeof(UserProfile));

            _userList            = con.LoadList <UserProfile>(restrict);
            this._currentProfile = SERIALIZER.CreateISerializableObject <UserProfile>();
        }
Esempio n. 10
0
        public T Next()
        {
            InitializeList();


            this._readerPosition++;

            if (this._readerPosition > this._keyList.Count - 1)
            {
                TryExtendEnd();
            }

            T ret = default(T);

            while (ret == null)
            {
                CsvPimaryKey key = this._keyList[this._readerPosition];
                IRestriction r   = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                ret = this._serializer.Connector.Load <T>(r);

                if (ret == null)
                {
                    _readerPosition++;
                }
            }

            return(ret);
        }
Esempio n. 11
0
 private void AddRestriction(IRestriction restriction)
 {
     activeRestrictions.Add(restriction);
     restriction.AddDrawingLayer(_map);
     EnsureSnapMode();
     ZoomoutIfRequired(restriction);
 }
Esempio n. 12
0
            public T this[int index]
            {
                get
                {
                    IRestriction r = Restrictions.RestrictionFactory.CsvKeyRestriction(_storedType, _keys[index]);
                    T            tmp;
                    if (_table == null)
                    {
                        tmp = (T)_serializer.Connector.Load(_storedType, r);
                    }
                    else
                    {
                        tmp = (T)_serializer.Connector.Load(_storedType, _table, r);
                    }
                    if (tmp == null)
                    {
                        throw new InvalidOperationException();
                    }

                    return(tmp);
                }
                set
                {
                    throw new NotSupportedException();
                }
            }
 public void Load(Type t, IRestriction r)
 {
     IList<ISerializableObject> list = this._serializer.Connector.LoadList(t, r);
     foreach (ISerializableObject iso in list)
     {
         this._pool.AddISerializableObject(iso);
     }
 }
Esempio n. 14
0
        public void Load(Type t, IRestriction r)
        {
            IList <ISerializableObject> list = this._serializer.Connector.LoadList(t, r);

            foreach (ISerializableObject iso in list)
            {
                this._pool.AddISerializableObject(iso);
            }
        }
Esempio n. 15
0
        //Beim Iterieren über die EventSeries muss beachtet werden, dass
        //die EmptyEventSeries manuell zur Auswahl zugefügt werden muss.(noch nicht erledigt)
        private EventSeriess()
        {
            IRestriction restrict = RestrictionFactory.TypeRestriction(typeof(CollectionEventSeries));

            _ceIterator             = new DirectAccesIteratorImpl <CollectionEventSeries>();
            _ceIterator.Serializer  = SERIALIZER;
            _ceIterator.Restriction = restrict;
            this.Current            = _ceIterator.First();
        }
Esempio n. 16
0
        private void buttonLoad_Click(object sender, RoutedEventArgs e)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(typeof(CollectionEventLocalisation));
            IList <CollectionEventLocalisation> spec = mobSer.Connector.LoadList <CollectionEventLocalisation>(r);
            CollectionEventLocalisation         ce   = spec.First();
            Guid g = ce.Rowguid;

            r    = RestrictionFactory.Eq(typeof(CollectionEventLocalisation), "_guid", g);
            obj2 = repSer.Connector.Load <CollectionEventLocalisation>(r);
        }
 public void SetUp()
 {
     _generator             = new UnmatchedRestrictionsGenerator();
     _context               = MockRepository.GenerateMock <HttpContextBase>();
     _route                 = new Route.Routing.Route("name", Guid.NewGuid(), "relative");
     _httpRuntime           = MockRepository.GenerateMock <IHttpRuntime>();
     _matchedRestrictions   = new[] { new UrlRelativePathRestriction("", CaseInsensitivePlainComparer.Instance, _httpRuntime) };
     _unmatchedRestrictions = new IRestriction[] { new HeaderRestriction <ContentEncodingHeader>("Content-Encoding", (Func <string, IEnumerable <ContentEncodingHeader> >)ContentEncodingHeader.ParseMany, header => false) };
     _routeMatchResults     = new[] { new RouteMatchResult(_route, MatchResult.RouteNotMatched(_matchedRestrictions, _unmatchedRestrictions)) };
 }
			public void SetUp()
			{
				_generator = new UnmatchedRestrictionsGenerator();
				_context = MockRepository.GenerateMock<HttpContextBase>();
				_route = new Route.Routing.Route("name", Guid.NewGuid(), "relative");
				_httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
				_matchedRestrictions = new[] { new UrlRelativePathRestriction("", CaseInsensitivePlainComparer.Instance, _httpRuntime) };
				_unmatchedRestrictions = new IRestriction[] { new HeaderRestriction<AcceptEncodingHeader>("Accept-Encoding", (Func<string, IEnumerable<AcceptEncodingHeader>>)AcceptEncodingHeader.ParseMany, header => false) };
				_routeMatchResults = new[] { new RouteMatchResult(_route, MatchResult.RouteNotMatched(_matchedRestrictions, _unmatchedRestrictions)) };
			}
Esempio n. 19
0
        //Zur Erzeugung eines DataReaders ohne explizite Tabellenangabe
        private DbDataReader CreateDataReader(Type type, IRestriction restriction, ISerializerTransaction transaction)
        {
            DbCommand com = _connection.CreateCommand();

            transaction.Guard(com);
            com.CommandText = GenerateSelectString(type, restriction);
            DbDataReader reader = com.ExecuteReader();

            return(reader);
        }
Esempio n. 20
0
        public IRestrictable <T> AddRestriction(IRestriction restriction)
        {
            if (Restrictions == null)
            {
                Restrictions = new List <IRestriction>();
            }

            Restrictions.Add(restriction);
            return(this);
        }
Esempio n. 21
0
        //internal CollectionEvents()
        //{
        //    IRestriction restrict = RestrictionFactory.TypeRestriction(typeof(CollectionEvent));
        //    _ceIterator = new DirectAccesIteratorImpl<CollectionEvent>();
        //    _ceIterator.Serializer = SERIALIZER;
        //    _ceIterator.Restriction = restrict;
        //    this.Current = _ceIterator.First();
        //}

        public CollectionEvents(int?seriesID)
        {
            IRestriction restrict = null;

            restrict                = RestrictionFactory.Eq(typeof(CollectionEvent), "_SeriesID", seriesID);
            _ceIterator             = new DirectAccesIteratorImpl <CollectionEvent>();
            _ceIterator.Serializer  = SERIALIZER;
            _ceIterator.Restriction = restrict;
            this.Current            = _ceIterator.First();
        }
Esempio n. 22
0
        private UserProfile createProfile()
        {
            UserProfile newProfile;
            UserProxy   proxy;
            int         i = 0;

            try
            {
                newProfile = ConnectionsAccess.MobileDB.CreateISerializableObject <UserProfile>();
                i++;
                //Zuerst korrespondierenden Userproxy holen
                IRestriction r = RestrictionFactory.Eq(typeof(UserProxy), "_LoginName", OptionsAccess.RepositoryOptions.LastUsername);
                //IRestriction r = RestrictionFactory.Eq(typeof(UserProxy), "_LoginName", @"TestEditor");
                proxy = ConnectionsAccess.RepositoryDB.Connector.Load <UserProxy>(r);
                i++;
                newProfile.LoginName = OptionsAccess.RepositoryOptions.LastUsername;
                //newProfile.LoginName = @"TestEditor";
                string agentName = null;
                i++;//3
                using (var conn = ConnectionsAccess.RepositoryDefinitions.CreateConnection())
                {
                    try
                    {
                        conn.Open();
                        i++;
                        var cmd = conn.CreateCommand();
                        cmd.CommandText = "SELECT [AgentName] FROM [" + OptionsAccess.RepositoryOptions.TaxonNamesInitialCatalog + "].[dbo].[IBFagents] WHERE [AgentURI] = '" + proxy.AgentURI + "'";
                        _Log.DebugFormat("Select AgentName Command: [{0}]", cmd.CommandText);
                        i++;//5
                        agentName = cmd.ExecuteScalar() as string;
                        _Log.DebugFormat("AgentName: [{0}]", agentName);
                        i++;
                    }
                    finally
                    {
                        conn.Close();
                        i++;//7
                    }
                }

                newProfile.CombinedNameCache = (!string.IsNullOrEmpty(agentName)) ? agentName : proxy.CombinedNameCache;
                i++;
                newProfile.HomeDB = OptionsAccess.RepositoryOptions.InitialCatalog;
                i++;//9
                newProfile.AgentURI = proxy.AgentURI;
                i++;
            }
            catch (Exception ex)
            {
                newProfile = null;

                _Log.ErrorFormat("Error Creating Profile: {0}", ex);
            }
            return(newProfile);
        }
Esempio n. 23
0
        private ISerializableObject FetchObject(Serializer s, Guid guid)
        {
            FieldInfo     fi  = AttributeWorker.RowGuid(_synchronizedType);
            String        col = AttributeWorker.GetInstance(s.Target).GetColumnMapping(fi);
            StringBuilder tmp = new StringBuilder();

            tmp.Append(col).Append("='").Append(guid).Append("'");;
            IRestriction        res = RestrictionFactory.SqlRestriction(_synchronizedType, tmp.ToString());
            ISerializableObject iso = s.Connector.Load(_synchronizedType, res);

            return(iso);
        }
        /// <summary>
        /// Deserialized byte array to a Restriction instance
        /// </summary>
        /// <param name="buffer">Byte array contain data of a Restriction instance.</param>
        /// <returns>Bytes count that deserialized in buffer.</returns>
        public override uint Deserialize(byte[] buffer)
        {
            BufferReader bufferReader = new BufferReader(buffer);
            this.RestrictType = (RestrictionType)bufferReader.ReadByte();

            uint size = bufferReader.Position;
            byte[] tmpArray = bufferReader.ReadToEnd();

            RestrictionType restrictionType = (RestrictionType)tmpArray[0];
            switch (restrictionType)
            {
                case RestrictionType.AndRestriction:
                    this.Restriction = new AndRestriction(this.CountType);
                    break;
                case RestrictionType.BitMaskRestriction:
                    this.Restriction = new BitMaskRestriction();
                    break;
                case RestrictionType.CommentRestriction:
                    this.Restriction = new CommentRestriction(this.CountType);
                    break;
                case RestrictionType.ComparePropertiesRestriction:
                    this.Restriction = new ComparePropertiesRestriction();
                    break;
                case RestrictionType.ContentRestriction:
                    this.Restriction = new ContentRestriction();
                    break;
                case RestrictionType.CountRestriction:
                    this.Restriction = new CountRestriction(this.CountType);
                    break;
                case RestrictionType.ExistRestriction:
                    this.Restriction = new ExistRestriction();
                    break;
                case RestrictionType.NotRestriction:
                    this.Restriction = new NotRestriction(this.CountType);
                    break;
                case RestrictionType.OrRestriction:
                    this.Restriction = new OrRestriction(this.CountType);
                    break;
                case RestrictionType.PropertyRestriction:
                    this.Restriction = new PropertyRestriction();
                    break;
                case RestrictionType.SizeRestriction:
                    this.Restriction = new SizeRestriction();
                    break;
                case RestrictionType.SubObjectRestriction:
                    this.Restriction = new SubObjectRestriction(this.CountType);
                    break;
            }

            size += this.Restriction.Deserialize(tmpArray);
            return size;
        }
Esempio n. 25
0
        private void buttonIdentifications_Click(object sender, EventArgs e)
        {
            IRestriction r = RestrictionFactory.TypeRestriction(typeof(IdentificationUnit));
            IList <IdentificationUnit> units = mobileDBSerializer.Connector.LoadList <IdentificationUnit>(r);

            foreach (IdentificationUnit iu in units)
            {
                Identification id = iu.Identifications.First();
                id.TaxonomicName = iu.LastIdentificationCache;
                mobileDBSerializer.Connector.Save(id);
            }
            MessageBox.Show("Success");
        }
Esempio n. 26
0
        private void ZoomoutIfRequired(IRestriction restriction)
        {
            if (restriction is CircularRestriction circ)
            {
                var newExtents = _map.Extents.Clone();
                newExtents.Union(circ.GetExtents());

                if (newExtents != _map.Extents)
                {
                    _map.ZoomToExtents(newExtents);
                }
            }
        }
Esempio n. 27
0
        public void DisplayRestriction(IRestriction restriction)
        {
            var restrictionSprite = restriction as IHasSprite;

            if (restrictionSprite != null)
            {
                DisplayRestrictionTextAndImage(restriction, restrictionSprite);
            }
            else
            {
                DisplayRestrictionText(restriction);
            }
        }
Esempio n. 28
0
        internal int CountRows <T>(IRestriction restriction, ISerializerTransaction transaction) where T : ISerializableObject
        {
            DbDataReader reader = CreateDataReader(typeof(T), restriction, transaction);

            int i = 0;

            while (reader.Read())
            {
                i++;
            }
            reader.Close();
            return(i);
        }
Esempio n. 29
0
        internal ISerializableObject Load(Type type, string table, IRestriction restriction, ISerializerTransaction transaction)
        {
            bool found    = false;
            bool multiple = false;
            bool isLoaded = false;


            DbDataReader        reader = CreateDataReader(type, table, restriction, transaction);
            ISerializableObject data   = null;

            if (reader.Read())
            {
                data  = _objectPool.RetrieveObject(type, reader, ref isLoaded);
                found = true;
            }



            if (reader.Read())
            {
                multiple = true;
            }
            reader.Close();

            if (multiple)
            {
                throw new MultipleResultException("More than one Result found for the given Restriction ...");
            }

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

            bool doRelationLoading = found && isLoaded;


            if (doRelationLoading)
            {
                ResolverData <ISerializableObject> rData = new ResolverData <ISerializableObject>();
                rData.HandledItem     = data;
                rData.FieldsToResolve = AttributeWorker.RetrieveAllFields(data.GetType());

                LoadHandler handler = new LoadHandler(this);
                RelationResolver <ISerializableObject> res = new RelationResolver <ISerializableObject>();
                res.Handler = handler;
                res.StartRelationResolving(rData);
            }

            return(data);
        }
Esempio n. 30
0
        internal T Load <T>(IRestriction restriction, int readerPosition, ISerializerTransaction transaction) where T : ISerializableObject
        {
            if (readerPosition < 0)
            {
                throw new ArgumentOutOfRangeException("The passed reader position is less than 0.");
            }


            bool found    = false;
            bool isLoaded = false;


            DbDataReader reader = CreateDataReader(typeof(T), restriction, transaction);
            T            data   = default(T);



            for (int i = 0; i <= readerPosition; i++)
            {
                if (!reader.Read())
                {
                    reader.Close();
                    throw new ArgumentOutOfRangeException("The passed reader position is too big.");
                }
            }

            data  = (T)_objectPool.RetrieveObject(typeof(T), reader, ref isLoaded);
            found = true;
            reader.Close();

            if (data == null)
            {
                return(default(T));
            }

            bool doRelationLoading = found && isLoaded;

            if (doRelationLoading)
            {
                ResolverData <ISerializableObject> rData = new ResolverData <ISerializableObject>();
                rData.HandledItem     = data;
                rData.FieldsToResolve = AttributeWorker.RetrieveAllFields(data.GetType());

                LoadHandler handler = new LoadHandler(this);
                RelationResolver <ISerializableObject> res = new RelationResolver <ISerializableObject>();
                res.Handler = handler;
                res.StartRelationResolving(rData);
            }

            return(data);
        }
Esempio n. 31
0
        //Erzeugt eine SQL Anfrage in der der Tabellenname übergeben wird
        protected virtual String GenerateSelectString(Type type, string tableName, IRestriction restriction)
        {
            StringBuilder ret = new StringBuilder();

            ret.Append(SELECT);
            ret.Append(tableName);
            ret.Append(" ");
            if (restriction != null)
            {
                ret.Append(restriction.ToSqlString(this, type, this.Target));
            }

            return(ret.ToString());
        }
Esempio n. 32
0
 public SyncPool CreateSyncPool(IRestriction r)
 {
     SyncPool pool = new SyncPool(_serializer, _syncSerializer);
     foreach (Type t in _registeredTypes)
     {
         IList<ISerializableObject> list = _serializer.Connector.LoadList(t, r);
         foreach (ISerializableObject iso in list)
         {
             pool.AddISerializableObject(iso);
         }
     }
     pool.Intialize();
     return pool;
 }
Esempio n. 33
0
        private void Start()
        {
            PieceSelectionManager.SequenceCompleted += SequenceCompleted;

            var currentLevel = LevelManager.Instance.GetNextLevel();

            _restriction = GameManager.Instance.Restriction;
            _restriction.Reset();

            _updateableRestriction = _restriction as IUpdateable;

            _restrictionInfo = GetComponentInParent <RestrictionInfo>();

            UpdateRestriction(0);
        }
Esempio n. 34
0
        public void AddRestriction(IRestriction restriction)
        {
            Init();
            if (!restrictions.ContainsKey(restriction.Platform))
            {
                restrictions.Add(restriction.Platform, new Dictionary <string, IRestriction>());
            }

            if (restrictions[restriction.Platform].ContainsKey(restriction.Name.ToLower().Trim()))
            {
                throw new Exception("Restriction already exists with this name!");
            }

            restrictions[restriction.Platform].Add(restriction.Name.ToLower().Trim(), restriction);
        }
 public RestrictionException(IRestriction restriction, object value, string message, Exception inner)
     : base(message, inner)
 {
     this._Restriction = restriction;
     this._Value = value;
 }
 public Parenthesis(IRestriction r)
 {
     _restriction = r;
 }
 public static IRestriction Not(IRestriction r)
 {
     return new NotRestriction(r);
 }
 public static IRestriction Parenthesize(IRestriction r)
 {
     Parenthesis p = new Parenthesis(r);
     return p;
 }
 internal NotRestriction(IRestriction restriction)
 {
     _restriction = restriction;
 }
 public LogicalRestriction Add(IRestriction r)
 {
     _restriction.Add(r);
     return this;
 }
        /// <summary>
        /// Deserialized byte array to a Restriction instance
        /// </summary>
        /// <param name="buffer">Byte array contain data of a Restriction instance.</param>
        /// <returns>Bytes count that deserialized in buffer.</returns>
        public override uint Deserialize(byte[] buffer)
        {
            BufferReader reader = new BufferReader(buffer);
            this.RestrictType = (RestrictionType)reader.ReadByte();
            this.TaggedValuesCount = reader.ReadByte();
            this.TaggedValues = new TaggedPropertyValue[this.TaggedValuesCount];
            uint size = reader.Position;
            byte[] tmpArray = reader.ReadToEnd();
            for (int i = 0; i < this.TaggedValuesCount; i++)
            {
                this.TaggedValues[i] = AdapterHelper.ReadTaggedProperty(tmpArray);
                uint tagLength = (uint)this.TaggedValues[i].Size();
                size += tagLength;
                reader = new BufferReader(tmpArray);
                tmpArray = reader.ReadBytes(tagLength, (uint)(tmpArray.Length - tagLength));
            }

            reader = new BufferReader(buffer);
            reader.ReadBytes(size);
            this.RestrictionPresent = reader.ReadByte();
            size += reader.Position;
            tmpArray = reader.ReadToEnd();
            if (this.RestrictionPresent == 0x01)
            {
                RestrictionType restrictionType = (RestrictionType)tmpArray[0];
                switch (restrictionType)
                {
                    case RestrictionType.AndRestriction:
                        this.Restriction = new AndRestriction(CountType);
                        break;
                    case RestrictionType.BitMaskRestriction:
                        this.Restriction = new BitMaskRestriction();
                        break;
                    case RestrictionType.CommentRestriction:
                        this.Restriction = new CommentRestriction(CountType);
                        break;
                    case RestrictionType.ComparePropertiesRestriction:
                        this.Restriction = new ComparePropertiesRestriction();
                        break;
                    case RestrictionType.ContentRestriction:
                        this.Restriction = new ContentRestriction();
                        break;
                    case RestrictionType.CountRestriction:
                        this.Restriction = new CountRestriction(CountType);
                        break;
                    case RestrictionType.ExistRestriction:
                        this.Restriction = new ExistRestriction();
                        break;
                    case RestrictionType.NotRestriction:
                        this.Restriction = new NotRestriction(CountType);
                        break;
                    case RestrictionType.OrRestriction:
                        this.Restriction = new OrRestriction(CountType);
                        break;
                    case RestrictionType.PropertyRestriction:
                        this.Restriction = new PropertyRestriction();
                        break;
                    case RestrictionType.SizeRestriction:
                        this.Restriction = new SizeRestriction();
                        break;
                    case RestrictionType.SubObjectRestriction:
                        this.Restriction = new SubObjectRestriction(CountType);
                        break;
                }

                size += this.Restriction.Deserialize(tmpArray);
            }

            return size;
        }