5 @METHODDEFAULT("O<V,V<C,C<IN,THISLOC=O,C*")
8 @LOC("V") char value[];
11 @LOC("V") private int cachedHashcode;
16 public String(@LOC("IN") String str) {
19 this.offset=str.offset;
22 public String(@LOC("IN") char c) {
23 @LOC("V") char[] str = new char[1];
28 public String(@LOC("IN") char str[]) {
29 @LOC("V") char charstr[]=new char[str.length];
30 for(@LOC("C") int i=0; i<str.length; i++)
34 this.count=str.length;
38 @LATTICE("O<V,V<C,C<IN,THISLOC=IN,C*")
40 public String concat(@LOC("IN") String str) {
41 @LOC("O") String newstr=new String(); // create new one, it has OUT location
42 @LOC("C") int newCount=this.count+str.count;
44 @LOC("V") char charstr[]=new char[newCount];
46 // here, for loop introduces indirect flow from [C] to [V]
47 for(@LOC("C") int i=0; i<count; i++) {
48 // value flows from GLB(THISLOC,C,THISLOC.V)=(THISLOC,TOP) to [V]
49 charstr[i]=value[i+offset];
51 for(@LOC("C") int i=0; i<str.count; i++) {
52 charstr[i+count]=str.value[i+str.offset];
57 // LOC(newstr.value)=[O,V]
65 public boolean equals(@LOC("IN") Object o) {
66 if (o.getType()!=getType()) // values are coming from [IN] and [THISLOC]
68 @LOC("V") String s=(String)o;
72 for(@LOC("C") int i=0; i<count; i++) {
73 if (s.value[i+s.offset]!=value[i+offset])
80 public static String valueOf(@LOC("IN") Object o) {
87 @LATTICE("O<V,V<C,C<IN,THISLOC=IN,C*")
89 public byte[] getBytes() {
90 @LOC("V") byte str[]=new byte[count];
91 for(@LOC("C") int i=0; i<count; i++)
92 str[i]=(byte)value[i+offset];
102 public char charAt(@LOC("IN") int index){
106 //public static native int convertdoubletochar(double val, char [] chararray);