/// <inheritdoc/> public override int GetHashCode() { var hashCode = base.GetHashCode(); hashCode = hashCode * -1521134295 + IsValueType.GetHashCode(); hashCode = hashCode * -1521134295 + Value.GetHashSafe(); hashCode = hashCode * -1521134295 + Timestamp.GetHashSafe(); hashCode = hashCode * -1521134295 + StatusCode.GetHashSafe(); hashCode = hashCode * -1521134295 + DataType.GetHashSafe(); hashCode = hashCode * -1521134295 + ValueRank.GetHashSafe(); hashCode = hashCode * -1521134295 + ArrayDimensions.GetHashSafe(); hashCode = hashCode * -1521134295 + AccessLevelEx.GetHashSafe(); hashCode = hashCode * -1521134295 + AccessLevel.GetHashSafe(); hashCode = hashCode * -1521134295 + UserAccessLevel.GetHashSafe(); hashCode = hashCode * -1521134295 + MinimumSamplingInterval.GetHashSafe(); hashCode = hashCode * -1521134295 + Historizing.GetHashSafe(); return(hashCode); }
public static IEnumerable<TreeNode> LazyGetChildNodesOfArray(Expression expression, ArrayDimensions dimensions) { if (dimensions.TotalElementCount == 0) return new TreeNode[] { new TreeNode(null, "(empty)", null, null, null) }; return new ArrayRangeNode(expression, dimensions, dimensions).ChildNodes; }
public override int GetHashCode() { if (IsVoidType) { return(-1); } if (IsFunctionType) { //Recommended approach in effective java book and java and android docs int result = 17; result = result * 31 + FunctionReturnType.GetHashCode(); FunctionParameters.ForEach(p => result = result * 31 + p.GetHashCode()); return(result); } if (IsBasicType) { int result = 17; result = result * 31 + RawTypeName.GetHashCode(); result = result * 31 + PtrIndirectionLevel.GetHashCode(); ArrayDimensions.ForEach(p => result = result * 31 + p.GetHashCode()); return(result); } throw new Exception("Type is not void, basic or a function type"); }
private static void TryToUpdateNeighborChuncks(ArrayDimensions pointer, Point currentChunckIndex, ref VoxelMapGenerator VMG) { if (pointer.X == 0) { if (currentChunckIndex.X - 1 >= 0) { VMG.worldResources.WorldMap[currentChunckIndex.Y, currentChunckIndex.X - 1].UpdateChunk(); } } if (pointer.X == 15) { if (currentChunckIndex.X + 1 < VMG.ChunksRenderDistance) { VMG.worldResources.WorldMap[currentChunckIndex.Y, currentChunckIndex.X + 1].UpdateChunk(); } } if (pointer.Z == 0) { if (currentChunckIndex.Y - 1 >= 0) { VMG.worldResources.WorldMap[currentChunckIndex.Y - 1, currentChunckIndex.X].UpdateChunk(); } } if (pointer.Z == 15) { if (currentChunckIndex.Y + 1 < VMG.ChunksRenderDistance) { VMG.worldResources.WorldMap[currentChunckIndex.Y + 1, currentChunckIndex.X].UpdateChunk(); } } }
public bool Equals(EcmaDesc other) { if (other == null) { return(false); } if (NestedType == null ^ other.NestedType == null || ArrayDimensions == null ^ other.ArrayDimensions == null || GenericTypeArguments == null ^ other.GenericTypeArguments == null || GenericMemberArguments == null ^ other.GenericMemberArguments == null || MemberArguments == null ^ other.MemberArguments == null || ExplicitImplMember == null ^ other.ExplicitImplMember == null) { return(false); } return(other != null && DescKind == other.DescKind && TypeName == other.TypeName && Namespace == other.Namespace && MemberName == other.MemberName && (NestedType == null || NestedType.Equals(other.NestedType)) && (ArrayDimensions == null || ArrayDimensions.SequenceEqual(other.ArrayDimensions)) && (GenericTypeArguments == null || GenericTypeArguments.SequenceEqual(other.GenericTypeArguments)) && (GenericMemberArguments == null || GenericMemberArguments.SequenceEqual(other.GenericMemberArguments)) && (MemberArguments == null || MemberArguments.SequenceEqual(other.MemberArguments)) && Etc == other.Etc && EtcFilter == other.EtcFilter && (ExplicitImplMember == null || ExplicitImplMember.Equals(other.ExplicitImplMember))); }
public Expression[] AppendIndexers(ArrayDimensions dimensions) { List<Expression> elements = new List<Expression>(); foreach(int[] indices in dimensions.Indices) { elements.Add(this.AppendIndexer(indices)); } return elements.ToArray(); }
public ArrayRangeNode(Expression arrayTarget, ArrayDimensions bounds, ArrayDimensions originalBounds) { this.arrayTarget = arrayTarget; this.bounds = bounds; this.originalBounds = originalBounds; this.Name = GetName(); this.ChildNodes = LazyGetChildren(); }
public virtual void Clear() { ArrayDimensions.Clear(); Type = null; Info = null; PackOffsetBytes = null; Attributes = null; Name = null; }
/// <inheritdoc/> public override bool Equals(object obj) { if (!(obj is VariableNodeModel model)) { return(false); } if (IsValueType != model.IsValueType) { return(false); } if (!Utils.IsEqual(Value ?? Variant.Null, model.Value ?? Variant.Null)) { return(false); } if (Timestamp != model.Timestamp) { return(false); } if (StatusCode != model.StatusCode) { return(false); } if (!Utils.IsEqual(DataType, model.DataType)) // TODO { return(false); } if (ValueRank != model.ValueRank) { return(false); } if (ArrayDimensions.SequenceEqualsSafe(model.ArrayDimensions)) { return(false); } if (AccessLevelEx != model.AccessLevelEx) { return(false); } if (AccessLevel != model.AccessLevel) { return(false); } if (UserAccessLevel != model.UserAccessLevel) { return(false); } if (MinimumSamplingInterval.EqualsSafe(model.MinimumSamplingInterval)) { return(false); } if (Historizing != model.Historizing) { return(false); } return(base.Equals(obj)); }
public Expression[] AppendIndexers(ArrayDimensions dimensions) { List <Expression> elements = new List <Expression>(); foreach (int[] indices in dimensions.Indices) { elements.Add(this.AppendIndexer(indices)); } return(elements.ToArray()); }
public static void InstantiateBlockToChunk(BlockSelectingType typeOfInstance, byte instantiateBlockId, ref Vector3 globalPointer, ref VoxelMapGenerator _VMG) { globalPointer = GetPointerPos(globalPointer, typeOfInstance); ArrayDimensions pointerInChunckMap = GetCorrectBlockPos(globalPointer); Point chunkIndex = GetChunkIndexFromPointer(globalPointer, pointerInChunckMap); Chunk selectedChunk = _VMG.worldResources.WorldMap[chunkIndex.Y, chunkIndex.X]; selectedChunk.ChunkMap[pointerInChunckMap.Y, pointerInChunckMap.Z, pointerInChunckMap.X] = instantiateBlockId; selectedChunk.UpdateChunk(); TryToUpdateNeighborChuncks(pointerInChunckMap, chunkIndex, ref _VMG); }
/// <summary> /// Create service model from api model /// </summary> public StructureFieldModel ToServiceModel() { return(new StructureFieldModel { ArrayDimensions = ArrayDimensions?.ToList(), DataTypeId = DataTypeId, Description = Description?.ToServiceModel(), IsOptional = IsOptional, MaxStringLength = MaxStringLength, Name = Name, ValueRank = ValueRank }); }
/// <summary> /// Create service model from api model /// </summary> public FieldMetaDataModel ToServiceModel() { return(new FieldMetaDataModel { Description = Description?.ToServiceModel(), ArrayDimensions = ArrayDimensions?.ToList(), BuiltInType = BuiltInType, DataSetFieldId = DataSetFieldId, DataTypeId = DataTypeId, FieldFlags = FieldFlags, MaxStringLength = MaxStringLength, Name = Name, Properties = Properties? .ToDictionary(k => k.Key, v => v.Value), ValueRank = ValueRank }); }
public string GetTypeName() { if (IsBasicType || IsFunctionType) { return(RawTypeName + String.Join("", ArrayDimensions.Select(d => "[" + d + "]")) + new string('*', PtrIndirectionLevel)); } else if (IsVoidType) { return("void"); } else { throw new Exception("Unknown cleps type category"); } }
private static Point GetChunkIndexFromPointer(Vector3 globalPointer, ArrayDimensions pointerInChunckMap) { int chunkX = (int)(globalPointer.x / 16f); int chunkZ = (int)(globalPointer.z / 16f); if (pointerInChunckMap.X >= 16) { chunkX++; pointerInChunckMap.X = 0; } if (pointerInChunckMap.Z >= 16) { chunkZ++; pointerInChunckMap.Z = 0; } return(new Point(chunkX, chunkZ)); }
// Returns the TypeName and the generic/inner type information if existing public string ToCompleteTypeName(char innerTypeSeparator = '.') { var result = TypeName; if (GenericTypeArguments != null) { result += FormatGenericArgs(GenericTypeArguments); } if (NestedType != null) { result += innerTypeSeparator + NestedType.ToCompleteTypeName(); } if (ArrayDimensions != null && ArrayDimensions.Count > 0) { result += ArrayDimensions.Select(dim => "[" + new string (',', dim - 1) + "]").Aggregate(string.Concat); } return(result); }
public bool Equals(StructuredType other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (!Equals(Name, other.Name)) { return(false); } if (!ArrayDimensions.SequenceEqual(other.ArrayDimensions)) { return(false); } return(GenericArguments.SequenceEqual(other.GenericArguments)); }
public void GenerateChunkMap() { ChunkMap = new int[255, GrassMap.GetSize().Height, GrassMap.GetSize().Width]; size = new ArrayDimensions(255, GrassMap.GetSize().Height, GrassMap.GetSize().Width); for (var z = size.Z - 1; z >= 0; z--) { if (z < surfaceHeight + hillsHeight) { for (var y = 0; y < size.Y; y++) { for (var x = 0; x < size.X; x++) { if (z < surfaceHeight) { ChunkMap[z, y, x] = 3; } else { //Debug.Log($"i = {surfaceHeight + (int)((float)(GrassMap.Map[y, x] / 255f) * hillsHeight) - 1}; z = {z} z = {z + 1}}"); if (surfaceHeight + (int)((float)(GrassMap.Map[y, x] / 255f) * hillsHeight) == z) { ChunkMap[z, y, x] = 1; } else { if (ChunkMap[z + 1, y, x] != 0) { ChunkMap[z, y, x] = 2; } } } } } } } }
public override string ToString() { return(string.Format("({8}) {0}::{1}{2}{3}{7} {4}{5}{6} {9} {10}", Namespace, TypeName, FormatGenericArgsFull(GenericTypeArguments), NestedType != null ? "+" + NestedType.ToString() : string.Empty, MemberName ?? string.Empty, FormatGenericArgsFull(GenericMemberArguments), MemberArguments != null ? "(" + string.Join(",", MemberArguments.Select(m => m.ToString())) + ")" : string.Empty, ArrayDimensions != null && ArrayDimensions.Count > 0 ? ArrayDimensions.Select(dim => "[" + new string (',', dim - 1) + "]").Aggregate(string.Concat) : string.Empty, DescKind.ToString()[0], Etc != 0 ? '(' + Etc.ToString() + ')' : string.Empty, ExplicitImplMember != null ? "$" + ExplicitImplMember.ToString() : string.Empty)); }
public static SideParams GetSideParamsFromBlock(WorldResources worldRes, Point chunkPosInWorldArray, Vector3 blockPos, bool chunkEdges = true) { ArrayDimensions CMSize = new ArrayDimensions(worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(0), worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(1), worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap.GetLength(2)); SideParams sp = new SideParams(); if (blockPos.x - 1 < 0) { if (chunkPosInWorldArray.X - 1 < 0) { sp.Left = chunkEdges; } else { if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y, (int)chunkPosInWorldArray.X - 1].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)CMSize.X - 1] == 0) { sp.Left = true; } else { sp.Left = false; } } } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)blockPos.x - 1] == 0) { sp.Left = true; } } if (blockPos.y - 1 < 0) { if (chunkPosInWorldArray.Y - 1 < 0) { sp.Backward = chunkEdges; //false } else { if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y - 1, (int)chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)CMSize.Y - 1, (int)blockPos.x] == 0) { sp.Backward = true; } else { sp.Backward = false; } } } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y - 1, (int)blockPos.x] == 0) { sp.Backward = true; } } if (blockPos.z - 1 < 0) { sp.Down = false; } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z - 1, (int)blockPos.y, (int)blockPos.x] == 0) { sp.Down = true; } } if (blockPos.x + 1 >= CMSize.X) { if (chunkPosInWorldArray.X + 1 >= worldRes.WorldMap.GetLength(1)) { sp.Right = chunkEdges; // false } else { if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y, (int)chunkPosInWorldArray.X + 1].ChunkMap[(int)blockPos.z, (int)blockPos.y, 0] == 0) { sp.Right = true; } else { sp.Right = false; } } } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y, (int)blockPos.x + 1] == 0) { sp.Right = true; } } if (blockPos.y + 1 >= CMSize.Y) { if (chunkPosInWorldArray.Y + 1 >= worldRes.WorldMap.GetLength(0)) { sp.Forward = chunkEdges; // false } else { if (worldRes.WorldMap[(int)chunkPosInWorldArray.Y + 1, (int)chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, 0, (int)blockPos.x] == 0) { sp.Forward = true; } else { sp.Forward = false; } } } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z, (int)blockPos.y + 1, (int)blockPos.x] == 0) { sp.Forward = true; } } if (blockPos.z + 1 >= CMSize.Z) { sp.Up = false; } else { if (worldRes.WorldMap[chunkPosInWorldArray.Y, chunkPosInWorldArray.X].ChunkMap[(int)blockPos.z + 1, (int)blockPos.y, (int)blockPos.x] == 0) { sp.Up = true; } } return(sp); }
protected override void LoadFromXml(XmlElement xml) { base.LoadFromXml(xml); Dims = new ArrayDimensions(xml.GetAttribute("dims")); ElementType = DbTypeBase.Load(xml.FindElement("Element")); }
public static IEnumerable <AbstractNode> GetChildNodesOfArray(Expression expression, ArrayDimensions dimensions) { if (dimensions.TotalElementCount == 0) { return(new AbstractNode[0]); } return(new ArrayRangeNode(expression, dimensions, dimensions).ChildNodes); }
public static IEnumerable <TreeNode> LazyGetChildNodesOfArray(Expression expression, ArrayDimensions dimensions) { if (dimensions.TotalElementCount == 0) { return new TreeNode[] { new TreeNode(null, "(empty)", null, null, null) } } ; return(new ArrayRangeNode(expression, dimensions, dimensions).ChildNodes); } }
public static IEnumerable<AbstractNode> GetChildNodesOfArray(Expression expression, ArrayDimensions dimensions) { if (dimensions.TotalElementCount == 0) return new AbstractNode[0]; return new ArrayRangeNode(expression, dimensions, dimensions).ChildNodes; }