Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AlgorithmInstances"/> class.
 /// </summary>
 /// <param name="assignAlgorithm">The assign algorithm.</param>
 /// <param name="readAlgorithm">The read algorithm.</param>
 /// <param name="commitAlgorithm">The commit algorithm.</param>
 /// <param name="memoryAlgorithm">The memory algorithm.</param>
 /// <param name="mergeAlgorithm">The merge algorithm.</param>
 /// <param name="printAlgorithm">The print algorithm.</param>
 public AlgorithmInstances(
     IAssignAlgorithm assignAlgorithm,
     IReadAlgorithm readAlgorithm,
     ICommitAlgorithm commitAlgorithm,
     IMemoryAlgorithm memoryAlgorithm,
     IMergeAlgorithm mergeAlgorithm,
     IPrintAlgorithm printAlgorithm
     )
 {
     this.AssignAlgorithm = assignAlgorithm;
     this.ReadAlgorithm   = readAlgorithm;
     this.CommitAlgorithm = commitAlgorithm;
     this.MemoryAlgorithm = memoryAlgorithm;
     this.MergeAlgorithm  = mergeAlgorithm;
     this.PrintAlgorithm  = printAlgorithm;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Resolve type of objects in snapshot entry
        /// </summary>
        /// <param name="context">Context where types are resolved</param>
        /// <returns>
        /// Resolved types
        /// </returns>
        protected override IEnumerable <TypeValue> resolveType(SnapshotBase context)
        {
            Snapshot snapshot = ToSnapshot(context);

            snapshot.Factories.Logger.Log(snapshot, "iterate fields: " + this.ToString());
            snapshot.Factories.Benchmark.StartOperation(snapshot);

            IReadAlgorithm algorithm = snapshot.Algorithms.ReadAlgorithm;

            snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.RESOLVE_TYPE);
            MemoryEntry values = algorithm.Read(snapshot, path);
            var         types  = algorithm.GetObjectType(snapshot, values);

            snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.RESOLVE_TYPE);

            snapshot.Factories.Benchmark.FinishOperation(snapshot);

            return(types);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Iterate indexes defined on array
        /// </summary>
        /// <param name="context">Context where indexes are searched</param>
        /// <returns>
        /// Enumeration of available fields
        /// </returns>
        protected override IEnumerable <MemberIdentifier> iterateIndexes(SnapshotBase context)
        {
            Snapshot snapshot = ToSnapshot(context);

            snapshot.Factories.Logger.Log(snapshot, "iterate indexes: " + this.ToString());
            snapshot.Factories.Benchmark.StartOperation(snapshot);

            IReadAlgorithm algorithm = snapshot.Algorithms.ReadAlgorithm;

            snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.ITERATE_INDEXES);
            MemoryEntry values  = algorithm.Read(snapshot, path);
            var         indexes = algorithm.GetIndexes(snapshot, values);

            snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.ITERATE_INDEXES);

            snapshot.Factories.Benchmark.FinishOperation(snapshot);

            return(indexes);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Resolve method on current snapshot entry with given methodName
        /// </summary>
        /// <param name="context">Context where methods are resolved</param>
        /// <param name="methodName">Name of resolved method</param>
        /// <returns>
        /// Resolved methods
        /// </returns>
        protected override IEnumerable <FunctionValue> resolveMethod(SnapshotBase context, QualifiedName methodName)
        {
            Snapshot snapshot = ToSnapshot(context);

            snapshot.Factories.Logger.Log(snapshot, "iterate filds: " + this.ToString());
            snapshot.Factories.Benchmark.StartOperation(snapshot);

            IReadAlgorithm algorithm = snapshot.Algorithms.ReadAlgorithm;

            snapshot.Factories.Benchmark.StartAlgorithm(snapshot, AlgorithmType.RESOLVE_METHOD);
            MemoryEntry values = algorithm.Read(snapshot, path);

            algorithm.Read(snapshot, path);
            var methods = algorithm.GetMethod(snapshot, values, methodName);

            snapshot.Factories.Benchmark.FinishAlgorithm(snapshot, AlgorithmType.RESOLVE_METHOD);

            snapshot.Factories.Benchmark.FinishOperation(snapshot);

            return(methods);
        }