package org.apache.ojb.broker;
import java.util.*;
public class TwoTable
{
    protected int twoId = 0;

    protected int oneId = 0;

    protected String name = null;

    protected OneTable one = null; 

    protected Collection children = new ArrayList(); 

    public int getTwoId() {
        return twoId;
    }
    public void setTwoId(int id) {
        this.twoId = id;
    }
    public int getOneId() {
        return oneId;
    }
    public void setOneId(int id) {
        this.oneId = id;
    }
    
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
   
    public OneTable getOne() {
        return one;
    }
    public void setOne(OneTable one) {
        if (this.one != one) {
            if (this.one != null) this.one.removeTwo(this);
            this.one = one;
            if (one != null) one.addTwo(this);
        }
    }
    public Collection getChildren() {
        return children;
    }
    public void addChild(Child child) {
        if (!this.children.contains(child)) {
            this.children.add(child);
            child.setTwo(this);
        }
    }
    public void removeChild(Child child) { 
        boolean removed = this.children.remove(child);
        if (removed) child.setTwo(null);
    } 
}
