码迷,mamicode.com
首页 > 其他好文 > 详细

SAFS Init Files

时间:2015-04-15 18:27:41      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

There‘re many deployment files for configuration. We need to learn how SAFS read these depolyment files.

 

Let‘s use the IBT as the a small example for reading UseMultiThreadSearch parameter which determines if we use multi-thread algorithm for image comparing.

 

In the DefaultDriver.java, define a variable USE_MULTIPLE_THREADS to store client‘s choice about using multi-thread:

/**
 * Set true if image searches using BitTolerance 
 * should attempt to use parallel threading.
 * The current implementation of multi-threading is poor, 
 * and may actually be slower than NOT using multi-threading.
 * Current default is ‘false‘.
 * @see org.safs.image.SmallPieceComparator
 * @see org.safs.image.ScreenXYBTComparator  
 */
public static boolean USE_MULTIPLE_THREADS = false;

Then, in the DefaultDriver.java file, the initializeMiscConfigInfo() method will call configInfo‘s getNamedValue() method to read the configuration files. So in order to get client‘s choice of whether use multi-thread, we‘ll do:

String useMultiThread = configInfo.getNamedValue(DriverConstant.SECTION_SAFS_IBT, "UseMultiThreadSearch");
if(useMultiThread!=null) {
	ImageUtils.USE_MULTIPLE_THREADS = StringUtilities.convertBool(useMultiThread);
	Log.info("SAFS_IBT:UseMultiThreadSearch set to: "+ ImageUtils.USE_MULTIPLE_THREADS);
}

The corresponding test.ini file should be written like this:

[SAFS_IBT]
UseTwoDimensionMatch=true

Obviously the [SAFS_IBT]  is determined by parameter DriverConstant.SECTION_SAFS_IBT in configInfo.getNamedValue() method.

 

SAFS Init Files

标签:

原文地址:http://www.cnblogs.com/kid551/p/4428921.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!