private CompoundIndex GetSub() { var sub = new CompoundIndex(subIndexes); sub.subIndexes.RemoveAt(0); return(sub); }
public IShape GetShapeAt(CompoundIndex index) { List <IShape> copy; lock (lockObject) { copy = shapes; } return(index.Size == 1 ? copy[index.Top] : copy[index.Top].GetShapeAt(index.Sub)); }
public void RemoveAt(CompoundIndex index) { lock (lockObject) { if (index.Size != 1) { shapes[index.Top].RemoveAt(index.Sub); } else { shapes.RemoveAt(index.Top); } } }
public static bool TryParse(string input, out CompoundIndex index) { index = null; var indexList = new List <int>(); var parts = input.Split(':'); foreach (var part in parts) { if (!int.TryParse(part, out var partInt)) { return(false); } indexList.Add(partInt); } index = new CompoundIndex(indexList); return(true); }
public bool Equals(CompoundIndex other) { if (other is null) { return(false); } if (Size != other.Size) { return(false); } for (var i = Size; i < other.Size; i++) { if (subIndexes[i] != other.subIndexes[i]) { return(false); } } return(true); }