X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Freactor%2Floader%2FChain.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Freactor%2Floader%2FChain.java;h=0000000000000000000000000000000000000000;hb=6f69aff66ba5617d0bb27874014b4274bc551ab8;hp=8c98e5098015299bc0b1c3b5a9799025e86a6db4;hpb=13a4fe6bece23b3dd561de657cf9bb7ea307e2b6;p=rhynodge.git
diff --git a/src/main/java/net/pterodactylus/reactor/loader/Chain.java b/src/main/java/net/pterodactylus/reactor/loader/Chain.java
deleted file mode 100644
index 8c98e50..0000000
--- a/src/main/java/net/pterodactylus/reactor/loader/Chain.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Reactor - Chain.java - Copyright © 2013 David Roden
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package net.pterodactylus.reactor.loader;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Model for chain definitions.
- *
- * @author David âBombeâ Roden
- */
-public class Chain {
-
- /**
- * Parameter model.
- *
- * @author David âBombeâ Roden
- */
- public static class Parameter {
-
- /** The name of the parameter. */
- @JsonProperty
- private String name;
-
- /** The value of the parameter. */
- @JsonProperty
- private String value;
-
- /**
- * Returns the name of the parameter.
- *
- * @return The name of the parameter
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns the value of the parameter.
- *
- * @return The value of the parameter
- */
- public String value() {
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- int hashCode = 0;
- hashCode ^= name.hashCode();
- hashCode ^= value.hashCode();
- return hashCode;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- if (!(object instanceof Parameter)) {
- return false;
- }
- Parameter parameter = (Parameter) object;
- if (!name.equals(parameter.name)) {
- return false;
- }
- if (!value.equals(parameter.value)) {
- return false;
- }
- return true;
- }
-
- }
-
- /**
- * Defines a part of a chain.
- *
- * @author David âBombeâ Roden
- */
- public static class Part {
-
- /** The class name of the part. */
- @JsonProperty(value = "class")
- private String name;
-
- /** The parameters of the part. */
- @JsonProperty
- private List parameters = new ArrayList();
-
- /**
- * Returns the name of the partâs class.
- *
- * @return The name of the partâs class
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns the parameters of the part.
- *
- * @return The parameters of the part
- */
- public List parameters() {
- return parameters;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- int hashCode = 0;
- hashCode ^= name.hashCode();
- for (Parameter parameter : parameters) {
- hashCode ^= parameter.hashCode();
- }
- return hashCode;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- if (!(object instanceof Part)) {
- return false;
- }
- Part part = (Part) object;
- if (!name.equals(part.name)) {
- return false;
- }
- if (parameters.size() != part.parameters.size()) {
- return false;
- }
- for (int parameterIndex = 0; parameterIndex < parameters.size(); ++parameterIndex) {
- if (!parameters.get(parameterIndex).equals(part.parameters.get(parameterIndex))) {
- return false;
- }
- }
- return true;
- }
-
- }
-
- /** Whether this chain is enabled. */
- @JsonProperty
- private boolean enabled;
-
- /** The name of the chain. */
- @JsonProperty
- private String name;
-
- /** The query of the chain. */
- @JsonProperty
- private Part query;
-
- /** The filters of the chain. */
- @JsonProperty
- private List filters = new ArrayList();
-
- /** The trigger of the chain. */
- @JsonProperty
- private Part trigger;
-
- /** The action of the chain. */
- @JsonProperty
- private Part action;
-
- /** Interval between updates (in seconds). */
- @JsonProperty
- private int updateInterval;
-
- /**
- * Returns whether this chain is enabled.
- *
- * @return {@code true} if this chain is enabled, {@code false} otherwise
- */
- public boolean enabled() {
- return enabled;
- }
-
- /**
- * Returns the name of the chain.
- *
- * @return The name of the chain
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns the query of this chain.
- *
- * @return The query of this chain
- */
- public Part query() {
- return query;
- }
-
- /**
- * Returns the filters of this chain.
- *
- * @return The filters of this chain
- */
- public List filters() {
- return filters;
- }
-
- /**
- * Returns the trigger of this chain.
- *
- * @return The trigger of this chain
- */
- public Part trigger() {
- return trigger;
- }
-
- /**
- * Returns the action of this chain.
- *
- * @return The action of this chain
- */
- public Part action() {
- return action;
- }
-
- /**
- * Returns the update interval of the chain.
- *
- * @return The update interval (in seconds)
- */
- public int updateInterval() {
- return updateInterval;
- }
-
- //
- // OBJECT METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- int hashCode = 0;
- hashCode ^= name.hashCode();
- hashCode ^= query.hashCode();
- for (Part filter : filters) {
- hashCode ^= filter.hashCode();
- }
- hashCode ^= trigger.hashCode();
- hashCode ^= action.hashCode();
- hashCode ^= updateInterval;
- return hashCode;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- if (!(object instanceof Chain)) {
- return false;
- }
- Chain chain = (Chain) object;
- if (!name.equals(chain.name)) {
- return false;
- }
- if (!query.equals(chain.query)) {
- return false;
- }
- if (filters.size() != chain.filters.size()) {
- return false;
- }
- for (int filterIndex = 0; filterIndex < filters.size(); ++filterIndex) {
- if (!filters.get(filterIndex).equals(chain.filters.get(filterIndex))) {
- return false;
- }
- }
- if (!trigger.equals(chain.trigger)) {
- return false;
- }
- if (!action.equals(chain.action)) {
- return false;
- }
- if (updateInterval != chain.updateInterval) {
- return false;
- }
- return true;
- }
-
-}