1 package com.beust.jcommander; 2 3 import com.beust.jcommander.FuzzyMap.IKey; 4 5 public class StringKey implements IKey { 6 7 private String m_name; 8 StringKey(String name)9 public StringKey(String name) { 10 m_name = name; 11 } 12 13 @Override getName()14 public String getName() { 15 return m_name; 16 } 17 18 @Override toString()19 public String toString() { 20 return m_name; 21 } 22 23 @Override hashCode()24 public int hashCode() { 25 final int prime = 31; 26 int result = 1; 27 result = prime * result + ((m_name == null) ? 0 : m_name.hashCode()); 28 return result; 29 } 30 31 @Override equals(Object obj)32 public boolean equals(Object obj) { 33 if (this == obj) 34 return true; 35 if (obj == null) 36 return false; 37 if (getClass() != obj.getClass()) 38 return false; 39 StringKey other = (StringKey) obj; 40 if (m_name == null) { 41 if (other.m_name != null) 42 return false; 43 } else if (!m_name.equals(other.m_name)) 44 return false; 45 return true; 46 } 47 48 } 49