整理代码
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace ShrlAlgo.RvKits.RvIndependent.MetroGauges.LandXMLData
|
||||
{
|
||||
[XmlType("Alignments")]
|
||||
[Serializable]
|
||||
public class Alignments : ComparableStructure<Alignments>
|
||||
{
|
||||
public Alignments()
|
||||
{
|
||||
AlignmentList = new List<Alignment>();
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Alignment this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (index < AlignmentList.Count)
|
||||
{
|
||||
return AlignmentList[index];
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (index < AlignmentList.Count)
|
||||
{
|
||||
AlignmentList[index] = value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == AlignmentList.Count)
|
||||
{
|
||||
AlignmentList.Add(value);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public int Count => AlignmentList.Count;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
[XmlElement("Alignment")]
|
||||
public List<Alignment> AlignmentList { get; set; }
|
||||
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
public void Add(Alignment item)
|
||||
{
|
||||
AlignmentList.Add(item);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
AlignmentList.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(Alignment item)
|
||||
{
|
||||
return AlignmentList.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(Alignment[] array, int arrayIndex)
|
||||
{
|
||||
AlignmentList.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public override bool DifferentDescendants(Alignments alignments)
|
||||
{
|
||||
if (AlignmentList.Count == alignments.AlignmentList.Count)
|
||||
{
|
||||
for (int i = 0; i < AlignmentList.Count; i++)
|
||||
{
|
||||
if (!AlignmentList[i].Equals(alignments.AlignmentList[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool DifferentItem(Alignments alignments)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerator<Alignment> GetEnumerator()
|
||||
{
|
||||
return AlignmentList.GetEnumerator();
|
||||
}
|
||||
|
||||
public int IndexOf(Alignment item)
|
||||
{
|
||||
return AlignmentList.IndexOf(item);
|
||||
}
|
||||
|
||||
public void Insert(int index, Alignment item)
|
||||
{
|
||||
AlignmentList.Insert(index, item);
|
||||
}
|
||||
|
||||
public bool Remove(Alignment item)
|
||||
{
|
||||
return AlignmentList.Remove(item);
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
AlignmentList.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user