Changeset 15032 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StringExpressions.cs
- Timestamp:
- 06/12/17 14:11:43 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StringExpressions.cs
r15017 r15032 12 12 using Stack; 13 13 14 [StorableClass] 15 [PushExpression(StackTypes.String, "STRING.FROMINTEGER", StackTypes.Integer)] 14 /// <summary> 15 /// Stringifies and pushes the top INTEGER., 16 /// </summary> 17 [StorableClass] 18 [PushExpression( 19 StackTypes.String, 20 "STRING.FROMINTEGER", 21 "Stringifies and pushes the top INTEGER.", 22 StackTypes.Integer)] 16 23 public class StringFromIntegerExpression : StatelessExpression { 17 24 public StringFromIntegerExpression() { } … … 30 37 31 38 [StorableClass] 32 [PushExpression(StackTypes.String, "STRING.FROMFLOAT", StackTypes.Float)] 39 [PushExpression( 40 StackTypes.String, 41 "STRING.FROMFLOAT", 42 "Stringifies and pushes the top FLOAT.", 43 StackTypes.Float)] 33 44 public class StringFromFloatExpression : StatelessExpression { 34 45 public StringFromFloatExpression() { } … … 48 59 } 49 60 50 [StorableClass] 51 [PushExpression(StackTypes.String, "STRING.FROMBOOLEAN", StackTypes.Boolean)] 61 /// <summary> 62 /// Stringifies and pushes the top BOOLEAN. 63 /// </summary> 64 [StorableClass] 65 [PushExpression( 66 StackTypes.String, 67 "STRING.FROMBOOLEAN", 68 "Stringifies and pushes the top BOOLEAN.", 69 StackTypes.Boolean)] 52 70 public class StringFromBooleanExpression : StatelessExpression { 53 71 public StringFromBooleanExpression() { } … … 65 83 } 66 84 67 [StorableClass] 68 [PushExpression(StackTypes.String, "STRING.FROMCHAR", StackTypes.Char)] 85 /// <summary> 86 /// Stringifies and pushes the top CHAR. 87 /// </summary> 88 [StorableClass] 89 [PushExpression( 90 StackTypes.String, 91 "STRING.FROMCHAR", 92 "Stringifies and pushes the top CHAR.", 93 StackTypes.Char)] 69 94 public class StringFromCharExpression : StatelessExpression { 70 95 public StringFromCharExpression() { } … … 82 107 } 83 108 84 [StorableClass] 85 [PushExpression(StackTypes.String, "STRING.CONCAT")] 109 /// <summary> 110 /// Concats the top 2 strings. 111 /// </summary> 112 [StorableClass] 113 [PushExpression( 114 StackTypes.String, 115 "STRING.CONCAT", 116 "Concats the top 2 strings.")] 86 117 public class StringConcatExpression : StatelessExpression { 87 118 public StringConcatExpression() { } … … 104 135 /// </summary> 105 136 [StorableClass] 106 [PushExpression(StackTypes.String, "STRING.CONJCHAR", StackTypes.Char)] 137 [PushExpression( 138 StackTypes.String, 139 "STRING.CONJCHAR", 140 "Conj top CHAR onto top STRING", 141 StackTypes.Char)] 107 142 public class StringConjCharExpression : StatelessExpression { 108 143 public StringConjCharExpression() { } … … 122 157 } 123 158 124 [StorableClass] 125 [PushExpression(StackTypes.String, "STRING.TAKE", StackTypes.Integer)] 159 /// <summary> 160 /// Same as substring 0-n, whereby n is taken from the INTEGER stack. 161 /// </summary> 162 [StorableClass] 163 [PushExpression( 164 StackTypes.String, 165 "STRING.TAKE", 166 "Same as substring 0-n, whereby n is taken from the INTEGER stack.", 167 StackTypes.Integer)] 126 168 public class StringTakeExpression : StatelessExpression { 127 169 public StringTakeExpression() { } … … 145 187 } 146 188 147 [StorableClass] 148 [PushExpression(StackTypes.String, "STRING.SUBSTRING", StackTypes.Integer)] 189 /// <summary> 190 /// Replaces top STRING with a substring from index A to B, whereby A and B are taken from the INTEGER STACK. 191 /// </summary> 192 [StorableClass] 193 [PushExpression( 194 StackTypes.String, 195 "STRING.SUBSTRING", 196 "Replaces top STRING with a substring from index A to B, whereby A and B are taken from the INTEGER STACK.", 197 StackTypes.Integer)] 149 198 public class StringSubstringExpression : StatelessExpression { 150 199 public StringSubstringExpression() { } … … 172 221 } 173 222 174 [StorableClass] 175 [PushExpression(StackTypes.String, "STRING.FIRST")] 223 /// <summary> 224 /// Pushes first char of top STRING. 225 /// </summary> 226 [StorableClass] 227 [PushExpression( 228 StackTypes.String, 229 "STRING.FIRST", 230 "Pushes first char of top STRING.")] 176 231 public class StringFirstExpression : StatelessExpression { 177 232 public StringFirstExpression() { } … … 189 244 } 190 245 191 [StorableClass] 192 [PushExpression(StackTypes.String, "STRING.LAST")] 246 /// <summary> 247 /// Pushes last char of top STRING. 248 /// </summary> 249 [StorableClass] 250 [PushExpression( 251 StackTypes.String, 252 "STRING.LAST", 253 "Pushes last char of top STRING.")] 193 254 public class StringLastExpression : StatelessExpression { 194 255 public StringLastExpression() { } … … 208 269 } 209 270 210 [StorableClass] 211 [PushExpression(StackTypes.String, "STRING.NTH", StackTypes.Integer)] 271 /// <summary> 272 /// Pushes nth char of top STRING, whereby n is take from the INTEGER stack. 273 /// </summary> 274 [StorableClass] 275 [PushExpression( 276 StackTypes.String, 277 "STRING.NTH", 278 "Pushes nth char of top STRING, whereby n is take from the INTEGER stack.", 279 StackTypes.Integer)] 212 280 public class StringNthExpression : StatelessExpression { 213 281 public StringNthExpression() { } … … 229 297 } 230 298 231 [StorableClass] 232 [PushExpression(StackTypes.String, "STRING.REST")] 299 /// <summary> 300 /// Removes first char of top STRING. 301 /// </summary> 302 [StorableClass] 303 [PushExpression( 304 StackTypes.String, 305 "STRING.REST", 306 "Removes first char of top STRING.")] 233 307 public class StringRestExpression : StatelessExpression { 234 308 public StringRestExpression() { } … … 247 321 } 248 322 249 [StorableClass] 250 [PushExpression(StackTypes.String, "STRING.BUTLAST")] 323 /// <summary> 324 /// Removes last char of top STRING. 325 /// </summary> 326 [StorableClass] 327 [PushExpression( 328 StackTypes.String, 329 "STRING.BUTLAST", 330 "Removes last char of top STRING.")] 251 331 public class StringButLastExpression : StatelessExpression { 252 332 public StringButLastExpression() { } … … 265 345 } 266 346 267 [StorableClass] 268 [PushExpression(StackTypes.String, "STRING.LENGTH", StackTypes.Integer)] 347 /// <summary> 348 /// Pushes length of top STRING onto the INTEGER stack. 349 /// </summary> 350 [StorableClass] 351 [PushExpression( 352 StackTypes.String, 353 "STRING.LENGTH", 354 "Pushes length of top STRING onto the INTEGER stack.", 355 StackTypes.Integer)] 269 356 public class StringLengthExpression : StatelessExpression { 270 357 public StringLengthExpression() { } … … 282 369 } 283 370 284 [StorableClass] 285 [PushExpression(StackTypes.String, "STRING.REVERSE")] 371 /// <summary> 372 /// Reverses the top STRING. 373 /// </summary> 374 [StorableClass] 375 [PushExpression( 376 StackTypes.String, 377 "STRING.REVERSE", 378 "Reverses the top STRING.")] 286 379 public class StringReverseExpression : StatelessExpression { 287 380 public StringReverseExpression() { } … … 300 393 } 301 394 302 [StorableClass] 303 [PushExpression(StackTypes.String, "STRING.PARSETOCHARS")] 395 /// <summary> 396 /// Maps every char of top STRING as separate string. 397 /// </summary> 398 [StorableClass] 399 [PushExpression( 400 StackTypes.String, 401 "STRING.PARSETOCHARS", 402 "Maps every char of top STRING as separate string.")] 304 403 public class StringParseToCharsExpression : StatelessExpression { 305 404 public StringParseToCharsExpression() { } … … 331 430 } 332 431 333 [StorableClass] 334 [PushExpression(StackTypes.String, "STRING.SPLIT")] 432 /// <summary> 433 /// Splits top STRING by whitespace chars. 434 /// </summary> 435 [StorableClass] 436 [PushExpression( 437 StackTypes.String, 438 "STRING.SPLIT", 439 "Splits top STRING by whitespace chars.")] 335 440 public class StringSplitExpression : StatelessExpression { 336 441 public StringSplitExpression() { } … … 360 465 361 466 /// <summary> 362 /// True if top string is empty 363 /// </summary> 364 [StorableClass] 365 [PushExpression(StackTypes.String, "STRING.EMPTYSTRING", StackTypes.Boolean)] 467 /// True if top string is empty. 468 /// </summary> 469 [StorableClass] 470 [PushExpression( 471 StackTypes.String, 472 "STRING.EMPTYSTRING", 473 "True if top STRING is empty.", 474 StackTypes.Boolean)] 366 475 public class StringEmptyStringExpression : StatelessExpression { 367 476 public StringEmptyStringExpression() { } … … 383 492 /// </summary> 384 493 [StorableClass] 385 [PushExpression(StackTypes.String, "STRING.CONTAINS", StackTypes.Boolean)] 494 [PushExpression( 495 StackTypes.String, 496 "STRING.CONTAINS", 497 "True if top STRING is a substring of second STRING, false otherwise.", 498 StackTypes.Boolean)] 386 499 public class StringContainsExpression : StatelessExpression { 387 500 public StringContainsExpression() { } … … 406 519 /// </summary> 407 520 [StorableClass] 408 [PushExpression(StackTypes.String, "STRING.CONTAINSCHAR", StackTypes.Boolean | StackTypes.Char)] 521 [PushExpression( 522 StackTypes.String, 523 "STRING.CONTAINSCHAR", 524 "True if the top CHAR is in the top STRING.", 525 StackTypes.Boolean | StackTypes.Char)] 409 526 public class StringContainsCharExpression : StatelessExpression { 410 527 public StringContainsCharExpression() { } … … 429 546 /// </summary> 430 547 [StorableClass] 431 [PushExpression(StackTypes.String, "STRING.INDEXOFCHAR", StackTypes.Integer | StackTypes.Char)] 548 [PushExpression( 549 StackTypes.String, 550 "STRING.INDEXOFCHAR", 551 "Puts on the INTEGER stack the index of the top CHAR in the top STRING.", 552 StackTypes.Integer | StackTypes.Char)] 432 553 public class StringIndexOfCharExpression : StatelessExpression { 433 554 public StringIndexOfCharExpression() { } … … 452 573 /// </summary> 453 574 [StorableClass] 454 [PushExpression(StackTypes.String, "STRING.OCCURRENCESOFCHAR", StackTypes.Integer | StackTypes.Char)] 575 [PushExpression( 576 StackTypes.String, 577 "STRING.OCCURRENCESOFCHAR", 578 "The number of times the top CHAR is in the top STRING.", 579 StackTypes.Integer | StackTypes.Char)] 455 580 public class StringOccurrencesOfCharExpression : StatelessExpression { 456 581 public StringOccurrencesOfCharExpression() { } … … 476 601 477 602 /// <summary> 478 /// In third string on stack, replaces second string with first string 479 /// </summary> 480 [StorableClass] 481 [PushExpression(StackTypes.String, "STRING.REPLACE")] 603 /// In third STRING, replaces second string with first string 604 /// </summary> 605 [StorableClass] 606 [PushExpression( 607 StackTypes.String, 608 "STRING.REPLACE", 609 "In third STRING, replaces second STRING with first STRING.")] 482 610 public class StringReplaceExpression : StatelessExpression { 483 611 public StringReplaceExpression() { } … … 502 630 503 631 /// <summary> 504 /// In third string on stack, replaces first occurrence of second string with first string 505 /// </summary> 506 [StorableClass] 507 [PushExpression(StackTypes.String, "STRING.REPLACEFIRST")] 632 /// In third STRING, replaces first occurrence of second string with first string 633 /// </summary> 634 [StorableClass] 635 [PushExpression( 636 StackTypes.String, 637 "STRING.REPLACEFIRST", 638 "In third STRING, replaces first occurrence of second STRING with first STRING")] 508 639 public class StringReplaceFirstExpression : StatelessExpression { 509 640 public StringReplaceFirstExpression() { } … … 533 664 534 665 /// <summary> 535 /// In top string on stack, replaces all occurrences of second char with first char 536 /// </summary> 537 [StorableClass] 538 [PushExpression(StackTypes.String, "STRING.REPLACECHAR", StackTypes.Char)] 666 /// In top STRING, replaces all occurrences of second char with first char 667 /// </summary> 668 [StorableClass] 669 [PushExpression( 670 StackTypes.String, 671 "STRING.REPLACECHAR", 672 "In top STRING, replaces all occurrences of second CHAR with first CHAR.", 673 StackTypes.Char)] 539 674 public class StringReplaceCharExpression : StatelessExpression { 540 675 public StringReplaceCharExpression() { } … … 558 693 559 694 /// <summary> 560 /// In top string on stack, replaces first occurrence of second char with first char 561 /// </summary> 562 [StorableClass] 563 [PushExpression(StackTypes.String, "STRING.REPLACEFIRSTCHAR", StackTypes.Char)] 695 /// In top STRING, replaces first occurrence of second char with first char 696 /// </summary> 697 [StorableClass] 698 [PushExpression( 699 StackTypes.String, 700 "STRING.REPLACEFIRSTCHAR", 701 "In top STRING, replaces first occurrence of second CHAR with first CHAR.", 702 StackTypes.Char)] 564 703 public class StringReplaceFirstCharExpression : StatelessExpression { 565 704 public StringReplaceFirstCharExpression() { } … … 592 731 593 732 /// <summary> 594 /// In top string on stack, remove all occurrences of char 595 /// </summary> 596 [StorableClass] 597 [PushExpression(StackTypes.String, "STRING.REMOVECHAR", StackTypes.Char)] 733 /// In top STRING, remove all occurrences of char 734 /// </summary> 735 [StorableClass] 736 [PushExpression( 737 StackTypes.String, 738 "STRING.REMOVECHAR", 739 "In top STRING, remove all occurrences of top CHAR.", 740 StackTypes.Char)] 598 741 public class StringRemoveCharExpression : StatelessExpression { 599 742 public StringRemoveCharExpression() { } … … 617 760 /// </summary> 618 761 [StorableClass] 619 [PushExpression(StackTypes.String, "STRING.SETCHAR", StackTypes.Char | StackTypes.Integer)] 762 [PushExpression( 763 StackTypes.String, 764 "STRING.SETCHAR", 765 "Sets top CHAR at index in top STRING, whereby the index is taken from the INTEGER stack.", 766 StackTypes.Char | StackTypes.Integer)] 620 767 public class StringSetCharExpression : StatelessExpression { 621 768 public StringSetCharExpression() { } … … 651 798 /// </summary> 652 799 [StorableClass] 653 [PushExpression(StackTypes.String, "STRING.ITERATE", StackTypes.Exec | StackTypes.Char, execIn: 1)] 800 [PushExpression( 801 StackTypes.String, 802 "STRING.ITERATE", 803 "Iterates over the top STRING using the CODE on the EXEC stack.", 804 StackTypes.Exec | StackTypes.Char, execIn: 1)] 654 805 public class StringIterateExpression : StatelessExpression { 655 806 public StringIterateExpression() { }
Note: See TracChangeset
for help on using the changeset viewer.