Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/01/12 15:15:22 (13 years ago)
Author:
abeham
Message:

#1614

  • Fixed plugin dependencies
  • Updated GQAP view
  • Changed instances infrastructure
    • Changed interface types into classes
    • Removed the library specific instance classes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances.ElloumiCTAP/3.3/ElloumiCTAPInstanceProvider.cs

    r7482 r7538  
    2828
    2929namespace HeuristicLab.Problems.Instances.ElloumiCTAP {
    30   public class ElloumiCTAPInstanceProvider : ProblemInstanceProvider<ICTAPInstance> {
     30  public class ElloumiCTAPInstanceProvider : ProblemInstanceProvider<CTAPInstance> {
    3131    public override string Name {
    3232      get { return "Elloumi's CTAP instances"; }
     
    6262    }
    6363
    64     public override ICTAPInstance GetInstance(IInstanceDescriptor id) {
     64    public override CTAPInstance LoadInstance(IInstanceDescriptor id) {
    6565      var descriptor = (ElloumiCTAPInstanceDescriptor)id;
    66       var instance = new ElloumiCTAPInstance();
    6766      using (var stream = Assembly.GetExecutingAssembly()
    6867        .GetManifestResourceStream(descriptor.InstanceIdentifier)) {
    69         ElloumiCTAPParser datParser = new ElloumiCTAPParser();
    70         datParser.Parse(stream);
    71         if (datParser.Error != null) throw datParser.Error;
    72         instance.Processors = datParser.Processors;
    73         instance.Tasks = datParser.Tasks;
    74         instance.ExecutionCosts = datParser.ExecutionCosts;
    75         instance.CommunicationCosts = datParser.CommunicationCosts;
    76         instance.MemoryRequirements = datParser.MemoryRequirements;
    77         instance.MemoryCapacities = datParser.MemoryCapacities;
     68        var parser = new ElloumiCTAPParser();
     69        parser.Parse(stream);
     70        var instance = Load(parser);
    7871
    7972        instance.Name = id.Name;
     
    9184          }
    9285        }
     86        return instance;
    9387      }
     88    }
     89
     90    public override CTAPInstance LoadInstance(string path) {
     91      var parser = new ElloumiCTAPParser();
     92      parser.Parse(path);
     93      var instance = Load(parser);
     94      instance.Name = Path.GetFileName(path);
     95      instance.Description = "Loaded from file \"" + path + "\" on " + DateTime.Now.ToString();
     96      return instance;
     97    }
     98
     99    public override void SaveInstance(CTAPInstance instance, string path) {
     100      throw new NotSupportedException();
     101    }
     102
     103    private CTAPInstance Load(ElloumiCTAPParser parser) {
     104      var instance = new CTAPInstance();
     105      instance.Processors = parser.Processors;
     106      instance.Tasks = parser.Tasks;
     107      instance.ExecutionCosts = parser.ExecutionCosts;
     108      instance.CommunicationCosts = parser.CommunicationCosts;
     109      instance.MemoryRequirements = parser.MemoryRequirements;
     110      instance.MemoryCapacities = parser.MemoryCapacities;
    94111      return instance;
    95112    }
Note: See TracChangeset for help on using the changeset viewer.