Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
9e3c6e9c
Commit
9e3c6e9c
authored
13 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Change type of some fields of ApplyOperator.
parent
f5bf93e5
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/ops/match/applyoperator.cpp
+16
-16
16 additions, 16 deletions
libwccl/ops/match/applyoperator.cpp
libwccl/ops/match/applyoperator.h
+6
-4
6 additions, 4 deletions
libwccl/ops/match/applyoperator.h
with
22 additions
and
20 deletions
libwccl/ops/match/applyoperator.cpp
+
16
−
16
View file @
9e3c6e9c
...
...
@@ -8,8 +8,8 @@ ApplyOperator::ApplyOperator(
const
VariableAccessor
<
Position
>&
cur_iter_pos
,
const
VariableAccessor
<
Match
>&
matches
,
const
boost
::
shared_ptr
<
const
MatchOperator
>&
match_op
,
const
std
::
vector
<
boost
::
shared_ptr
<
const
MatchAction
>
>&
actions
,
const
std
::
vector
<
boost
::
shared_ptr
<
const
Function
<
Bool
>
>
>&
conditions
)
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
MatchAction
>
>
>&
actions
,
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
Function
<
Bool
>
>
>
>&
conditions
)
:
_cur_iter_pos
(
cur_iter_pos
),
_matches
(
matches
),
_match_op
(
match_op
),
...
...
@@ -17,7 +17,7 @@ ApplyOperator::ApplyOperator(
_conditions
(
conditions
)
{
BOOST_ASSERT
(
_match_op
);
BOOST_ASSERT
(
actions
.
size
()
>
0
);
BOOST_ASSERT
(
actions
->
size
()
>
0
);
}
void
ApplyOperator
::
execute
(
const
ActionExecContext
&
context
)
const
...
...
@@ -32,12 +32,12 @@ void ApplyOperator::execute(const ActionExecContext &context) const
boost
::
shared_ptr
<
Match
>
match
=
_match_op
->
apply
(
iter_pos
,
context
);
// Execute the actions only if match isn't empty and all post-conditions are met:
bool
should_act
=
!
match
->
empty
();
for
(
size_t
i
=
0
;
should_act
&&
i
<
_conditions
.
size
();
++
i
)
{
should_act
=
_conditions
[
i
]
->
apply
(
context
)
->
get_value
();
for
(
size_t
i
=
0
;
should_act
&&
i
<
_conditions
->
size
();
++
i
)
{
should_act
=
(
*
_conditions
)
[
i
]
->
apply
(
context
)
->
get_value
();
}
if
(
should_act
)
{
matches
->
append
(
match
);
// the match goes to $m:_M[0]
foreach
(
const
boost
::
shared_ptr
<
const
MatchAction
>&
action
,
_actions
)
{
foreach
(
const
boost
::
shared_ptr
<
MatchAction
>&
action
,
*
_actions
)
{
action
->
execute
(
context
);
}
}
...
...
@@ -55,22 +55,22 @@ std::string ApplyOperator::to_string(const Corpus2::Tagset& tagset) const
{
std
::
ostringstream
ostream
;
ostream
<<
name
()
<<
"("
<<
_match_op
->
to_string
(
tagset
)
<<
", "
;
if
(
!
_conditions
.
empty
())
{
if
(
!
_conditions
->
empty
())
{
ostream
<<
"cond("
;
for
(
size_t
i
=
0
;
i
<
_conditions
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
_conditions
->
size
();
++
i
)
{
if
(
i
!=
0
)
{
ostream
<<
", "
;
}
ostream
<<
_conditions
[
i
]
->
to_string
(
tagset
);
ostream
<<
(
*
_conditions
)
[
i
]
->
to_string
(
tagset
);
}
ostream
<<
"), "
;
}
ostream
<<
"actions("
;
for
(
size_t
i
=
0
;
i
<
_actions
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
_actions
->
size
();
++
i
)
{
if
(
i
!=
0
)
{
ostream
<<
", "
;
}
ostream
<<
_actions
[
i
]
->
to_string
(
tagset
);
ostream
<<
(
*
_actions
)
[
i
]
->
to_string
(
tagset
);
}
ostream
<<
"))"
;
return
ostream
.
str
();
...
...
@@ -79,22 +79,22 @@ std::string ApplyOperator::to_string(const Corpus2::Tagset& tagset) const
std
::
ostream
&
ApplyOperator
::
write_to
(
std
::
ostream
&
ostream
)
const
{
ostream
<<
name
()
<<
"("
<<
*
_match_op
<<
", "
;
if
(
!
_conditions
.
empty
())
{
if
(
!
_conditions
->
empty
())
{
ostream
<<
"cond("
;
for
(
size_t
i
=
0
;
i
<
_conditions
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
_conditions
->
size
();
++
i
)
{
if
(
i
!=
0
)
{
ostream
<<
", "
;
}
ostream
<<
*
_conditions
[
i
];
ostream
<<
*
(
*
_conditions
)
[
i
];
}
ostream
<<
"), "
;
}
ostream
<<
"actions("
;
for
(
size_t
i
=
0
;
i
<
_actions
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
(
*
_actions
)
.
size
();
++
i
)
{
if
(
i
!=
0
)
{
ostream
<<
", "
;
}
ostream
<<
*
_actions
[
i
];
ostream
<<
*
(
*
_actions
)
[
i
];
}
ostream
<<
"))"
;
return
ostream
;
...
...
This diff is collapsed.
Click to expand it.
libwccl/ops/match/applyoperator.h
+
6
−
4
View file @
9e3c6e9c
...
...
@@ -26,8 +26,10 @@ public:
const
VariableAccessor
<
Position
>&
cur_iter_pos
,
const
VariableAccessor
<
Match
>&
matches
,
const
boost
::
shared_ptr
<
const
MatchOperator
>&
match_op
,
const
std
::
vector
<
boost
::
shared_ptr
<
const
MatchAction
>
>&
actions
,
const
std
::
vector
<
boost
::
shared_ptr
<
const
Function
<
Bool
>
>
>&
conditions
=
(
std
::
vector
<
boost
::
shared_ptr
<
const
Function
<
Bool
>
>
>
()));
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
MatchAction
>
>
>&
actions
,
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
Function
<
Bool
>
>
>
>&
conditions
=
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
Function
<
Bool
>
>
>
>
(
new
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
Function
<
Bool
>
>
>
>
()));
/**
* @returns Name of the operator.
...
...
@@ -61,8 +63,8 @@ private:
const
VariableAccessor
<
Position
>
_cur_iter_pos
;
const
VariableAccessor
<
Match
>
_matches
;
const
boost
::
shared_ptr
<
const
MatchOperator
>
_match_op
;
const
std
::
vector
<
boost
::
shared_ptr
<
const
MatchAction
>
>
_actions
;
const
std
::
vector
<
boost
::
shared_ptr
<
const
Function
<
Bool
>
>
>
_conditions
;
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
MatchAction
>
>
>
_actions
;
const
boost
::
shared_ptr
<
const
std
::
vector
<
boost
::
shared_ptr
<
Function
<
Bool
>
>
>
>
_conditions
;
};
}
/* end ns Wccl */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment