Esempio n. 1
0
        public void LoadInputFile(string filename, string weather_file)
        {
            this.CurrentINPFilePath = filename;
            this.weather_file = weather_file;
            this.Commands.Clear();
            this.parents.Clear();
            string command_string = "";

            List<String> FileAsString = File.ReadAllLines(this.CurrentINPFilePath).ToList();
            foreach (string line in FileAsString)
            {
                Regex IsComment = new Regex(@"\$.*");
                if (!IsComment.IsMatch(line))
                {
                    //Check if this is the last line of the command.
                    Regex IsLastLine = new Regex(@"(.*?)\.\.");
                    if (IsLastLine.IsMatch(line))
                    {
                        Match match = IsLastLine.Match(line);
                        command_string = command_string + match.Groups[1];
                        DOECommand command = new DOECommand();
                        command.get_command_from_string(command_string);
                        command_string = "";
                        Commands.Add(command);
                    }
                    else
                    {
                        command_string += line;
                    }

                }

            }
        }
Esempio n. 2
0
        public List<DOECommand> determine_current_parents(DOECommand new_command)
        {
            if (this.last_command == null)
            {
                this.last_command = new_command;
            }
            //Check to see if scope (HVAC versus Envelope) has changed or the parent depth is undefined "0"
            if (this.parents.Count != 0 && (new_command.doe_scope() != @parents.Last().doe_scope() || new_command.depth() == 0 ))
            {
                this.parents.Clear();
            }

            //no change in parent
            if ( (new_command.depth() == this.last_command.depth() ) )
            {
                last_command = new_command;
            }
            //Parent Depth Added.
            if ( (new_command.depth() > this.last_command.depth() ) )
            {
                parents.Add(last_command);
                last_command = new_command;
            }

            //Parent Depth Added.
            if ( (new_command.depth() < this.last_command.depth() ) )
            {
                parents.RemoveAt(parents.Count() -1 );
                last_command = new_command;
            }
            return parents;
        }