
com.github.dakusui.valid8j_pcond.experimentals.currying.context.CurriedContext Maven / Gradle / Ivy
The newest version!
package com.github.dakusui.valid8j_pcond.experimentals.currying.context;
import com.github.dakusui.valid8j_pcond.internals.InternalUtils;
import java.util.Formattable;
import java.util.Formatter;
import java.util.List;
import static com.github.dakusui.valid8j_pcond.experimentals.currying.context.CurriedContext.PrivateUtils.variableBundleToString;
import static java.util.Collections.singletonList;
/**
* `Context` is a concept to handle multiple values in the `pcond`.
*/
public interface CurriedContext extends Formattable {
/**
* Returns the number of context values.
*
* @return The number of context values.
*/
default int size() {
return values().size();
}
/**
* Returns the context value specified by the index.
*
* @param i The index of the context value to be returned.
* @param Expected type of the returned context value.
* @return The specified context value.
*/
@SuppressWarnings("unchecked")
default T valueAt(int i) {
return (T) values().get(i);
}
/**
* Creates a new context with an appended value.
*
* @param o A value to appended
* @return A new context with the appended value.
*/
default CurriedContext append(Object o) {
return new CurriedContext() {
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy