Exemplo n.º 1
0
        //---------------------------------------------------------------------

        private void ReadPlugIn(out IEditablePlugIn <IDisturbance> disturbPlugIn,
                                out IEditablePlugIn <IOutput> outputPlugIn)
        {
            disturbPlugIn = null;
            outputPlugIn  = null;

            StringReader currentLine = new StringReader(CurrentLine);
            InputValue <Edu.Wisc.Forest.Flel.Util.PlugIns.Info> plugInInfo = ReadPlugInName(currentLine);

            if (plugInInfo.Actual.InterfaceType == typeof(IDisturbance))
            {
                CheckForRepeatedName(plugInInfo.Actual.Name);
                disturbPlugIn      = new EditablePlugIn <IDisturbance>();
                disturbPlugIn.Info = plugInInfo;
                ReadInitFile(disturbPlugIn, currentLine);
            }
            else if (plugInInfo.Actual.InterfaceType == typeof(IOutput))
            {
                nameLineNumbers.Clear();
                CheckForRepeatedName(plugInInfo.Actual.Name);
                outputPlugIn      = new EditablePlugIn <IOutput>();
                outputPlugIn.Info = plugInInfo;
                ReadInitFile(outputPlugIn, currentLine);
            }
            else
            {
                throw new InputValueException(plugInInfo.String,
                                              "\"{0}\" is not a disturbance or output plug-in.",
                                              plugInInfo.Actual.Name);
            }
            GetNextLine();
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------

        private void ReadInitFile <T>(IEditablePlugIn <T> plugIn,
                                      StringReader currentLine)
            where T : Edu.Wisc.Forest.Flel.Util.PlugIns.IPlugIn
        {
            InputVar <string> initFile = new InputVar <string>("InitializationFile");

            ReadValue(initFile, currentLine);
            plugIn.InitFile = initFile.Value;

            CheckNoDataAfter("the " + initFile.Name + " column",
                             currentLine);
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------

        private void ReadPlugIn <T>(IEditablePlugIn <T> plugIn)
            where T : Edu.Wisc.Forest.Flel.Util.PlugIns.IPlugIn
        {
            StringReader currentLine = new StringReader(CurrentLine);

            plugIn.Info = ReadPlugInName(currentLine);
            if (plugIn.Info.Actual.InterfaceType == typeof(PlugIns.IOutput))
            {
                CheckForRepeatedName(plugIn.Info.Actual.Name);
            }
            ReadInitFile(plugIn, currentLine);
            GetNextLine();
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Inserts a plug-in into the list.
        /// </summary>
        /// <param name="index">
        /// Index where to insert the new plug-in.  Valid values are between 0
        /// and Count.  Inserting at index Count adds the new plug-in to the
        /// end of the list.
        /// </param>
        /// <exception cref="System.IndexOutOfRangeException">
        /// index is less than 0 or greater than Count.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// plugIn is null.
        /// </exception>
        public void InsertAt(int index,
                             IEditablePlugIn <T> plugIn)
        {
            if (index < 0 || index > Count)
            {
                throw new System.IndexOutOfRangeException();
            }
            if (plugIn == null)
            {
                throw new System.ArgumentNullException();
            }
            if (index == Count)
            {
                plugIns.Add(plugIn);
            }
            else
            {
                plugIns[index] = plugIn;
            }
        }