Key.java
资源名称:Parsing.rar [点击查看]
上传用户:xiaozhuqw
上传日期:2021-11-10
资源大小:21k
文件大小:1k
源码类别:
词法分析
开发平台:
Java
- import java.util.Vector;
- public class Key {
- public Vector rs;
- public Key(String line){
- this.rs = new Vector();
- String[] s;
- //this.rs = new Vector();
- s = line.split(" ");
- //Value value = new Value(s[1], Double.parseDouble(s[0]));
- //System.out.println(s.length);
- for(int i = 3;i<s.length;i++){
- this.rs.add(s[i]);
- }
- }
- public Key(Vector rs){
- this.rs = new Vector();
- this.rs = rs;
- }
- public int hashCode(){
- String s = "";
- for (int i = 0; i < rs.size(); i++)
- s += rs.get(i);
- return s.hashCode();
- }
- public boolean equals(Object k){
- boolean b = true;
- for (int i = 0; i < rs.size(); i++ )
- if (!((Key)k).rs.get(i).equals(rs.get(i))){
- b = false;
- break;
- }
- return b;
- }
- }