127 lines
6.0 KiB
C#
127 lines
6.0 KiB
C#
/*
|
|
* Copyright (c) 2018 iTAC Software AG, Germany. All Rights Reserved.
|
|
*
|
|
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
|
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
|
* without the written permission of iTAC Software AG.
|
|
*/
|
|
// created 06.11.2018 11:07:38
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace com.itac.oib.siplacesetupcenter.contracts.data
|
|
{
|
|
// source: assembly 5.1.0.84
|
|
// source: assembly ASM.AS.OIB.SIPLACESetupCenter.Contracts
|
|
public class ConveyorLaneMapper
|
|
{
|
|
// used for itac->asm: True
|
|
// used for asm->itac: True
|
|
|
|
// maps iTAC namespace conform type to ASM namespace type
|
|
public static Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane get(ConveyorLane itacConveyorLane)
|
|
{
|
|
if (itacConveyorLane == null) { return null; }
|
|
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane asmConveyorLane = new Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane();
|
|
mapItac2Asm(asmConveyorLane, itacConveyorLane);
|
|
return asmConveyorLane;
|
|
}
|
|
|
|
public static void mapItac2Asm(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane asmConveyorLane, ConveyorLane itacConveyorLane)
|
|
{
|
|
asmConveyorLane.ConveyorLanePosition = itacConveyorLane.ConveyorLanePosition;
|
|
// complex property ProcessingAreas, isArray:False, isGeneric:True
|
|
// map Dictionary
|
|
asmConveyorLane.ProcessingAreas = getDictionary(itacConveyorLane.ProcessingAreas);
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace array
|
|
public static Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane[] get(ConveyorLane[] itacConveyorLane)
|
|
{
|
|
if (itacConveyorLane == null) { return null; }
|
|
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane[] asmConveyorLane = new Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane[itacConveyorLane.Length];
|
|
for (int i = 0; i < itacConveyorLane.Length; i++)
|
|
{
|
|
// to itac array
|
|
asmConveyorLane[i] = ConveyorLaneMapper.get(itacConveyorLane[i]);
|
|
}
|
|
return asmConveyorLane;
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace list
|
|
public static List<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane> getList(ConveyorLane[] asmConveyorLane)
|
|
{
|
|
if (asmConveyorLane == null) { return null; }
|
|
List<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane> itacConveyorLane = new List<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane>();
|
|
for (int i = 0; i < asmConveyorLane.Length; i++)
|
|
{
|
|
itacConveyorLane.Add(ConveyorLaneMapper.get(asmConveyorLane[i]));
|
|
}
|
|
return itacConveyorLane;
|
|
}
|
|
|
|
// map type from ASM namespace to iTAC namespace
|
|
public static ConveyorLane get(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane asmConveyorLane)
|
|
{
|
|
if (asmConveyorLane == null) { return null; }
|
|
ConveyorLane itacConveyorLane = new ConveyorLane();
|
|
mapAsm2Itac(asmConveyorLane, itacConveyorLane);
|
|
return itacConveyorLane;
|
|
}
|
|
|
|
public static void mapAsm2Itac(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane asmConveyorLane, ConveyorLane itacConveyorLane)
|
|
{
|
|
itacConveyorLane.ConveyorLanePosition = asmConveyorLane.ConveyorLanePosition;
|
|
// assign Dictionary(): maps ASM Dictionary 2 iTAC dictionary
|
|
itacConveyorLane.ProcessingAreas = getProcessingAreasDictionary( asmConveyorLane.ProcessingAreas);
|
|
}
|
|
|
|
// maps ASM namespace conform list to iTAC namespace array
|
|
public static ConveyorLane[] getArray(IList<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane> asmConveyorLane)
|
|
{
|
|
if (asmConveyorLane == null) { return null; }
|
|
ConveyorLane[] itacConveyorLane = new ConveyorLane[asmConveyorLane.Count];
|
|
for (int i = 0; i < asmConveyorLane.Count; i++)
|
|
{
|
|
itacConveyorLane[i] = ConveyorLaneMapper.get(asmConveyorLane[i]);
|
|
}
|
|
return itacConveyorLane;
|
|
}
|
|
|
|
// maps ASM namespace conform array to iTAC namespace array
|
|
public static ConveyorLane[] getArray(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ConveyorLane[] asmConveyorLane)
|
|
{
|
|
if (asmConveyorLane == null) { return null; }
|
|
ConveyorLane[] itacConveyorLane = new ConveyorLane[asmConveyorLane.Length];
|
|
for (int i = 0; i < asmConveyorLane.Length; i++)
|
|
{
|
|
itacConveyorLane[i] = ConveyorLaneMapper.get(asmConveyorLane[i]);
|
|
}
|
|
return itacConveyorLane;
|
|
}
|
|
// maps c# dictionary with ASM types to c# dictionary with java types
|
|
public static Dictionary<Int32, Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ProcessingArea> getDictionary(Dictionary<Int32, ProcessingArea> dictionary)
|
|
{
|
|
Dictionary<Int32, Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ProcessingArea> result = new Dictionary<Int32,Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ProcessingArea>();
|
|
foreach (Int32 key in dictionary.Keys)
|
|
{
|
|
result.Add(key, ProcessingAreaMapper.get(dictionary[key]));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// original declaration: System.Collections.Generic.Dictionary`2[System.Int32,Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ProcessingArea]
|
|
// generate key / value array for dictionary
|
|
// generated dictionary mapper
|
|
private static Dictionary<Int32, ProcessingArea> getProcessingAreasDictionary(IDictionary<Int32, Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ProcessingArea> processingAreas)
|
|
{
|
|
Dictionary <Int32, ProcessingArea> result = new Dictionary<Int32, ProcessingArea>();
|
|
foreach (Int32 key in processingAreas.Keys)
|
|
{
|
|
result.Add(key, com.itac.oib.siplacesetupcenter.contracts.data.ProcessingAreaMapper.get(processingAreas[key]));
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|