Cross Reference: IfThenElseImpl.java
xref
: /
owl-s
/
src
/
impl
/
owls
/
process
/
constructs
/
IfThenElseImpl.java
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
2
ronwalf
/*
2
ronwalf
* Created on Aug 30, 2004
2
ronwalf
*/
22
daenzerorama
package
impl
.
owls
.
process
.
constructs
;
2
ronwalf
22
daenzerorama
import
impl
.
owls
.
process
.
ProcessListImpl
;
22
daenzerorama
2
ronwalf
import
java
.
util
.
ArrayList
;
2
ronwalf
import
java
.
util
.
List
;
2
ronwalf
2
ronwalf
import
org
.
mindswap
.
owl
.
OWLIndividual
;
2
ronwalf
import
org
.
mindswap
.
owls
.
process
.
Condition
;
2
ronwalf
import
org
.
mindswap
.
owls
.
process
.
ControlConstruct
;
2
ronwalf
import
org
.
mindswap
.
owls
.
process
.
IfThenElse
;
2
ronwalf
import
org
.
mindswap
.
owls
.
process
.
ProcessList
;
2
ronwalf
import
org
.
mindswap
.
owls
.
vocabulary
.
OWLS
;
2
ronwalf
2
ronwalf
/**
2
ronwalf
*
@author
Evren Sirin
2
ronwalf
*/
2
ronwalf
public
class
IfThenElseImpl
extends
ControlConstructImpl
implements
IfThenElse
{
2
ronwalf
public
IfThenElseImpl
(
OWLIndividual
ind
) {
2
ronwalf
super
(
ind
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
ControlConstruct
getThen
() {
2
ronwalf
return
(
ControlConstruct
)
getPropertyAs
(
OWLS
.
Process
.
thenP
,
ControlConstruct
.
class
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
ControlConstruct
getElse
() {
2
ronwalf
return
(
ControlConstruct
)
getPropertyAs
(
OWLS
.
Process
.
elseP
,
ControlConstruct
.
class
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
Condition
getCondition
() {
2
ronwalf
return
(
Condition
)
getPropertyAs
(
OWLS
.
Process
.
ifCondition
,
Condition
.
class
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
void
setCondition
(
Condition
condition
) {
2
ronwalf
setProperty
(
OWLS
.
Process
.
ifCondition
,
condition
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
void
setThen
(
ControlConstruct
cc
) {
2
ronwalf
setProperty
(
OWLS
.
Process
.
thenP
,
cc
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
void
setElse
(
ControlConstruct
cc
) {
2
ronwalf
setProperty
(
OWLS
.
Process
.
elseP
,
cc
);
2
ronwalf
}
2
ronwalf
2
ronwalf
public
List
getConstructs
() {
2
ronwalf
ControlConstruct
thenP
=
getThen
();
2
ronwalf
ControlConstruct
elseP
=
getElse
();
2
ronwalf
2
ronwalf
List
list
=
new
ArrayList
();
2
ronwalf
list
.
add
(
thenP
);
2
ronwalf
if
(
elseP
!=
null
)
list
.
add
(
elseP
);
2
ronwalf
return
list
;
2
ronwalf
}
2
ronwalf
2
ronwalf
public
ProcessList
getAllProcesses
(
boolean
recursive
) {
2
ronwalf
ControlConstruct
thenP
=
getThen
();
2
ronwalf
ControlConstruct
elseP
=
getElse
();
2
ronwalf
2
ronwalf
ProcessList
list
=
new
ProcessListImpl
();
2
ronwalf
list
.
addAll
(
thenP
.
getAllProcesses
(
recursive
));
2
ronwalf
if
(
elseP
!=
null
)
list
.
addAll
(
elseP
.
getAllProcesses
(
recursive
));
2
ronwalf
2
ronwalf
return
list
;
2
ronwalf
}
2
ronwalf
2
ronwalf
public
String
getConstructName
() {
2
ronwalf
return
"If-Then-Else"
;
2
ronwalf
}
2
ronwalf
16
daenzerorama
public
boolean
removeConstruct
(
ControlConstruct
CC
) {
16
daenzerorama
if
(
getThen
().
equals
(
CC
))
16
daenzerorama
setThen
(
null
);
16
daenzerorama
if
(
getElse
().
equals
(
CC
))
16
daenzerorama
setElse
(
null
);
16
daenzerorama
return
true
;
18
daenzerorama
}
18
daenzerorama
18
daenzerorama
public
void
deleteElse
() {
18
daenzerorama
ControlConstruct
elseCC
=
getElse
();
18
daenzerorama
removeElse
();
18
daenzerorama
elseCC
.
delete
();
18
daenzerorama
}
18
daenzerorama
18
daenzerorama
public
void
deleteThen
() {
18
daenzerorama
ControlConstruct
thenCC
=
getThen
();
18
daenzerorama
removeThen
();
18
daenzerorama
thenCC
.
delete
();
18
daenzerorama
}
18
daenzerorama
18
daenzerorama
public
void
removeElse
() {
18
daenzerorama
if
(
hasProperty
(
OWLS
.
Process
.
elseP
))
18
daenzerorama
removeProperties
(
OWLS
.
Process
.
elseP
);
18
daenzerorama
}
18
daenzerorama
18
daenzerorama
public
void
removeThen
() {
18
daenzerorama
if
(
hasProperty
(
OWLS
.
Process
.
thenP
))
18
daenzerorama
removeProperties
(
OWLS
.
Process
.
thenP
);
18
daenzerorama
}
18
daenzerorama
18
daenzerorama
@
Override
18
daenzerorama
public
void
delete
() {
18
daenzerorama
deleteElse
();
18
daenzerorama
deleteThen
();
18
daenzerorama
individual
.
delete
();
16
daenzerorama
}
18
daenzerorama
18
daenzerorama
2
ronwalf
}