org.solovyev.common.text.NumberIntervalMapper Maven / Gradle / Ivy
/*
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
* For more information, please, contact [email protected]
* or visit http://se.solovyev.org
*/
package org.solovyev.common.text;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.common.interval.Interval;
import org.solovyev.common.interval.IntervalImpl;
import org.solovyev.common.interval.IntervalLimit;
import org.solovyev.common.interval.IntervalLimitImpl;
/**
* User: serso
* Date: 9/20/11
* Time: 11:56 PM
*/
public class NumberIntervalMapper> extends GenericIntervalMapper {
public NumberIntervalMapper(@NotNull Class clazz) {
super(new NumberMapper(clazz));
}
@NotNull
@Override
protected Interval newInstance(@Nullable T left, @Nullable T right) {
final IntervalLimit leftLimit;
if (left == null) {
leftLimit = IntervalLimitImpl.newLowest();
} else {
leftLimit = IntervalLimitImpl.newInstance(left, true);
}
final IntervalLimit rightLimit;
if (right == null) {
rightLimit = IntervalLimitImpl.newHighest();
} else {
rightLimit = IntervalLimitImpl.newInstance(right, true);
}
return new IntervalImpl(leftLimit, rightLimit);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy