/// <summary>
        /// Nice helper function that tallies up compounds for a set of streams
        /// </summary>
        /// <param name="streams"></param>
        /// <returns></returns>
        protected virtual Dictionary <string, StreamComponent> TallyCompounds(IEnumerable <AbstractStream> streams)
        {
            Dictionary <string, StreamComponent> compounds = new Dictionary <string, StreamComponent>(5);

            //tally up flow rates for each compound
            foreach (AbstractStream stream in streams)
            {
                // TODO: Get the commented-out part working again
                throw new NotImplementedException();
                ITableAdapter tableAdapter = null;// TableAdapterFactory.CreateTableAdapter(stream.Table);

                //start at index value = 1 as we're assuming that 1 is the header row, which we don't
                //check in this particular rule (see CheckOverallFlowRate())
                for (int i = 1; i < tableAdapter.GetRowCount(); i++)
                {
                    string compound = tableAdapter.GetCompoundAtRow(i);
                    string quantity = tableAdapter.GetQuantityAtRow(i);
                    string units    = tableAdapter.GetUnitAtRow(i);

                    if (compound != null)
                    {
                        if (!compounds.ContainsKey(compound))
                        {
                            compounds[compound]      = new StreamComponent();
                            compounds[compound].Name = compound;
                        }
                        compounds[compound].AddValue(quantity, units);
                    }
                }
            }
            return(compounds);
        }
            /// <summary>
            /// This compares the passed in object to itself in regards to the value.  If both have wild cards then true,
            /// if 1 does and that one has a bigger value then true and if neither have wildcards then if values are the same
            /// then true otherwise it is false.
            /// </summary>
            /// <param name="obj">the object being compared too</param>
            /// <returns>-1 if obj is not a StreamComponent or false, 0 if true</returns>
            public int CompareTo(object obj)
            {
                //return -1 if we're not comparing the same thing so GTFO
                if (!(obj is StreamComponent))
                {
                    return(-1);
                }

                //comparing stream weights is kind of cookey.  In the simplest case,
                //all we need to do is compare two double values.  However, with the common
                //case, we deal with wildcards, which can be any value.  When dealing
                //with wildcards, we return equal when the supplied object (THE one supplied
                //in the parameter list) is larger than the other object.  Otherwise, return false.
                StreamComponent other = obj as StreamComponent;

                if (!this.WildCardFound && !other.WildCardFound)
                {
                    //case 1: just compare double values.
                    return(this.Value.CompareTo(other.Value));
                }
                else if (!this.WildCardFound && other.WildCardFound)
                {
                    //case 2: if the other's widcard is set, make sure that it's larger
                    if (other.Value < this.Value)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else if (this.WildCardFound && !other.WildCardFound)
                {
                    //case 3: If we don't know our value, we must be equal!
                    if (this.Value < other.Value)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else if (this.WildCardFound && other.WildCardFound)
                {
                    //case 4: wildcards on both sides no clue so return true
                    return(0);
                }
                //catch-all: return 0?
                return(0);
            }
        /// <summary>
        /// Returns the overall flow rate for a set of streams
        /// </summary>
        /// <param name="streams">This is a list of streams whos Overall will be add together</param>
        /// <returns>Returns a StreamComponent which contains the results</returns>
        private StreamComponent TallyOverallFlowRate(IEnumerable <AbstractStream> streams)
        {
            StreamComponent component = new StreamComponent();

            //tally up flow rates coming into this compound
            foreach (AbstractStream stream in streams)
            {
                // TODO: Get the commented-out part working again
                throw new NotImplementedException();
                ITableAdapter tableAdapter = null;// TableAdapterFactory.CreateTableAdapter(stream.Table);
                if (tableAdapter.GetTableType() == TableType.Chemcial)
                {
                    component.AddValue(tableAdapter.GetQuantityAtRow(0));
                }
            }
            return(component);
        }
        /// <summary>
        /// Checks to make sure that the flow rate of the overall streams match
        /// </summary>
        /// <returns></returns>
        protected virtual ValidationResult CheckOverallFlowRate()
        {
            //variables used to store incoming and outgoing flow rates.
            StreamComponent incomingFlow = TallyOverallFlowRate(target.IncomingStreams);
            StreamComponent outogingFlow = TallyOverallFlowRate(target.OutgoingStreams);

            //if they're equal then we're good, otherwise return an error
            if (incomingFlow.CompareTo(outogingFlow) == 0)
            {
                return(ValidationResult.Empty);
            }
            else
            {
                string message = ErrorMessageGenerator.GenerateMesssage(ErrorMessages.Overall_Flowrate_Mismatch);
                return(new ValidationResult(target.OutgoingStreams, message));
            }
        }