コード例 #1
0
ファイル: Perimeter.cs プロジェクト: modulexcite/benchmarker
        /**
         * The entry point to computing the perimeter of an image.
         *
         * @param args the command line arguments
         */
        public static void Main(String[] args, ILog ilog)
        {
            logger = ilog;
            parseCmdLine(args);
            Quadrant.staticInitQuadrant();

            int size  = 1 << levels;
            int msize = 1 << (levels - 1);

            QuadTreeNode.gcmp = size * 1024;
            QuadTreeNode.lcmp = msize * 1024;

            QuadTreeNode tree = QuadTreeNode.createTree(msize, 0, 0, null, Quadrant.cSouthEast, levels);

            int leaves = tree.countTree();
            int perm   = tree.perimeter(size);

            if (printResult)
            {
                logger.InfoFormat("Perimeter is " + perm);
                logger.InfoFormat("Number of leaves " + leaves);
            }

            logger.InfoFormat("Done!");
        }
コード例 #2
0
 /**
  * Count the number of leaves in the quad tree.
  *
  * @return the number of leaves in the quad tree.
  */
 public int countTree()
 {
     if (nw == null && ne == null && sw == null && se == null)
     {
         return(1);
     }
     else
     {
         return(sw.countTree() + se.countTree() + ne.countTree() + nw.countTree());
     }
 }