Changeset 9010


Ignore:
Timestamp:
12/06/12 16:18:16 (9 years ago)
Author:
svonolfe
Message:

used explicit conversions in Interpreters and removed the unused method IVRPDataInterpreter.GetDataType (#1953)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPInterpreter.cs

    r8649 r9010  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
    30   public class CVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<CVRPData> {
    31     public override Type GetDataType() {
    32       return typeof(CVRPData);
    33     }
    34    
     30  public class CVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<CVRPData> {   
    3531    protected override IVRPProblemInstance CreateProblemInstance() {
    3632      return new CVRPProblemInstance();
     
    3834
    3935    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
    40       CVRPData cvrpData = data as CVRPData;
    41       CVRPProblemInstance problem = problemInstance as CVRPProblemInstance;
     36      CVRPData cvrpData = (CVRPData)data;
     37      CVRPProblemInstance problem = (CVRPProblemInstance)problemInstance;
    4238     
    4339      if (cvrpData.Coordinates != null)
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPTWInterpreter.cs

    r8649 r9010  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
    30   public class CVRPTWInterpreter: CVRPInterpreter, IVRPDataInterpreter<CVRPTWData> {
    31     public override Type GetDataType() {
    32       return typeof(CVRPTWData);
    33     }
    34    
     30  public class CVRPTWInterpreter: CVRPInterpreter, IVRPDataInterpreter<CVRPTWData> {   
    3531    protected override IVRPProblemInstance CreateProblemInstance() {
    3632      return new CVRPTWProblemInstance();
     
    4036      base.Interpret(data, problemInstance);
    4137
    42       CVRPTWData cvrptwData = data as CVRPTWData;
    43       CVRPTWProblemInstance problem = problemInstance as CVRPTWProblemInstance;
     38      CVRPTWData cvrptwData = (CVRPTWData)data;
     39      CVRPTWProblemInstance problem = (CVRPTWProblemInstance)problemInstance;
    4440
    4541      problem.ReadyTime = new DoubleArray(cvrptwData.ReadyTimes);
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/IVRPDataInterpreter.cs

    r8649 r9010  
    3434
    3535  public interface IVRPDataInterpreter {
    36     Type GetDataType();
    3736    VRPInstanceDescription Interpret(IVRPData data);
    3837  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPInterpreter.cs

    r8649 r9010  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
    30   public class MDCVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<MDCVRPData> {
    31     public override Type GetDataType() {
    32       return typeof(MDCVRPData);
    33     }
    34    
     30  public class MDCVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<MDCVRPData> {   
    3531    protected override IVRPProblemInstance CreateProblemInstance() {
    3632      return new MDCVRPProblemInstance();
     
    3834
    3935    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
    40       MDCVRPData cvrpData = data as MDCVRPData;
    41       MDCVRPProblemInstance problem = problemInstance as MDCVRPProblemInstance;
     36      MDCVRPData cvrpData = (MDCVRPData)data;
     37      MDCVRPProblemInstance problem = (MDCVRPProblemInstance)problemInstance;
    4238
    4339      if (cvrpData.Coordinates != null)
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPTWInterpreter.cs

    r8649 r9010  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
    30   public class MDCVRPTWInterpreter : MDCVRPInterpreter, IVRPDataInterpreter<MDCVRPTWData> {
    31     public override Type GetDataType() {
    32       return typeof(MDCVRPTWData);
    33     }
    34    
     30  public class MDCVRPTWInterpreter : MDCVRPInterpreter, IVRPDataInterpreter<MDCVRPTWData> {   
    3531    protected override IVRPProblemInstance CreateProblemInstance() {
    3632      return new MDCVRPTWProblemInstance();
     
    4036      base.Interpret(data, problemInstance);
    4137
    42       MDCVRPTWData cvrptwData = data as MDCVRPTWData;
    43       MDCVRPTWProblemInstance problem = problemInstance as MDCVRPTWProblemInstance;
     38      MDCVRPTWData cvrptwData = (MDCVRPTWData)data;
     39      MDCVRPTWProblemInstance problem = (MDCVRPTWProblemInstance)problemInstance;
    4440
    4541      problem.ReadyTime = new DoubleArray(cvrptwData.ReadyTimes);
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/PDPTWInterpreter.cs

    r8649 r9010  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
    30   public class PDPTWInterpreter : CVRPTWInterpreter, IVRPDataInterpreter<PDPTWData> {
    31     public override Type GetDataType() {
    32       return typeof(PDPTWData);
    33     }
    34    
     30  public class PDPTWInterpreter : CVRPTWInterpreter, IVRPDataInterpreter<PDPTWData> {   
    3531    protected override IVRPProblemInstance CreateProblemInstance() {
    3632      return new CVRPPDTWProblemInstance();
     
    4036      base.Interpret(data, problemInstance);
    4137
    42       PDPTWData pdpData = data as PDPTWData;
    43       CVRPPDTWProblemInstance problem = problemInstance as CVRPPDTWProblemInstance;
     38      PDPTWData pdpData = (PDPTWData)data;
     39      CVRPPDTWProblemInstance problem = (CVRPPDTWProblemInstance)problemInstance;
    4440
    4541      problem.PickupDeliveryLocation = new IntArray(pdpData.PickupDeliveryLocations);
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/VRPInterpreter.cs

    r8649 r9010  
    5050    }
    5151
    52     public abstract Type GetDataType();
    53 
    5452    protected abstract IVRPProblemInstance CreateProblemInstance();
    5553   
Note: See TracChangeset for help on using the changeset viewer.