Beispiel #1
0
        public void BackwardInputIteratorTest2()
        {
            int[] data = { 1, 2, 2, 3 };

            int[] output = new int[2];

            int removeValue = 2;

            using (IIntRandomAccessIterator <int> inputIterator = new BackwardInputIterator <int>(data))
            {
                int index = 0;

                IRemoveable removeable = inputIterator as IRemoveable;

                while (!inputIterator.IsEnd())
                {
                    //testing if the remove work

                    if (inputIterator.Read().Equals(removeValue))
                    {
                        removeable.Remove();
                    }
                    else
                    {
                        output[index] = inputIterator.Read();

                        ++index;
                    }

                    inputIterator.MoveNext();
                }

                Assert.IsTrue(output[0] == 3 && output[1] == 1);
            }
        }
Beispiel #2
0
 public ConfigChecker(IRemoveable root, T parent, IConfigurationProvider configProvider)
 {
     ConfigProvider = configProvider;
     Root           = root;
     Parent         = parent;
     LoadFromConfig();
 }
Beispiel #3
0
 private static void RemoveItem(IRemoveable collection, int count, List <string> removedElementsList)
 {
     for (int i = 0; i < count; i++)
     {
         removedElementsList.Add(collection.Remove());
     }
 }
Beispiel #4
0
        // processes main menu operation
        public override void DoOperation(UMLDes.GUI.View.EditOperation op)
        {
            int i;

            switch (op)
            {
            case EditOperation.Delete:
                i = 0;
                while (i < SelectedObjects.Count)
                {
                    GuiObject   obj = SelectedObjects[i];
                    IRemoveable o   = obj as IRemoveable;
                    if (o != null && Destroy(o))
                    {
                        SelectedObjects.Remove(obj);
                    }
                    else
                    {
                        i++;
                    }
                }
                break;

            case EditOperation.SelectAll:
                foreach (GuiObject o in active_objects)
                {
                    SelectedObjects.Add(o);
                }
                break;

            case EditOperation.SelectNone:
                SelectedObjects.Clear();
                break;
            }
        }
Beispiel #5
0
 static void RemoveFromCollections(IRemoveable collection, int removeCount)
 {
     for (int i = 0; i < removeCount; i++)
     {
         Console.Write(collection.Remove() + " ");
     }
     Console.WriteLine();
 }
Beispiel #6
0
 public static void PrintRemove(int removeOperations, IRemoveable collection)
 {
     for (int i = 0; i < removeOperations; i++)
     {
         Console.Write(collection.Remove() + " ");
     }
     Console.WriteLine();
 }
 public StayRelativeTo(IWithPosition objectToMove, IWithPositionAndDirection origin, Vector2 offset, IWorldObject root)
 {
     Parent = origin;
     Offset = offset;
     Object = objectToMove;
     root.Layer.Scene.AddObject(this);
     Root = root;
 }
Beispiel #8
0
 public Animation(IRemoveable root, IWithPosition parent, Sprite sprite, params int[] frames)
 {
     Root              = root;
     Parent            = parent;
     TimePerFrame      = new ConfigValue <TimeSpan>("animation frame");
     Sprite            = sprite;
     Frames            = frames;
     CurrentFrameIndex = new CyclingInteger(frames.Length);
     DrawInfo          = sprite.DrawInfo;
 }
Beispiel #9
0
        // tries to remove object from diagram with Undo
        public bool Destroy(IRemoveable o)
        {
            bool res = o.Destroy();

            if (res)
            {
                Undo.Push(new RemoveOperation(o), false);
            }
            return(res);
        }
Beispiel #10
0
 public DirectedAnimation(IRemoveable root, IWithPositionAndDirection parent, Sprite sprite, TextureFlipBehavior flipbehavior, params int[] frames)
     : base(root, parent, sprite, frames)
 {
     Parent       = parent;
     FlipBehavior = flipbehavior;
 }
Beispiel #11
0
 public CreateOperation(IRemoveable r)
 {
     obj = r;
 }
Beispiel #12
0
 public RemoveOperation(IRemoveable r)
 {
     obj = r;
 }
Beispiel #13
0
 // tries to remove object from diagram with Undo
 public bool Destroy( IRemoveable o )
 {
     bool res = o.Destroy();
     if( res )
         Undo.Push( new RemoveOperation( o ), false );
     return res;
 }
Beispiel #14
0
 public Timer(IWorldObject owner)
 {
     Owner = owner;
     owner.Layer.Scene.AddObject(this);
 }
Beispiel #15
0
 public RemoveOperation( IRemoveable r )
 {
     obj = r;
 }
Beispiel #16
0
 public CreateOperation( IRemoveable r )
 {
     obj = r;
 }