
com.metreeca.json.shapes.MinExclusive Maven / Gradle / Ivy
/*
* Copyright © 2013-2021 Metreeca srl
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.metreeca.json.shapes;
import com.metreeca.json.Shape;
import org.eclipse.rdf4j.model.Value;
import static com.metreeca.json.Values.format;
import static com.metreeca.json.Values.value;
/**
* Exclusive minimum value constraint.
*
* States that each value in the focus set is strictly greater than a given minimum value, according to SPARQL ordering rules.
*/
public final class MinExclusive extends Shape {
public static Shape minExclusive(final Object limit) {
if ( limit == null ) {
throw new NullPointerException("null limit");
}
return new MinExclusive(value(limit));
}
public static Shape minExclusive(final Value limit) {
if ( limit == null ) {
throw new NullPointerException("null limit");
}
return new MinExclusive(limit);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private final Value limit;
private MinExclusive(final Value limit) {
this.limit=limit;
}
public Value limit() {
return limit;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override public T map(final Probe probe) {
if ( probe == null ) {
throw new NullPointerException("null probe");
}
return probe.probe(this);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override public boolean equals(final Object object) {
return this == object || object instanceof MinExclusive
&& limit.equals(((MinExclusive)object).limit);
}
@Override public int hashCode() {
return limit.hashCode();
}
@Override public String toString() {
return "minExclusive("+format(limit)+")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy