1 /**
2  * Copyright (c) 2008, http://www.snakeyaml.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.yaml.snakeyaml.issues.issue73;
17 
18 import java.util.LinkedHashSet;
19 import java.util.Set;
20 import java.util.TreeSet;
21 
22 public class Blog {
23 
24     private String name;
25     private Set<Post> posts = new TreeSet<Post>();
26     public Set<Integer> numbers = new LinkedHashSet<Integer>();
27     private TreeSet<String> labels = new TreeSet<String>();
28 
Blog()29     public Blog() {
30         name = "SuperBlog";
31     }
32 
Blog(String name)33     public Blog(String name) {
34         this.name = name;
35     }
36 
addPost(Post p)37     public void addPost(Post p) {
38         posts.add(p);
39     }
40 
getPosts()41     public Set<Post> getPosts() {
42         return posts;
43     }
44 
getName()45     public String getName() {
46         return name;
47     }
48 
setName(String name)49     public void setName(String name) {
50         this.name = name;
51     }
52 
setPosts(Set<Post> posts)53     public void setPosts(Set<Post> posts) {
54         this.posts = posts;
55     }
56 
getLabels()57     public TreeSet<String> getLabels() {
58         return labels;
59     }
60 
setLabels(TreeSet<String> labels)61     public void setLabels(TreeSet<String> labels) {
62         this.labels = labels;
63     }
64 
65     @Override
equals(Object obj)66     public boolean equals(Object obj) {
67         return name.equals(obj.toString());
68     }
69 
70     @Override
hashCode()71     public int hashCode() {
72         return name.hashCode();
73     }
74 
75     @Override
toString()76     public String toString() {
77         return "Blog '" + name + "'";
78     }
79 }