using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Common; using HeuristicLab.Core; namespace HeuristicLab.DebugEngine { public class OperationContent : IContent { public IOperation Operation { get; private set; } public OperationCollection Collection { get; private set; } public IAtomicOperation AtomicOperation { get; private set; } public ExecutionContext ExecutionContext { get; private set; } public string Name { get; private set; } public OperationContent(IOperation operation) { Operation = operation; Collection = operation as OperationCollection; AtomicOperation = operation as IAtomicOperation; ExecutionContext = operation as ExecutionContext; if (AtomicOperation != null) { Name = string.IsNullOrEmpty(AtomicOperation.Operator.Name) ? AtomicOperation.Operator.ItemName : AtomicOperation.Operator.Name; } else if (Collection != null) { Name = string.Format("{0} Operations", Collection.Count); } else { Name = ""; } } public bool IsCollection { get { return Collection != null; } } public bool IsAtomic { get { return AtomicOperation != null; } } public bool IsContext { get { return ExecutionContext != null; } } } }