Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Sequencer"/> class.
 /// </summary>
 /// <param name="sequencerKey">The sequencer key.</param>
 /// <param name="myIndex">The creator's index.</param>
 /// <param name="rootHeight">Height of the root.</param>
 public Sequencer(Guid sequencerKey, int myIndex, int rootHeight)
 {
     m_sequenceKey = sequencerKey;
     m_myIndex     = myIndex;
     m_myKey       = GuidOps.Add(sequencerKey, myIndex);
     m_rootHeight  = rootHeight;
 }
Exemplo n.º 2
0
 public int GetGenerationFromGuid(Guid guid)
 {
     for (int i = 0; i < 10; i++)
     {
         if (GuidOps.Add(Specification.Guid, i).Equals(guid))
         {
             return(i);
         }
     }
     throw new ApplicationException("Generation count exceeded ten - error.");
     // TODO: Need a more robust GUID subtraction routine.
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the guid for an object created (or to be created) by the specification
        /// with the specCentricGuid that is of the same generation as the instance provided.
        /// This is useful for determining the guid to assign to a port that is owned by a
        /// parent operation.
        /// </summary>
        /// <param name="specCentricGuid">The guid of the specification for which the instance
        /// guid is desired. (In the example above, it would be the port specification.)</param>
        /// <param name="instance">The correlated instance. (In the example above, it would be
        /// the parent task.)</param>
        /// <returns>The correlated guid. (In the example, above, it would be the guid to be
        /// assigned to a new port that is to be added to the given parent task.)</returns>
        public Guid GetInstanceSpecificGuid(Guid specCentricGuid, object instance)
        {
            int instanceGeneration = ((InstanceData)m_instanceDataByInstance[instance]).Generation;

            return(GuidOps.Add(specCentricGuid, instanceGeneration));
        }
Exemplo n.º 4
0
        public object GetInstance(Guid specificationGuid, int generation)
        {
            Guid instanceGuid = GuidOps.Add(specificationGuid, generation);

            return(((InstanceData)m_instanceDataByGuid[instanceGuid]).Instance);
        }
Exemplo n.º 5
0
 public Guid GenerationizedGuid(int generation)
 {
     return(GuidOps.Add(m_guid, generation));
 }