src/main/java/de/uapcore/lightpit/entities/Module.java

Sat, 09 May 2020 14:58:20 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 09 May 2020 14:58:20 +0200
changeset 31
58f78f0142e8
parent 29
27a0fdd7bca7
child 34
824d4042c857
permissions
-rw-r--r--

adds module priorities

universe@21 1 /*
universe@21 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@21 3 *
universe@24 4 * Copyright 2018 Mike Becker. All rights reserved.
universe@21 5 *
universe@21 6 * Redistribution and use in source and binary forms, with or without
universe@21 7 * modification, are permitted provided that the following conditions are met:
universe@21 8 *
universe@21 9 * 1. Redistributions of source code must retain the above copyright
universe@21 10 * notice, this list of conditions and the following disclaimer.
universe@21 11 *
universe@21 12 * 2. Redistributions in binary form must reproduce the above copyright
universe@21 13 * notice, this list of conditions and the following disclaimer in the
universe@21 14 * documentation and/or other materials provided with the distribution.
universe@21 15 *
universe@21 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@21 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@21 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@21 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@21 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@21 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@21 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@21 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@21 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@21 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@21 26 * POSSIBILITY OF SUCH DAMAGE.
universe@31 27 *
universe@21 28 */
universe@21 29 package de.uapcore.lightpit.entities;
universe@21 30
universe@21 31 import de.uapcore.lightpit.LightPITModule;
universe@21 32
universe@31 33 import java.util.Comparator;
universe@31 34
universe@26 35 public final class Module {
universe@21 36 private int modID;
universe@21 37 private String classname;
universe@21 38 private boolean visible;
universe@31 39 private int priority;
universe@31 40
universe@21 41 private LightPITModule.ELProxy annotatedInfos;
universe@21 42
universe@21 43 public int getModID() {
universe@21 44 return modID;
universe@21 45 }
universe@21 46
universe@21 47 public void setModID(int modID) {
universe@21 48 this.modID = modID;
universe@21 49 }
universe@21 50
universe@21 51 public String getClassname() {
universe@21 52 return classname;
universe@21 53 }
universe@21 54
universe@21 55 public void setClassname(String classname) {
universe@21 56 this.classname = classname;
universe@21 57 }
universe@21 58
universe@21 59 public boolean isVisible() {
universe@21 60 return visible;
universe@21 61 }
universe@21 62
universe@21 63 public void setVisible(boolean visible) {
universe@21 64 this.visible = visible;
universe@21 65 }
universe@21 66
universe@31 67 public int getPriority() {
universe@31 68 return priority;
universe@31 69 }
universe@31 70
universe@31 71 public void setPriority(int priority) {
universe@31 72 this.priority = priority;
universe@31 73 }
universe@31 74
universe@21 75 public LightPITModule.ELProxy getAnnotatedInfos() {
universe@21 76 return annotatedInfos;
universe@21 77 }
universe@21 78
universe@21 79 public void setAnnotatedInfos(LightPITModule.ELProxy annotatedInfos) {
universe@21 80 this.annotatedInfos = annotatedInfos;
universe@21 81 }
universe@21 82
universe@21 83 @Override
universe@21 84 public int hashCode() {
universe@21 85 int hash = 3;
universe@21 86 hash = 41 * hash + this.modID;
universe@21 87 return hash;
universe@21 88 }
universe@21 89
universe@21 90 @Override
universe@21 91 public boolean equals(Object obj) {
universe@21 92 if (this == obj) {
universe@21 93 return true;
universe@21 94 }
universe@21 95 if (obj == null || getClass() != obj.getClass()) {
universe@21 96 return false;
universe@21 97 } else {
universe@21 98 return this.modID == ((Module) obj).modID;
universe@21 99 }
universe@31 100 }
universe@31 101
universe@31 102 public static final class PriorityComparator implements Comparator<Module> {
universe@31 103
universe@31 104 @Override
universe@31 105 public int compare(Module left, Module right) {
universe@31 106 return Integer.compare(left.priority, right.priority);
universe@31 107 }
universe@31 108
universe@31 109 @Override
universe@31 110 public boolean equals(Object o) {
universe@31 111 return o instanceof PriorityComparator;
universe@31 112 }
universe@31 113 }
universe@21 114 }

mercurial