Add() public method

public Add ( int v ) : void
v int
return void
示例#1
0
 public IntPair InitTestCase(int largeBoxRelativePos)
 {
     IntPair[] loc = GenerateRandomTestCase(largeBoxRelativePos);
     smallBoxTopLeft = loc[0];
     largeBoxTopLeft = (IntPair)loc[1].Clone();
     largeBoxTopLeft.Add(-1);
     return loc[1];
 }
示例#2
0
 public IntPair InitTestCase(int largeBoxRelativePos)
 {
     IntPair[] loc = GenerateRandomTestCase(largeBoxRelativePos);
     smallBoxTopLeft = loc[0];
     largeBoxTopLeft = (IntPair)loc[1].Clone();
     largeBoxTopLeft.Add(-1);
     return(loc[1]);
 }
示例#3
0
        private IntPair[] GenerateRandomTestCase(int largeBoxRelativePos)
        {
            IntPair smallBoxPos = new IntPair(rnd.Next(BoxTrialCase.BASE_RESOLUTION),
                                              rnd.Next(BoxTrialCase.BASE_RESOLUTION));

            IntPair largeBoxPos = (IntPair)smallBoxPos.Clone();

            switch (largeBoxRelativePos)
            {
            case 0:
                largeBoxPos.AddX(5);
                break;

            case 1:
                largeBoxPos.AddY(5);
                break;

            case 2:
                if (rnd.NextDouble() > 0.5)
                {
                    largeBoxPos.Add(3, 4);
                }
                else
                {
                    largeBoxPos.Add(4, 3);
                }
                break;
            }

            if (largeBoxPos.X > BoxTrialCase.BOUNDS)
            {
                largeBoxPos.AddX(-BoxTrialCase.BASE_RESOLUTION);

                if (0 == largeBoxPos.X)
                {
                    largeBoxPos.Add(1);
                }
            }
            else if (BoxTrialCase.BOUNDS == largeBoxPos.X)
            {
                largeBoxPos.AddX(-1);
            }
            else if (largeBoxPos.X == 0)
            {
                largeBoxPos.AddX(1);
            }

            if (largeBoxPos.Y > BoxTrialCase.BOUNDS)
            {
                largeBoxPos.AddY(-BoxTrialCase.BASE_RESOLUTION);

                if (0 == largeBoxPos.Y)
                {
                    largeBoxPos.AddY(1);
                }
            }
            else if (BoxTrialCase.BOUNDS == largeBoxPos.Y)
            {
                largeBoxPos.AddY(-1);
            }
            else if (0 == largeBoxPos.Y)
            {
                largeBoxPos.AddY(1);
            }
            return(new IntPair[] { smallBoxPos, largeBoxPos });
        }