コード例 #1
0
 public override bool IsValidDestination(AbstractProcessUnit unit)
 {
     // Heat streams can only have reactors as destinations (and of course the
     // reactor unit has to be accepting incoming streams).
     // TODO: Check with the chemistry guys to verify this
     return((unit is Reactor) && unit.CanAcceptIncomingStream(this));
 }
コード例 #2
0
 public override bool IsValidSource(AbstractProcessUnit unit)
 {
     // Chemical streams can accept any type of process unit as a source, provided
     // that the unit is accepting outgoing streams.
     // TODO: Double check this with the chemistry guys
     return(unit.CanAcceptOutgoingStream(this));
 }
コード例 #3
0
 public override bool IsValidDestination(AbstractProcessUnit unit)
 {
     // As far as I can tell, the chemical streams can accept any type of process
     // unit as a destination. So the only required check is that the unit is
     // accepting incoming streams.
     // TODO: Double check this with the chemistry guys
     return(unit.CanAcceptIncomingStream(this));
 }
コード例 #4
0
        public void AddProcessUnit(AbstractProcessUnit unit)
        {
            // Make sure that the process unit ID is unique. This is very important.
            if (null != GetProcessUnit(unit.Id))
            {
                throw new InvalidOperationException(string.Format(
                                                        "A process unit with ID={0} already exists in the workspace. The new process unit that " +
                                                        "was passed to \"AddProcessUnit\" also had this ID. Each process unit in the workspace is " +
                                                        "required to have a unique ID.", unit.Id));
            }

            m_procUnits.Add(unit);

            if (null != ProcessUnitsCollectionChanged)
            {
                ProcessUnitsCollectionChanged(this, EventArgs.Empty);
            }
        }
コード例 #5
0
        /// <summary>
        /// Removes a process unit from the workspace. Any streams in the workspace that referenced
        /// that process unit as a source or destination will have their references set to null.
        /// </summary>
        public void RemoveProcessUnit(AbstractProcessUnit unit)
        {
            // First go through all streams and remove references to this unit
            foreach (AbstractStream stream in m_streams)
            {
                if (object.ReferenceEquals(stream.Source, unit))
                {
                    stream.Source = null;
                }
                if (object.ReferenceEquals(stream.Destination, unit))
                {
                    stream.Destination = null;
                }
            }

            // Now remove it from the collection
            m_procUnits.Remove(unit);

            if (null != ProcessUnitsCollectionChanged)
            {
                ProcessUnitsCollectionChanged(this, EventArgs.Empty);
            }
        }
コード例 #6
0
ファイル: AbstractStream.cs プロジェクト: petlyuk/CHEMPROV
 /// <summary>
 /// E.O.
 /// Every stream has a source and destination process unit. This method determines whether or
 /// not the specified unit is a valid destination. This may depend on multiple things, such
 /// as the type of the stream and whether or not the process unit can accept more incoming
 /// streams.
 /// </summary>
 /// <returns>True if the unit is a valid destination, false otherwise.</returns>
 public abstract bool IsValidDestination(AbstractProcessUnit unit);
コード例 #7
0
ファイル: AbstractStream.cs プロジェクト: petlyuk/CHEMPROV
 /// <summary>
 /// Every stream has a source and destination process unit. This method determines whether or
 /// not the specified unit is a valid source. This may depend on multiple things, such
 /// as the type of the stream and whether or not the process unit can accept more outgoing
 /// streams.
 /// </summary>
 /// <returns>True if the unit is a valid source, false otherwise.</returns>
 public abstract bool IsValidSource(AbstractProcessUnit unit);
コード例 #8
0
 public override bool IsValidSource(AbstractProcessUnit unit)
 {
     return(false);
 }
コード例 #9
0
ファイル: Reactor.cs プロジェクト: petlyuk/CHEMPROV
 public Reactor()
     : this(AbstractProcessUnit.GetNextUID())
 {
 }
コード例 #10
0
 public HeatExchangerNoUtility()
     : this(AbstractProcessUnit.GetNextUID())
 {
 }
コード例 #11
0
ファイル: Separator.cs プロジェクト: petlyuk/CHEMPROV
 public Separator()
     : this(AbstractProcessUnit.GetNextUID())
 {
 }
コード例 #12
0
ファイル: Mixer.cs プロジェクト: petlyuk/CHEMPROV
 public Mixer()
     : this(AbstractProcessUnit.GetNextUID())
 {
 }