⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compression.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
字号:
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)package org.xbill.DNS;/** * DNS Name Compression object. * @see Name * * @author Brian Wellington */class Compression {private static class Entry {	Name name;	int pos;	Entry next;}private static final int TABLE_SIZE = 17;private Entry [] table;private boolean verbose = Options.check("verbosecompression");/** * Creates a new Compression object. */publicCompression() {	table = new Entry[TABLE_SIZE];}/** Adds a compression entry mapping a name to a position.  */public voidadd(int pos, Name name) {	int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;	Entry entry = new Entry();	entry.name = name;	entry.pos = pos;	entry.next = table[row];	table[row] = entry;	if (verbose)		System.err.println("Adding " + name + " at " + pos);}/** * Retrieves the position of the given name, if it has been previously * included in the message. */public intget(Name name) {	int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;	int pos = -1;	for (Entry entry = table[row]; entry != null; entry = entry.next) {		if (entry.name.equals(name))			pos = entry.pos;	}	if (verbose)		System.err.println("Looking for " + name + ", found " + pos);	return pos;}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -