Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DatasetProxy"/> class.
        /// </summary>
        /// <param name="constructorArgs">The object that holds all the constructor arguments that do not belong to the timeline.</param>
        /// <param name="proxyBuilder">The function that is used to create the proxy for the data inside the dataset.</param>
        /// <param name="notifications">The object that stores the notifications for the user interface.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <param name="historyId">The ID for use in the history system.</param>
        /// <param name="name">The data structure that stores the history information for the name of the dataset.</param>
        /// <param name="summary">The data structure that stores the history information for the summary of the dataset.</param>
        /// <param name="distributionLocation">
        /// The data structure that stores the history information indicating if the dataset is activated at any point.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="constructorArgs"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="proxyBuilder"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="notifications"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="historyId"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="name"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="summary"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="distributionLocation"/> is <see langword="null" />.
        /// </exception>
        private DatasetProxy(
            DatasetConstructionParameters constructorArgs,
            Func <DatasetOnlineInformation, DatasetStorageProxy> proxyBuilder,
            ICollectNotifications notifications,
            SystemDiagnostics diagnostics,
            HistoryId historyId,
            IVariableTimeline <string> name,
            IVariableTimeline <string> summary,
            IVariableTimeline <NetworkIdentifier> distributionLocation)
        {
            {
                Lokad.Enforce.Argument(() => constructorArgs);
                Lokad.Enforce.Argument(() => proxyBuilder);
                Lokad.Enforce.Argument(() => notifications);
                Lokad.Enforce.Argument(() => diagnostics);
                Lokad.Enforce.Argument(() => historyId);
                Lokad.Enforce.Argument(() => name);
                Lokad.Enforce.Argument(() => summary);
                Lokad.Enforce.Argument(() => distributionLocation);
            }

            m_ConstructorArgs      = constructorArgs;
            m_ProxyBuilder         = proxyBuilder;
            m_Notifications        = notifications;
            m_Diagnostics          = diagnostics;
            m_HistoryId            = historyId;
            m_Name                 = name;
            m_Summary              = summary;
            m_DistributionLocation = distributionLocation;

            m_Name.OnExternalValueUpdate    += HandleOnNameUpdate;
            m_Summary.OnExternalValueUpdate += HandleOnSummaryUpdate;
            m_DistributionLocation.OnExternalValueUpdate += HandleOnIsActivatedUpdate;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of the <see cref="ProjectHistoryStorage"/> class with the given
        /// history information.
        /// </summary>
        /// <param name="id">The history ID for the project 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="ProjectHistoryStorage"/> class.</returns>
        /// <exception cref="UnknownMemberException">
        /// Thrown if the <paramref name="members"/> collection contains data for an unknown member field.
        /// </exception>
        internal static ProjectHistoryStorage CreateInstance(
            HistoryId id,
            IEnumerable <Tuple <byte, IStoreTimelineValues> > members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 2, "There should only be two members.");
            }

            IVariableTimeline <string> name    = null;
            IVariableTimeline <string> summary = null;

            foreach (var member in members)
            {
                if (member.Item1 == NameIndex)
                {
                    name = member.Item2 as IVariableTimeline <string>;
                    continue;
                }

                if (member.Item1 == SummaryIndex)
                {
                    summary = member.Item2 as IVariableTimeline <string>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return(new ProjectHistoryStorage(id, name, summary));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new instance of the <see cref="DatasetHistoryStorage"/> 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="DatasetHistoryStorage"/> class.</returns>
        internal static DatasetHistoryStorage CreateInstance(
            HistoryId id,
            IEnumerable <Tuple <byte, IStoreTimelineValues> > members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 2, "There should only be 2 members.");
            }

            BidirectionalGraphHistory <DatasetId, Edge <DatasetId> > graph         = null;
            IDictionaryTimelineStorage <DatasetId, DatasetProxy>     knownDatasets = null;

            foreach (var member in members)
            {
                if (member.Item1 == GraphIndex)
                {
                    graph = member.Item2 as BidirectionalGraphHistory <DatasetId, Edge <DatasetId> >;
                    continue;
                }

                if (member.Item1 == DatasetsIndex)
                {
                    knownDatasets = member.Item2 as IDictionaryTimelineStorage <DatasetId, DatasetProxy>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return(new DatasetHistoryStorage(id, graph, knownDatasets));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ObjectUnknownToTimelineException"/> class.
 /// </summary>
 /// <param name="id">The history ID of the unknown object.</param>
 public ObjectUnknownToTimelineException(HistoryId id)
     : this(string.Format(
             CultureInfo.InvariantCulture,
             Resources.Exceptions_Messages_ObjectUnknownToTimeline_WithId,
             id))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimelineIdDoesNotMatchException"/> class.
 /// </summary>
 /// <param name="provided">The ID number that was provided.</param>
 /// <param name="expected">The ID number that was expected.</param>
 public TimelineIdDoesNotMatchException(HistoryId provided, HistoryId expected)
     : this(string.Format(
             CultureInfo.InvariantCulture, 
             Resources.Exceptions_Messages_HistoryIdDoesNotMatch_WithIds,
             provided,
             expected))
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleConditionStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="knownConditions">The collection that contains the conditions.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="knownConditions"/> is <see langword="null" />.
        /// </exception>
        private ScheduleConditionStorage(
            HistoryId id,
            IDictionaryTimelineStorage<ScheduleElementId, ConditionMap> knownConditions)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => knownConditions);
            }

            m_HistoryId = id;
            m_Conditions = knownConditions;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="knownSchedules">The collection that contains the schedules.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="knownSchedules"/> is <see langword="null" />.
        /// </exception>
        private ScheduleStorage(
            HistoryId id,
            IDictionaryTimelineStorage<ScheduleId, ScheduleMap> knownSchedules)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => knownSchedules);
            }

            m_HistoryId = id;
            m_Schedules = knownSchedules;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="knownSchedules">The collection that contains the schedules.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="knownSchedules"/> is <see langword="null" />.
        /// </exception>
        private ScheduleStorage(
            HistoryId id,
            IDictionaryTimelineStorage <ScheduleId, ScheduleMap> knownSchedules)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => knownSchedules);
            }

            m_HistoryId = id;
            m_Schedules = knownSchedules;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScheduleActionStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="knownActions">The collection that contains the actions.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="knownActions"/> is <see langword="null" />.
        /// </exception>
        private ScheduleActionStorage(
            HistoryId id,
            IDictionaryTimelineStorage <ScheduleElementId, ActionMap> knownActions)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => knownActions);
            }

            m_HistoryId = id;
            m_Actions   = knownActions;
        }
Ejemplo n.º 11
0
        /// <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;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectHistoryStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="name">The timeline storage that stores the name of the project.</param>
        /// <param name="summary">The timeline storage that stores the summary of the project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="name"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="summary"/> is <see langword="null" />.
        /// </exception>
        private ProjectHistoryStorage(
            HistoryId id,
            IVariableTimeline <string> name,
            IVariableTimeline <string> summary)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => name);
                Lokad.Enforce.Argument(() => summary);
            }

            m_HistoryId = id;
            m_Name      = name;
            m_Summary   = summary;
        }
Ejemplo n.º 13
0
        /// <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;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectHistoryStorage"/> class.
        /// </summary>
        /// <param name="id">The ID used by the timeline to uniquely identify the current object.</param>
        /// <param name="name">The timeline storage that stores the name of the project.</param>
        /// <param name="summary">The timeline storage that stores the summary of the project.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="id"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="name"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when <paramref name="summary"/> is <see langword="null" />.
        /// </exception>
        private ProjectHistoryStorage(
            HistoryId id,
            IVariableTimeline<string> name,
            IVariableTimeline<string> summary)
        {
            {
                Lokad.Enforce.Argument(() => id);
                Lokad.Enforce.Argument(() => name);
                Lokad.Enforce.Argument(() => summary);
            }

            m_HistoryId = id;
            m_Name = name;
            m_Summary = summary;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Creates a new instance of the <see cref="DatasetProxy"/> class with the given data that was stored in the history system.
        /// </summary>
        /// <param name="historyId">The ID of the current object as used by the timeline.</param>
        /// <param name="members">The collection of member fields that are stored in the timeline.</param>
        /// <param name="constructorArguments">The arguments needed to create the proxy.</param>
        /// <returns>A new instance of the <see cref="DatasetProxy"/> class.</returns>
        /// <exception cref="UnknownMemberException">
        ///     Thrown if <paramref name="members"/> contains member data for an unknown member.
        /// </exception>
        internal static DatasetProxy CreateInstance(
            HistoryId historyId,
            IEnumerable <Tuple <byte, IStoreTimelineValues> > members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 3, "There should only be three members.");
                Debug.Assert(constructorArguments.Length == 4, "There should be four constructor arguments.");
            }

            IVariableTimeline <string>            name    = null;
            IVariableTimeline <string>            summary = null;
            IVariableTimeline <NetworkIdentifier> distributionLocation = null;

            foreach (var member in members)
            {
                if (member.Item1 == NameIndex)
                {
                    name = member.Item2 as IVariableTimeline <string>;
                    continue;
                }

                if (member.Item1 == SummaryIndex)
                {
                    summary = member.Item2 as IVariableTimeline <string>;
                    continue;
                }

                if (member.Item1 == DistributionLocationIndex)
                {
                    distributionLocation = member.Item2 as IVariableTimeline <NetworkIdentifier>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return(new DatasetProxy(
                       constructorArguments[0] as DatasetConstructionParameters,
                       constructorArguments[1] as Func <DatasetOnlineInformation, DatasetStorageProxy>,
                       constructorArguments[2] as ICollectNotifications,
                       constructorArguments[3] as SystemDiagnostics,
                       historyId,
                       name,
                       summary,
                       distributionLocation));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Creates a new <see cref="ScheduleActionStorage"/> instance with the given parameters.
        /// </summary>
        /// <param name="id">The ID that will be used to uniquely identify the object to the history system.</param>
        /// <param name="members">The collection containing all the member collections.</param>
        /// <param name="constructorArguments">The constructor arguments.</param>
        /// <returns>The newly created instance.</returns>
        public static ScheduleActionStorage CreateInstance(
            HistoryId id,
            IEnumerable <Tuple <byte, IStoreTimelineValues> > members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 1, "There should only be 1 member.");
            }

            var pair = members.First();

            if (pair.Item1 != StorageIndex)
            {
                throw new UnknownMemberException();
            }

            var actions = pair.Item2 as IDictionaryTimelineStorage <ScheduleElementId, ActionMap>;

            return(new ScheduleActionStorage(id, actions));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Creates a new instance of the <see cref="DatasetHistoryStorage"/> 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="DatasetHistoryStorage"/> class.</returns>
        internal static DatasetHistoryStorage CreateInstance(
            HistoryId id,
            IEnumerable<Tuple<byte, IStoreTimelineValues>> members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 2, "There should only be 2 members.");
            }

            BidirectionalGraphHistory<DatasetId, Edge<DatasetId>> graph = null;
            IDictionaryTimelineStorage<DatasetId, DatasetProxy> knownDatasets = null;
            foreach (var member in members)
            {
                if (member.Item1 == GraphIndex)
                {
                    graph = member.Item2 as BidirectionalGraphHistory<DatasetId, Edge<DatasetId>>;
                    continue;
                }

                if (member.Item1 == DatasetsIndex)
                {
                    knownDatasets = member.Item2 as IDictionaryTimelineStorage<DatasetId, DatasetProxy>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return new DatasetHistoryStorage(id, graph, knownDatasets);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Creates a new instance of the <see cref="ProjectHistoryStorage"/> class with the given 
        /// history information.
        /// </summary>
        /// <param name="id">The history ID for the project 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="ProjectHistoryStorage"/> class.</returns>
        /// <exception cref="UnknownMemberException">
        /// Thrown if the <paramref name="members"/> collection contains data for an unknown member field.
        /// </exception>
        internal static ProjectHistoryStorage CreateInstance(
            HistoryId id,
            IEnumerable<Tuple<byte, IStoreTimelineValues>> members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 2, "There should only be two members.");
            }

            IVariableTimeline<string> name = null;
            IVariableTimeline<string> summary = null;
            foreach (var member in members)
            {
                if (member.Item1 == NameIndex)
                {
                    name = member.Item2 as IVariableTimeline<string>;
                    continue;
                }

                if (member.Item1 == SummaryIndex)
                {
                    summary = member.Item2 as IVariableTimeline<string>;
                    continue;
                }

                throw new UnknownMemberException();
            }

            return new ProjectHistoryStorage(id, name, summary);
        }
 public MockHistoryObject(long id)
 {
     m_Id = new HistoryId(id);
 }
Ejemplo n.º 20
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));
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </returns>
 public override string ToString()
 {
     return(String.Join(SEPARATOR.ToString(), new string[] { base.ToString(), UniqueId.ToString(), HistoryId.ToString() }));
 }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
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;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Creates a new <see cref="ScheduleConditionStorage"/> instance with the given parameters.
        /// </summary>
        /// <param name="id">The ID that will be used to uniquely identify the object to the history system.</param>
        /// <param name="members">The collection containing all the member collections.</param>
        /// <param name="constructorArguments">The constructor arguments.</param>
        /// <returns>The newly created instance.</returns>
        public static ScheduleConditionStorage CreateInstance(
            HistoryId id,
            IEnumerable<Tuple<byte, IStoreTimelineValues>> members,
            params object[] constructorArguments)
        {
            {
                Debug.Assert(members.Count() == 1, "There should only be 1 member.");
            }

            var pair = members.First();
            if (pair.Item1 != StorageIndex)
            {
                throw new UnknownMemberException();
            }

            var schedules = pair.Item2 as IDictionaryTimelineStorage<ScheduleElementId, ConditionMap>;
            return new ScheduleConditionStorage(id, schedules);
        }