ZoneCodeGenerator: Add Computations class for StructureInformation including IsUsed to check whether a structure has at least 1 usage

This commit is contained in:
Jan 2019-11-21 21:46:03 +01:00
parent b79f237014
commit 27f92e6c33
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using ZoneCodeGenerator.Domain.FastFileStructure;
using ZoneCodeGenerator.Generating.Computations;
using ZoneCodeGenerator.Persistence;
namespace ZoneCodeGenerator.Domain.Information
@ -33,6 +34,7 @@ namespace ZoneCodeGenerator.Domain.Information
public bool IsLeaf { get; set; }
public List<MemberInformation> NameChain { get; set; }
public StructureComputations Computations => new StructureComputations(this);
public StructureInformation(DataTypeWithMembers type)
{

View File

@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using ZoneCodeGenerator.Domain;
using ZoneCodeGenerator.Domain.Evaluation;
using ZoneCodeGenerator.Domain.Information;
namespace ZoneCodeGenerator.Generating.Computations
{
class StructureComputations
{
private readonly StructureInformation information;
public bool IsUsed => information.Usages.Any();
public StructureComputations(StructureInformation information)
{
this.information = information;
}
}
}