2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================LICENSE_END===========================================
21 package org.onap.dcae.apod.analytics.model.domain.policy.tca;
23 import java.math.BigDecimal;
25 import javax.annotation.Nonnull;
29 * Enum for Threshold Direction
31 * @author Rajiv Singla . Creation Date: 11/5/2016.
33 public enum Direction implements TCAPolicyModel {
37 public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
38 return value1.compareTo(value2) == 0;
43 public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
44 return value1.compareTo(value2) < 0;
49 public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
50 return value1.compareTo(value2) <= 0;
55 public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
56 return value1.compareTo(value2) > 0;
61 public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
62 return value1.compareTo(value2) >= 0;
67 * Configure logic for a particular Direction
69 * @param value1 left operand for Direction operation
70 * @param value2 right operand for Direction operation
72 * @return result of operation for the direction logic
74 public abstract Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2);