示例#1
0
 public void LoadDataIntoCells(ICell[] cells)
 {
     while (TokenNode != null)
     {
         switch (TokenNode.Value.Tag)
         {
             case Tag.FORMAT_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.IsAssignmentFormat() == false)
                     {
                         throw new InvalidFAPFileException("The Format type of the given assignment file is not of an \"ASSIGNMENT\" type");
                     }
                 }
                 break;
             case Tag.GENERATION_INFORMATION_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.ValidScenarioID(ScenarioID) == false)
                     {
                         throw new InvalidScenarioIDException("The given assignment file scenario id doesn't match the problem file scenario id");
                     }
                 }
                 break;
             case Tag.CELLS_START: FillCells(cells);
                 break;
         }
         TokenNode = TokenNode.Next;
     }
 }
示例#2
0
        private void CreateFormat(ref LinkedListNode<Token> tokenNode)
        {
            tokenNode = tokenNode.Next;
            while (tokenNode.Value.Tag != Tag.FORMAT_END)
            {
                Token token = tokenNode.Value;
                switch (tokenNode.Value.Tag)
                {
                    case Tag.FORMAT_TYPE:
                        {
                            FAPFileVerifier verifier = new FAPFileVerifier(tokenNode);
                            if (verifier.IsScenarioFormat())
                            {
                                this.Format.Type = ((StringBlock)token).value;
                            }
                            else
                            {
                                throw new InvalidFAPFileException("The current problem file specified in the problem path isn't of a scenario type");
                            }

                        }
                        break;
                    case Tag.FORMAT_VERSION: this.Format.version = ((StringBlock)token).value;
                        break;
                }
                tokenNode = tokenNode.Next;
            }
        }