Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionLayer"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="definitions">The collection containing all the known group definitions.</param>
        /// <param name="groups">The collection containing the known groups for the current dataset.</param>
        /// <param name="groupConnections">The graph that describes the connections between the groups.</param>
        /// <param name="parts">The collection that contains all the parts for the currently selected groups.</param>
        /// <param name="partConnections">The graph that determines how the different parts are connected.</param>
        /// <param name="instances">The object that stores the instances of the parts.</param>
        private CompositionLayer(
            HistoryId id,
            IDictionaryTimelineStorage <GroupRegistrationId, GroupDefinition> definitions,
            IDictionaryTimelineStorage <GroupCompositionId, GroupRegistrationId> groups,
            IBidirectionalGraphHistory <GroupCompositionId, GroupCompositionGraphEdge> groupConnections,
            IDictionaryTimelineStorage <PartCompositionId, PartCompositionInfo> parts,
            IBidirectionalGraphHistory <PartCompositionId, PartImportExportEdge <PartCompositionId> > partConnections,
            IVariableTimeline <IStoreInstances> instances)
        {
            {
                Debug.Assert(id != null, "The ID object should not be a null reference.");
                Debug.Assert(definitions != null, "The definition collectino should not be a null reference.");
                Debug.Assert(groups != null, "The groups collection should not be a null reference.");
                Debug.Assert(groupConnections != null, "The group connection graph should not be a null reference.");
                Debug.Assert(parts != null, "The parts collection should not be a null reference.");
                Debug.Assert(partConnections != null, "The part connection graph should not be a null reference.");
                Debug.Assert(instances != null, "The instance collection should not be a null reference.");
            }

            m_HistoryId        = id;
            m_Definitions      = definitions;
            m_Groups           = groups;
            m_GroupConnections = groupConnections;
            m_Parts            = parts;
            m_PartConnections  = partConnections;
            m_Instances        = instances;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetHistoryStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="graph">The graph that describes the connections between the datasets.</param>
        /// <param name="knownDatasets">The collection that contains the known but not necessary active datasets.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="graph"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="knownDatasets"/> is <see langword="null" />.
        /// </exception>
        private DatasetHistoryStorage(
            HistoryId id,
            IBidirectionalGraphHistory <DatasetId, Edge <DatasetId> > graph,
            IDictionaryTimelineStorage <DatasetId, DatasetProxy> knownDatasets)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => graph);
                Lokad.Enforce.Argument(() => knownDatasets);
            }

            m_HistoryId = id;
            m_Graph     = graph;
            m_Datasets  = knownDatasets;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetHistoryStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="graph">The graph that describes the connections between the datasets.</param>
        /// <param name="knownDatasets">The collection that contains the known but not necessary active datasets.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="graph"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="knownDatasets"/> is <see langword="null" />.
        /// </exception>
        private DatasetHistoryStorage(
            HistoryId id,
            IBidirectionalGraphHistory<DatasetId, Edge<DatasetId>> graph,
            IDictionaryTimelineStorage<DatasetId, DatasetProxy> knownDatasets)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => graph);
                Lokad.Enforce.Argument(() => knownDatasets);
            }

            m_HistoryId = id;
            m_Graph = graph;
            m_Datasets = knownDatasets;
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new instance of the <see cref="CompositionLayer"/> class with the given
        /// history information.
        /// </summary>
        /// <param name="id">The history ID for the dataset storage.</param>
        /// <param name="members">The collection that holds all the members for the current object.</param>
        /// <param name="constructorArguments">The optional constructor arguments.</param>
        /// <returns>A new instance of the <see cref="CompositionLayer"/> class.</returns>
        internal static CompositionLayer CreateInstance(
            HistoryId id,
            IEnumerable <Tuple <byte, IStoreTimelineValues> > members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 6, "There should be 6 members.");
            }

            IDictionaryTimelineStorage <GroupRegistrationId, GroupDefinition>          definitions = null;
            IDictionaryTimelineStorage <GroupCompositionId, GroupRegistrationId>       groups      = null;
            IBidirectionalGraphHistory <GroupCompositionId, GroupCompositionGraphEdge> graph       = null;
            IDictionaryTimelineStorage <PartCompositionId, PartCompositionInfo>        parts       = null;
            IBidirectionalGraphHistory <PartCompositionId, PartImportExportEdge <PartCompositionId> > partConnections = null;
            IVariableTimeline <IStoreInstances> instances = null;

            foreach (var member in members)
            {
                if (member.Item1 == GroupDefinitionIndex)
                {
                    definitions = member.Item2 as IDictionaryTimelineStorage <GroupRegistrationId, GroupDefinition>;
                    continue;
                }

                if (member.Item1 == GroupCompositionIndex)
                {
                    groups = member.Item2 as IDictionaryTimelineStorage <GroupCompositionId, GroupRegistrationId>;
                    continue;
                }

                if (member.Item1 == GroupConnectionIndex)
                {
                    graph = member.Item2 as IBidirectionalGraphHistory <GroupCompositionId, GroupCompositionGraphEdge>;
                    continue;
                }

                if (member.Item1 == PartCompositionIndex)
                {
                    parts = member.Item2 as IDictionaryTimelineStorage <PartCompositionId, PartCompositionInfo>;
                    continue;
                }

                if (member.Item1 == PartConnectionIndex)
                {
                    partConnections = member.Item2 as IBidirectionalGraphHistory <PartCompositionId, PartImportExportEdge <PartCompositionId> >;
                    continue;
                }

                if (member.Item1 == PartInstanceIndex)
                {
                    instances = member.Item2 as IVariableTimeline <IStoreInstances>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return(new CompositionLayer(
                       id,
                       definitions,
                       groups,
                       graph,
                       parts,
                       partConnections,
                       instances));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionLayer"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="definitions">The collection containing all the known group definitions.</param>
        /// <param name="groups">The collection containing the known groups for the current dataset.</param>
        /// <param name="groupConnections">The graph that describes the connections between the groups.</param>
        /// <param name="parts">The collection that contains all the parts for the currently selected groups.</param>
        /// <param name="partConnections">The graph that determines how the different parts are connected.</param>
        /// <param name="instances">The object that stores the instances of the parts.</param>
        private CompositionLayer(
            HistoryId id,
            IDictionaryTimelineStorage<GroupRegistrationId, GroupDefinition> definitions,
            IDictionaryTimelineStorage<GroupCompositionId, GroupRegistrationId> groups,
            IBidirectionalGraphHistory<GroupCompositionId, GroupCompositionGraphEdge> groupConnections,
            IDictionaryTimelineStorage<PartCompositionId, PartCompositionInfo> parts,
            IBidirectionalGraphHistory<PartCompositionId, PartImportExportEdge<PartCompositionId>> partConnections,
            IVariableTimeline<IStoreInstances> instances)
        {
            {
                Debug.Assert(id != null, "The ID object should not be a null reference.");
                Debug.Assert(definitions != null, "The definition collectino should not be a null reference.");
                Debug.Assert(groups != null, "The groups collection should not be a null reference.");
                Debug.Assert(groupConnections != null, "The group connection graph should not be a null reference.");
                Debug.Assert(parts != null, "The parts collection should not be a null reference.");
                Debug.Assert(partConnections != null, "The part connection graph should not be a null reference.");
                Debug.Assert(instances != null, "The instance collection should not be a null reference.");
            }

            m_HistoryId = id;
            m_Definitions = definitions;
            m_Groups = groups;
            m_GroupConnections = groupConnections;
            m_Parts = parts;
            m_PartConnections = partConnections;
            m_Instances = instances;
        }