
org.jpmml.rexp.RPair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pmml-rexp Show documentation
Show all versions of pmml-rexp Show documentation
JPMML R to PMML converter
/*
* Copyright (c) 2016 Villu Ruusmann
*
* This file is part of JPMML-R
*
* JPMML-R is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JPMML-R is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with JPMML-R. If not, see .
*/
package org.jpmml.rexp;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
public class RPair extends RExp {
private RExp tag = null;
private RExp value = null;
private RPair next = null;
public RPair(RExp tag, RExp value, RPair attributes){
super(attributes);
setTag(tag);
setValue(value);
}
@Override
public void write(RDataOutput output) throws IOException {
RExp tag = getTag();
RExp value = getValue();
RPair attributes = getAttributes();
RPair next = getNext();
int flags = SExpTypes.LISTSXP;
if(attributes != null){
flags = SerializationUtil.setHasAttributes(flags);
} // End if
if(tag != null){
flags = SerializationUtil.setHasTag(flags);
}
output.writeInt(flags);
if(attributes != null){
attributes.write(output);
} // End if
if(tag != null){
RString string = (RString)tag;
RExpWriter writer = output.getWriter();
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy