1 @LATTICE("String_V<String_C, String_V<String_O")
2 @METHODDEFAULT("StringDM_O<StringDM_V,StringDM_V<StringDM_C,StringDM_C<StringDM_I,THISLOC=StringDM_O,StringDM_C*")
5 @LOC("String_V") char value[];
6 @LOC("String_C") int count;
7 @LOC("String_O") int offset;
8 @LOC("String_V") private int cachedHashcode;
13 public String(@LOC("StringDM_I") char c) {
14 @LOC("StringDM_V") char[] str = new char[1];
19 public String(@LOC("StringDM_I") char str[]) {
20 @LOC("StringDM_V") char charstr[]=new char[str.length];
21 for(@LOC("StringDM_C") int i=0; i<str.length; i++)
24 this.count=str.length;
28 @LATTICE("StringM1_O<StringM1_V,StringM1_V<StringM1_C,StringM1_C<StringM1_I,THISLOC=StringM1_I,StringM1_C*")
29 public String concat(@LOC("StringM1_I") String str) {
30 @LOC("StringM1_O") String newstr=new String(); // create new one, it has OUT location
31 @LOC("StringM1_C") int newCount=this.count+str.count;
33 @LOC("StringM1_V") char charstr[]=new char[newCount];
35 // here, for loop introduces indirect flow from [C] to [V]
36 for(@LOC("StringM1_C") int i=0; i<count; i++) {
37 // value flows from GLB(THISLOC,C,THISLOC.V)=(THISLOC,TOP) to [V]
38 charstr[i]=value[i+offset];
40 for(@LOC("StringM1_C") int i=0; i<str.count; i++) {
41 charstr[i+count]=str.value[i+str.offset];
45 // LOC(newstr.value)=[O,STRING_V]
52 public boolean equals(@LOC("StringDM_I") Object o) {
53 if (o.getType()!=getType()) // values are coming from [StringDM_I] and [THISLOC]
55 @LOC("StringDM_V") String s=(String)o;
58 for(@LOC("StringDM_C") int i=0; i<count; i++) {
59 if (s.value[i+s.offset]!=value[i+offset])