-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathString_.php
More file actions
730 lines (671 loc) Β· 24.7 KB
/
String_.php
File metadata and controls
730 lines (671 loc) Β· 24.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
<?php
declare(strict_types=1);
namespace PHPJava\Packages\java\lang;
use PHPJava\Core\JavaClass;
use PHPJava\Core\JVM\ConstantPool;
use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Kernel\Filters\Normalizer;
use PHPJava\Kernel\Structures\Utf8Info;
use PHPJava\Kernel\Types\Char_;
// use PHPJava\Packages\java\io\Serializable;
// use PHPJava\Packages\java\util\Comparator;
// use PHPJava\Packages\java\util\stream\IntStream;
/**
* The `String` class was auto generated.
*
* @parent \PHPJava\Packages\java\lang\Object_
*/
class String_ extends Object_ implements CharSequence
{
private $hash = 0;
private $object;
/**
* A Comparator that orders String objects as by compareToIgnoreCase.
*
* @var mixed $CASE_INSENSITIVE_ORDER
*/
public static $CASE_INSENSITIVE_ORDER = null;
/**
* StringInfo constructor.
* @param null $object
*/
public function __construct($object = null)
{
parent::__construct();
$this->object = $object;
}
/**
* Returns the char value at the specified index.
*
* @throws IndexOutOfBoundsException
* @return _Char
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#charAt(int)
*/
public function charAt($a)
{
$index = Normalizer::getPrimitiveValue($a);
$length = $this->length();
if ($index < 0 || $length <= $index) {
throw new IndexOutOfBoundsException("String index out of range: {$index}");
}
return new Char_($this->toString()[$index]);
}
/**
* Returns a stream of int zero-extending the char values from this sequence.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#chars
* @param null|mixed $a
* @throws NotImplementedException
*/
public function chars($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the character (Unicode code point) at the specified index.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#codePointAt
* @param null|mixed $a
* @throws NotImplementedException
*/
public function codePointAt($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the character (Unicode code point) before the specified index.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#codePointBefore
* @param null|mixed $a
* @throws NotImplementedException
*/
public function codePointBefore($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the number of Unicode code points in the specified text range of this String.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#codePointCount
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function codePointCount($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a stream of code point values from this sequence.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#codePoints
* @param null|mixed $a
* @throws NotImplementedException
*/
public function codePoints($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Compares two strings lexicographically.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#compareTo
* @param null|mixed $a
* @throws NotImplementedException
*/
public function compareTo($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Compares two strings lexicographically, ignoring case differences.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#compareToIgnoreCase
* @param null|mixed $a
* @throws NotImplementedException
*/
public function compareToIgnoreCase($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Concatenates the specified string to the end of this string.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#concat(java.lang.String)
* @param null|mixed $a
*/
public function concat($a = null)
{
return JavaClass::load('java.lang.String', $this->javaClass->getOptions())
->getInvoker()
->construct($this . $a)
->getJavaClass();
}
/**
* Returns true if and only if this string contains the specified sequence of char values.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#contains
* @param null|mixed $a
* @throws NotImplementedException
*/
public function contains($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Compares this string to the specified CharSequence.
* Compares this string to the specified StringBuffer.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#contentEquals
* @param null|mixed $a
* @throws NotImplementedException
*/
public function contentEquals($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Equivalent to valueOf(char[]).
* Equivalent to valueOf(char[], int, int).
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#copyValueOf
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @throws NotImplementedException
*/
public static function static_copyValueOf($a = null, $b = null, $c = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Tests if this string ends with the specified suffix.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#endsWith
* @param null|mixed $a
* @throws NotImplementedException
*/
public function endsWith($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Compares this string to the specified object.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#equals(java.lang.Object)
* @param null|mixed $a
*/
public function equals($a = null)
{
if (!($this->object instanceof Utf8Info)) {
return false;
}
if ($a instanceof String_) {
return $this->toString() === $a->toString();
}
return $this->toString() === $a;
}
/**
* Compares this String to another String, ignoring case considerations.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#equalsIgnoreCase
* @param null|mixed $a
* @throws NotImplementedException
*/
public function equalsIgnoreCase($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a formatted string using the specified format string and arguments.
* Returns a formatted string using the specified locale, format string, and arguments.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#format
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @throws NotImplementedException
*/
public static function static_format($a = null, $b = null, $c = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
* Deprecated.This method does not properly convert characters into bytes.
* Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.
* Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#getBytes
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @param null|mixed $d
* @throws NotImplementedException
*/
public function getBytes($a = null, $b = null, $c = null, $d = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Copies characters from this string into the destination character array.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#getChars
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @param null|mixed $d
* @throws NotImplementedException
*/
public function getChars($a = null, $b = null, $c = null, $d = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a hash code for this string.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#hashCode()
*/
public function hashCode()
{
$count = $this->length();
$h = $this->hash;
if ($h || !$count) {
return $h;
}
$str = $this->toString();
for ($i = 0; $i < $count; $i++) {
$h = 31 * $h + ord($str[$i]);
}
return $this->hash = $h;
}
/**
* Returns the index within this string of the first occurrence of the specified character.
* Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
* Returns the index within this string of the first occurrence of the specified substring.
* Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#indexOf
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function indexOf($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a canonical representation for the string object.
*
* @native ConstantPool
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#intern
* @throws NotImplementedException
*/
public function intern(ConstantPool $cp)
{
// Find the string from the Constant Pool.
foreach ($cp as $key => $value) {
if (!($value instanceof Utf8Info)) {
continue;
}
/**
* @var Utf8Info $value
*/
if ((string) $value === (string) $this->object) {
$this->object = $value
->enableWrite(true)
->setStringObject(
$this->javaClass
);
break;
}
}
return $this->javaClass;
}
/**
* Returns true if the string is empty or contains only white space codepoints, otherwise false.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#isBlank
* @param null|mixed $a
* @throws NotImplementedException
*/
public function isBlank($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns true if, and only if, length() is 0.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#isEmpty
* @param null|mixed $a
* @throws NotImplementedException
*/
public function isEmpty($a = null)
{
return $this->length() === 0;
}
/**
* Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter.
* Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#join
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public static function static_join($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the index within this string of the last occurrence of the specified character.
* Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
* Returns the index within this string of the last occurrence of the specified substring.
* Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#lastIndexOf
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function lastIndexOf($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the length of this string.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#length
* @param null|mixed $a
* @throws NotImplementedException
*/
public function length($a = null)
{
return strlen($this->toString());
}
/**
* Returns a stream of lines extracted from this string, separated by line terminators.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#lines
* @param null|mixed $a
* @throws NotImplementedException
*/
public function lines($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Tells whether or not this string matches the given regular expression.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#matches
* @param null|mixed $a
* @throws NotImplementedException
*/
public function matches($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the index within this String that is offset from the given index by codePointOffset code points.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#offsetByCodePoints
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function offsetByCodePoints($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Tests if two string regions are equal.
* Tests if two string regions are equal.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#regionMatches
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @param null|mixed $d
* @param null|mixed $e
* @throws NotImplementedException
*/
public function regionMatches($a = null, $b = null, $c = null, $d = null, $e = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string whose value is the concatenation of this string repeated count times.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#repeat
* @param null|mixed $a
* @throws NotImplementedException
*/
public function repeat($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.
* Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#replace(java.lang.CharSequence,java.lang.CharSequence)
* @param null|mixed $a
* @param null|mixed $b
*/
public function replace($a = null, $b = null)
{
return JavaClass::load('java.lang.String', $this->javaClass->getOptions())
->getInvoker()
->construct(str_replace($a, $b, $this))
->getJavaClass();
}
/**
* Replaces each substring of this string that matches the given regular expression with the given replacement.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#replaceAll
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function replaceAll($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Replaces the first substring of this string that matches the given regular expression with the given replacement.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#replaceFirst
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function replaceFirst($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Splits this string around matches of the given regular expression.
* Splits this string around matches of the given regular expression.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#split
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function split($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Tests if this string starts with the specified prefix.
* Tests if the substring of this string beginning at the specified index starts with the specified prefix.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#startsWith
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function startsWith($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string whose value is this string, with all leading and trailing white space removed.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#strip
* @param null|mixed $a
* @throws NotImplementedException
*/
public function strip($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string whose value is this string, with all leading white space removed.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#stripLeading
* @param null|mixed $a
* @throws NotImplementedException
*/
public function stripLeading($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string whose value is this string, with all trailing white space removed.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#stripTrailing
* @param null|mixed $a
* @throws NotImplementedException
*/
public function stripTrailing($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a character sequence that is a subsequence of this sequence.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#subSequence
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function subSequence($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns a string that is a substring of this string.
* Returns a string that is a substring of this string.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#substring
* @param null|mixed $a
* @param null|mixed $b
* @throws NotImplementedException
*/
public function substring($a = null, $b = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Converts this string to a new character array.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#toCharArray
* @param null|mixed $a
* @throws NotImplementedException
*/
public function toCharArray($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Converts all of the characters in this String to lower case using the rules of the default locale.
* Converts all of the characters in this String to lower case using the rules of the given Locale.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#toLowerCase
* @param null|mixed $a
* @throws NotImplementedException
*/
public function toLowerCase($a = null)
{
$locale = $a;
if ($locale) {
throw new NotImplementedException(__METHOD__);
}
return JavaClass::load('java.lang.String', $this->javaClass->getOptions())
->getInvoker()
->construct(
strtolower((string) $this)
)
->getJavaClass();
}
/**
* This object (which is already a string!).
*
* @throws NotImplementedException
* @return mixed
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#toString
*/
public function toString(): string
{
return $this->__toString();
}
/**
* Converts all of the characters in this String to upper case using the rules of the default locale.
* Converts all of the characters in this String to upper case using the rules of the given Locale.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#toUpperCase
* @param null|mixed $a
* @throws NotImplementedException
*/
public function toUpperCase($a = null)
{
$locale = $a;
if ($locale) {
throw new NotImplementedException(__METHOD__);
}
return JavaClass::load('java.lang.String', $this->javaClass->getOptions())
->getInvoker()
->construct(strtoupper((string) $this))
->getJavaClass();
}
/**
* Returns a string whose value is this string, with all leading and trailing space removed, where space is defined as any character whose codepoint is less than or equal to 'U+0020' (the space character).
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#trim
* @param null|mixed $a
* @throws NotImplementedException
*/
public function trim($a = null)
{
throw new NotImplementedException(__METHOD__);
}
/**
* Returns the string representation of the boolean argument.
* Returns the string representation of the char argument.
* Returns the string representation of the char array argument.
* Returns the string representation of a specific subarray of the char array argument.
* Returns the string representation of the double argument.
* Returns the string representation of the float argument.
* Returns the string representation of the int argument.
* Returns the string representation of the long argument.
* Returns the string representation of the Object argument.
*
* @see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/package-summary.html#valueOf
* @param null|mixed $a
* @param null|mixed $b
* @param null|mixed $c
* @throws NotImplementedException
*/
public static function static_valueOf($a = null, $b = null, $c = null)
{
throw new NotImplementedException(__METHOD__);
}
public function __toString(): string
{
if (!($this->object instanceof Utf8Info)) {
return (string) $this->object;
}
return $this->object->getString();
}
}