public override string AsClickHouseType() { return($"Nullable({InnerType.AsClickHouseType()})"); }
public virtual IMember Index(IPythonInstance instance, object index) => InnerType.Index(instance, index);
public void SetAsSymbol(int args, int[] arg) { m_Type = InnerType.Symbol; m_Text = null; switch (args) { case 1: m_LayerNumber = -1; m_PlotNumber = arg[0]; m_PlotPointNumber = -1; break; case 2: m_LayerNumber = arg[0]; m_PlotNumber = arg[1]; m_PlotPointNumber = -1; break; case 3: m_LayerNumber = arg[0]; m_PlotNumber = arg[1]; m_PlotPointNumber = arg[2]; break; } }
public void SetAsPlotCurveName(int args, int[] arg) { m_Type = InnerType.PlotCurveName; m_Text = null; switch (args) { case 1: m_LayerNumber = -1; m_PlotNumber = arg[0]; m_PlotPointNumber = -1; break; case 2: m_LayerNumber = arg[0]; m_PlotNumber = arg[1]; m_PlotPointNumber = -1; break; } }
private void NotifyEvent(ProcessType processType, InnerType innerType = InnerType.NA) { ProcessEvent?.Invoke(this, new FileScannerProcessEventArgs(processType, innerType)); }
public TextItem(Font ft) { m_Type = InnerType.Empty; m_Text = ""; m_Font = (null == ft) ? null : (Font)ft.Clone(); }
public virtual IMember Index(IPythonInstance instance, IArgumentSet args) => InnerType.Index(instance, args);
public virtual IMember GetMember(string name) => InnerType.GetMember(name);
public override void ValuesFromConst(IEnumerable objects) { InnerType.NullableValuesFromConst(objects); Nulls = objects.Cast <object>().Select(x => x == null).ToArray(); //Data = objects.Cast<DateTime>().ToArray(); }
public virtual IPythonInstance CreateInstance(IArgumentSet args) => IsAbstract ? null : InnerType.CreateInstance(args);
public override object Value(int currentRow) { return(Nulls[currentRow]?null:InnerType.Value(currentRow)); }
public override void ValueFromConst(Parser.ValueType val) { Nulls = new[] { val.StringValue == null && val.ArrayValue == null }; InnerType.ValueFromConst(val); }
public override void Write(ProtocolFormatter formatter, int rows) { Debug.Assert(Rows == rows, "Row count mismatch!"); new SimpleColumnType <byte>(Nulls.Select(x => x ? (byte)1 : (byte)0).ToArray()).Write(formatter, rows); InnerType.Write(formatter, rows); }
public void AddReference(Location location) => InnerType?.AddReference(location);
public void ComplexCollection() { var innerType = new InnerType() { String = "test" }; var source = new GenericCollections <ComplexType>(false); for (int i = 0; i < 10; i++) { source.Array[i] = new ComplexType() { A = i, InnerType = innerType }; source.List.Add(new ComplexType() { A = i, InnerType = innerType }); source.HashSet.Add(new ComplexType() { A = i, InnerType = innerType }); source.SortedSet.Add(new ComplexType() { A = i, InnerType = innerType }); source.Stack.Push(new ComplexType() { A = i, InnerType = innerType }); source.Queue.Enqueue(new ComplexType() { A = i, InnerType = innerType }); source.LinkedList.AddLast(new ComplexType() { A = i, InnerType = innerType }); source.ObservableCollection.Add(new ComplexType() { A = i, InnerType = innerType }); } var target = new GenericCollections <ComplexType>(false); var ultraMapper = new Mapper(); ultraMapper.Map(source, target); bool isResultOk = ultraMapper.VerifyMapperResult(source, target); Assert.IsTrue(isResultOk); Assert.IsTrue(!Object.ReferenceEquals(source.HashSet.First().InnerType, target.HashSet.First().InnerType)); Assert.IsTrue(target.List.Concat(target.HashSet.Concat(target.SortedSet.Concat(target.Stack.Concat( target.Queue.Concat(target.LinkedList.Concat(target.ObservableCollection)))))) .Select(it => it.InnerType) .All(item => Object.ReferenceEquals(item, target.HashSet.First().InnerType))); }
public void RemoveReferences(IPythonModule module) => InnerType?.RemoveReferences(module);
public void CollectionUpdate() { var innerType = new InnerType() { String = "test" }; var source = new GenericCollections <ComplexType>(false); //initialize source for (int i = 0; i < 10; i++) { source.Array[i] = new ComplexType() { A = i, InnerType = innerType }; source.List.Add(new ComplexType() { A = i, InnerType = innerType }); source.HashSet.Add(new ComplexType() { A = i, InnerType = innerType }); source.SortedSet.Add(new ComplexType() { A = i, InnerType = innerType }); source.Stack.Push(new ComplexType() { A = i, InnerType = innerType }); source.Queue.Enqueue(new ComplexType() { A = i, InnerType = innerType }); source.LinkedList.AddLast(new ComplexType() { A = i, InnerType = innerType }); source.ObservableCollection.Add(new ComplexType() { A = i, InnerType = innerType }); } var tempItemA = new ComplexType() { A = 1 }; var tempItemB = new ComplexType() { A = 9 }; var target = new GenericCollections <ComplexType>(false) { Array = new ComplexType[10] { tempItemA, tempItemB, new ComplexType() { A = 10 }, null, null, null, null, null, null, null }, List = new List <ComplexType>() { tempItemA, tempItemB, new ComplexType() { A = 10 } }, HashSet = new HashSet <ComplexType>() { tempItemA, tempItemB, new ComplexType() { A = 10 } }, SortedSet = new SortedSet <ComplexType>() { tempItemA, tempItemB, new ComplexType() { A = 10 } }, ObservableCollection = new ObservableCollection <ComplexType>() { tempItemA, tempItemB, new ComplexType() { A = 10 } } }; target.Stack = new Stack <ComplexType>(); target.Stack.Push(tempItemA); target.Stack.Push(tempItemB); target.Stack.Push(new ComplexType() { A = 10 }); target.Queue = new Queue <ComplexType>(); target.Queue.Enqueue(tempItemA); target.Queue.Enqueue(tempItemB); target.Queue.Enqueue(new ComplexType() { A = 10 }); target.LinkedList = new LinkedList <ComplexType>(); target.LinkedList.AddLast(tempItemA); target.LinkedList.AddLast(tempItemB); target.LinkedList.AddLast(new ComplexType() { A = 10 }); //item comparer should also check for nulls ALWAYS Expression <Func <ComplexType, ComplexType, bool> > itemComparer = (itemA, itemB) => Comparison(itemA, itemB); var ultraMapper = new Mapper(cfg => { cfg.MapTypes <IEnumerable <ComplexType>, IEnumerable <ComplexType> >(cfg2 => { cfg2.ReferenceBehavior = ReferenceBehaviors.USE_TARGET_INSTANCE_IF_NOT_NULL; cfg2.CollectionBehavior = CollectionBehaviors.UPDATE; //use one or the other: cfg2.CollectionItemEqualityComparer = itemComparer; cfg2.SetCollectionItemEqualityComparer <ComplexType, ComplexType>((s, t) => Comparison(s, t)); }); }); ultraMapper.Map(source, target); string tree = ultraMapper.Config.TypeMappingTree.ToString(includeMembers: true, includeOptions: true); Assert.IsTrue(target.Array.Length == source.Array.Length); Assert.IsTrue(object.ReferenceEquals(target.Array.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.Array.First(item => item.A == 9), tempItemB)); foreach (var item in target.Array) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.List.Count == source.List.Count); Assert.IsTrue(object.ReferenceEquals(target.List.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.List.First(item => item.A == 9), tempItemB)); foreach (var item in target.List) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.HashSet.Count == source.HashSet.Count); Assert.IsTrue(object.ReferenceEquals(target.HashSet.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.HashSet.First(item => item.A == 9), tempItemB)); foreach (var item in target.HashSet) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.SortedSet.Count == source.SortedSet.Count); Assert.IsTrue(object.ReferenceEquals(target.SortedSet.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.SortedSet.First(item => item.A == 9), tempItemB)); foreach (var item in target.SortedSet) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.ObservableCollection.Count == source.ObservableCollection.Count); Assert.IsTrue(object.ReferenceEquals(target.ObservableCollection.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.ObservableCollection.First(item => item.A == 9), tempItemB)); foreach (var item in target.ObservableCollection) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.LinkedList.Count == source.LinkedList.Count); Assert.IsTrue(object.ReferenceEquals(target.LinkedList.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.LinkedList.First(item => item.A == 9), tempItemB)); foreach (var item in target.LinkedList) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.Stack.Count == source.Stack.Count); Assert.IsTrue(object.ReferenceEquals(target.Stack.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.Stack.First(item => item.A == 9), tempItemB)); foreach (var item in target.Stack) { Assert.IsTrue(item.InnerType != null); } Assert.IsTrue(target.Queue.Count == source.Queue.Count); Assert.IsTrue(object.ReferenceEquals(target.Queue.First(item => item.A == 1), tempItemA)); Assert.IsTrue(object.ReferenceEquals(target.Queue.First(item => item.A == 9), tempItemB)); foreach (var item in target.Queue) { Assert.IsTrue(item.InnerType != null); } bool isResultOk = ultraMapper.VerifyMapperResult(source, target); Assert.IsTrue(isResultOk); }
public virtual IEnumerable <string> GetMemberNames() => InnerType.GetMemberNames();
public override IMember CreateInstance(string typeName, IArgumentSet args) => InnerType.CreateInstance(typeName, args);
protected bool Equals(InnerType other) { return this.Id.Equals(other.Id) && string.Equals(this.Something, other.Something); }
protected override bool LLEquals(TypeSpec other, bool partialNameMatch) { NamedTypeSpec spec = other as NamedTypeSpec; if (spec == null) { return(false); } var innersMatch = (InnerType == null && spec.InnerType == null) || (InnerType != null && InnerType.LLEquals(spec.InnerType, partialNameMatch)); if (partialNameMatch) { return(NameWithoutModule == spec.NameWithoutModule && innersMatch); } else { return(Name == spec.Name && innersMatch); } }
public void SetAsText(string txt) { m_Type = InnerType.Text; m_Text = txt; }
public virtual IMember CreateInstance(string typeName, IArgumentSet args) => IsAbstract ? null : InnerType.CreateInstance(typeName, args);
public void SetAsPlotCurveName(int layerNumber, int plotNumber, string plotLabelStyle, bool isPropCol) { m_Type = InnerType.PlotCurveName; m_Text = null; m_PlotPointNumber = -1; m_LayerNumber = layerNumber; m_PlotNumber = plotNumber; m_PlotLabelStyle = plotLabelStyle; m_PlotLabelStyleIsPropColName = isPropCol; }
public virtual IMember Call(IPythonInstance instance, string memberName, IArgumentSet args) => InnerType.Call(instance, memberName, args);
/// <summary> /// /// </summary> /// <param name="from"></param> /// <param name="ft"></param> public TextItem(TextItem from, Font ft) { m_Type = InnerType.Empty; m_Text = ""; m_bUnderlined = from.m_bUnderlined; m_bItalic = from.m_bItalic; m_bBold = from.m_bBold; m_bGreek = from.m_bGreek; m_SubIndex = from.m_SubIndex; m_yShift = from.m_yShift; m_Font = null != ft ? ft : from.m_Font; }
public MappersBenchmark() { var config = new MapperConfiguration(cfg => { cfg.CreateMap <GenericCollections <ComplexType>, ReadOnlyGeneric <ComplexType> >(); cfg.CreateMap <ComplexType, ComplexType>(); cfg.CreateMap <InnerType, InnerType>(); }); _autoMapper = new AutoMapper.Mapper(config); _ultraMapper = new Mapper(cfg => { cfg.IsReferenceTrackingEnabled = true; cfg.MapTypes <ComplexType, ComplexType>() .MapTypeToMember <int>(typeof(InnerType).GetProperties().First()); }); var innerType = new InnerType() { String = "test" }; _source = new GenericCollections <ComplexType>(false, 0, 1000); for (int i = 0; i < 1000; i++) { _source.Array[i] = new ComplexType() { A = i, InnerType = innerType }; _source.List.Add(new ComplexType() { A = i, InnerType = innerType }); _source.HashSet.Add(new ComplexType() { A = i, InnerType = innerType }); _source.SortedSet.Add(new ComplexType() { A = i, InnerType = innerType }); _source.Stack.Push(new ComplexType() { A = i, InnerType = innerType }); _source.Queue.Enqueue(new ComplexType() { A = i, InnerType = innerType }); _source.LinkedList.AddLast(new ComplexType() { A = i, InnerType = innerType }); _source.ObservableCollection.Add(new ComplexType() { A = i, InnerType = innerType }); } }