// Path: arc-cd-wrap-cdrdao/src/main/java/org/opf_labs/arc_cd/cdrdao/toc/AudioTrack.java
// @SuppressWarnings("hiding")
// public static class Builder {
// 	private int number = 1;
// 	private TrackType type = TrackType.AUDIO;
// 	private boolean copyPermitted = false;
// 	private boolean preEmphasisFlag = false;
// 	private boolean isTwoChannel = true;
// 	private boolean isFourChannel = false;
// 	private String isrc = "";
// 	private String file = "";
// 	private String start = "0";
// 	private String length = "";
// 
// 	/**
// 	 * Create a new Builder with the passed track number
// 	 * @param number the track number 
// 	 */
// 	public Builder(final int number) {
// 		Preconditions.checkArgument((number > 0) || (number < 100),
// 				"Track number out of range:" + number);
// 		this.number = number;
// 	}
// 
// 	/**
// 	 * @param type the new TrackType value
// 	 * @return this builder for chaining
// 	 */
// 	public Builder type(final TrackType type) {
// 		Preconditions.checkNotNull(type, "type == null");
// 		this.type = type;
// 		return this;
// 	}
// 	/**
// 	 * @param copyPermitted a new copyPermitted flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder copyPermitted(final boolean copyPermitted) {
// 		this.copyPermitted = copyPermitted;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param preEmphasisFlag a new preEmphasisFlag flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder preEmphasisFlag(final boolean preEmphasisFlag) {
// 		this.preEmphasisFlag = preEmphasisFlag;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isTwoChannel a new isTwoChannel flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isTwoChannel(final boolean isTwoChannel) {
// 		this.isTwoChannel = isTwoChannel;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isFourChannel a new isFourChannel flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isFourChannel(final boolean isFourChannel) {
// 		this.isFourChannel = isFourChannel;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isrc an International Standard Recording Number for the track
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isrc(final String isrc) {
// 		Preconditions.checkNotNull(isrc, "isrc == null");
// 		this.isrc = isrc;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param file the file value for the track
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder file(final String file) {
// 		Preconditions.checkNotNull(file, "file == null");
// 		this.file = file;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param start set the Track start
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder start(final String start) {
// 		Preconditions.checkNotNull(start, "start is null");
// 		Preconditions.checkArgument(!start.isEmpty(), "start.isEmpty()");
// 		this.start = start;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param length set the Track length
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder length(final String length) {
// 		Preconditions.checkNotNull(length, "length is null");
// 		this.length = length;
// 		return this;
// 	}
// 
// 	/**
// 	 * Create a new AudioTrack instance from the Builder values
// 	 * @return the created AudioTrack
// 	 */
// 	public AudioTrack build() {
// 		return new AudioTrack(this.number, this.type, this.copyPermitted,
// 				this.preEmphasisFlag, this.isTwoChannel,
// 				this.isFourChannel, this.isrc, this.file, this.start,
// 				this.length);
// 	}
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import org.apache.log4j.Logger;
import org.opf_labs.arc_cd.cdrdao.toc.AudioTrack.Builder;
import com.google.common.base.Preconditions;
			Matcher trackStartMatcher = TocUtilities.TRACK_START_COMMENT.matcher(line);
			if (trackStartMatcher.matches()) {
				lastTrack = trackStartMatcher.group(1);
			}
			Matcher trackTypeMatcher = TocUtilities.TRACK_TYPE_PATTERN.matcher(line);
			if (trackTypeMatcher.matches()) {
				tracks.add(parseTrack(lastTrack, TrackType.fromTocValue(trackTypeMatcher.group(1)), reader));
			}
		}
		return new TocItemRecord(tracks);
	}

	private static AudioTrack parseTrack(String numberMatch, TrackType type,
			BufferedReader reader) throws IOException {
		int number = Integer.parseInt(numberMatch);
		Builder builder = new Builder(number);
		builder.type(type);
		String line;
		while (((line = reader.readLine()) != null) && !(line.isEmpty())) {
			Matcher isrcMatcher = TocUtilities.ISRC_PATTERN.matcher(line);
			if (isrcMatcher.matches()) {
				builder.isrc(isrcMatcher.group(1));
			}
			Matcher fileMatcher = TocUtilities.FILE_PATTERN.matcher(line);
			if (fileMatcher.matches()) {
				builder.file(fileMatcher.group(1));
				builder.start(fileMatcher.group(2));
				builder.length(fileMatcher.group(3));
			}
		}
// Path: arc-cd-wrap-cdrdao/src/main/java/org/opf_labs/arc_cd/cdrdao/toc/AudioTrack.java
// @SuppressWarnings("hiding")
// public static class Builder {
// 	private int number = 1;
// 	private TrackType type = TrackType.AUDIO;
// 	private boolean copyPermitted = false;
// 	private boolean preEmphasisFlag = false;
// 	private boolean isTwoChannel = true;
// 	private boolean isFourChannel = false;
// 	private String isrc = "";
// 	private String file = "";
// 	private String start = "0";
// 	private String length = "";
// 
// 	/**
// 	 * Create a new Builder with the passed track number
// 	 * @param number the track number 
// 	 */
// 	public Builder(final int number) {
// 		Preconditions.checkArgument((number > 0) || (number < 100),
// 				"Track number out of range:" + number);
// 		this.number = number;
// 	}
// 
// 	/**
// 	 * @param type the new TrackType value
// 	 * @return this builder for chaining
// 	 */
// 	public Builder type(final TrackType type) {
// 		Preconditions.checkNotNull(type, "type == null");
// 		this.type = type;
// 		return this;
// 	}
// 	/**
// 	 * @param copyPermitted a new copyPermitted flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder copyPermitted(final boolean copyPermitted) {
// 		this.copyPermitted = copyPermitted;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param preEmphasisFlag a new preEmphasisFlag flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder preEmphasisFlag(final boolean preEmphasisFlag) {
// 		this.preEmphasisFlag = preEmphasisFlag;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isTwoChannel a new isTwoChannel flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isTwoChannel(final boolean isTwoChannel) {
// 		this.isTwoChannel = isTwoChannel;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isFourChannel a new isFourChannel flag value
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isFourChannel(final boolean isFourChannel) {
// 		this.isFourChannel = isFourChannel;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param isrc an International Standard Recording Number for the track
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder isrc(final String isrc) {
// 		Preconditions.checkNotNull(isrc, "isrc == null");
// 		this.isrc = isrc;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param file the file value for the track
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder file(final String file) {
// 		Preconditions.checkNotNull(file, "file == null");
// 		this.file = file;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param start set the Track start
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder start(final String start) {
// 		Preconditions.checkNotNull(start, "start is null");
// 		Preconditions.checkArgument(!start.isEmpty(), "start.isEmpty()");
// 		this.start = start;
// 		return this;
// 	}
// 
// 	/**
// 	 * @param length set the Track length
// 	 * @return this Builder object for chaining
// 	 */
// 	public Builder length(final String length) {
// 		Preconditions.checkNotNull(length, "length is null");
// 		this.length = length;
// 		return this;
// 	}
// 
// 	/**
// 	 * Create a new AudioTrack instance from the Builder values
// 	 * @return the created AudioTrack
// 	 */
// 	public AudioTrack build() {
// 		return new AudioTrack(this.number, this.type, this.copyPermitted,
// 				this.preEmphasisFlag, this.isTwoChannel,
// 				this.isFourChannel, this.isrc, this.file, this.start,
// 				this.length);
// 	}
// }


// Path: arc-cd-wrap-cdrdao/src/main/java/org/opf_labs/arc_cd/cdrdao/toc/TocItemRecord.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import org.apache.log4j.Logger;
import org.opf_labs.arc_cd.cdrdao.toc.AudioTrack.Builder;
import com.google.common.base.Preconditions;

			Matcher trackStartMatcher = TocUtilities.TRACK_START_COMMENT.matcher(line);
			if (trackStartMatcher.matches()) {
				lastTrack = trackStartMatcher.group(1);
			}
			Matcher trackTypeMatcher = TocUtilities.TRACK_TYPE_PATTERN.matcher(line);
			if (trackTypeMatcher.matches()) {
				tracks.add(parseTrack(lastTrack, TrackType.fromTocValue(trackTypeMatcher.group(1)), reader));
			}
		}
		return new TocItemRecord(tracks);
	}

	private static AudioTrack parseTrack(String numberMatch, TrackType type,
			BufferedReader reader) throws IOException {
		int number = Integer.parseInt(numberMatch);
		Builder builder = new Builder(number);
		builder.type(type);
		String line;
		while (((line = reader.readLine()) != null) && !(line.isEmpty())) {
			Matcher isrcMatcher = TocUtilities.ISRC_PATTERN.matcher(line);
			if (isrcMatcher.matches()) {
				builder.isrc(isrcMatcher.group(1));
			}
			Matcher fileMatcher = TocUtilities.FILE_PATTERN.matcher(line);
			if (fileMatcher.matches()) {
				builder.file(fileMatcher.group(1));
				builder.start(fileMatcher.group(2));
				builder.length(fileMatcher.group(3));
			}
		}
		return builder.build();