Skip to contentMethod: setName(String)
      1: package model;
2: 
3: /**
4:  * Represents a router.
5:  */
6: public final class Router {
7:         /**
8:          * The router's name.
9:          */
10:         private String name;
11: 
12:         /**
13:          * Creates a Router.
14:          * 
15:          * @param name
16:          *            The router's name.
17:          */
18:         public Router(final String name) {
19:                 this.name = name;
20:         }
21: 
22:         @Override
23:         public boolean equals(final Object o) {
24:                 if (!(o instanceof Router)) {
25:                         return false;
26:                 }
27:                 final Router other = (Router) o;
28:                 return other.getName().equals(this.getName());
29:         }
30: 
31:         @Override
32:         public int hashCode() {
33:                 return this.name.hashCode();
34:         }
35: 
36:         /**
37:          * @return the router's name.
38:          */
39:         public String getName() {
40:                 return this.name;
41:         }
42: 
43:         /**
44:          * Changes a router's name.
45:          * 
46:          * @param name
47:          *            The router's new name.
48:          */
49:         public void setName(final String name) {
50:                 this.name = name;
51:         }
52: }