当前位置: 首页>>代码示例>>Java>>正文


Java LogService.info方法代码示例

本文整理汇总了Java中org.scijava.log.LogService.info方法的典型用法代码示例。如果您正苦于以下问题:Java LogService.info方法的具体用法?Java LogService.info怎么用?Java LogService.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.scijava.log.LogService的用法示例。


在下文中一共展示了LogService.info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.scijava.log.LogService; //导入方法依赖的package包/类
/**
 * Testing method.
 *
 * @param args Ignored.
 */
public static void main(final String[] args) {
	final LogService log = new StderrLogService();

	final int trials = 50000;
	final int[] nums = new int[trials];
	final int[] len = new int[trials];
	final BitWriter bw = new BitWriter();
	int totallen = 0;

	final Random r = new Random();
	log.info("Generating " + trials + " trials.");
	log.info("Writing to byte array");
	// we want the trials to be able to be all possible bit lengths.
	// r.nextInt() by itself is not sufficient... in 50000 trials it would
	// be
	// extremely unlikely to produce bit strings of 1 bit.
	// instead, we randomly choose from 0 to 2^(i % 32).
	// Except, 1 << 31 is a negative number in two's complement, so we make
	// it
	// a random number in the entire range.
	for (int i = 0; i < trials; i++) {
		if (31 == i % 32) {
			nums[i] = r.nextInt();
		}
		else {
			nums[i] = r.nextInt(1 << (i % 32));
		}
		// How many bits are required to represent this number?
		len[i] = (Integer.toBinaryString(nums[i])).length();
		totallen += len[i];
		bw.write(nums[i], len[i]);
	}
	BitBuffer bb = new BitBuffer(bw.toByteArray());
	int readint;
	log.info("Reading from BitBuffer");
	// Randomly skip or read bytes
	for (int i = 0; i < trials; i++) {
		final int c = r.nextInt(100);
		if (c > 50) {
			readint = bb.getBits(len[i]);
			if (readint != nums[i]) {
				log.info("Error at #" + i + ": " + readint + " received, " + nums[i] +
					" expected.");
			}
		}
		else {
			bb.skipBits(len[i]);
		}
	}
	// Test reading past end of buffer.
	log.info("Testing end of buffer");
	bb = new BitBuffer(bw.toByteArray());
	// The total length could be mid byte. Add one byte to test.
	bb.skipBits(totallen + 8);
	final int read = bb.getBits(1);
	if (-1 != read) {
		log.info("-1 expected at end of buffer, " + read + " received.");
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:65,代码来源:BitBuffer.java

示例2: main

import org.scijava.log.LogService; //导入方法依赖的package包/类
/** Method for testing file pattern logic. */
public static void main(final String[] args) {
	String pat = null;
	final SCIFIO scifio = new SCIFIO();
	final LogService log = scifio.log();
	if (args.length > 0) {
		// test file pattern detection based on the given file on disk
		final Location file = new Location(scifio.getContext(), args[0]);
		log.info("File = " + file.getAbsoluteFile());
		pat = scifio.filePattern().findPattern(file);
	}
	else {
		// test file pattern detection from a virtual file list
		final String[] nameList = new String[2 * 4 * 3 * 12 + 1];
		nameList[0] = "outlier.ext";
		int count = 1;
		for (int i = 1; i <= 2; i++) {
			for (int j = 1; j <= 4; j++) {
				for (int k = 0; k <= 2; k++) {
					for (int l = 1; l <= 12; l++) {
						final String sl = (l < 10 ? "0" : "") + l;
						nameList[count++] =
							"hypothetical" + sl + k + j + "c" + i + ".ext";
					}
				}
			}
		}
		pat = scifio.filePattern().findPattern(nameList[1], null, nameList);
	}
	if (pat == null) log.info("No pattern found.");
	else {
		log.info("Pattern = " + pat);
		final FilePattern fp = new FilePattern(scifio.getContext(), pat);
		if (fp.isValid()) {
			log.info("Pattern is valid.");
			log.info("Files:");
			final String[] ids = fp.getFiles();
			for (int i = 0; i < ids.length; i++) {
				log.info("  #" + i + ": " + ids[i]);
			}
		}
		else log.info("Pattern is invalid: " + fp.getErrorMessage());
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:45,代码来源:FilePattern.java

示例3: main

import org.scijava.log.LogService; //导入方法依赖的package包/类
/** Method for testing pattern guessing logic. */
public static void main(final String[] args, final Context context)
	throws FormatException, IOException
{
	final SCIFIO scifio = new SCIFIO(context);
	final LogService log = scifio.log();
	final Location file =
		args.length < 1 ? new Location(context, System.getProperty("user.dir"))
			.listFiles()[0] : new Location(context, args[0]);
	log.info("File = " + file.getAbsoluteFile());
	final String pat = scifio.filePattern().findPattern(file);
	if (pat == null) log.info("No pattern found.");
	else {
		log.info("Pattern = " + pat);
		final FilePattern fp = new FilePattern(context, pat);
		if (fp.isValid()) {
			log.info("Pattern is valid.");
			final String id = fp.getFiles()[0];
			if (!new Location(context, id).exists()) {
				log.info("File '" + id + "' does not exist.");
			}
			else {
				// read dimensional information from first file
				log.info("Reading first file ");
				final Reader reader = scifio.initializer().initializeReader(id);
				final AxisType[] dimOrder =
					(AxisType[]) reader.getMetadata().get(0).getAxes().toArray();
				final long sizeZ = reader.getMetadata().get(0).getAxisLength(Axes.Z);
				final long sizeT =
					reader.getMetadata().get(0).getAxisLength(Axes.TIME);
				final long sizeC =
					reader.getMetadata().get(0).getAxisLength(Axes.CHANNEL);
				final boolean certain = reader.getMetadata().get(0).isOrderCertain();
				reader.close();
				log.info("[done]");
				log.info("\tdimOrder = " + Arrays.toString(dimOrder) + " (" +
					(certain ? "certain" : "uncertain") + ")");
				log.info("\tsizeZ = " + sizeZ);
				log.info("\tsizeT = " + sizeT);
				log.info("\tsizeC = " + sizeC);

				// guess axes
				final AxisGuesser ag =
					new AxisGuesser(fp, dimOrder, sizeZ, sizeT, sizeC, certain);

				// output results
				final String[] blocks = fp.getBlocks();
				final String[] prefixes = fp.getPrefixes();
				final int[] axes = ag.getAxisTypes();
				final AxisType[] newOrder = ag.getAdjustedOrder();
				final boolean isCertain = ag.isCertain();
				log.info("Axis types:");
				for (int i = 0; i < blocks.length; i++) {
					String axis;
					switch (axes[i]) {
						case Z_AXIS:
							axis = "Z";
							break;
						case T_AXIS:
							axis = "T";
							break;
						case C_AXIS:
							axis = "C";
							break;
						default:
							axis = "?";
					}
					log.info("\t" + blocks[i] + "\t" + axis + " (prefix = " +
						prefixes[i] + ")");
				}
				if (!Arrays.equals(dimOrder, newOrder)) {
					log.info("Adjusted dimension order = " + Arrays.toString(newOrder) + " (" +
						(isCertain ? "certain" : "uncertain") + ")");
				}
			}
		}
		else log.info("Pattern is invalid: " + fp.getErrorMessage());
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:80,代码来源:AxisGuesser.java


注:本文中的org.scijava.log.LogService.info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。