blob: 950caf3b9db309eb1f3a169405b71e2ab9d6a9c6 (
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
|
<?php
namespace SMW;
/**
* Small data container class for describing filtering conditions on the string
* label of some entity. States that a given string should either be prefix,
* postfix, or some arbitrary part of labels.
*
* @license GNU GPL v2+
* @since 1.0
*
* @author Markus Krötzsch
*/
class StringCondition {
/**
* String matches prefix
*/
const COND_PRE = 0;
const STRCOND_PRE = self::COND_PRE; // Deprecated
/**
* String matches postfix
*/
const COND_POST = 1;
const STRCOND_POST = self::COND_POST; // Deprecated
/**
* String matches to some inner part
*/
const COND_MID = 2;
const STRCOND_MID = self::COND_MID; // Deprecated
/**
* String matches as equal
*/
const COND_EQ = 3;
/**
* String to match.
*
* @var string
*/
public $string;
/**
* Whether to match the strings as conjunction or
* disjunction.
*
* @var boolean
*/
public $isOr;
/**
* @var boolean
*/
public $isNot;
/**
* @var integer
*/
public $condition;
/**
* @since 1.0
*
* @param srting $string
* @param integer $condition
* @param boolean $isOr
*/
public function __construct( $string, $condition, $isOr = false, $isNot = false ) {
$this->string = $string;
$this->condition = $condition;
$this->isOr = $isOr;
$this->isNot = $isNot;
}
/**
* @since 2.4
*
* @return string
*/
public function getHash() {
return $this->string . '#' . $this->condition . '#' . $this->isOr . '#' . $this->isNot;
}
}
|