summaryrefslogtreecommitdiffstats
path: root/modules/php_musicbrainz/mbRelation.php
blob: a03efe1855f3a5640c92a9bcd4c785b81f0eebef (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
	class mbRelation {
		const DIR_BOTH	 = 0;
		const DIR_FORWARD  = 1;
		const DIR_BACKWARD = 2;
		
		const TO_ARTIST  = "http://musicbrainz.org/ns/mmd-1.0#Artist";
		const TO_TRACK   = "http://musicbrainz.org/ns/mmd-1.0#Track";
		const TO_RELEASE = "http://musicbrainz.org/ns/mmd-1.0#Release";
		const TO_URL	 = "http://musicbrainz.org/ns/mmd-1.0#Url";

		private $type;
		private $targetType;
		private $targetId;
		private $direction;
		private $attributes;
		private $beginDate;
		private $endDate;
		private $target;

		function mbRelation( $relationType = '',
						   $targetType = '',
						   $targetId = '',
						   $direction = DIR_BOTH,
						   array $attributes = array(),
						   $beginDate = '',
						   $endDate = '',
						   MusicBrainzEntity $target = null ) {
			$this->type = $relationType;
			$this->targetType = $targetType;
			$this->targetId = $targetId;
			$this->direction = $direction;
			$this->attributes = $attributes;
			$this->beginDate = $beginDate;
			$this->endDate = $endDate;
			$this->target = $target;
		}

		function setType( $type ) {
			$this->type = $type;
		}

		function getType() {
			return $this->type;
		}

		function setTargetType( $ttype ) {
			$this->targetType = $ttype;
		}

		function getTargetType() {
			return $this->targetType;
		}

		function setTargetId( $tid ) {
			$this->targetId = $tid;
		}

		function getTargetId() {
			return $this->targetId;
		}

		function setBeginDate( $bdate ) {
			$this->beginDate = $bdate;
		}

		function getBeginDate() {
			return $this->beginDate;
		}

		function setEndDate( $edate ) {
			$this->endDate = $edate;
		}

		function getEndDate() {
			return $this->endDate;
		}
		
		function getDirection() {
			return $this->direction;
		}

		function setDirection( $dir ) {
			$this->direction = $dir;
		}

		function getTarget() {
			return $this->target;
		}

		function setTarget( MusicBrainzEntity $entity=null ) {
			$this->target = $entity;
		}

		function &getAttributes() {
			return $this->attributes;
		}

		function addAttribute( $value ) {
			$this->attributes[] = $value;
		}

		function getNumAttributes() {
			return count($this->attributes);
		}

		function getAttribute( $i ) {
			return $this->attributes( $i );
		}
	}
?>