Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotCurveObjectNodeClass.php 2.54 KB
d7f73bcb   Benjamin Renard   Integration for c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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;
	}
}

?>