📄 simpletest.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.//// $Id$package test.ozoneDB.DxLib;import org.ozoneDB.DxLib.*;class SimpleTest { public static void main(String[] args) throws Exception { DxDeque deque = new DxArrayDeque(1024); deque.peek(); deque.pushBottom("daniela"); deque.pushBottom("knuffi"); System.out.println(deque.count()); System.out.println(deque.popBottom()); System.out.println(deque.popBottom()); deque.push("daniela"); deque.push("knuffi"); System.out.println(deque.pop()); deque.push("mumpi"); System.out.println(deque.count()); System.out.println(deque.pop()); System.out.println(deque.pop()); // System.out.println ("\nzeit: " + (System.currentTimeMillis() - start) + "msec"); } public void testMemory() { Runtime rt = Runtime.getRuntime(); try { DxVector bag = new DxArrayBag(); for (int i = 0; i < 100000; i++) { bag.add(new byte[100000]); System.out.println("total:" + rt.totalMemory() + " free:" + rt.freeMemory()); } } catch (OutOfMemoryError e) { System.gc(); } System.out.println("total:" + rt.totalMemory() + " free:" + rt.freeMemory()); } public static void testDiskHash(String[] args) throws Exception { long start = System.currentTimeMillis(); int count = Integer.valueOf(args[0]).intValue(); boolean re_use = Boolean.valueOf(args[1]).booleanValue(); System.out.println(count + ", " + re_use); DxDiskHashMap map = new DxDiskHashMap("map/map", 100, 12, 8); // if (re_use) // map.re_use(); // else { // for (int i=0; i<count; i++) { // map.addForKey ("daniela", new Integer(i)); // } // System.out.println ("\naddForKey(): " + (System.currentTimeMillis() - start) + "msec"); // } for (; ;) { start = System.currentTimeMillis(); for (int i = 0; i < count; i++) { map.addForKey(String.valueOf(i), new Integer(i)); } System.out.println("\naddForKey(): " + (System.currentTimeMillis() - start) + "msec"); start = System.currentTimeMillis(); for (int i = 0; i < count; i++) { String s = (String) map.elementForKey(new Integer(i)); if (!s.equals(String.valueOf(i))) { throw new Exception("falscher inhalt"); } } System.out.println("\nelementForKey(): " + (System.currentTimeMillis() - start) + "msec"); start = System.currentTimeMillis(); for (int i = 0; i < count; i++) { String s = (String) map.removeForKey(new Integer(i)); if (!s.equals(String.valueOf(i))) { throw new Exception("falscher inhalt"); } } System.out.println("\nremoveForKey(): " + (System.currentTimeMillis() - start) + "msec"); map.printStatistics(); } // map.close(); // System.out.println ("\nclose(): " + (System.currentTimeMillis() - start) + "msec"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -