-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOTWEB3.0-CDOLLAR
2508 lines (2401 loc) · 69.5 KB
/
DOTWEB3.0-CDOLLAR
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
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
CDOLLAR-DOTWEB3.0-MODULE-1
==========================
CDOLLAR-DOTWEB3.0 is used in Linux platform.
How Cdollar-J$ Technology Works?
––––––––––––––––––––––––––––––––-
At first .cdollar or .c$ is compiled by Cdollarc compiler
And it translate to .C$ file with pure oops concepts.
Cdollarv.4 translator uses CDC friend compiler Which compiles
the Cdollar program.
After that Cdollarv.4 translates to .wl class files and use
CDRUN filename.wl automatically to run the Program.
So converting the bytes codes in .wl class file makes the progam
to run faster than other compilers..
==================================================================================
C D O L L A R -PROGRAMMING-TUTORIAL
--------------------------------------------------
Written By
wilmix jemin j
==================================================================================
UNIT -1
--------
INTRODUCTION
------------
Why CDollar?
-------------
CDollar is used for creating libraries ; CDollar is formed in C/C++
in year 2004.
CDollar is modified in java technology in year 2013, 2015,2016.
CDollar is the combination of JAVA , C/C++, and Advanced OOPS.
it will only accept the shortest attractive syntax.
CDollar first name is "OLIVE Technology" which represents OLIVE TREE . Olive Technology
is renamed as CDOLLAR.
Note: a) The Meaning of CDollar is combination of C++ and JAVA OOPS
concepts.
b) CDollar version 1 and CDollar Version 2 is not good
c) CDollar version 3 contains a build compiler .cdollar.
where .cdollar has the features like java and C/C++.
SYNTAX-1 (used only for WEB - .cdollar)
------------------------------------------------------------
<CDollar>
<IMPORT>
<%
<! CDollar-.cdolar OOPS Logic and main functions !>
%>
?>
PRINT STATEMENT OF CDOLLAR .cdollar
------------------------------------------------
Print Statement of CDollar - .cdollar
-------------------------------------------------
Print.Println(String ,<DataTypes>);
where DataTypes is {int,char,String,Double,float)
This will print space followed by concatenation of String and
datatypes input when you apply \n.
This solves everytime when user wish to concat a String with
datatype every time.
simillary
Print.printf(String ,<DataTypes>);
This will be same to above Print statement but
it will not print space when you apply \n also.
Program-1.cdollar
-----------------
<CDollar>
<IMPORT>
<%
class Program1
{
public Shared void LIB( )
{
int i;
Print.Println("\nList of Technologies in year ","2016 ");
LL1 list = <NEW> LL1();
String i1="weew";
Print.Println("wilmix",i1);
Print.Println("Hiram is going","today");
Print.printf("Hiram Age is =","45 ");
Print.Println("Hiram is working ","in Abc Bank\n");
Print.Println(" \njemin","is going");
<TS> ar2 = <NEW> <TS>();
ar2.add("100");
ar2.add("22");
Print.printf("jeminjhjhjh",ar2.StringConvert());
Print.Println("no: 2/782 ,ds street,california-2322",ar2.StringConvert());
}
}
%>
?>
Notice what happens?
Compile and run the CDollar Program in bash shell using the
command
CDollarc Program1.cdollar
Output:
.
*************************************************************************************
********
Sun Sep 20 14:38:19 GMT+00:00 2015*CDollar: List of Technologies in year 2016 0 C 1
CDOLLAR 2 GDOLLAR 3 CHDOLLAR 4 JDOLLAR 5 JSTAR 6 JSAUCER
wilmix weewHiram is going todayHiram Age is = 45 Hiram is working in Abc Bank jemin is
goingjeminjhjhjh [100, 22]
no: 2/782 ,ds street,california-2322 [100, 22]
Error: <table bgcolor=green>OUTPUT=Compling Cdollar files
CDOLLAR VERSION 1.3 Copy Right 2015 all rights reserved
Created by Jemin Information Technology ,wilmix jemin Bad token: < on row 2 and column 1
Process failed during translation. no Errors in Cdollar program
Note:
----
To Compile and run the CDollar Program in bash shell using the
command
CDollarc filename.cdollar
or
CDRUN <filename.wl> to see the Output or Errors of Cdollar.
Output:
------
> Cdollar EVENORODD
Check Whether the Given No is ODD or EVEN : ?
5
ODD No is 5
WELDONE !
Note: Read.sreadln() Function is used to read data from the
console.....
-------
FAQS:
--------
Why CDollar (.C$) is simillar to JAVA OOPS concepts?
Since in futhure JSAUCER want to interact with
MYBATICS
Framework.
How CDollar is formed ? What are its Advantages Over Native language JAVA Programming?
--------------------------------------------------------------------------------------------------------------
CDollar is formed in C++ OOPS concepts..
JAVA borrowed C++ OOPS concepts but
CDollar borrowed C++ OOPS concepts and JAVA oops and it has
Attractive syntax ; Plus in-build functions
for Program and it is responsible for creating
libraries (.wl). JAVA has attained the Programming
standards, But CDollar attains combination of C Technology
and JAVA Technology advantages.
CDollar Generates .wl class files
but JAVA Generated .class files.
Cdollar Has Advanced OOPS than JAVA 1.8.
==================================================================================
UNIT-2 :CDOLLAR ADVANCED CONCEPTS
==================================================================================
UNIT-2 :CDOLLAR ADVANCED CONCEPTS
-------------------------------------
ADVANCED OOPS CONCEPTS
--------------------------------------------
Example -3:
------------
Write a Program to print two String and add String 100 to
ArrayList.
and create a DataStructure for Linked List and Technologies for year
2016
is C, CDOLLAR ,GDOLLAR,CHDOLLAR, JDOLLAR,JSTAR, JSAUCER.
And add Those in Userdefined LinkedList. But you should not use
extends
keyword to provide inheritance. but you should call the method of
other program without extending the class.
IS it Possible? IN JAVA?
NO
IS it Possible ? in CDollar?
Yes.
Program :abc.cdollar
-------------------
<CDollar>
<IMPORT>
<%
class LL1
{
private LL1 nextNode = null;
private String datum = null;
public LL1()
{
LL1 list = <NEW> LL1("0 C");
list.add("1 CDOLLAR");
list.add("2 GDOLLAR");
list.add("3 CHDOLLAR");
list.add("4 JDOLLAR");
list.add("5 JSTAR");
list.add("6 JSAUCER");
for (int i = 0; i NOT= list.size(); i = i + 1)
{
Print.Println("",list.get(i).StringConvert());
}
}
public LL1(String datum)
{
<SUPER>();
<IS>.datum = datum;
}
public void add(String datum)
{
if (nextNode NOT= null)
{
nextNode.add(datum);
return;
}
nextNode = <NEW> LL1(datum);
}
public String get(int i)
{
if (i == 0)
return datum;
return nextNode.get(i - 1);
}
public int size()
{
if (nextNode == null)
return 1;
return nextNode.size() + 1;
}
}
class abc
{
public Shared void LIB( )
{
int i;
Print.Println("\nList of Technologies in year ","2016 ");
LL1 list = <NEW> LL1();
String i1="weew";
Print.Println("wilmix",i1);
Print.Println(" \njemin","is going");
<AList> ar2 = <NEW> <AList>();
ar2.add("100");
Main m =<NEW> Main();
m.main();
Print.Println("jeminjhjhjh",ar2.StringConvert());
}
}
%>
?>
Note : LinkedList1 is the unwanted keyword
-------
so cdollar did not accept it.
What will be the Output when you run using ?
>CDollarc abc.cdollar
Output:
------
Compiling ....
*************************************************************************************
********
Sun Sep 20 14:46:18 GMT+00:00 2015*CDollar: List of Technologies in year 2016
0 C 1 CDOLLAR 2 GDOLLAR 3 CHDOLLAR 4 JDOLLAR 5 JSTAR 6 JSAUCERwilmix weew jemin is goingList
of Technologies in year 2016
0 C 1 CDOLLAR 2 GDOLLAR 3 CHDOLLAR 4 JDOLLAR 5 JSTAR 6 JSAUCERjeminjhjhjh [100, 22]
Error: <table bgcolor=green>OUTPUT=Compling Cdollar filesCDOLLAR VERSION 1.3 Copy
Right 2015 all rights reserved
Created by Jemin Information Technology ,wilmix jemin Bad token: < on row 2 and column 1
Process failed during translation. no Errors in Cdollar program
Example-4:
-----------
Write a Program to add 1 lakh Natural integers using arraylist
and add the arraylist objects to CDollarArrays
what happens when you compile and execute the given the below program?
SYNTAX for CDollarArrays:
--------------------------------------
CDollarArrays list1 = new CDollarArrays(string);
to add any collection objects to array use
add (String) functions and to Display those
objects use list1.Display();
Any class that use CDollarArrays you should extends Array in class...
Program2:
---------
<CDollar>
<IMPORT>
<%
public class Program2 <--- CDollarArrays
{
public Shared void LIB( )
{
<AList> ar= <NEW> <AList> ();
for (int i=0;i<=100000;i++)
ar.add(i);
CDollarArrays list1 = <NEW> CDollarArrays("ANIMALS ");
list1.add("1 horse");
list1.add("2 pig");
list1.add("3 cow");
list1.add("4 goat");
list1.add("5 chicken");
list1.add("6 ostrich");
list1.add(ar.StringConvert());
list1.Display();
}
}
%>
?>
What will be the Output when you run using ?
CDollarc Program2.cdollar
Ans: It store other collection objects and stores huge amount of data.
TREEOFARRAY
---------------------
Write a Program to add 1 lakh Natural integers incremented by 10 using arraylist
and add the arraylist objects to TreeOfARRAY
what happens when you compile and execute the given the below program?
SYNTAX for TreeofArray:
--------------------------------------
TreeArray <name> = new TreeArray(String);
<name>.add(elements);
where elements may be string or collections....
Program: Tree.cdollar
--------------
<CDollar>
<IMPORT>
<%
public class Tree
{
public Shared void LIB( )
{
TreeArray root = <NEW> TreeArray("SNO");
<AList> ar= <NEW> <AList>();
for (int i=0;i<=100000;i+=10)
ar.add(i);
for (int i = 0; i NOT= 10; i = i + 1)
{
root.add("item "+ ++ i);
}
root.add(ar.StringConvert());
//print the tree's size and contents
Print.Println( "\n\n",root.size() );
root.printTree();
}
}
%>
?>
What will be the Output when you run using ?
CDollarc Tree.cdollar
Ans: It store other collection objects and stores huge amount of data
in tree format.
LISTOFARRAY
---------------------
Write a Program to add 1000 Natural integers using arraylist
and add the arraylist objects to LISTOfARRAY
what happens when you compile and execute the given the below program?
SYNTAX for List of Array:
--------------------------------------
LArray <name> = new LArray(string);
<name>.add(elements);
The elements may be string or collection elements.
Program : LArray1s.cdollar
---------------------------
<CDollar>
<IMPORT>
<%
public class LArray1s
{
public Shared void LIB( )
{
LArray root = <NEW> LArray("root");
<AList> ar= <NEW> <AList>();
for (int i=0;i<=1000;i++)
ar.add(i);
root.add("wilmix");
root.add("jemin");
root.add("shalom");
root.add("1010");
root.add("101");
root.add("201");
root.add(ar.StringConvert());
root.add("100000000");
//print the tree's size and contents
Print.Println( "\n\n",root.size() );
root.printTree();
}
}
%>
?>
What will be the Output when you run using ?
CDollarc LArray1s.cdollar
Ans: It store other collection objects and stores huge amount of data
in tree format.
and sorts the elements in descending order and allow to insert the
element in to middle
of list. This means act like combination of Set and Linked List , and Tree....
==================================================================================
UNIT 3: MISC ,Fundametals of CDollar, Keywords,Operators,loops,Datatypes,Inner class, OOPS
concepts of Cdollar ,and collections
==================================================================================
CDOLLAR OUTPUT STATEMENT
----------------------------------------------
CDollar.out.println(" "+" ");
It is used for printing the output followed by line.
We had to add + operator to concatenate the outputs.....
String
------------
String is represented by <Str> notation.
a) <Str> <strname> = new <Str> ();
This statement is used to create an object...
b) <Str> <strname> = value;
But this Statement will not create an object...
but it stores the value...
the differences between
a) if ( s1==s2)
== means it is used to compare the values...
b) if s1.EQ(s2)
EQ means EQUALS is used to compare objects..
CDOLLAR COLLECTIONS
------------------------------------
Why we use collections in our software development?
Because for various projects we will use various kinds of
datastructures that's why collections are focused.
Q: What are the Important concepts of Software Development?
ARRAYLIST
----------------
SYNTAX:
------------
<AList> <Type> arraylistobjectname = new <AList><Type>
But type may be Object, int, Double,String,etc.
Why we focus Arraylist ?
Since ArrayList involves Powerful insertion and search mechanism when
compared to array.
So we focus it.
Some built in functions available in ArrayList they are add and remove.
syntax : arraylistobjectname.add(<datatype>);
syntax: arraylistobjectname.remove(<datatype>);
How did you iterate the ArrayList?
<WR> syntax means Iterator; this is the shortest syntax of Iterator.
<WR> iteratorname = <CollectionOBJECT>.record();
LinkedList
----------
<LList> <Type> arraylistobjectname <NEW> <LList><Type>
But type may be Object, int, Double,String,etc.
As according to collection concepts , built in functions are Designed for
LinkedList they are add and remove.
syntax : Linkedlistobjectname.add(<datatype>);
syntax: Linkedlistobjectname.remove(<datatype>);
syntax : Linkedlistobjectname.addFirst(<datatype>);
syntax: Linkedlistobjectname.removeFirst(<datatype>);
syntax : Linkedlistobjectname.addLast(<datatype>);
syntax: Linkedlistobjectname.removeLast(<datatype>);
Actually when you study about Datastructures of LinkedList
and here we Designed the LinkedList using the LinkedList code
as mentioned in above that is LinkedList.c$. And add more functions...
and we use CDollar Generics...
What is the function of LinkedList? Why we use LinkedList?
In ArrayList You can't insert element in to the middle
or first or last so LinkedList is focused....
LinkedList is a Good example of Train....
VECTOR
------------
Vector also has the same Datastructures of ArrayList;
but why we focus? . So vector is simillar to Arraylist.
So we can mention in short notation as VList.
but Vector is synchronized and ArrayList is not Synchronized.
Vector use Enumerator and Iterator but ArrayList use only Iterator.
<VList> <VectorObject> = <NEW> <VList> ();
<VectorObject>.addE(elements);
but vector used add functions
<VectorObject>.first(); => Represent First Element...
<VectorObject>.last(); => Represent Last Element...
<VectorObject>.removeAll(elements); => It is used to remove all elements..
<VectorObject>.removeAt(elements); => remove at Particular position
<VectorObject>.remove(object); => remove the first occurance of the given element
<VectorObject>.remove(index); => Remove by Index or position.
OOPS in CDOLLAR
------------------------------
A) INHERITANCE NOT USING EXTENDS METHOD...
C.cdollar
-------------
<CDollar>
<IMPORT>
<%
class A
{
public A() { Print.Println("A's called","n"); }
}
class B
{
public B() { Print.Println("B's called","n"); }
}
class C
{
public C() { { Print.Println("C's called","n"); } }
public Shared void LIB( )
{
<NEW> A();
<NEW> B();
<NEW> C();
}
}
%>
?>
Output:
------
CDollar: A's called nB's called nC's called n
?>
What is the Output for that?
Tue Aug 18 08:14:53 GMT+00:00 2015*CDollar: A's constructor called nB's constructor called nC's
constructor called nError: <table bgcolor=green>OUTPUT=Compling Cdollar filesCDOLLAR
VERSION 1.3 Copy Right 2015 all rights reservedCreated by Jemin Information
Technology ,wilmix jemin Bad token: < on row 1 and column 1Process failed during translation. no
Errors in Cdollar program
B) POLYMORPHISM in CDOLLAR
-----------------------------------------------
What is polymorphism?
It is Means action on method to do different things
based on the object that is action upon.
Example:
-------------
Write a Program to compute Rectangle Area and Triangle area
using Polymorphism.
Geometry.cdollar
----------------------------
<CDollar>
<IMPORT>
<%
class Polygon {
Shared int width, height;
public Shared int set_values (int a, int b)
{ width=a; height=b; return(0); }
}
class Rectangle <--- Polygon {
public int area()
{ return width*height; }
}
class Triangle <--- Polygon {
public int area()
{ return width*height/2; }
}
class Geome<TRY>{
public Shared void LIB( ) {
Rectangle rect = <NEW> Rectangle();
Triangle trgl= <NEW> Triangle();
int t= Polygon.set_values (4,5) * Polygon.set_values (4,5);
Print.Println( "Rect area=",rect.area());
Print.Println( "Triange Area=",trgl.area());
}
}
%>
?>
What will be the Output?
Tue Aug 18 07:45:46 GMT+00:00 2015*CDollar: Rect area= 20Triange Area= 10
CAN CDOLLAR Solves diamond Problem in multiple Inheritance?
Yes
C) Write a Progam to List Faculty , students using Diamond method in CDOLLAR
:-
Note: Without Extends methods its calls methods and value when new ()
is intialized.
This is the Major Advantage of Cdollar over native programming languages
like JAVA.
Program: TA.cdollar
--------------
<CDollar>
<IMPORT>
<%
class Person {
// Data members of person
Person(){}
public Person(int x) { Print.Println("Person::Person(int ) called",x); }
}
class Faculty {
public Faculty(int x)
{
<NEW> Person(x);
Print.Println("Faculty::Faculty(int ) called",x);
}
}
class Student {
// data members of Student
public Student(int x) {
<NEW> Person(x);
Print.Println("Student::Student(int ) called", x);
}
}
class TA {
TA(int x) {
<NEW> Faculty(x);
<NEW> Student(x);
Print.Println("TA::TA(int ) called",x);
}
public Shared void LIB( )
{
<NEW> TA(30);
}
}
%>
?>
What will be the output ?
Tue Aug 18 07:59:57 GMT+00:00 2015*CDollar: Person::Person(int ) called 30Faculty::Faculty(int ) called
30Person::Person(int ) called 30Student::Student(int ) called 30TA::TA(int ) called 30Error: <table
bgcolor=green>OUTPUT=Compling Cdollar filesCDOLLAR VERSION 1.3 Copy Right 2015 all
rights reservedCreated by Jemin Information Technology ,wilmix jemin Bad token: < on row
1 and column 1Process failed during translation. no Errors in Cdollar program
How to run this program?
CDollarc <Filename.cdollar>
C) ABSTRACT CLASS
What did you meant by Abstract class?
Abstract class defines an Abstract concept which can't
be instanated using new Operator().
Where compare to multiple Inheritance it has an implementation
where multiple Inheritance cannot have.
<CDollar>
<IMPORT>
<%
abstract class Abc51
{
abstract void display();
}
public class Abc5 <--- Abc51
{
Shared void display()
{
Print.Println("Wilmix","jemin");
}
public Shared void LIB( )
{
display();
}
}
%>
?>
Output:
-------
No output
Note:
------
It will display errors in wl file.
Errors:[Abc5.CDollar:27: display() in Abc5 cannot override display() in Abc51; overriding method is
static]Errors:[ static void display()]Errors:[ ^]Errors:[1 error]
SO when you remove static in display method()
and call display method() in CDollar Main Program
What happens?
Abc5.cdollar: 35: non-static method display() cannot be referenced from a static context
display();
^
1 error
This means it does not allow the Object to be created ......
and it doesnot allow static methods in abstract class.
=========================================================================
More about COLLECTIONS
---------------------------------------------
SET
------
So Set is represented in Cdollar as <S>
Syntax:
-----------
<S> Objectname = new <S>();
Difference between Set and List?
List allow duplicates but Set did not allow duplicates...
Set did not allow insertion at middle.
For listing the elements in Ascending or descending order
we had to use TreeSet.
Treeset
------------
Treeset represent a collection that uses Tree datastructure for storage
Items in the collections are stored in Ascending or descending order.
<TS> objectname = new <TS>();
objectname.add(elements);
Write a Cdollar Program about Treeset?
remaining things Developer should fill it.
public Shared void LIB( )
{
<AList> ar= <NEW> <AList>();
ar.add("1123");
ar.add("211");
ar.add("31");
ar.add("4");
ar.add("100");
<SORTINT>( ar,"ASC");
<SORTINT>( ar,"DESC");
<AList> ar1= <NEW> <AList>();
ar1.add("rahul");
ar1.add("wilmix");
ar1.add("dion");
ar1.add("shiyam");
ar1.add("priya");
ar1.add("abraham");
<SORTSTRING>( ar1,"ASC");
<SORTSTRING>( ar1,"DESC");
}
Output:
------
Order=ASC[4][31][100][211][1123]
*******************************
Order=DESC[1123][211][100][31][4]
*******************************
Order=ASC[abraham][dion][priya][rahul][shiyam][wilmix]
*******************************
Order=DESC[wilmix][shiyam][rahul][priya][dion][abraham]
Operators conditions and loops
--------------------------------------------------
Operators
---------
+ => ADD
++=> Increment
- => Substract
--=> Substract
* => Mulitply
/ = Division
~ => bitwise unary not operator
NOT (!) => flips true values to false and false values to true.
>>, >>>, and << => IT is used to shift all the bits of a number left
or right
a Specified number of places...
Other Operators
----------------
AND => And operator
OR => OR operator
?: => value =condition ? value1 : value2 (similar to if then else)
== => compare two values...
= => Assignment operators
EQ => Compare two objects
Relational Operators
--------------------
> >= => Greater than , Greater than equals.
< <= => Less than , Less than equal
NOTEQ => Equals and not equals
NotEQ simillar to !=
CONDITIONS
----------
IF Syntax:
------------
if <condition> statements;
IF then else Syntax:
----------------------
if <condition> statements else statements1
if <condition> statements1 else if condition1 statement2 .... and soon.
SWITCH Statements:
-------------------
switch (expression)
{
case value1 :
statement1;
[break]
................
case valuen:
statementn;
[break]
-----
default:
default_statement;
}
Explanation:
------------
If the expression is equals value1
statement1 will be executed.
if you use break it comes out of the loop
otherwise it continue to execute next statement.
The default value at the end is optional. It can be included if there are other values that can be held in
your variable but that you haven't checked for elsewhere in the switch statement.
THE WHILE LOOP
-----------------------------
while (<condition> )
{
< Statements block>
}
Note: if the condition is true the block get executed.
otherwise the loop will be continued.
THE DO --- WHILE LOOP
-----------------------------
do
{
< Statements block>
}
while( <conditon> )
Note: if the condition is true the block get executed.
and it is tested at the end of the loop, but not at the
beginning. The loop will be continued until it satisfies the condition.
biggest reason to be use the do - while loop is that
when you need the body of the loop to be run atleast once.
FOR LOOP
--------
for ( identifier=value; cond1; iterator operators)
{
< Block statements >
}
For -EACH Statement
----------------------
for ( variable : collection)
statement;
for eg)
If you add integers (1 to 3) to arraylist
and if you wish to copy and store it in an integer variable
so that you can print the values that is copied from
arraylist.
Then follow this method of for each statements...
for ( int a : ar)
{
CDollar.out.println("value="+a);
}
Output:
-----------
value=1
value =2
value =3
CONTINUE and Break
---------------------------------
Break means it break out of loop
and continue means
it will continue to execute the statements;
for eg)
Program :WHILE LOOP with continue and break if statement...
--------------------------------------------------------------------------
<CDollar>
<IMPORT>
<%
public class WHILE
{
public Shared void LIB( )
{
int a=0;
while (a <=10)
{
a++;
CDollar.out.println("value="+a);
if ( a==9) continue;
// if you remove this if --else statements it will print all the
values..
else break;
}
}
}
%>
?>
Output:
-------
Wed Aug 19 10:09:23 GMT+00:00 2015*
CDollar: value=1
Error: <table bgcolor=green>OUTPUT=Compling Cdollar filesCDOLLAR VERSION 1.3 Copy
Right 2015 all rights reservedCreated by Jemin Information Technology ,wilmix jemin
Bad token: < on row 2 and column 1Process failed during translation. no Errors in Cdollar .
DATATYPES and OVERLOADING and OVERRIDING CONCEPTS, INNER CLASS
---------------------------------------------------------------------------------------
DATATYPES of CDollar are
-------------------------------
int -> accept only int value
float -> accept float value=>eg) 1.5f
boolean => true or false
character => accept character value
byte -> 1 byte
short -> 2 bytes
long-> 8 bytes
double-> for eg) 1.2121233232E9 => Accept double value
ARRAY => It is used to store values and had fixed size.
ARRAY
-------
SYNTAX:
<Datatype> Arrayname ARRAY [index]
int a ARRAY[1000]; => has 1000 locations to store values...
for two dimension ARRAY
int a[100] ARRAY[100]=> 100 *100 => has 10000 locations to store values
OTHER KEYWORDS IN CDOLLAR
--------------------------------------------------
AND -> AND operator
NOT -> NOT operator
# -> NOTEQUALS
RUN -> Runnable used in thread
TH-> Thread
<EXE> -> Exception
Friends -> Frend function
INNER and OUTER CLASS
-----------------------------------------
Inner class are nested inside outer class even if the fields
declared as private members.
<CDollar>
<IMPORT>
<%
class Outer {
private int privInt = 10;
public void createInnerClass() {
Inner inClass = <NEW> Inner(); //creating innerclass object and calling method
access.
inClass.access();
}
class Inner { // Inner class
public void access() {
CDollar.out.println("The outer classs privInt is " + privInt);
}
}
}
%>
OVERLOADING AND OVERRIDING functions
-------------------------------------------
OVERLOADING
------------
A functions with same name but different signature is called
as Overloading concept.
public void display(int i , String j) {}
=> If you pass int and string values from main program it will call
this function.
ABC a = <NEW> ABC(10,"ewew");
public void display(int i, int j) {}
ABC a = <NEW> ABC(10,20);
=> If you pass int and int values it will call this function.
OVERRIDING
-----------
A function with same name and same signature
will cause overriding....
Overriding can be avoided by using super() keyword.
in another class.
<CDollar>
<IMPORT>
<%
class abc
{
void display(String s)
{
CDollar.out.println("We learn C , Dotnet ,and ,CDollar");
}
}
class abcd <--- abc
{
void display(String s)
{
<SUPER>(s); // if super keyword is added we had to pass arguments in
super keyword.
CDollar.out.println("We learn C , Dotnet ,and ,JDollar");
}
}
%>
Note: this will cause overriding
and it can be avoided by using super () keyword.
OTHER ATTRACTIVE SYMBOLS in CDOLLAR
-------------------------------------------
--> => implements
<-- => extends
MISC
-----
Program -MISC
-----------------------
<CDollar>
<IMPORT>
<%
// Advanced concepts : Here Friends is a helper function used in other classes
friends toy
{
public void display();
}
// friends will act like friend function in C++.
class concat1 --> toy
//---> indicates implements toy
{
public void display()
{
CDollar.out.println("CDollar is going to be finished");
}
}
public class concat
{
Shared int counter=4;
//Shared means static and which can be accessed over all the objects of
variables.
//<EXE> means throws Exception
// <S> means set
//<WR> indicates iterator
//<SBD> means string builder
//<SB> is String Buffer
// Differences is StringBuffer is Synchronized and
//and String Builder is not Synchronized
//AND means && in JAVA
//NOT means ! in JAVA
//TH means Thread in CDollar
//int <Arrayname> Array [nooflocations] (ARRAY SYNTAX)
//addE means AddElements
public Shared void LIB( ) throws <EXE>
{
int i;
String i1="weew";
Print.Println("wilmix",i1);
Print.Println(" \njemin","is going");
<S> <Integer> ar2 = <NEW> <TS> <Integer> ();
ar2.add(100);
<WR> it = ar2.record();
while (it.<HAS>)
{