1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 | using HeuristicLab.Data;
|
---|
7 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
8 | using HeuristicLab.Problems.VehicleRouting.Interfaces;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
|
---|
11 | class ItemTransfer {
|
---|
12 | public static object Convert(IItem item) {
|
---|
13 | if (item is IScope)
|
---|
14 | return ScopeTransfer.Convert(item as IScope);
|
---|
15 | else if (item is IVariable)
|
---|
16 | return VariableTransfer.Convert(item as IVariable);
|
---|
17 | else if (item is DoubleValue)
|
---|
18 | return DoubleValueTransfer.Convert(item as DoubleValue);
|
---|
19 | else if (item is IntValue)
|
---|
20 | return IntValueTransfer.Convert(item as IntValue);
|
---|
21 | else if (item is IVRPEncoding)
|
---|
22 | return VRPTransfer.Convert(item as IVRPEncoding);
|
---|
23 | else if (item is Permutation)
|
---|
24 | return PermutationTransfer.Convert(item as Permutation);
|
---|
25 | else
|
---|
26 | return null;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public static IItem Convert(object item, IExecutionContext globalScope) {
|
---|
30 | if (item is ScopeTransfer)
|
---|
31 | return ScopeTransfer.Convert(item as ScopeTransfer, globalScope);
|
---|
32 | else if (item is VariableTransfer)
|
---|
33 | return VariableTransfer.Convert(item as VariableTransfer, globalScope);
|
---|
34 | else if (item is DoubleValueTransfer)
|
---|
35 | return DoubleValueTransfer.Convert(item as DoubleValueTransfer);
|
---|
36 | else if (item is IntValueTransfer)
|
---|
37 | return IntValueTransfer.Convert(item as IntValueTransfer);
|
---|
38 | else if (item is PermutationTransfer)
|
---|
39 | return PermutationTransfer.Convert(item as PermutationTransfer);
|
---|
40 | else if (item is VRPTransfer)
|
---|
41 | return VRPTransfer.Convert(item as VRPTransfer, globalScope);
|
---|
42 | else
|
---|
43 | return null;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|