bacoAlunos
ENGSOFT2019
BlueGrey
calm
Elegant
Català-Valencià - Catalan
中文 - Chinese (Simplified)
中文 - Chinese (Traditional)
Česky - Czech
Dansk - Danish
Nederlands - Dutch
English - English
Suomi - Finnish
Français - French
Deutsch - German
עברית - Hebrew
हिंदी - Hindi
Magyar - Hungarian
Bahasa Indonesia - Indonesian
Italiano - Italian
日本語 - Japanese
한국어 - Korean
मराठी - Marathi
Norsk - Norwegian
Polski - Polish
Português - Portuguese
Português - Portuguese (Brazil)
Русский - Russian
Slovenčina - Slovak
Slovenščina - Slovenian
Español - Spanish
Svenska - Swedish
Türkçe - Turkish
Oëzbekcha - Uzbek
Subversion Repositories
bacoAlunos
(root)
/
impl
/
src
/
java
/
pt
/
utl
/
ist
/
berserk
/
logic
/
filterManager
/
FilterParameters.java
@ 1
- Rev
Rev
Blame
|
Compare with Previous
|
Last modification
|
View Log
|
RSS feed
/*
* Created on Apr 3, 2004
*
* by gedl
*/
package
pt.utl.ist.berserk.logic.filterManager
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
pt.utl.ist.berserk.util.Dictionary
;
/**
* Created on Apr 3, 2004
*
* @author gedl
*
*/
public
class
FilterParameters
{
private
class
ParameterKey
{
private
1.
5
.0/docs/api/java/lang/String.html">
String
name
;
private
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
index
;
public
ParameterKey
(
1.
5
.0/docs/api/java/lang/String.html">
String
name,
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
index
)
{
this
.
setIndex
(
index
)
;
this
.
setName
(
name
)
;
}
public
ParameterKey
(
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
index
)
{
this
.
setIndex
(
index
)
;
}
public
ParameterKey
(
1.
5
.0/docs/api/java/lang/String.html">
String
name
)
{
this
.
setName
(
name
)
;
}
/**
* @return Returns the index.
*/
public
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
getIndex
(
)
{
return
this
.
index
;
}
/**
* @param index
* The index to set.
*/
public
void
setIndex
(
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
index
)
{
this
.
index
= index
;
}
/**
* @return Returns the name.
*/
public
1.
5
.0/docs/api/java/lang/String.html">
String
getName
(
)
{
return
this
.
name
;
}
/**
* @param name
* The name to set.
*/
public
void
setName
(
1.
5
.0/docs/api/java/lang/String.html">
String
name
)
{
this
.
name
= name
;
}
public
boolean
equals
(
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
obj
)
{
boolean
result =
false
;
if
(
obj
instanceof
ParameterKey
)
{
ParameterKey key =
(
ParameterKey
)
obj
;
if
(
this
.
getName
(
)
!
=
null
)
{
result =
this
.
getName
(
)
.
equals
(
key.
getName
(
)
)
;
}
if
(
this
.
getIndex
(
)
!
=
null
)
{
result |=
this
.
getIndex
(
)
.
equals
(
key.
getIndex
(
)
)
;
}
}
return
result
;
}
public
int
hashCode
(
)
{
//TODO: do something usefull here
return
1
;
}
public
1.
5
.0/docs/api/java/lang/String.html">
String
toString
(
)
{
1.
5
.0/docs/api/java/lang/String.html">
String
result =
"[ParameterKey:"
;
result +=
"Name="
+
this
.
getName
(
)
;
result +=
"Index="
+
this
.
getIndex
(
)
;
result +=
"]"
;
return
result
;
}
}
private
1.
5
.0/docs/api/java/util/Dictionary.html">
Dictionary
parametersMap
;
// stores key/value
private
long
id =
1
;
public
FilterParameters
(
)
{
this
.
parametersMap
=
new
1.
5
.0/docs/api/java/util/Dictionary.html">
Dictionary
(
)
;
}
public
void
addParameter
(
1.
5
.0/docs/api/java/lang/String.html">
String
name,
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
value
)
{
1.
5
.0/docs/api/java/lang/String.html">
String
key = name
;
if
(
key ==
null
)
{
key =
"FP"
+
(
++
this
.
id
)
;
}
ParameterKey parameterKey =
new
ParameterKey
(
key
)
;
parameterKey.
setIndex
(
new
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
(
this
.
parametersMap
.
size
(
)
)
)
;
this
.
parametersMap
.
put
(
parameterKey, value
)
;
}
public
void
addParameter
(
1.
5
.0/docs/api/java/lang/String.html">
String
name,
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
value,
int
index
)
{
1.
5
.0/docs/api/java/lang/String.html">
String
key = name
;
if
(
key ==
null
)
{
key =
"FP"
+
(
++
this
.
id
)
;
}
ParameterKey parameterKey =
new
ParameterKey
(
key
)
;
parameterKey.
setIndex
(
new
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
(
index
)
)
;
this
.
parametersMap
.
put
(
parameterKey, value
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
removeParameter
(
1.
5
.0/docs/api/java/lang/String.html">
String
name
)
{
ParameterKey parameterKey =
new
ParameterKey
(
new
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
(
name
)
)
;
return
this
.
parametersMap
.
remove
(
parameterKey
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
removeParameter
(
int
index
)
{
ParameterKey parameterKey =
new
ParameterKey
(
new
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
(
index
)
)
;
return
this
.
parametersMap
.
remove
(
parameterKey
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
getParameter
(
1.
5
.0/docs/api/java/lang/String.html">
String
name
)
{
ParameterKey parameterKey =
new
ParameterKey
(
name
)
;
return
this
.
parametersMap
.
get
(
parameterKey
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
getParameter
(
int
index
)
{
ParameterKey parameterKey =
new
ParameterKey
(
new
1.
5
.0/docs/api/java/lang/Integer.html">
Integer
(
index
)
)
;
return
this
.
parametersMap
.
get
(
parameterKey
)
;
}
public
5+
0
%
2Fdocs
%
2Fapi+Object">
Object
[
]
parametersArray
(
)
{
return
this
.
parametersCollection
(
)
.
toArray
(
)
;
}
public
1.
5
.0/docs/api/java/util/Collection.html">
Collection
parametersCollection
(
)
{
1.
5
.0/docs/api/java/util/Collection.html">
Collection
collection =
new
1.
5
.0/docs/api/java/util/ArrayList.html">
ArrayList
(
)
;
int
size =
this
.
parametersMap
.
size
(
)
;
for
(
int
i =
0
;
i
<
size
;
i++
)
{
collection.
add
(
this
.
getParameter
(
i
)
)
;
}
return
collection
;
}
public
1.
5
.0/docs/api/java/lang/String.html">
String
toString
(
)
{
return
this
.
parametersMap
.
toString
(
)
;
}
}