brigning down group tpes

This commit is contained in:
Filip Izydorczyk
2021-01-19 10:44:35 +01:00
parent 06fb41b5dd
commit 6a4ea45900
7 changed files with 99 additions and 15 deletions

View File

@ -1,23 +1,39 @@
package com.plannaplan.types;
/**
* GroupType contains types: LECTURE, CLASS, LAB, SEMINAR, CONSERVATORY, PRATICE
* GroupType contains types: LECTURE, CLASS, LAB, SEMINAR, CONSERVATORY, PRATICE
*/
public enum GroupType {
LECTURE("Wykład"), CLASS("Ćwiczenia"), LAB("Laboratorium"), SEMINAR("Seminarium"),CONSERVATORY("Konwersatorium"), PRATICE("Praktyka");
LECTURE("Wykład"), CLASS("Ćwiczenia"), LAB("Laboratorium"), SEMINAR("Seminarium"), CONSERVATORY("Konwersatorium"),
PRATICE("Praktyka");
public final String type;
private GroupType(String type) {
this.type = type;
}
/**
* @param type as string
* @return Enum converted from provided string
*/
public final static GroupType getType(String type) {
for (GroupType d : values()) {
if (d.type.equals(type)) {
return d;
}
}
return null;
return null;
}
/**
* @param type group type to check
* @return general convertion to bring down tours to two generals LECTURE and
* CLASS. To class are included: CLASS, LAB, SEMINAR, CONSERVATORY,
* PRATICE.
*/
public final static GroupType isLectureOrClass(GroupType type) {
return type == GroupType.LECTURE ? GroupType.LECTURE : GroupType.CLASS;
}
}