package modules.dataflow;

import utils.*;
import simulator.*;
import java.util.*;
import modules.codegas.*;
import modules.gradient.*;
import modules.line.*;
import modules.node.*;
import java.awt.*;

public class DFNPort {
  Object id;
  Object[] in;
  Object[] out;

  public DFNPort(Object id, double in, double out) 
  { make(id,new double[]{in},new double[]{out}); }
  public DFNPort(Object id, double[] in, double out)
  { make(id,in,new double[]{out}); }
  public DFNPort(Object id, double in, double[] out)
  { make(id,new double[]{in},out); }
  public DFNPort(Object id, double[] in, double[] out)
  { make(id,in,out); }
  public DFNPort(Object id, Object[] in, Object[] out) {
    this.id=id; this.in=in; this.out=out;
  }

  private void make(Object id, double[] in, double[] out) {
    this.id=id; 
    this.in=new Object[in.length];
    for(int i=0;i<in.length;i++) { this.in[i]=new Double(in[i]); }
    this.out=new Object[out.length];
    for(int i=0;i<out.length;i++) { this.out[i]=new Double(out[i]); }
  }

  public Object id() { return id; }
  public Object[] in() { return in; }
  public Object[] out() { return out; }
  public Iterator getIn() { return Arrays.asList(in).iterator(); }
  public Iterator getOut() { return Arrays.asList(out).iterator(); }
}
