Rev | Line | |
---|
[7544] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Operators.MPISupport.BinaryTransport {
|
---|
| 8 | [Serializable]
|
---|
| 9 | class ScopeTransfer {
|
---|
| 10 | public string Name { get; set; }
|
---|
| 11 | public string Description { get; set; }
|
---|
| 12 | public List<VariableTransfer> Variables { get; set; }
|
---|
| 13 | public List<ScopeTransfer> SubScopes { get; set; }
|
---|
| 14 |
|
---|
| 15 | public ScopeTransfer() {
|
---|
| 16 | Variables = new List<VariableTransfer>();
|
---|
| 17 | SubScopes = new List<ScopeTransfer>();
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public static ScopeTransfer Convert(IScope item) {
|
---|
| 21 | ScopeTransfer result = new ScopeTransfer();
|
---|
| 22 |
|
---|
| 23 | result.Name = item.Name;
|
---|
| 24 | result.Description = item.Description;
|
---|
| 25 |
|
---|
| 26 | foreach (IVariable variable in item.Variables) {
|
---|
| 27 | result.Variables.Add(VariableTransfer.Convert(variable));
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | foreach (IScope subscope in item.SubScopes) {
|
---|
| 31 | result.SubScopes.Add(Convert(subscope));
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | return result;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public static IScope Convert(ScopeTransfer item, IExecutionContext globalScope) {
|
---|
| 38 | IScope result = new Scope();
|
---|
| 39 |
|
---|
| 40 | result.Name = item.Name;
|
---|
| 41 | result.Description = item.Description;
|
---|
| 42 |
|
---|
| 43 | foreach (VariableTransfer variable in item.Variables) {
|
---|
| 44 | result.Variables.Add(VariableTransfer.Convert(variable, globalScope));
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | foreach (ScopeTransfer subscope in item.SubScopes) {
|
---|
| 48 | result.SubScopes.Add(Convert(subscope, globalScope));
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | return result;
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.