From a232e0d5e8cc33bdc87c9703c638f0d940349749 Mon Sep 17 00:00:00 2001 From: mokha Date: Wed, 8 May 2019 18:48:53 -0600 Subject: add documentation --- src/Q8/Communication.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/Q8/Communication.java') diff --git a/src/Q8/Communication.java b/src/Q8/Communication.java index 1fd3002..cc217e3 100644 --- a/src/Q8/Communication.java +++ b/src/Q8/Communication.java @@ -1,22 +1,54 @@ +/** + * Assignment 1, COMP268 Class: Communication.java + * + * @description Represents a candidates communication ability. + * @author: mo khan Student ID: 3431709 + * @date May 8, 2019 + * @version 1.0 + */ package Q8; public class Communication implements Comparable { private String name; private Integer ranking; + /** + * Constructs a Communication object. + * + * @param name the name of the communication level + * @param ranking the ranking of the communication level. + */ public Communication(String name, Integer ranking) { this.name = name; this.ranking = ranking; } + /** + * Compares one communication level with another. + * + * @param other the other communication level to compare against + * @return a negative integer, zero, or a positive integer as this object is less than, equal to, + * or greater than the specified object. + */ public int compareTo(Communication other) { return this.ranking.compareTo(other.ranking); } + /** + * Compares one communication level with another. + * + * @param other the other communication level to compare against + * @return true if this communication level is equal to or better than the other. + */ public boolean isAtLeast(Communication other) { return this.compareTo(other) >= 0; } + /** + * The string representation of the candidate. + * + * @return the name of the candidate + */ @Override public String toString() { return this.name; @@ -26,6 +58,10 @@ public class Communication implements Comparable { public static final Communication Average = new Communication("average", 1); public static final Communication Excellent = new Communication("excellent", 2); + /** + * @param name of the communication level to find. + * @return the Communication level matching the name + */ public static Communication findBy(String name) { switch (name) { case "poor": -- cgit v1.2.3