// Chapter.java  P. Conrad, for CISC370, 06/18/2007
//   based on p. 231 from Java Cookbook, 2nd Edition (O'Reilly)

import java.io.*;
import java.util.ArrayList;


// SectionTest.java  P. Conrad, for CISC370, 06/18/2007
//   based on p. 231 from Java Cookbook, 2nd Edition (O'Reilly)

import java.util.ArrayList;


/**
 * Unit tests for the {@link Section} class.
 * @author Phill Conrad
 */

public class Chapter {

    /**
     * A unit test to test the constructors and the getters
     * A more "pure" approach would factor this into multiple tests.
     * What are the pros/cons of doing that?
     */

    private String _name;
    private String _title;
    private ArrayList<Section> _sections;

    /*
     * Construct a new chapter
     * @param name name of the chapter
     * @param title title of the chapter
     */

    public Chapter(String name, String title) {
	 
	_name = name;
	_title = title; 
	
	_sections = new ArrayList<Section>();
	
    }

    public String getName() { return _name; }
    public String getTitle() { return _title; }

    public Section getSection(int i) {
	return _sections.get(i);
    }


    public void add(Section s) {
	 _sections.add(s); 
    }


    public Section get(int i) {
	return  _sections.get(i); 
    }

    public int getNumSections() {

	 return _sections.size(); 
    }



} // class
