Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
d5da179a
Commit
d5da179a
authored
10 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
String -> RAbstractStringVector fix
parent
71eeb93b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java
+10
-8
10 additions, 8 deletions
...om/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java
with
10 additions
and
8 deletions
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java
+
10
−
8
View file @
d5da179a
...
...
@@ -267,10 +267,10 @@ public class GrepFunctions {
}
@Specialization
public
Object
regexp
(
String
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
perl
,
byte
fixed
,
byte
useBytes
)
{
public
Object
regexp
(
RAbstractStringVector
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
perl
,
byte
fixed
,
byte
useBytes
)
{
controlVisibility
();
checkExtraArgs
(
ignoreCase
,
perl
,
fixed
,
useBytes
,
RRuntime
.
LOGICAL_FALSE
);
String
pattern
=
RegExp
.
checkPreDefinedClasses
(
patternArg
);
String
pattern
=
RegExp
.
checkPreDefinedClasses
(
patternArg
.
getDataAt
(
0
)
);
int
[]
result
=
new
int
[
vector
.
getLength
()];
for
(
int
i
=
0
;
i
<
vector
.
getLength
();
i
++)
{
result
[
i
]
=
findIndex
(
pattern
,
vector
.
getDataAt
(
i
)).
get
(
0
);
...
...
@@ -310,10 +310,10 @@ public class GrepFunctions {
@Specialization
@Override
public
Object
regexp
(
String
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
perl
,
byte
fixed
,
byte
useBytes
)
{
public
Object
regexp
(
RAbstractStringVector
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
perl
,
byte
fixed
,
byte
useBytes
)
{
controlVisibility
();
checkExtraArgs
(
ignoreCase
,
perl
,
fixed
,
useBytes
,
RRuntime
.
LOGICAL_FALSE
);
String
pattern
=
RegExp
.
checkPreDefinedClasses
(
patternArg
);
String
pattern
=
RegExp
.
checkPreDefinedClasses
(
patternArg
.
getDataAt
(
0
)
);
Object
[]
result
=
new
Object
[
vector
.
getLength
()];
for
(
int
i
=
0
;
i
<
vector
.
getLength
();
i
++)
{
int
[]
data
=
toIntArray
(
findIndex
(
pattern
,
vector
.
getDataAt
(
i
)));
...
...
@@ -345,7 +345,7 @@ public class GrepFunctions {
@SuppressWarnings
(
"unused"
)
@Specialization
public
Object
aGrep
(
String
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
value
,
RIntVector
costs
,
RDoubleVector
bounds
,
byte
useBytes
,
byte
fixed
)
{
public
Object
aGrep
(
RAbstractStringVector
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
byte
value
,
RIntVector
costs
,
RDoubleVector
bounds
,
byte
useBytes
,
byte
fixed
)
{
// TODO implement properly, this only supports strict equality!
controlVisibility
();
checkExtraArgs
(
ignoreCase
,
RRuntime
.
LOGICAL_FALSE
,
RRuntime
.
LOGICAL_FALSE
,
useBytes
,
RRuntime
.
LOGICAL_FALSE
);
...
...
@@ -355,8 +355,9 @@ public class GrepFunctions {
}
int
[]
tmp
=
new
int
[
vector
.
getLength
()];
int
numMatches
=
0
;
String
pattern
=
patternArg
.
getDataAt
(
0
);
for
(
int
i
=
0
;
i
<
vector
.
getLength
();
i
++)
{
if
(
pattern
Arg
.
equals
(
vector
.
getDataAt
(
i
)))
{
if
(
pattern
.
equals
(
vector
.
getDataAt
(
i
)))
{
tmp
[
i
]
=
i
+
1
;
numMatches
++;
}
...
...
@@ -383,13 +384,14 @@ public class GrepFunctions {
@SuppressWarnings
(
"unused"
)
@Specialization
public
Object
aGrep
(
String
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
RIntVector
costs
,
RDoubleVector
bounds
,
byte
useBytes
,
byte
fixed
)
{
public
Object
aGrep
(
RAbstractStringVector
patternArg
,
RAbstractStringVector
vector
,
byte
ignoreCase
,
RIntVector
costs
,
RDoubleVector
bounds
,
byte
useBytes
,
byte
fixed
)
{
// TODO implement properly, this only supports strict equality!
controlVisibility
();
checkExtraArgs
(
ignoreCase
,
RRuntime
.
LOGICAL_FALSE
,
RRuntime
.
LOGICAL_FALSE
,
useBytes
,
RRuntime
.
LOGICAL_FALSE
);
byte
[]
data
=
new
byte
[
vector
.
getLength
()];
String
pattern
=
patternArg
.
getDataAt
(
0
);
for
(
int
i
=
0
;
i
<
vector
.
getLength
();
i
++)
{
data
[
i
]
=
RRuntime
.
asLogical
(
pattern
Arg
.
equals
(
vector
.
getDataAt
(
i
)));
data
[
i
]
=
RRuntime
.
asLogical
(
pattern
.
equals
(
vector
.
getDataAt
(
i
)));
}
return
RDataFactory
.
createLogicalVector
(
data
,
RDataFactory
.
COMPLETE_VECTOR
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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