Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
//
// @author Yves Lafon
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2020.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.values;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import java.math.BigDecimal;
import java.util.ArrayList;
/**
* CSS max().
*
* @spec https://www.w3.org/TR/2019/WD-css-values-4-20190131/#funcdef-max
*/
public class CssMax extends CssCheckableValue {
public static final int type = CssTypes.CSS_MAX;
public final int getRawType() {
return type;
}
public final int getType() {
if (computed_type == CssTypes.CSS_MAX) {
return type;
}
return computed_type;
}
ApplContext ac;
int computed_type = CssTypes.CSS_UNKNOWN;
ArrayList values = null;
String _toString = null;
/**
* Create a new CssCalc
*/
public CssMax() {
}
public CssMax(ApplContext ac) {
this(ac, null);
}
public CssMax(CssValue value) {
this(null, value);
}
public CssMax(ApplContext ac, CssValue value) {
if (ac != null) {
this.ac = ac;
}
if (value != null) {
computed_type = value.getType();
if (values == null) {
values = new ArrayList<>();
}
values.add(value);
try {
computed_type = _checkAcceptableType(value.getType());
} catch (Exception ex) { // todo report error here or wait ?
}
}
}
public void set(String s, ApplContext ac) throws InvalidParamException {
// we don't support this way of setting the value
// as we rely on the parsing to create it incrementally
throw new InvalidParamException("unrecognize", s, ac);
}
public void setValue(BigDecimal d) {
// we don't support this way of setting the value
// as we rely on the parsing to create it incrementally
}
/**
* Add one operand, if we already got one we will... Add one operand.
*
* @param value
* @return
*/
public CssMax addValue(CssValue value)
throws InvalidParamException {
boolean first = false;
if (values == null) {
values = new ArrayList<>();
first = true;
}
values.add(value);
_computeResultingType(false);
return this;
}
public void validate() throws InvalidParamException {
_computeResultingType(true);
}
private int _checkAcceptableType(int type)
throws InvalidParamException {
// , , ,