示例#1
0
 public Page(Content content, NewspaperProperties newspaperProperties, IFormatter formatter)
 {
     NoOfCols              = newspaperProperties.NoOfCols;
     NoOfRows              = newspaperProperties.NoOfRows;
     WidthOfPage           = newspaperProperties.WidthOfPage;
     ColumnSpacing         = newspaperProperties.ColumnSpacing;
     this.readabilityLevel = readabilityLevel;
     WidthOfRow            = (WidthOfPage - (NoOfCols - 1) * 3) / NoOfCols;
     Columns = new List <Column>();
     for (int i = 0; i < NoOfCols; i++)
     {
         Column column = new Column(content, newspaperProperties, formatter);
         Columns.Add(column);
     }
 }
示例#2
0
 public Newspaper(Content content, NewspaperProperties newspaperProperties, IFormatter formatter)
 {
     try
     {
         NoOfCols              = newspaperProperties.NoOfCols;
         NoOfRows              = newspaperProperties.NoOfRows;
         WidthOfPage           = newspaperProperties.WidthOfPage;
         Pages                 = new List <Page>();
         this.readabilityLevel = readabilityLevel;
         while (!content.isEmpty())
         {
             NoOfPages++;
             Page page = new Page(content, newspaperProperties, formatter);
             Pages.Add(page);
         }
     }
     catch (Exception)
     {
         throw new Exception("Newspaper with the given dimensions cannot be created.");
     }
 }
示例#3
0
 public Column(Content content, NewspaperProperties newspaperProperties, IFormatter formatter)
 {
     NoOfRows   = newspaperProperties.NoOfRows;
     WidthOfRow = newspaperProperties.WidthOfRow;
     Rows       = formatter.format(content, newspaperProperties);
 }