calabash-android 0.4.0.pre10 → 0.4.0.pre11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/operations.rb +19 -2
- data/lib/calabash-android/steps/list_steps.rb +1 -1
- data/lib/calabash-android/steps/time_picker_steps.rb +1 -1
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/AndroidManifest.xml +2 -0
- data/test-server/instrumentation-backend/antlr/UIQuery.g +13 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/CalabashChromeClient.java +1 -6
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/ExecuteJavascript.java +10 -11
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/InvocationOperation.java +26 -5
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/Query.java +6 -2
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQuery.tokens +17 -14
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryLexer.java +727 -236
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryParser.java +212 -78
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/BeginsWithRelation.java +45 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ComparisonOperator.java +54 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ContainsRelation.java +41 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/EndsWithRelation.java +42 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/LikeRelation.java +79 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicate.java +147 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicateRelation.java +5 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTWith.java +3 -26
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryUtils.java +50 -9
- metadata +9 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
// $ANTLR 3.4 antlr/UIQuery.g 2013-01-
|
1
|
+
// $ANTLR 3.4 antlr/UIQuery.g 2013-01-24 10:28:02
|
2
2
|
|
3
3
|
package sh.calaba.instrumentationbackend.query.antlr;
|
4
4
|
|
@@ -14,25 +14,28 @@ import org.antlr.runtime.tree.*;
|
|
14
14
|
@SuppressWarnings({"all", "warnings", "unchecked"})
|
15
15
|
public class UIQueryParser extends Parser {
|
16
16
|
public static final String[] tokenNames = new String[] {
|
17
|
-
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "ALL", "BOOL", "ESC_SEQ", "FILTER_COLON", "HEX_DIGIT", "INT", "NAME", "NIL", "OCTAL_ESC", "QUALIFIED_NAME", "STRING", "UNICODE_ESC", "VISIBLE", "WHITE", "WILDCARD"
|
17
|
+
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "ALL", "BEGINPRED", "BOOL", "ENDPRED", "ESC_SEQ", "FILTER_COLON", "HEX_DIGIT", "INT", "NAME", "NIL", "OCTAL_ESC", "QUALIFIED_NAME", "RELATION", "STRING", "UNICODE_ESC", "VISIBLE", "WHITE", "WILDCARD"
|
18
18
|
};
|
19
19
|
|
20
20
|
public static final int EOF=-1;
|
21
21
|
public static final int ALL=4;
|
22
|
-
public static final int
|
23
|
-
public static final int
|
24
|
-
public static final int
|
25
|
-
public static final int
|
26
|
-
public static final int
|
27
|
-
public static final int
|
28
|
-
public static final int
|
29
|
-
public static final int
|
30
|
-
public static final int
|
31
|
-
public static final int
|
32
|
-
public static final int
|
33
|
-
public static final int
|
34
|
-
public static final int
|
35
|
-
public static final int
|
22
|
+
public static final int BEGINPRED=5;
|
23
|
+
public static final int BOOL=6;
|
24
|
+
public static final int ENDPRED=7;
|
25
|
+
public static final int ESC_SEQ=8;
|
26
|
+
public static final int FILTER_COLON=9;
|
27
|
+
public static final int HEX_DIGIT=10;
|
28
|
+
public static final int INT=11;
|
29
|
+
public static final int NAME=12;
|
30
|
+
public static final int NIL=13;
|
31
|
+
public static final int OCTAL_ESC=14;
|
32
|
+
public static final int QUALIFIED_NAME=15;
|
33
|
+
public static final int RELATION=16;
|
34
|
+
public static final int STRING=17;
|
35
|
+
public static final int UNICODE_ESC=18;
|
36
|
+
public static final int VISIBLE=19;
|
37
|
+
public static final int WHITE=20;
|
38
|
+
public static final int WILDCARD=21;
|
36
39
|
|
37
40
|
// delegates
|
38
41
|
public Parser[] getDelegates() {
|
@@ -180,7 +183,7 @@ public TreeAdaptor getTreeAdaptor() {
|
|
180
183
|
|
181
184
|
|
182
185
|
// $ANTLR start "expr"
|
183
|
-
// antlr/UIQuery.g:38:1: expr : ( className | filter | visibility ) ;
|
186
|
+
// antlr/UIQuery.g:38:1: expr : ( className | filter | visibility | predicate ) ;
|
184
187
|
public final UIQueryParser.expr_return expr() throws RecognitionException {
|
185
188
|
UIQueryParser.expr_return retval = new UIQueryParser.expr_return();
|
186
189
|
retval.start = input.LT(1);
|
@@ -194,17 +197,19 @@ public TreeAdaptor getTreeAdaptor() {
|
|
194
197
|
|
195
198
|
UIQueryParser.visibility_return visibility6 =null;
|
196
199
|
|
200
|
+
UIQueryParser.predicate_return predicate7 =null;
|
201
|
+
|
197
202
|
|
198
203
|
|
199
204
|
try {
|
200
|
-
// antlr/UIQuery.g:38:6: ( ( className | filter | visibility ) )
|
201
|
-
// antlr/UIQuery.g:38:8: ( className | filter | visibility )
|
205
|
+
// antlr/UIQuery.g:38:6: ( ( className | filter | visibility | predicate ) )
|
206
|
+
// antlr/UIQuery.g:38:8: ( className | filter | visibility | predicate )
|
202
207
|
{
|
203
208
|
root_0 = (CommonTree)adaptor.nil();
|
204
209
|
|
205
210
|
|
206
|
-
// antlr/UIQuery.g:38:8: ( className | filter | visibility )
|
207
|
-
int alt2=
|
211
|
+
// antlr/UIQuery.g:38:8: ( className | filter | visibility | predicate )
|
212
|
+
int alt2=4;
|
208
213
|
switch ( input.LA(1) ) {
|
209
214
|
case QUALIFIED_NAME:
|
210
215
|
case WILDCARD:
|
@@ -237,6 +242,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
237
242
|
alt2=3;
|
238
243
|
}
|
239
244
|
break;
|
245
|
+
case BEGINPRED:
|
246
|
+
{
|
247
|
+
alt2=4;
|
248
|
+
}
|
249
|
+
break;
|
240
250
|
default:
|
241
251
|
NoViableAltException nvae =
|
242
252
|
new NoViableAltException("", 2, 0, input);
|
@@ -280,6 +290,18 @@ public TreeAdaptor getTreeAdaptor() {
|
|
280
290
|
|
281
291
|
adaptor.addChild(root_0, visibility6.getTree());
|
282
292
|
|
293
|
+
}
|
294
|
+
break;
|
295
|
+
case 4 :
|
296
|
+
// antlr/UIQuery.g:38:43: predicate
|
297
|
+
{
|
298
|
+
pushFollow(FOLLOW_predicate_in_expr89);
|
299
|
+
predicate7=predicate();
|
300
|
+
|
301
|
+
state._fsp--;
|
302
|
+
|
303
|
+
adaptor.addChild(root_0, predicate7.getTree());
|
304
|
+
|
283
305
|
}
|
284
306
|
break;
|
285
307
|
|
@@ -325,13 +347,13 @@ public TreeAdaptor getTreeAdaptor() {
|
|
325
347
|
|
326
348
|
CommonTree root_0 = null;
|
327
349
|
|
328
|
-
Token
|
329
|
-
Token
|
330
|
-
Token
|
350
|
+
Token WILDCARD8=null;
|
351
|
+
Token NAME9=null;
|
352
|
+
Token QUALIFIED_NAME10=null;
|
331
353
|
|
332
|
-
CommonTree
|
333
|
-
CommonTree
|
334
|
-
CommonTree
|
354
|
+
CommonTree WILDCARD8_tree=null;
|
355
|
+
CommonTree NAME9_tree=null;
|
356
|
+
CommonTree QUALIFIED_NAME10_tree=null;
|
335
357
|
|
336
358
|
try {
|
337
359
|
// antlr/UIQuery.g:41:13: ( ( WILDCARD ^| NAME ^| QUALIFIED_NAME ^) )
|
@@ -370,11 +392,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
370
392
|
case 1 :
|
371
393
|
// antlr/UIQuery.g:41:18: WILDCARD ^
|
372
394
|
{
|
373
|
-
|
374
|
-
|
375
|
-
(CommonTree)adaptor.create(
|
395
|
+
WILDCARD8=(Token)match(input,WILDCARD,FOLLOW_WILDCARD_in_className107);
|
396
|
+
WILDCARD8_tree =
|
397
|
+
(CommonTree)adaptor.create(WILDCARD8)
|
376
398
|
;
|
377
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
399
|
+
root_0 = (CommonTree)adaptor.becomeRoot(WILDCARD8_tree, root_0);
|
378
400
|
|
379
401
|
|
380
402
|
}
|
@@ -382,11 +404,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
382
404
|
case 2 :
|
383
405
|
// antlr/UIQuery.g:41:30: NAME ^
|
384
406
|
{
|
385
|
-
|
386
|
-
|
387
|
-
(CommonTree)adaptor.create(
|
407
|
+
NAME9=(Token)match(input,NAME,FOLLOW_NAME_in_className112);
|
408
|
+
NAME9_tree =
|
409
|
+
(CommonTree)adaptor.create(NAME9)
|
388
410
|
;
|
389
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
411
|
+
root_0 = (CommonTree)adaptor.becomeRoot(NAME9_tree, root_0);
|
390
412
|
|
391
413
|
|
392
414
|
}
|
@@ -394,11 +416,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
394
416
|
case 3 :
|
395
417
|
// antlr/UIQuery.g:41:38: QUALIFIED_NAME ^
|
396
418
|
{
|
397
|
-
|
398
|
-
|
399
|
-
(CommonTree)adaptor.create(
|
419
|
+
QUALIFIED_NAME10=(Token)match(input,QUALIFIED_NAME,FOLLOW_QUALIFIED_NAME_in_className117);
|
420
|
+
QUALIFIED_NAME10_tree =
|
421
|
+
(CommonTree)adaptor.create(QUALIFIED_NAME10)
|
400
422
|
;
|
401
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
423
|
+
root_0 = (CommonTree)adaptor.becomeRoot(QUALIFIED_NAME10_tree, root_0);
|
402
424
|
|
403
425
|
|
404
426
|
}
|
@@ -446,11 +468,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
446
468
|
|
447
469
|
CommonTree root_0 = null;
|
448
470
|
|
449
|
-
Token
|
450
|
-
Token
|
471
|
+
Token ALL11=null;
|
472
|
+
Token VISIBLE12=null;
|
451
473
|
|
452
|
-
CommonTree
|
453
|
-
CommonTree
|
474
|
+
CommonTree ALL11_tree=null;
|
475
|
+
CommonTree VISIBLE12_tree=null;
|
454
476
|
|
455
477
|
try {
|
456
478
|
// antlr/UIQuery.g:47:14: ( ( ALL ^| VISIBLE ^) )
|
@@ -480,11 +502,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
480
502
|
case 1 :
|
481
503
|
// antlr/UIQuery.g:47:19: ALL ^
|
482
504
|
{
|
483
|
-
|
484
|
-
|
485
|
-
(CommonTree)adaptor.create(
|
505
|
+
ALL11=(Token)match(input,ALL,FOLLOW_ALL_in_visibility155);
|
506
|
+
ALL11_tree =
|
507
|
+
(CommonTree)adaptor.create(ALL11)
|
486
508
|
;
|
487
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
509
|
+
root_0 = (CommonTree)adaptor.becomeRoot(ALL11_tree, root_0);
|
488
510
|
|
489
511
|
|
490
512
|
}
|
@@ -492,11 +514,11 @@ public TreeAdaptor getTreeAdaptor() {
|
|
492
514
|
case 2 :
|
493
515
|
// antlr/UIQuery.g:47:26: VISIBLE ^
|
494
516
|
{
|
495
|
-
|
496
|
-
|
497
|
-
(CommonTree)adaptor.create(
|
517
|
+
VISIBLE12=(Token)match(input,VISIBLE,FOLLOW_VISIBLE_in_visibility160);
|
518
|
+
VISIBLE12_tree =
|
519
|
+
(CommonTree)adaptor.create(VISIBLE12)
|
498
520
|
;
|
499
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
521
|
+
root_0 = (CommonTree)adaptor.becomeRoot(VISIBLE12_tree, root_0);
|
500
522
|
|
501
523
|
|
502
524
|
}
|
@@ -544,13 +566,13 @@ public TreeAdaptor getTreeAdaptor() {
|
|
544
566
|
|
545
567
|
CommonTree root_0 = null;
|
546
568
|
|
547
|
-
Token
|
548
|
-
Token
|
549
|
-
Token
|
569
|
+
Token NAME13=null;
|
570
|
+
Token FILTER_COLON14=null;
|
571
|
+
Token set15=null;
|
550
572
|
|
551
|
-
CommonTree
|
552
|
-
CommonTree
|
553
|
-
CommonTree
|
573
|
+
CommonTree NAME13_tree=null;
|
574
|
+
CommonTree FILTER_COLON14_tree=null;
|
575
|
+
CommonTree set15_tree=null;
|
554
576
|
|
555
577
|
try {
|
556
578
|
// antlr/UIQuery.g:54:8: ( NAME FILTER_COLON ^ ( INT | STRING | BOOL | NIL ) )
|
@@ -559,26 +581,26 @@ public TreeAdaptor getTreeAdaptor() {
|
|
559
581
|
root_0 = (CommonTree)adaptor.nil();
|
560
582
|
|
561
583
|
|
562
|
-
|
563
|
-
|
564
|
-
(CommonTree)adaptor.create(
|
584
|
+
NAME13=(Token)match(input,NAME,FOLLOW_NAME_in_filter187);
|
585
|
+
NAME13_tree =
|
586
|
+
(CommonTree)adaptor.create(NAME13)
|
565
587
|
;
|
566
|
-
adaptor.addChild(root_0,
|
588
|
+
adaptor.addChild(root_0, NAME13_tree);
|
567
589
|
|
568
590
|
|
569
|
-
|
570
|
-
|
571
|
-
(CommonTree)adaptor.create(
|
591
|
+
FILTER_COLON14=(Token)match(input,FILTER_COLON,FOLLOW_FILTER_COLON_in_filter189);
|
592
|
+
FILTER_COLON14_tree =
|
593
|
+
(CommonTree)adaptor.create(FILTER_COLON14)
|
572
594
|
;
|
573
|
-
root_0 = (CommonTree)adaptor.becomeRoot(
|
595
|
+
root_0 = (CommonTree)adaptor.becomeRoot(FILTER_COLON14_tree, root_0);
|
574
596
|
|
575
597
|
|
576
|
-
|
598
|
+
set15=(Token)input.LT(1);
|
577
599
|
|
578
600
|
if ( input.LA(1)==BOOL||input.LA(1)==INT||input.LA(1)==NIL||input.LA(1)==STRING ) {
|
579
601
|
input.consume();
|
580
602
|
adaptor.addChild(root_0,
|
581
|
-
(CommonTree)adaptor.create(
|
603
|
+
(CommonTree)adaptor.create(set15)
|
582
604
|
);
|
583
605
|
state.errorRecovery=false;
|
584
606
|
}
|
@@ -611,24 +633,136 @@ public TreeAdaptor getTreeAdaptor() {
|
|
611
633
|
}
|
612
634
|
// $ANTLR end "filter"
|
613
635
|
|
636
|
+
|
637
|
+
public static class predicate_return extends ParserRuleReturnScope {
|
638
|
+
CommonTree tree;
|
639
|
+
public Object getTree() { return tree; }
|
640
|
+
};
|
641
|
+
|
642
|
+
|
643
|
+
// $ANTLR start "predicate"
|
644
|
+
// antlr/UIQuery.g:59:1: predicate : BEGINPRED ^ NAME WHITE ! RELATION WHITE ! ( INT | STRING | BOOL | NIL ) ENDPRED !;
|
645
|
+
public final UIQueryParser.predicate_return predicate() throws RecognitionException {
|
646
|
+
UIQueryParser.predicate_return retval = new UIQueryParser.predicate_return();
|
647
|
+
retval.start = input.LT(1);
|
648
|
+
|
649
|
+
|
650
|
+
CommonTree root_0 = null;
|
651
|
+
|
652
|
+
Token BEGINPRED16=null;
|
653
|
+
Token NAME17=null;
|
654
|
+
Token WHITE18=null;
|
655
|
+
Token RELATION19=null;
|
656
|
+
Token WHITE20=null;
|
657
|
+
Token set21=null;
|
658
|
+
Token ENDPRED22=null;
|
659
|
+
|
660
|
+
CommonTree BEGINPRED16_tree=null;
|
661
|
+
CommonTree NAME17_tree=null;
|
662
|
+
CommonTree WHITE18_tree=null;
|
663
|
+
CommonTree RELATION19_tree=null;
|
664
|
+
CommonTree WHITE20_tree=null;
|
665
|
+
CommonTree set21_tree=null;
|
666
|
+
CommonTree ENDPRED22_tree=null;
|
667
|
+
|
668
|
+
try {
|
669
|
+
// antlr/UIQuery.g:59:11: ( BEGINPRED ^ NAME WHITE ! RELATION WHITE ! ( INT | STRING | BOOL | NIL ) ENDPRED !)
|
670
|
+
// antlr/UIQuery.g:59:13: BEGINPRED ^ NAME WHITE ! RELATION WHITE ! ( INT | STRING | BOOL | NIL ) ENDPRED !
|
671
|
+
{
|
672
|
+
root_0 = (CommonTree)adaptor.nil();
|
673
|
+
|
674
|
+
|
675
|
+
BEGINPRED16=(Token)match(input,BEGINPRED,FOLLOW_BEGINPRED_in_predicate225);
|
676
|
+
BEGINPRED16_tree =
|
677
|
+
(CommonTree)adaptor.create(BEGINPRED16)
|
678
|
+
;
|
679
|
+
root_0 = (CommonTree)adaptor.becomeRoot(BEGINPRED16_tree, root_0);
|
680
|
+
|
681
|
+
|
682
|
+
NAME17=(Token)match(input,NAME,FOLLOW_NAME_in_predicate228);
|
683
|
+
NAME17_tree =
|
684
|
+
(CommonTree)adaptor.create(NAME17)
|
685
|
+
;
|
686
|
+
adaptor.addChild(root_0, NAME17_tree);
|
687
|
+
|
688
|
+
|
689
|
+
WHITE18=(Token)match(input,WHITE,FOLLOW_WHITE_in_predicate230);
|
690
|
+
|
691
|
+
RELATION19=(Token)match(input,RELATION,FOLLOW_RELATION_in_predicate233);
|
692
|
+
RELATION19_tree =
|
693
|
+
(CommonTree)adaptor.create(RELATION19)
|
694
|
+
;
|
695
|
+
adaptor.addChild(root_0, RELATION19_tree);
|
696
|
+
|
697
|
+
|
698
|
+
WHITE20=(Token)match(input,WHITE,FOLLOW_WHITE_in_predicate235);
|
699
|
+
|
700
|
+
set21=(Token)input.LT(1);
|
701
|
+
|
702
|
+
if ( input.LA(1)==BOOL||input.LA(1)==INT||input.LA(1)==NIL||input.LA(1)==STRING ) {
|
703
|
+
input.consume();
|
704
|
+
adaptor.addChild(root_0,
|
705
|
+
(CommonTree)adaptor.create(set21)
|
706
|
+
);
|
707
|
+
state.errorRecovery=false;
|
708
|
+
}
|
709
|
+
else {
|
710
|
+
MismatchedSetException mse = new MismatchedSetException(null,input);
|
711
|
+
throw mse;
|
712
|
+
}
|
713
|
+
|
714
|
+
|
715
|
+
ENDPRED22=(Token)match(input,ENDPRED,FOLLOW_ENDPRED_in_predicate254);
|
716
|
+
|
717
|
+
}
|
718
|
+
|
719
|
+
retval.stop = input.LT(-1);
|
720
|
+
|
721
|
+
|
722
|
+
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
|
723
|
+
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
|
724
|
+
|
725
|
+
}
|
726
|
+
catch (RecognitionException re) {
|
727
|
+
reportError(re);
|
728
|
+
recover(input,re);
|
729
|
+
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
|
730
|
+
|
731
|
+
}
|
732
|
+
|
733
|
+
finally {
|
734
|
+
// do for sure before leaving
|
735
|
+
}
|
736
|
+
return retval;
|
737
|
+
}
|
738
|
+
// $ANTLR end "predicate"
|
739
|
+
|
614
740
|
// Delegated rules
|
615
741
|
|
616
742
|
|
617
743
|
|
618
744
|
|
619
|
-
public static final BitSet FOLLOW_expr_in_query53 = new BitSet(new long[]{
|
620
|
-
public static final BitSet FOLLOW_WHITE_in_query56 = new BitSet(new long[]{
|
621
|
-
public static final BitSet FOLLOW_expr_in_query59 = new BitSet(new long[]{
|
745
|
+
public static final BitSet FOLLOW_expr_in_query53 = new BitSet(new long[]{0x0000000000100002L});
|
746
|
+
public static final BitSet FOLLOW_WHITE_in_query56 = new BitSet(new long[]{0x0000000000289030L});
|
747
|
+
public static final BitSet FOLLOW_expr_in_query59 = new BitSet(new long[]{0x0000000000100002L});
|
622
748
|
public static final BitSet FOLLOW_className_in_expr77 = new BitSet(new long[]{0x0000000000000002L});
|
623
749
|
public static final BitSet FOLLOW_filter_in_expr81 = new BitSet(new long[]{0x0000000000000002L});
|
624
750
|
public static final BitSet FOLLOW_visibility_in_expr85 = new BitSet(new long[]{0x0000000000000002L});
|
625
|
-
public static final BitSet
|
626
|
-
public static final BitSet
|
627
|
-
public static final BitSet
|
628
|
-
public static final BitSet
|
629
|
-
public static final BitSet
|
630
|
-
public static final BitSet
|
631
|
-
public static final BitSet
|
632
|
-
public static final BitSet
|
751
|
+
public static final BitSet FOLLOW_predicate_in_expr89 = new BitSet(new long[]{0x0000000000000002L});
|
752
|
+
public static final BitSet FOLLOW_WILDCARD_in_className107 = new BitSet(new long[]{0x0000000000000002L});
|
753
|
+
public static final BitSet FOLLOW_NAME_in_className112 = new BitSet(new long[]{0x0000000000000002L});
|
754
|
+
public static final BitSet FOLLOW_QUALIFIED_NAME_in_className117 = new BitSet(new long[]{0x0000000000000002L});
|
755
|
+
public static final BitSet FOLLOW_ALL_in_visibility155 = new BitSet(new long[]{0x0000000000000002L});
|
756
|
+
public static final BitSet FOLLOW_VISIBLE_in_visibility160 = new BitSet(new long[]{0x0000000000000002L});
|
757
|
+
public static final BitSet FOLLOW_NAME_in_filter187 = new BitSet(new long[]{0x0000000000000200L});
|
758
|
+
public static final BitSet FOLLOW_FILTER_COLON_in_filter189 = new BitSet(new long[]{0x0000000000022840L});
|
759
|
+
public static final BitSet FOLLOW_set_in_filter192 = new BitSet(new long[]{0x0000000000000002L});
|
760
|
+
public static final BitSet FOLLOW_BEGINPRED_in_predicate225 = new BitSet(new long[]{0x0000000000001000L});
|
761
|
+
public static final BitSet FOLLOW_NAME_in_predicate228 = new BitSet(new long[]{0x0000000000100000L});
|
762
|
+
public static final BitSet FOLLOW_WHITE_in_predicate230 = new BitSet(new long[]{0x0000000000010000L});
|
763
|
+
public static final BitSet FOLLOW_RELATION_in_predicate233 = new BitSet(new long[]{0x0000000000100000L});
|
764
|
+
public static final BitSet FOLLOW_WHITE_in_predicate235 = new BitSet(new long[]{0x0000000000022840L});
|
765
|
+
public static final BitSet FOLLOW_set_in_predicate238 = new BitSet(new long[]{0x0000000000000080L});
|
766
|
+
public static final BitSet FOLLOW_ENDPRED_in_predicate254 = new BitSet(new long[]{0x0000000000000002L});
|
633
767
|
|
634
768
|
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
package sh.calaba.instrumentationbackend.query.ast;
|
2
|
+
|
3
|
+
import android.annotation.SuppressLint;
|
4
|
+
|
5
|
+
public class BeginsWithRelation implements UIQueryASTPredicateRelation {
|
6
|
+
|
7
|
+
private final boolean caseSensitive;
|
8
|
+
|
9
|
+
public BeginsWithRelation(boolean isCaseSensitive) {
|
10
|
+
super();
|
11
|
+
this.caseSensitive = isCaseSensitive;
|
12
|
+
}
|
13
|
+
|
14
|
+
|
15
|
+
public boolean isCaseSensitive() {
|
16
|
+
return caseSensitive;
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Does firstValue BEGIN WITH secondValue?
|
21
|
+
*/
|
22
|
+
@SuppressLint("DefaultLocale")
|
23
|
+
@Override
|
24
|
+
public boolean areRelated(Object firstValue, Object secondValue) {
|
25
|
+
if (firstValue == secondValue) {
|
26
|
+
return true;
|
27
|
+
}
|
28
|
+
if (firstValue == null || secondValue == null) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
if (firstValue instanceof CharSequence && secondValue instanceof CharSequence) {
|
32
|
+
String firstStr = firstValue.toString();
|
33
|
+
String secondStr = secondValue.toString();
|
34
|
+
if (!isCaseSensitive()) {
|
35
|
+
firstStr = firstStr.toLowerCase();
|
36
|
+
secondStr = secondStr.toLowerCase();
|
37
|
+
}
|
38
|
+
return firstStr.startsWith(secondStr);
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|