1 package com.daffodilwoods.daffodildb.server.sql99.expression. 2 stringvalueexpression; 3 4 import com.daffodilwoods.database.resource.*; 5 import com.daffodilwoods.daffodildb.server.sql99.token.*; 6 import com.daffodilwoods.daffodildb.server.sql99.utils.ByteComparison; 7 import com.daffodilwoods.daffodildb.server.sql99.common.ColumnDetails; 8 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference; 9 import com.daffodilwoods.daffodildb.server.serversystem._ServerSession; 10 import com.daffodilwoods.daffodildb.server.sql99.common.ParameterInfo; 11 import com.daffodilwoods.daffodildb.utils.field.*; 12 import com.daffodilwoods.daffodildb.server.sql99.common.*; 13 import com.daffodilwoods.daffodildb.utils.*; 14 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression. 15 AbstractRowValueExpression; 16 import in.co.daffodil.db.jdbc.DatabaseProperties; 17 import java.util.*; 18 import java.text.*; 19 import java.sql.Date ; 20 import java.sql.*; 21 22 public class stringfunction 23 extends AbstractStringValueExpression 24 implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, 25 charactervaluefunction, Datatypes { 26 27 public Srightparen_1874859514 _Srightparen_18748595140; 28 public stringfunctionparameters _stringfunctionparameters1; 29 public Sleftparen653880241 _Sleftparen6538802412; 30 public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439223; 31 String romanZeroToNine[] = { 32 "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}; 33 static HashMap mapOfFormats; 34 static HashMap mapForSpecialFormats; 35 36 static { 37 mapOfFormats = new HashMap(); 38 mapForSpecialFormats = new HashMap(); 39 initializeMapValues(); 40 initializeMapForSpecialFormats(); 41 } 42 43 78 79 public Object run(Object object) throws com.daffodilwoods.database.resource. 80 DException { 81 FieldBase[] field = GeneralPurposeStaticClass.changeIntoFieldBase( ( 82 Object []) _stringfunctionparameters1.run(object)); 83 FieldBase expression = field[0]; 84 FieldBase format0 = field[1]; 85 if (expression.isNull()) { 86 return new FieldLiteral(FieldUtility.NULLBUFFERRANGE, 87 Datatypes.BIGDECIMAL); 88 } 89 String format = ""; 90 if (format0 != null) { 91 if (!format0.isNull()) { 92 format = (String ) (format0.getObject()); 93 } 94 } 95 int expressiontype = getExpressionDataType(object); 96 97 return getResult(expression.getObject(), expressiontype, format); 98 99 } 100 101 private int getExpressionDataType(Object object) throws DException { 102 return getDataTypeForByte(_stringfunctionparameters1.getByteComparison( 103 object)); 104 } 105 106 private Object getResult(Object object, int type, String format) throws 107 DException { 108 109 switch (type) { 110 case BYTE: 111 case TINYINT: 112 case INTEGER: 113 case INT: 114 case SHORT: 115 case SMALLINT: 116 case REAL: 117 case DOUBLE: 118 case FLOAT: 119 case LONG: 120 case BIGINT: 121 case DOUBLEPRECISION: 122 case BIGDECIMAL: 123 case DEC: 124 case DECIMAL: 125 case NUMERIC: 126 Number expresion = (Number ) object; 127 return new FieldStringLiteral(numberFromat(expresion.toString(), format), 128 CHARACTER); 129 case CHARACTER: 130 case VARCHAR: 131 case CHAR: 132 case CHARACTERVARYING: 133 return new FieldStringLiteral( (String ) object, CHARACTER); 134 case DATE: 135 Date date = (Date ) object; 136 Date d1 = new com.daffodilwoods.daffodildb.utils.DBDate(date.getTime()); 137 return new FieldStringLiteral(getDateAndTimeResult(d1, format), CHARACTER); 138 case TIMESTAMP: 139 Timestamp timestamp = (Timestamp) object; 140 return new FieldStringLiteral(getDateAndTimeResult(timestamp, format), 141 CHARACTER); 142 case TIME: 143 default: 144 throw new DException("DSE4108", 145 new Object [] {StaticClass.getDataTypeName(type), 146 "STRINGFUNCTION"}); 147 } 148 149 } 150 151 185 186 private String numberFromat(String number, String format) throws DException { 187 try { 188 if (format.equals("")) { 189 return number; 190 } 191 if (format.startsWith("FM")) { 192 return number.trim(); 193 } 194 if (format.startsWith("$")) { 195 return "$" + number; 196 } 197 if (format.startsWith("B")) { 198 return removeLeadingZero(number.trim()); 199 } 200 if (format.indexOf("S") != -1) { 201 return addPlusWithNumber(number, format); 202 } 203 if (format.startsWith("PR")) { 204 return "<" + number + ">"; 205 } 206 if (format.toLowerCase().indexOf("mi") != -1) { 207 return addMinusWithNumber(number, format); 208 } 209 if (format.toLowerCase().startsWith("rn")) { 210 return getRomans(number); 211 } 212 if (format.toLowerCase().indexOf("d") != -1) { 213 return positionOfDecimalPoint(number, format); 214 } 215 if (format.indexOf(",") != -1) { 216 number = positionOfComma(number, format); 217 if (format.indexOf(".") != -1) { 218 return WithAndWithoutPeriod(number, format); 219 } 220 } 221 if (format.toLowerCase().indexOf("g") != -1) { 222 return positionOfComma_G(number, format); 223 } 224 if (format.startsWith("C")) { 225 return "C" + number; 226 } 227 if (format.startsWith("L")) { 228 return "L" + number; 229 } 230 if (format.startsWith("0")) { 231 return includingLeadingZero(number, format); 232 } 233 return WithAndWithoutPeriod(number, format); 234 } 235 catch (Exception ex) { 236 throw new DException("DSE568",new Object [] {format}); 237 } 238 } 239 240 241 private String addPlusWithNumber(String expression,String format) { 242 if (format.startsWith("S")) { 243 if (!expression.startsWith("-")) 244 return "+" + expression; 245 } 246 return expression+"+"; 247 } 248 249 private String addMinusWithNumber(String expression,String format) { 250 if (format.startsWith("MI")) { 251 if (!expression.startsWith("-")) 252 return "-" + expression; 253 } 254 return expression+"-"; 255 } 256 257 private String includingLeadingZero(String expression, String format) { 258 char[] formatArray = format.toCharArray(); 259 int i = 0; 260 boolean flag = true, firstTime = true; 261 StringBuffer temp = new StringBuffer (); 262 for (; i < formatArray.length; i++) { 263 if (formatArray[i] == '0' && flag) 264 temp.append('0'); 265 else 266 flag = false; 267 if (!flag && firstTime) { 268 firstTime = false; 269 temp.append(expression); 270 } 271 if (formatArray[i] == 'D') { 272 flag = true; 273 temp.append('.'); 274 } 275 } 276 return temp.toString(); 277 278 } 279 280 private String positionOfDecimalPoint(String expression, String format) { 281 StringBuffer sb =new StringBuffer (); 282 int indexInExpression = expression.indexOf("."); 283 int indexInFormat = format.toLowerCase().indexOf("d"); 284 if(indexInExpression == -1){ 285 if(expression.length() <= format.length() ) 286 return " "+expression; 287 for (int i = 0; i < expression.length(); i++) 288 sb.append("#"); 289 return sb.toString() ; 290 } 291 for (int i = 0; i < expression.length(); i++) { 292 char charToAppend = expression.charAt(i); 293 if(charToAppend!='.') { 294 if (i == indexInFormat) 295 sb.append("."); 296 sb.append(charToAppend); 297 } 298 299 } 300 return sb.toString(); 301 } 302 303 private String positionOfComma(String expression, String format) { 304 int indexOfG = format.indexOf(","); 305 StringBuffer sb=new StringBuffer (); 306 for (int i = 0; i < expression.length(); i++) { 307 char charToAppend = expression.charAt(i); 308 if(charToAppend!='.') { 309 if (i == indexOfG) 310 sb.append(","); 311 sb.append(charToAppend); 312 } 313 } 314 return sb.toString(); 315 } 316 317 private String BKOfLastCode_positionOfComma_G(String expression, String format) { 318 int indexOfG = format.toLowerCase().indexOf("G"); 319 StringBuffer sb=new StringBuffer (); 320 for (int i = 0; i < expression.length(); i++) { 321 char charToAppend = expression.charAt(i); 322 if(charToAppend!='.') { 323 if (i == indexOfG) 324 sb.append(","); 325 sb.append(charToAppend); 326 } 327 } 328 return sb.toString(); 329 } 330 331 private String positionOfComma_G(String expression, String format) { 332 int indexOfG = format.toLowerCase().indexOf("G"); 333 StringBuffer sb=new StringBuffer (); 334 if(expression.length()==format.length()){ 335 for (int i = 0; i < expression.length(); i++) { 336 char charToAppend = expression.charAt(i); 337 char charInForamt =format.charAt(i); 338 if(charInForamt ==','||i==indexOfG) 339 sb.append(","); 340 sb.append(charToAppend); 341 } 342 return sb.toString(); 343 } 344 for (int i = 0; i < expression.length(); i++) { 345 sb.append("#"); 346 } 347 return sb.toString(); 348 } 349 350 private String WithAndWithoutPeriod(String expression, String format) throws DException { 351 StringBuffer sb=new StringBuffer (); 352 int indexInExpression = expression.indexOf("."); 353 int indexInFormat = format.indexOf("."); 354 if(indexInFormat == -1 && indexInExpression == -1){ 355 if(expression.length() <= format.length() ) 356 return " "+expression; 357 for (int i = 0; i < expression.length(); i++) 358 sb.append("#"); 359 return sb.toString() ; 360 } 361 if(indexInFormat == -1 && indexInExpression != -1) { 362 return expression.substring(0,indexInExpression); 363 } 364 boolean flag = indexInExpression > indexInFormat ; 365 if(flag) 366 for (int i = 0; i < indexInExpression; i++) 367 sb.append("#") ; 368 else 369 sb.append( indexInExpression == -1 ? expression : expression.substring(0, indexInExpression)); 370 for (int i = 0,j=sb.length() ; i < format.substring (indexInFormat,format.length() ).length() ; i++,j++) { 371 sb.append(flag ? "#" : ((j >= expression.length()) ? "0" : ""+expression.charAt(j)) ) ; 372 } 373 return sb.toString(); 374 } 375 376 386 private String getRomans(String expression) { 387 StringBuffer sb = new StringBuffer (); 388 long num = (new Double (Math.ceil(Double.parseDouble(expression))).longValue()); 389 ArrayList list = new ArrayList(); 390 int count = 0, val = 0; 391 if (num > 0) { 392 do { 393 val = (int) num % 10; 394 num = num / 10; 395 val = (val * (int) Math.pow(10, count)); 396 list.add(new Integer (val)); 397 count++; 398 } 399 while (num > 0); 400 } 401 else { 402 return "#"; 403 } 404 Integer [] intArr = new Integer [list.size()]; 405 list.toArray(intArr); 406 for (int i = intArr.length - 1; i >= 0; i--) { 407 val = intArr[i].intValue(); 408 romanEquivalentOfANumber(val, sb); 409 } 410 return sb.toString(); 411 } 412 413 private void romanEquivalentOfANumber(int number, StringBuffer sb) { 414 if (number <= 9) 415 sb.append(romanZeroToNine[number]); 416 else { 417 switch (number) { 418 case 10: 419 sb.append("X");break; 420 case 20: 421 sb.append("XX");break; 422 case 30: 423 sb.append("XXX");break; 424 case 40: 425 sb.append("XL"); break; 426 case 50: 427 sb.append("L"); break; 428 case 60: 429 sb.append("LX"); break; 430 case 70: 431 sb.append("LXX"); break; 432 case 80: 433 sb.append("LXXX"); break; 434 case 90: 435 sb.append("XC"); break; 436 case 100: 437 sb.append("C"); break; 438 case 200: 439 sb.append("CC"); break; 440 case 300: 441 sb.append("CCC"); break; 442 case 400: 443 sb.append("CD"); break; 444 case 500: 445 sb.append("D"); break; 446 case 600: 447 sb.append("DC"); break; 448 case 700: 449 sb.append("DCC"); break; 450 case 800: 451 sb.append("DCCC"); break; 452 case 900: 453 sb.append("CM"); break; 454 case 1000: 455 sb.append("M"); break; 456 case 2000: 457 sb.append("MM"); break; 458 case 3000: 459 sb.append("MMM"); break; 460 default: 461 sb.append("#"); break; 462 } 463 } 464 } 465 466 public String removeLeadingZero(String value) throws DException { 467 do { 468 value = value.replaceFirst("0", ""); 469 } 470 while (value.startsWith("0")); 471 return value.trim(); 472 } 473 474 537 public String getDateAndTimeResult(Object dateOrTimestamp, String format) throws 538 DException { 539 if(format.equals("")){ 540 return dateOrTimestamp.toString(); 541 } 542 StringBuffer result = new StringBuffer (); 543 DaffodilStringTokenizer st = new DaffodilStringTokenizer(format); 544 while (st.hasMoreTokens()) { 545 String reqformat = (String ) mapOfFormats.get(st.token); 546 if (reqformat != null) { 547 result.append(getDateTimeValue(dateOrTimestamp, reqformat)); 548 } 549 else { 550 String [] entry = (String []) mapForSpecialFormats.get(st.token); 551 if (entry == null) 552 throw new DException("DSE568", 553 new Object [] {format}); 554 if (entry.length > 2) { 555 result.append(getDateTimeValue(dateOrTimestamp, entry[0])); 556 result.append("."); 557 result.append(getDateTimeValue(dateOrTimestamp, entry[2])); 558 } 559 else { 560 result.append(specialHandling(dateOrTimestamp, entry)); 561 } 562 } 563 result.append(st.getDelemeter()); 564 } 565 return result.toString(); 566 } 567 568 static void initializeMapForSpecialFormats() { 569 mapForSpecialFormats.put("SS.ssss", new String [] {"s", "dot", "SSS"}); 570 mapForSpecialFormats.put("SS.SSSS", new String [] {"s", "dot", "SSS"}); 571 mapForSpecialFormats.put("ss.ssss", new String [] {"s", "dot", "SSS"}); 572 mapForSpecialFormats.put("ss.SSSS", new String [] {"s", "dot", "SSS"}); 573 mapForSpecialFormats.put("FMmon", new String [] {"MMM", "lower"}); 574 mapForSpecialFormats.put("mon", new String [] {"MMM", "lower"}); 575 mapForSpecialFormats.put("month", new String [] {"MMMM", "lower"}); 576 mapForSpecialFormats.put("FMmonth", new String [] {"MMMM", "lower"}); 577 mapForSpecialFormats.put("day", new String [] {"E", "lower"}); 578 mapForSpecialFormats.put("FMday", new String [] {"E", "lower"}); 579 mapForSpecialFormats.put("FMMon", new String [] {"MMMM", "InitCap"}); 580 mapForSpecialFormats.put("Mon", new String [] {"MMMM", "InitCap"}); 581 mapForSpecialFormats.put("Month", new String [] {"MMMM", "InitCap"}); 582 mapForSpecialFormats.put("FMMonth", new String [] {"MMMM", "InitCap"}); 583 mapForSpecialFormats.put("Day", new String [] {"E", "InitCap"}); 584 mapForSpecialFormats.put("FMDay", new String [] {"E", "InitCap"}); 585 mapForSpecialFormats.put("DDSPTH", new String [] {"d", "TH"}); 586 mapForSpecialFormats.put("DDDth", new String [] {"d", "th"}); 587 mapForSpecialFormats.put("DDth", new String [] {"d", "th"}); 588 mapForSpecialFormats.put("DDTH", new String [] {"d", "TH"}); 589 mapForSpecialFormats.put("ddth", new String [] {"d", "th"}); 590 mapForSpecialFormats.put("ddTH", new String [] {"d", "TH"}); 591 mapForSpecialFormats.put("q", new String [] {"", "q"}); 592 mapForSpecialFormats.put("Q", new String [] {"", "q"}); 593 mapForSpecialFormats.put("cc", new String [] {"", "cc"}); 594 mapForSpecialFormats.put("CC", new String [] {"", "cc"}); 595 mapForSpecialFormats.put("scc", new String [] {"", "scc"}); 596 mapForSpecialFormats.put("SCC", new String [] {"", "scc"}); 597 598 } 599 600 static void initializeMapValues() { 601 mapOfFormats.put("BC", "G"); 602 mapOfFormats.put("AC", "G"); 603 mapOfFormats.put("RR", "yy"); 604 mapOfFormats.put("YYYY", "yyyy"); 605 mapOfFormats.put("yyyy", "yyyy"); 606 mapOfFormats.put("IYYY", "yyyy"); 607 mapOfFormats.put("YY", "yy"); 608 mapOfFormats.put("yy", "yy"); 609 mapOfFormats.put("YEAR", "yyyy"); 610 mapOfFormats.put("year", "yyyy"); 611 mapOfFormats.put("SYEAR", "yyyy"); 612 mapOfFormats.put("syear", "yyyy"); 613 mapOfFormats.put("MM", "M"); 614 mapOfFormats.put("mm", "M"); 615 mapOfFormats.put("Mm", "M"); 616 mapOfFormats.put("mM", "M"); 617 mapOfFormats.put("FMon", "MMM"); 618 mapOfFormats.put("FMMon", "MMM"); 619 mapOfFormats.put("FMMON", "MMM"); 620 mapOfFormats.put("Mon", "MMM"); 621 mapOfFormats.put("MON", "MMM"); 622 mapOfFormats.put("FMonth", "MMMM"); 623 mapOfFormats.put("FMMonth", "MMMM"); 624 mapOfFormats.put("Month", "MMMM"); 625 mapOfFormats.put("MONTH", "MMMM"); 626 627 mapOfFormats.put("WW", "w"); 628 mapOfFormats.put("IW", "w"); 629 mapOfFormats.put("D", "dd"); 630 mapOfFormats.put("DDD", "D"); 631 mapOfFormats.put("DD", "d"); 632 mapOfFormats.put("dd", "d"); 633 mapOfFormats.put("j", "d"); 634 mapOfFormats.put("DAY", "E"); 635 mapOfFormats.put("Day", "E"); 636 mapOfFormats.put("day", "E"); 637 mapOfFormats.put("DY", "EEE"); 638 mapOfFormats.put("FMDAY", "E"); 639 mapOfFormats.put("HH", "h"); 640 mapOfFormats.put("hh", "h"); 641 mapOfFormats.put("HH12", "h"); 642 mapOfFormats.put("hh12", "h"); 643 mapOfFormats.put("HH24", "K"); 644 mapOfFormats.put("hh24", "K"); 645 mapOfFormats.put("MI", "m"); 646 mapOfFormats.put("mi", "m"); 647 mapOfFormats.put("SS", "s"); 648 mapOfFormats.put("ss", "s"); 649 mapOfFormats.put("SSSS", "S"); 650 mapOfFormats.put(".ssss", "S"); 651 mapOfFormats.put("FF", "SSS"); 652 mapOfFormats.put("ff", "SSS"); 653 mapOfFormats.put("AM", "a"); 654 mapOfFormats.put("am", "a"); 655 mapOfFormats.put("PM", "a"); 656 mapOfFormats.put("pm", "a"); 657 mapOfFormats.put("A.M.", "a"); 658 mapOfFormats.put("a.m.", "a"); 659 mapOfFormats.put("P.M.", "a"); 660 mapOfFormats.put("p.m.", "a"); 661 662 } 663 664 String specialHandling(Object dateOrTimestamp, String [] entry0) throws 665 DException { 666 String toReturn = getDateTimeValue(dateOrTimestamp, entry0[0]); 667 if (entry0[1].equalsIgnoreCase("lower")) { 668 return toReturn.toLowerCase(); 669 } 670 if (entry0[1].equalsIgnoreCase("initcap")) { 671 return toReturn.replaceFirst("" + toReturn.charAt(0), 672 ("" + toReturn.charAt(0)).toUpperCase()); 673 } 674 if (entry0[1].equalsIgnoreCase("th")) { 675 return toReturn += entry0[1]; 676 } 677 if (entry0[1].equalsIgnoreCase("q")) { 678 return toReturn += getQuarter(dateOrTimestamp); 679 } 680 if (entry0[1].equalsIgnoreCase("scc") || entry0[1].equalsIgnoreCase("cc")) { 681 return toReturn += getCentuary(dateOrTimestamp); 682 } 683 return toReturn; 684 } 685 686 690 java.lang.String getDateTimeValue(Object dateOrTimestamp, 691 java.lang.String format) throws DException { 692 try { 693 SimpleDateFormat formatter = new SimpleDateFormat(format); 694 return formatter.format(dateOrTimestamp); 695 } 696 catch (IllegalArgumentException ex) { 697 throw new DException("DSE568", new Object [] {format}); 698 } 699 } 700 701 private String getQuarter(Object DateOftimestamp) throws DException{ 702 int mm = 0; 703 if (DateOftimestamp instanceof Date ) { 704 mm = ( (Date ) DateOftimestamp).getMonth() + 1; 705 } 706 else { 707 mm = ( (Timestamp) DateOftimestamp).getMonth() + 1; 708 } 709 if (mm <= 3) { 710 mm = 1; 711 } 712 else if (mm <= 6) { 713 mm = 2; 714 } 715 else if (mm <= 9) { 716 mm = 3; 717 } 718 else if (mm <= 12) { 719 mm = 4; 720 } 721 return "" + mm; 722 } 723 724 private String getCentuary(Object dateOrTimestamp) throws DException { 725 int year = -1; 726 if (dateOrTimestamp instanceof Date ) { 727 year = ( (Date ) dateOrTimestamp).getYear() + 1900; 728 } 729 else { 730 year = ( (Timestamp) dateOrTimestamp).getYear() + 1900; 731 } 732 year = year % 100 == 0 ? year / 100 : (year/100 +1 ) ; 733 return "" + year; 734 } 735 736 public ByteComparison getByteComparison(Object object) throws DException { 737 ByteComparison byteComparison = new ByteComparison(false,new int[] {CHARACTER}); 738 byteComparison.setSize(getColumnSize(object)); 739 return byteComparison; 740 } 741 742 public ColumnDetails[] getChildColumnDetails() { 743 return columnDetails; 744 } 745 746 public _Reference[] checkSemantic(_ServerSession parent) throws DException { 747 _Reference[] ref = super.checkSemantic(parent); 748 if (ref != null) { 749 return ref; 750 } 751 int type = _stringfunctionparameters1.getByteComparison(parent). 752 getDataTypes()[0]; 753 switch (type) { 754 case -1: 755 case BYTE: 756 case TINYINT: 757 case INTEGER: 758 case INT: 759 case SHORT: 760 case SMALLINT: 761 case REAL: 762 case DOUBLE: 763 case FLOAT: 764 case DOUBLEPRECISION: 765 case LONG: 766 case BIGINT: 767 case BIGDECIMAL: 768 case DEC: 769 case DECIMAL: 770 case NUMERIC: 771 return ref; 772 default: 773 throw new DException("DSE4108", 774 new Object [] {StaticClass.getDataTypeName(type), 775 "STRINGFUNCTION"}); 776 } 777 } 778 779 public ParameterInfo[] getParameterInfo() { 780 return new ParameterInfo[0]; 781 } 782 783 public AbstractRowValueExpression[] getChilds() { 784 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] { 785 (AbstractRowValueExpression) _stringfunctionparameters1}; 786 return childs; 787 788 } 789 790 public int getColumnSize(Object object) throws DException { 791 ColumnDetails[] columnDetails = getChildColumnDetails(); 792 if (columnDetails[0].getQuestion()) { 793 return DatabaseProperties.maxCharLiteralLength; 794 } 795 if (columnDetails[0].getType() != TypeConstants.CONSTANT || 796 columnDetails[0].getSize() != -5) { 797 return columnDetails[0].getSize(); 798 } 799 FieldBase field = (FieldBase) _stringfunctionparameters1.run(object); 800 field.setDatatype(columnDetails[0].getDatatype()); 801 return field.getLength(); 802 803 } 804 805 public String getType() throws DException { 806 return (String ) _SRESERVEDWORD12065439223.run(null); 807 } 808 809 public Object clone() throws CloneNotSupportedException { 810 stringfunction tempClass = new stringfunction(); 811 tempClass._Srightparen_18748595140 = (Srightparen_1874859514) 812 _Srightparen_18748595140.clone(); 813 tempClass._stringfunctionparameters1 = (stringfunctionparameters) 814 _stringfunctionparameters1.clone(); 815 tempClass._Sleftparen6538802412 = (Sleftparen653880241) 816 _Sleftparen6538802412.clone(); 817 tempClass._SRESERVEDWORD12065439223 = (SRESERVEDWORD1206543922) 818 _SRESERVEDWORD12065439223.clone(); 819 return tempClass; 820 821 } 822 823 public String toString() { 824 StringBuffer sb = new StringBuffer (); 825 sb.append(" "); 826 sb.append(_SRESERVEDWORD12065439223); 827 sb.append(" "); 828 sb.append(_Sleftparen6538802412); 829 sb.append(" "); 830 sb.append(_stringfunctionparameters1); 831 sb.append(" "); 832 sb.append(_Srightparen_18748595140); 833 return sb.toString(); 834 } 835 } 836 837 class DaffodilStringTokenizer { 838 int position; 839 boolean tokenCompleted; 840 String token, delimeter; 841 char[] charArray; 842 843 DaffodilStringTokenizer(String toBeTokenized) { 844 charArray = toBeTokenized.toCharArray(); 845 position = -1; 846 } 847 848 boolean hasMoreTokens() { 849 token = delimeter = ""; 850 tokenCompleted = false; 851 while (++position < charArray.length) { 852 if (charArray[position] == ',' || charArray[position] == '/' || 853 charArray[position] == ' ' || charArray[position] == '-') { 854 delimeter += charArray[position]; 855 tokenCompleted = true; 856 } 857 else { 858 if (tokenCompleted) { 859 position--; 860 return true; 861 } 862 token += charArray[position]; 863 } 864 } 865 return token.length() >= 1; 866 } 867 868 String getToken() { 869 return token; 870 } 871 872 String getDelemeter() { 873 return delimeter; 874 } 875 876 } 877 | Popular Tags |