org.dmg.pmml.ComplexArray Maven / Gradle / Ivy
/*
* Copyright (c) 2019 Villu Ruusmann
*/
package org.dmg.pmml;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.jpmml.model.ArrayUtil;
import org.jpmml.model.annotations.Property;
import org.jpmml.model.annotations.ValueConstructor;
public class ComplexArray extends Array {
public ComplexArray(){
}
@ValueConstructor
public ComplexArray(@Property("type") Array.Type type, @Property("value") Collection> value){
super(type, requireComplexValue(value));
}
@Override
public ComplexArray setN(@Property("n") Integer n){
return (ComplexArray)super.setN(n);
}
@Override
public ComplexArray setType(@Property("type") Array.Type type){
return (ComplexArray)super.setType(type);
}
@Override
public Collection> getValue(){
return (Collection>)super.getValue();
}
public ComplexArray setValue(List> values){
return (ComplexArray)super.setValue(new ListValue(this, values));
}
public ComplexArray setValue(Set> values){
return (ComplexArray)super.setValue(new SetValue(this, values));
}
@Override
public ComplexArray setValue(@Property("value") Object value){
return (ComplexArray)super.setValue(requireComplexValue(value));
}
static
public & ComplexValue> V requireComplexValue(Object value){
if(value == null){
return null;
} // End if
if((value instanceof Collection) && (value instanceof ComplexValue)){
return (V)value;
}
throw new IllegalArgumentException();
}
static
public class ListValue extends ArrayList