/*
 * Copyright (c) 2006-2008 Maskat Project.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Maskat Project - initial API and implementation
 */
package org.maskat.core.event;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Target extends AbstractEventElement {
	
	public static final String TYPE_DEFAULT = "remote";

	private String out;

	private String in;

	private String inkey;

	private String type = TYPE_DEFAULT;

	// TODO binds属性を削除
	private List binds;

	private String teleType;

	private String workType;

	public String getIn() {
		return in;
	}

	public void setIn(String in) {
		this.in = in;
	}

	public String getInkey() {
		return inkey;
	}

	public void setInkey(String inkey) {
		this.inkey = inkey;
	}

	public String getOut() {
		return out;
	}

	public void setOut(String out) {
		this.out = out;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTeleType() {
		return teleType;
	}

	public void setTeleType(String teleType) {
		this.teleType = teleType;
	}

	public String getWorkType() {
		return workType;
	}

	public void setWorkType(String workType) {
		this.workType = workType;
	}

	public void addChild(Object child) {
		super.addChild(child);
		if (child instanceof Bind) {
			addBind((Bind) child);
		}
	}

	private void addBind(Bind bind) {
		if (binds == null) {
			binds = new ArrayList();
		}
		binds.add(bind);
	}

	public List getBinds() {
		return binds;
	}

	public Iterator getBindsIt() {
		//return (binds == null) ? null : new DefChildIterator(this, binds.iterator());
		return this.getTypedChildren(Bind.class);
	}

	/**
	 * @deprecated
	 * @param binds
	 */
	public void setBinds(List binds) {
		// TODO BasicDef#childrenと一致するように！
		this.binds = binds;
	}
}
