package brn.sim;

import brn.sim.builder.TrafficBuilder;
import brn.sim.builder.TransBuilder;
import brn.sim.builder.TrafficBuilder.TrafficParams;
import brn.sim.builder.TransBuilder.TransParams;


/**
 * {@link AbstractParams} with transport and traffic specifications.
 * 
 * @deprecated use {@link BasicParams}
 * @author kurth
 */
public class DeprecatedBasicParams extends AbstractParams {
  private static final long serialVersionUID = 1L;
  
  public TrafficBuilder.TrafficParams trafficParams = new TrafficBuilder.HorizontalParams();

  public TransBuilder.TransParams transParams = new TransBuilder.UdpParams();

  public TrafficBuilder.TrafficParams getTrafficParams() {
    return trafficParams;
  }

  public void setTrafficParams(TrafficBuilder.TrafficParams trafficParams) {
    this.trafficParams = trafficParams;
  }

  public TransBuilder.TransParams getTransParams() {
    return transParams;
  }

  public void setTransParams(TransBuilder.TransParams transParams) {
    this.transParams = transParams;
  }

  /* (non-Javadoc)
   * @see brn.sim.AbstractParams#clone()
   */
  public Object clone() throws CloneNotSupportedException {
    DeprecatedBasicParams ret = (DeprecatedBasicParams) super.clone();
    if (null != trafficParams) ret.trafficParams = (TrafficParams) trafficParams.clone();
    if (null != transParams) ret.transParams = (TransParams) transParams.clone();
    return ret;
  }

//  public static BasicParams defaultParams() {
//    BasicParams params = new BasicParams();
//
//    // set parameters
//    params.endTime = 100;
//    params.nodes = 2;
//    params.dumpRadio = "dsr.tr";
//    params.dumpFieldNam = "dsr.nam";
//    params.dumpNet = true;
//    params.seed = 2;
//
//    FieldBuilder.FieldParams field = new FieldBuilder.FieldParams();
//    field.fieldX = 300;
//    field.fieldY = 100;
//    field.pathloss = new PathLossBuilder.FreeSpaceParams();
////    field.exponent = 2.7;
////    field.stdDeviation = 4.;
//    field.spatial_mode = Constants.SPATIAL_LINEAR;
//    params.field = field;
//
//    RadioBuilder.NoiseParams radio = new RadioBuilder.NoiseAdditiveParams();
//    radio.fieldX = field.fieldX;
//    radio.fieldY = field.fieldY;
//    radio.placement = Constants.PLACEMENT_POISSON;
//    radio.placementOpts = "0.5x0.5x30x18";
//    radio.radioType = Constants.MAC_802_11g_PURE;
//    radio.useAnnos = true;
//    params.node.radio = radio;
//
//    MacBuilder.M802_11Params mac = new MacBuilder.M802_11Params();
////    mac.macType = Constants.MAC_802_11g_PURE;
//    mac.useAnnos = radio.useAnnos;
//    mac.useBitRateAnnos = false;
//    params.node.mac = mac;
//
//    NetBuilder.IpParams net = new NetBuilder.IpParams();
//    net.protocolMapper = new int[] { Constants.NET_PROTOCOL_UDP,
//        Constants.NET_PROTOCOL_LINK_PROBE, Constants.NET_PROTOCOL_MCEXOR,
//        Constants.NET_PROTOCOL_FLOODING };
//    params.node.net = net;
//
//    RouteBuilder.BrnDsrParams route = new RouteBuilder.BrnDsrParams();
//    route.protocol = Constants.NET_PROTOCOL_MCEXOR;
//    route.forwarding = brn.swans.Constants.FORWARDING_UNICAST;
//    route.discovery = brn.swans.Constants.DISCOVERY_PROACTIVE;
//    route.floodintOffset = 50000;
//    route.floodingPeriod = 10000;
//    route.floodingMax = 0;
//    params.node.route = route;
//
//    MetricBuilder.EtxParams metric = new MetricBuilder.EtxParams();
////    metric.rates = new int[] { 22 };
//    metric.probes = new int[] { Constants.BANDWIDTH_DEFAULT, 1000 };
//    metric.period = 1000;
//    metric.tau = 30000;
//    metric.globalLinkTable = true;
//    route.metric = metric;
//
//    TrafficBuilder.RadialParams trafficParams = new TrafficBuilder.RadialParams();
//    trafficParams.flowParams = params.trafficParams.flowParams;
//    trafficParams.startAngle = .75 * Math.PI;
//    params.trafficParams = trafficParams;
//
//    ((FlowBuilder.SaturatingUdpParams)params.trafficParams.flowParams).start = 80000;
//    ((FlowBuilder.SaturatingUdpParams)params.trafficParams.flowParams).end = 90000;
//    ((FlowBuilder.CaUdpParams)params.trafficParams.flowParams).maxOutstandingPackets = 180;
//
//    return params;
//  }
//
//  public static BasicParams alternativeParams() {
//    BasicParams params = new BasicParams();
//
//    // set parameters
//    params.endTime = 100;
//    params.seed = 0;
//    params.nodes = 12;
//    params.assertion = true;
//    params.dumpRadio = "dsr.tr";
//    params.dumpFieldNam = "dsr.nam";
//    params.dumpNet = true;
//    params.seed = 2;
//
//    LogDistanceParams lossExp = new LogDistanceParams();
//    lossExp.exponent = 2.7;
//
//    ShadowingParams pathLoss = new ShadowingParams();
//    pathLoss.pathloss = lossExp;
//    pathLoss.stdDeviation = 4.;
////    pathLoss.exponential = false; // JistAPI.END !! 
////    pathLoss.coherenceTime = JistAPI.END;
//
//    FieldBuilder.FieldParams field = new FieldBuilder.FieldParams();
//    field.fieldX = 500;
//    field.fieldY = 100;
//    //field.pathloss = Constants.PATHLOSS_FREE_SPACE;//PATHLOSS_DIST_SHADOWING;
//    field.pathloss = pathLoss;
//    field.spatial_mode = Constants.SPATIAL_LINEAR;
//    params.field = field;
//
//    RadioBuilder.NoiseParams radio = new RadioBuilder.NoiseAdditiveParams();
//    radio.fieldX = field.fieldX;
//    radio.fieldY = field.fieldY;
//    radio.placement = Constants.PLACEMENT_POISSON;
//    radio.placementOpts = "0.5x0.5x30x18";
//    radio.useAnnos = true;
//    params.node.radio = radio;
//
//    MacBuilder.M802_11Params mac = new MacBuilder.M802_11Params();
//    mac.useAnnos = radio.useAnnos;
//    mac.useBitRateAnnos = false;
//    params.node.mac = mac;
//
//    NetBuilder.IpParams net = new NetBuilder.IpParams();
//    net.protocolMapper = new int[] { Constants.NET_PROTOCOL_UDP,
//        Constants.NET_PROTOCOL_LINK_PROBE, Constants.NET_PROTOCOL_MCEXOR,
//        Constants.NET_PROTOCOL_FLOODING };
//    params.node.net = net;
//
//    RouteBuilder.BrnDsrParams route = new RouteBuilder.BrnDsrParams();
//    route.forwarding = brn.swans.Constants.FORWARDING_TXDOR;
//    route.discovery = brn.swans.Constants.DISCOVERY_PROACTIVE;
//    route.floodintOffset = 50000;
//    route.floodingPeriod = 10000;
//    route.floodingMax = 0;
//    params.node.route = route;
//
//    MetricBuilder.EtxParams metric = new MetricBuilder.EtxParams();
////    metric.rates = new int[] { 22 };
//    metric.probes = new int[] { Constants.BANDWIDTH_DEFAULT, 1000 };
//    metric.period = 1000;
//    metric.tau = 30000;
//    metric.globalLinkTable = true;
//    route.metric = metric;
//
//    // and out
//    //Util.writeObject("res/config/DsrParams.xml", params);
//    return params;
//  }

}
