Add IMergable interface
This commit is contained in:
parent
001b6a944e
commit
6f87bc6904
|
@ -66,3 +66,8 @@ public class GenericChunk : IChunk
|
|||
writer.Write(Data);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMergable
|
||||
{
|
||||
public abstract void Merge(IMergable other);
|
||||
}
|
|
@ -34,7 +34,7 @@ public record LinkId
|
|||
}
|
||||
}
|
||||
|
||||
public class LinkChunk : IChunk
|
||||
public class LinkChunk : IChunk, IMergable
|
||||
{
|
||||
public record Link
|
||||
{
|
||||
|
@ -68,9 +68,15 @@ public class LinkChunk : IChunk
|
|||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Merge(IMergable other)
|
||||
{
|
||||
links.AddRange(((LinkChunk)other).links);
|
||||
}
|
||||
}
|
||||
|
||||
public class LinkDataMetaProp : IChunk
|
||||
// TODO: This should be generic like Property
|
||||
public class LinkDataMetaProp : IChunk, IMergable
|
||||
{
|
||||
public record LinkData
|
||||
{
|
||||
|
@ -102,4 +108,9 @@ public class LinkDataMetaProp : IChunk
|
|||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Merge(IMergable other)
|
||||
{
|
||||
linkData.AddRange(((LinkDataMetaProp)other).linkData);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ public class Property
|
|||
}
|
||||
}
|
||||
|
||||
public class PropertyChunk<T> : IChunk where T : Property, new()
|
||||
public class PropertyChunk<T> : IChunk, IMergable where T : Property, new()
|
||||
{
|
||||
public ChunkHeader Header { get; set; }
|
||||
public List<T> properties;
|
||||
|
@ -38,6 +38,11 @@ public class PropertyChunk<T> : IChunk where T : Property, new()
|
|||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Merge(IMergable other)
|
||||
{
|
||||
properties.AddRange(((PropertyChunk<T>)other).properties);
|
||||
}
|
||||
}
|
||||
|
||||
public class PropGeneric : Property
|
||||
|
|
Loading…
Reference in New Issue