📄 intkey.java
字号:
package neustore.base;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
/**
* An integer key.
* @author Donghui Zhang <donghui@ccs.neu.edu>
*/
public class IntKey implements Key {
public int key;
public IntKey( int _key ) {
key = _key;
}
public Object clone() {
IntKey newKey = new IntKey(key);
return newKey;
}
public int size() { return 4; }
public int maxSize() { return 4;}
public void read(DataInputStream in) throws IOException {
key = in.readInt();
}
public void write(DataOutputStream out) throws IOException {
out.writeInt(key);
}
public int compareTo(Object key2) {
Integer i1 = new Integer(key);
Integer i2 = new Integer( ((IntKey)key2).key );
return i1.compareTo(i2);
}
public boolean equals(Object key2) {
int k = ((IntKey)key2).key;
return key==k;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -