public static void main(String[] args) {
    List<EqualJoin> ejs = new ArrayList<EqualJoin>();
    Column col1t1 = new Column(new Table(null, "t1"), "c1");
    Column col1t2 = new Column(new Table(null, "t2"), "c1");
    EqualJoin ej = new EqualJoin(col1t1, col1t2);
    ej.setLeftSize(100);
    ej.setRightSize(200);
    ejs.add(ej);

    Column col2t2 = new Column(new Table(null, "t2"), "c2");
    Column col2t3 = new Column(new Table(null, "t3"), "c2");
    ej = new EqualJoin(col2t2, col2t3);
    ej.setLeftSize(200);
    ej.setRightSize(300);
    ejs.add(ej);

    Column col3t3 = new Column(new Table(null, "t3"), "c3");
    Column col3t4 = new Column(new Table(null, "t4"), "c3");
    ej = new EqualJoin(col3t3, col3t4);
    ej.setLeftSize(30);
    ej.setRightSize(40);
    ejs.add(ej);

    Column col4t4 = new Column(new Table(null, "t4"), "c4");
    Column col4t5 = new Column(new Table(null, "t5"), "c4");
    ej = new EqualJoin(col4t4, col4t5);
    ej.setLeftSize(40);
    ej.setRightSize(50);
    ejs.add(ej);

    Column col5t5 = new Column(new Table(null, "t5"), "c5");
    Column col5t6 = new Column(new Table(null, "t6"), "c5");
    ej = new EqualJoin(col5t5, col5t6);
    ej.setLeftSize(50);
    ej.setRightSize(60);
    ejs.add(ej);

    // reorder(ejs);
    for (EqualJoin j : ejs) System.out.println(j);
  }
  public JoinManager(List<EqualJoin> joins, Map<String, Operator> operMapIn, File swapDirIn) {
    joinedHistory = new HashSet<String>();
    joinList = joins;
    operMap = operMapIn;

    // find and set size
    for (EqualJoin ej : joins) {
      ej.setLeftSize(operMap.get(ej.getLeftTableName()).getLength());
      ej.setRightSize(operMap.get(ej.getRightTableName()).getLength());
    }

    // move the biggest last, and
    // make each of them has an overlap,
    // so that easy to pipeline
    reorder(joinList);
  }