private void B_Populate_Click(object sender, EventArgs e)
        {
            const int lineCount = 40;
            const int minLength = 25;
            const int maxLength = 401;
            const int minWidth  = 1;
            const int maxWidth  = 11;

            lineList = new List <FunLine>();

            for (int count = 0; count < lineCount; ++count)
            {
                FunLine newLine = new FunLine(rnd.Next(minLength, maxLength), rnd.Next(minWidth, maxWidth));
                lineList.Add(newLine);
            }

            RenderLines();
            B_LenAsc.Enabled      = true;
            B_LenDesc.Enabled     = true;
            B_Width.Enabled       = true;
            B_WidthHeight.Enabled = true;
            B_RemStub.Enabled     = true;
            B_RemLong.Enabled     = true;
            TrB_Length.Enabled    = true;
            TrackMinMax();
        }
Beispiel #2
0
        public int CompareTo(object lineObj)
        {
            if (!(lineObj is FunLine))
            {
                throw new ArgumentException("Incorrect type in CompareTo!");
            }
            FunLine objCopy = (FunLine)lineObj;

            return(_length.CompareTo(objCopy._length));
        }
Beispiel #3
0
 public static int WidthThenHeightComp(FunLine lineA, FunLine lineB)
 {
     if (lineA._width.CompareTo(lineB._width) == 0)
     {
         return(lineA._length.CompareTo(lineB._length));
     }
     else
     {
         return(lineA._width.CompareTo(lineB._width));
     }
 }
        private bool ShorterThan(FunLine line)
        {
            const int minLength = 75;

            return(line._length < minLength);
        }
Beispiel #5
0
 public static int DecComp(FunLine lineA, FunLine lineB)
 {
     return(-1 * lineA._length.CompareTo(lineB._length));
 }