summaryrefslogtreecommitdiff
path: root/python/edu/learn-python/src/com/jetbrains/python/edu/course/CourseInfo.java
blob: 9f820c12c57206ba119a1557410552a26df6c7b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.jetbrains.python.edu.course;

/**
 * Implementation of class which contains information to be shawn in course description in tool window
 * and when project is being created
 */
public class CourseInfo {
  private String myName;
  private String myAuthor;
  private String myDescription;
  public static CourseInfo INVALID_COURSE = new CourseInfo("", "", "");

  public CourseInfo(String name, String author, String description) {
    myName = name;
    myAuthor = author;
    myDescription = description;
  }

  public String getName() {
    return myName;
  }

  public String getAuthor() {
    return myAuthor;
  }

  public String getDescription() {
    return myDescription;
  }

  @Override
  public String toString() {
    return myName;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    CourseInfo that = (CourseInfo)o;
    return that.getName().equals(myName) && that.getAuthor().equals(myAuthor)
           && that.getDescription().equals(myDescription);
  }

  @Override
  public int hashCode() {
    int result = myName != null ? myName.hashCode() : 0;
    result = 31 * result + (myAuthor != null ? myAuthor.hashCode() : 0);
    result = 31 * result + (myDescription != null ? myDescription.hashCode() : 0);
    return result;
  }
}