/
Tutorial1.java
44 lines (37 loc) · 1.63 KB
/
Tutorial1.java
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
/* Tutorial1.java
* ...................................................................................
* SCOM: Single Class Object Model (http://code.google.com/p/scom/)
* Licence: MIT (http://en.wikipedia.org/wiki/MIT_License)
* Michel Kern - 28 may 2012 - 22:52
* Copyright (C) <2012> www.terimakasi.com
*/
package scom.tutorials.tutorial1;
import scom.It;
import static scom.It.*;
public class Tutorial1
{
public static String K_MOTOR = "moteur";
public static void main(String[] args)
{
Print("**** SCOM: Tutorial1 sample ****");
//----- 'item1' It instance -----
It item = New(K_VALUE, "this is item1")
.putFacet(NAME, New("item1"))
.putFacet("version", New("1.01"))
.putFacet(ItSuccessorF.BASENAME, New(ItSuccessorF.BASENAME, ItSuccessorF.BASENAME, ItSuccessorF.CLASS_NAME));
Print(item);
Print(" successeur de '" + item + "': " + item.getFacet(ItSuccessorF.BASENAME).evaluate(New(2)));
//----- 'item1' It instance
//----- 'Voiture' class -----
//It voiture_class_it = NewClass("Voiture")
It voiture_class_it = New("Voiture", METACLASS)
.putFacet(K_MOTOR, New("rolls royce"))
.putFacet(ItSuccessorF.BASENAME, New(ItSuccessorF.BASENAME, "successor", ItSuccessorF.CLASS_NAME));
It ma_voiture = New(voiture_class_it);
Print(ma_voiture);
Print("successor of '1': " + ma_voiture.getFacet(ItSuccessorF.BASENAME).evaluate(New(1)));
Print("");
Print(ma_voiture, WITH_UNLIMITED_DEPTH);
//----- 'Voiture' class
} //---- main()
} //---------- Tutorial1