📄 dictionaryfieldkey.java.svn-base
字号:
package com.gisinfo.Dictionary;
import java.util.Hashtable;
/**
* Author: Jimmy lin
* Date: Nov 10, 2003
* Time: 9:58:29 PM
*/
/**
* This class represents fields of one Dictionaryfield which has same tableName and fieldName
*/
public class DictionaryFieldKey extends DictionaryKey {
private String fieldName ="";
public DictionaryFieldKey(String tableName, String fieldName) {
this.tableName = tableName;
this.fieldName = fieldName;
}
public DictionaryFieldKey() {
}
public boolean equals(Object obj) {
if (!super.equals(obj))
return false;
if (obj instanceof DictionaryKey){
DictionaryFieldKey key = (DictionaryFieldKey)obj;
//we use ignore case method here
return stringCompareIgnoreCase(key.getFieldName(),this.fieldName );
}
return false;
}
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public int hashCode() {
// return this.fieldName == null ? 0 : this.fieldName.charAt(this.fieldName .length()-1) ;//会出现错误,因为大小写在这里的ascii是不同的
return super.hashCode() + this.fieldName.length() ;
}
//for test
public void displayKey(){
System.out .println("\ntable_name : " +this.tableName+
"\nfield_name : "+this.fieldName ) ;
}
public static void main(String[] argv){
Hashtable ht = new Hashtable();
DictionaryFieldKey dfk = new DictionaryFieldKey();
dfk.setTableName("kkk");
dfk.setFieldName("aaa");
ht.put(dfk,"a");
ht.get(dfk);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -