001/*
002 *  Copyright 2014 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.runtime.config;
017
018/**
019 * A disable condition for config parameters 
020 */
021public class DisableCondition
022{
023    /**
024     * The available operators
025     */
026    public enum OPERATOR
027    {
028        /** Equals */
029        EQ,
030        /** Non equals */
031        NEQ,
032        /** Greater than */
033        GT,
034        /** Greater or equals */
035        GEQ,
036        /** Less or equals */ 
037        LEQ,
038        /** Less than */
039        LT
040    }
041    
042    private final String _id;
043    private final OPERATOR _operator;
044    private final String _value;
045    
046    /**
047     * Creates a condition
048     * @param id The parameter id
049     * @param operator comparison operator of the condition ('eq'...)
050     * @param value value to compare to
051     */
052    public DisableCondition(String id, OPERATOR operator, String value)
053    {
054        _id = id;
055        _operator = operator;
056        _value = value;
057    }
058
059    /**
060     * Get the id
061     * @return the parameter identifier
062     */
063    public String getId()
064    {
065        return _id;
066    }
067
068    /**
069     * Get the operator
070     * @return The comparison operator
071     */
072    public OPERATOR getOperator()
073    {
074        return _operator;
075    }
076
077    /**
078     * Get the value
079     * @return The value to compare to
080     */
081    public String getValue()
082    {
083        return _value;
084    }
085}