@@ -52,6 +52,10 @@ public class RDetailsProvider extends DetailsProvider.Basic {
52
52
private static final String RCOMPLEX_VECTOR_FQN = "com.oracle.truffle.r.runtime.data.RComplexVector" ; // NOI18N
53
53
private static final String RINT_SEQUENCE_FQN = "com.oracle.truffle.r.runtime.data.RIntSequence" ; // NOI18N
54
54
private static final String RINT_SEQUENCE1_FQN = "com.oracle.truffle.r.runtime.data.RIntSeqVectorData" ; // NOI18N
55
+ private static final String RDOUBLE_SEQUENCE_FQN = "com.oracle.truffle.r.runtime.data.RDoubleSequence" ; // NOI18N
56
+ private static final String RDOUBLE_SEQUENCE1_FQN = "com.oracle.truffle.r.runtime.data.RDoubleSeqVectorData" ; // NOI18N
57
+ private static final String RSTRING_SEQUENCE_FQN = "com.oracle.truffle.r.runtime.data.RStringSequence" ; // NOI18N
58
+ private static final String RSTRING_SEQUENCE1_FQN = "com.oracle.truffle.r.runtime.data.RStringSeqVectorData" ; // NOI18N
55
59
private static final String REXPRESSION_FQN = "com.oracle.truffle.r.runtime.data.RExpression" ; // NOI18N
56
60
private static final String RWRAPPER_MASK = "com.oracle.truffle.r.runtime.data.RForeignWrapper+" ; // NOI18N
57
61
private static final String RSYMBOL_MASK = "com.oracle.truffle.r.runtime.data.RSymbol" ; //NOI18N
@@ -67,8 +71,9 @@ public class RDetailsProvider extends DetailsProvider.Basic {
67
71
68
72
public RDetailsProvider () {
69
73
super (RVECTOR_MASK , RABSTRACT_VECTOR_MASK , RSCALAR_VECTOR_MASK , RINT_SEQUENCE_FQN ,
70
- RINT_SEQUENCE1_FQN , RWRAPPER_MASK , RSYMBOL_MASK , RFUNCTION_MASK ,
71
- RS4OBJECT_MASK , RNULL_MASK , RENVIRONMENT_MASK , CHARSXPWRAPPER_FQN );
74
+ RINT_SEQUENCE1_FQN , RDOUBLE_SEQUENCE_FQN , RDOUBLE_SEQUENCE1_FQN ,
75
+ RSTRING_SEQUENCE_FQN , RSTRING_SEQUENCE1_FQN , RWRAPPER_MASK , RSYMBOL_MASK ,
76
+ RFUNCTION_MASK , RS4OBJECT_MASK , RNULL_MASK , RENVIRONMENT_MASK , CHARSXPWRAPPER_FQN );
72
77
}
73
78
74
79
public String getDetailsString (String className , Instance instance , Heap heap ) {
@@ -164,18 +169,33 @@ public String getDetailsString(String className, Instance instance, Heap heap) {
164
169
return getScalar (instance , heap );
165
170
}
166
171
if (RINT_SEQUENCE_FQN .equals (className ) || RINT_SEQUENCE1_FQN .equals (className )) {
167
- Integer stride = (Integer ) instance .getValueOfField ("stride" ); // NOI18N
168
- Integer start = (Integer ) instance .getValueOfField ("start" ); // NOI18N
172
+ String val = logicalValueForIntSeq (instance );
173
+ if (val != null ) {
174
+ return val ;
175
+ }
176
+ }
177
+ if (RDOUBLE_SEQUENCE_FQN .equals (className ) || RDOUBLE_SEQUENCE1_FQN .equals (className )) {
178
+ Double stride = (Double ) instance .getValueOfField ("stride" ); // NOI18N
179
+ Double start = (Double ) instance .getValueOfField ("start" ); // NOI18N
169
180
Integer len = (Integer ) instance .getValueOfField ("length" ); // NOI18N
170
181
171
182
if (stride != null && start != null & len != null ) {
172
183
int length = len .intValue ();
173
184
if (length == 0 ) { // empty vector
174
- return "[]" ;
185
+ return "[]" ; // NOI18N
175
186
}
176
- if (stride .intValue () == 1 ) {
177
- int end = start .intValue () + length -1 ;
178
- return "[" +start .intValue ()+":" +end +"]" ;
187
+ double end = start .doubleValue ()+ (length -1 ) * stride .doubleValue ();
188
+ return "seq(" +start +"," +end +"," +stride +")" ; // NOI18N
189
+ }
190
+ }
191
+ if (RSTRING_SEQUENCE_FQN .equals (className ) || RSTRING_SEQUENCE1_FQN .equals (className )) {
192
+ String val = logicalValueForIntSeq (instance );
193
+ if (val != null ) {
194
+ String prefix = DetailsUtils .getInstanceFieldString (instance , "prefix" , heap ); // NOI18N
195
+ String suffix = DetailsUtils .getInstanceFieldString (instance , "suffix" , heap ); // NOI18N
196
+
197
+ if (prefix != null && suffix != null ) {
198
+ return "paste0(\" " +prefix +"\" , " +val +", \" " +suffix +"\" )" ;
179
199
}
180
200
}
181
201
}
@@ -217,6 +237,25 @@ public String getDetailsString(String className, Instance instance, Heap heap) {
217
237
return null ;
218
238
}
219
239
240
+ private String logicalValueForIntSeq (Instance instance ) {
241
+ Integer stride = (Integer ) instance .getValueOfField ("stride" ); // NOI18N
242
+ Integer start = (Integer ) instance .getValueOfField ("start" ); // NOI18N
243
+ Integer len = (Integer ) instance .getValueOfField ("length" ); // NOI18N
244
+
245
+ if (stride != null && start != null & len != null ) {
246
+ int length = len .intValue ();
247
+ if (length == 0 ) { // empty vector
248
+ return "[]" ; // NOI18N
249
+ }
250
+ int end = start .intValue () + (length -1 ) * stride .intValue ();
251
+ if (stride .intValue () == 1 ) {
252
+ return "[" +start .intValue ()+":" +end +"]" ; // NOI18N
253
+ }
254
+ return "seq(" +start +"," +end +"," +stride +")" ; // NOI18N
255
+ }
256
+ return null ;
257
+ }
258
+
220
259
private String getRClassName (Instance instance , Heap heap ) {
221
260
Instance attributesInst = (Instance ) instance .getValueOfField ("attributes" ); // NOI18N
222
261
if (attributesInst != null ) {
0 commit comments