![JAR search and dependency download from the Maven repository](/logo.png)
com.inamik.text.tables.line.base.FunctionWithWidth Maven / Gradle / Ivy
The newest version!
/*
* iNamik Text Tables for Java
*
* Copyright (C) 2016 David Farrell ([email protected])
*
* Licensed under The MIT License (MIT), see LICENSE.txt
*/
package com.inamik.text.tables.line.base;
public abstract class FunctionWithWidth
{
public abstract String apply(Integer width, String line);
public static final FunctionWithWidth IDENTITY = new FunctionWithWidth() {
@Override
public Function withWidth(int _1) {
return Function.IDENTITY;
}
@Override
public String apply(Integer _1, String line) { return line; }
};
public Function withWidth(final int width) {
// curry(this, width)
//
final FunctionWithWidth f = this;
return new Function() {
@Override
public String apply(String line) {
return f.apply(width, line);
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy