blob: 48eedb8a9819205086aa46f854ac1c70398f65ee [file] [log] [blame]
/*
* Copyright (c) 2020 Kentyou.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Kentyou - initial API and implementation
*/
package org.eclipse.sensinact.gateway.common.constraint;
/**
* @author <a href="mailto:christophe.munilla@cea.fr">Christophe Munilla</a>
*/
public class MinLength extends ConstraintOnCollectionSize {
public static final String OPERATOR = "+";
/**
* Constructor
*
* @param operator String operator of this constraint
* @param length integer value on which will be based the compliance evaluation
* of the size of a collection
*/
public MinLength(ClassLoader classloader, int length, boolean complement) {
super(classloader, OPERATOR, length, complement);
}
/**
* @inheritDoc
* @see ConstraintOnCollectionSize#
* doComplies(int)
*/
@Override
protected boolean doComplies(int length) {
return this.length <= length;
}
/**
* @inheritDoc
* @see Constraint#getComplement()
*/
@Override
public Constraint getComplement() {
MinLength complement = null;
complement = new MinLength(super.classloader, super.length, !this.complement);
return complement;
}
}