RequestOutputPlotCurveObjectNodeClass.php 2.54 KB
<?php

define ("REQUESTOUTPUTPLOTCURVEOBJECT_NAME", "curvePlot");
define ("REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID", "serieId");

define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME", "function");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME", "name");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES", "attributes");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE", "attribute");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME", "name");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE", "value");

/**
 * @class RequestOutputPlotCurveObjectFunctionNodeClass
 * @brief Definition of a function for a curve object element of a plot
 * @details
 */
class RequestOutputPlotCurveObjectFunctionNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
	}
	
	public function setFunctionName($name)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME, $name);
	}
	
	public function getFunctionName()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME);
	}
	
	public function getAttributes()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES);
	
		if (!isset($node))
		{
			$node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES);
			$this->addChild($node);
		}
	
		return $node;
	}
	
	public function addAttribute($name, $value)
	{
		$attributesNode = $this->getAttributes();
		
		$node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE);
		
		$node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME, $name);
		$node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE, $value);
		
		$attributesNode->addChild($node);
		return $node;
	}
}

/**
 * @class RequestOutputPlotCurveObjectNodeClass
 * @brief Definition of a curve object element for a plot
 * @details
 */
class RequestOutputPlotCurveObjectNodeClass extends RequestOutputPlotCurveNodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECT_NAME);
	}
	
	public function setSerieId($serieId)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID, $serieId);
	}
	
	public function getSerieId()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID);
	}
	
	public function getFunction()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
	
		if (!isset($node))
		{
			$node = new RequestOutputPlotCurveObjectFunctionNodeClass();
			$this->addChild($node);
		}
	
		return $node;
	}
}

?>