public void Visit(BasicFigure f) { if (select) { f.selected = true; } else { f.selected = false; } }
private IFigure Fig(Lexeme figure) { IFigure result; String north = ""; String south = ""; String west = ""; String east = ""; while (figure.type == TokenType.ORNAMENT) { Console.WriteLine("[DEBUG] Reading in a: " + figure.str); // Print lexeme type for debugging // tokentype is ornament // tokentype should be direction var direction = Pop(); Console.WriteLine("[DEBUG] Direction:" + direction.str); // Print lexeme type for debugging // tokentype should be string with text var content = Pop(); Console.WriteLine("[DEBUG] Content:" + content.str); // Print lexeme type for debugging if (direction.str == "top") { north = content.str; } if (direction.str == "bottom") { south = content.str; } if (direction.str == "right") { west = content.str; } if (direction.str == "left") { east = content.str; } figure = Pop(); } if (figure.type == TokenType.RECTANGLE) { Console.WriteLine("[DEBUG] Reading in a: " + figure.str); // Print lexeme type for debugging result = new BasicFigure(Pop().number, Pop().number, Pop().number, Pop().number, BasicFigure.RectangleStrategy.Instance); } else if (figure.type == TokenType.ELLIPSE) { Console.WriteLine("[DEBUG] Reading in a: " + figure.str); // Print lexeme type for debugging result = new BasicFigure(Pop().number, Pop().number, Pop().number, Pop().number, BasicFigure.EllipseStrategy.Instance); } else if (figure.type == TokenType.GROUP) { Console.WriteLine("[DEBUG] Reading in a: " + figure.str); // Print lexeme type for debugging result = Grp(); } else { Console.WriteLine("[DEBUG] Reading in a: " + figure.str); // Print lexeme type for debugging return(new BasicFigure(0, 0, 0, 0, BasicFigure.RectangleStrategy.Instance)); } var decoratedResult = new DecoratedFigure(result); if (north != "") { decoratedResult.North(north); } if (south != "") { decoratedResult.South(south); } if (east != "") { decoratedResult.East(east); } if (west != "") { decoratedResult.West(west); } if (north != "" || south != "" || east != "" || west != "") { return(decoratedResult); } return(result); }