PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/farmR/src/java/src/jfm/model/CropYear.java

https://code.google.com/p/javawfm/
Java | 37 lines | 26 code | 5 blank | 6 comment | 4 complexity | 9e6eeeb0f4ab11dcfce63edf12a12687 MD5 | raw file
 1package jfm.model;
 2
 3
 4import jfm.model.Types.CropType;
 5
 6/** \internal Identifier class for a particular crop in a particular year. 
 7 * Typically used as a key in hashmaps 
 8
 9 * <em> immutable </em>
10 *
11 * @author Ira Cooke */
12final class CropYear {
13	public final CropType base;
14	public final int copyYear;
15	CropYear(CropType b,int y){
16		base=b;
17		copyYear=y;
18	}
19	public boolean equals(Object other){
20		if ( this == other ){ return true;};
21		if ( other instanceof CropYear){
22			CropYear oth=(CropYear)other;
23			if ( oth.base==base&& oth.copyYear==copyYear){
24				return true;
25			} 
26		}
27		return false;
28	}
29	public int hashCode(){
30		int hash=7;
31		hash=31*hash+base.hashCode();
32		hash=31*hash+copyYear;
33		return hash;
34	}
35
36	
37}