freespace.java
来自「Java的面向对象数据库系统的源代码」· Java 代码 · 共 72 行
JAVA
72 行
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// Copyright (C) 2003-@year@, Leo Mekenkamp. All rights reserved.//// $Id: FreeSpace.java,v 1.1.2.1 2004/04/10 10:06:51 per_nyfelt Exp $package org.ozoneDB.core.storage.gammaStore;import java.util.Comparator;public final class FreeSpace { private static Comparator sizeComparator = new Comparator() { public int compare(Object o1, Object o2) { return compare((FreeSpace) o1, (FreeSpace) o2); } private int compare(FreeSpace o1, FreeSpace o2) { if (o1 == o2) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } int result = o1.getSize() - o2.getSize(); if (result == 0) { result = o1.getClusterId() - o2.getClusterId(); if (result == 0) { result = o1.getLocation() - o2.getLocation(); } } return result; } }; public static Comparator getSizeComparator() { return sizeComparator; } private int clusterId; private int location; private int size; public FreeSpace(int clusterId, int location, int size) { this.clusterId = clusterId; this.location = location; this.size = size; } public int getClusterId() { return clusterId; } public int getLocation() { return location; } public int getSize() { return size; } public int hashCode() { return (clusterId + 1) * location; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?