/*
 * Created on Mar 26, 2009
 * 
 * (C) Copyright TANDBERG Television Ltd.
 */

package com.tandbergtv.watchpoint.pmm.title.conf;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Vijay Silva
 */
public class ComplexVariable extends Variable {

	private boolean showCollapsed = false;
	private List<Variable> children = new ArrayList<Variable>();

	/**
	 * Constructor
	 * 
	 * @param title The title conf
	 */
	public ComplexVariable(TitleConf title) {
		super(title);
	}

	/**
	 * @return the children
	 */
	public List<Variable> getChildren() {
		return children;
	}

	/**
	 * @param children the children to set
	 */
	void setChildren(List<Variable> children) {
		this.children = (children != null) ? children : new ArrayList<Variable>();
	}

	/**
	 * @param child The child variable to add
	 */
	void addChild(Variable child) {
		this.children.add(child);
	}
	
	/**
	 * @return the showCollapsed
	 */
	public boolean isShowCollapsed() {
		return showCollapsed;
	}

	/**
	 * @param showCollapsed the showCollapsed to set
	 */
	public void setShowCollapsed(boolean showCollapsed) {
		this.showCollapsed = showCollapsed;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.tandbergtv.watchpoint.pmm.title.conf.Variable#toString()
	 */
	@Override
	public String toString() {
		String desc = super.toString();
		String delimiter = " | ";
		desc += delimiter + "Child Count: " + children.size();
		return desc;
	}
}
