| Line | |
|---|
| 1 | //////////////////////////////////////////////////////// |
|---|
| 2 | // actually, a Tag can be any value stored in a profile (see Client class definition for more infos) |
|---|
| 3 | class Tag { |
|---|
| 4 | // TAG |
|---|
| 5 | String tag ; // word |
|---|
| 6 | int val ; // valeur |
|---|
| 7 | |
|---|
| 8 | /////////////// shape |
|---|
| 9 | float l,h ; // size |
|---|
| 10 | float r, ang; // ang position |
|---|
| 11 | float nx, ny ; // new position |
|---|
| 12 | float nr, nang ; // new ang position |
|---|
| 13 | float t = 0 ; // time of move |
|---|
| 14 | |
|---|
| 15 | ////////////// interaction |
|---|
| 16 | boolean selected = false ; |
|---|
| 17 | boolean highlighted = false ; |
|---|
| 18 | |
|---|
| 19 | Tag( String inStr ) { |
|---|
| 20 | tag = inStr ; |
|---|
| 21 | val = 0 ; |
|---|
| 22 | } |
|---|
| 23 | Tag( String inStr, int inValue) { // constructor for Tags (with value) |
|---|
| 24 | if(!inStr.equals("")) { |
|---|
| 25 | if(inValue!=0) { |
|---|
| 26 | tag = inStr ; |
|---|
| 27 | val = inValue ; |
|---|
| 28 | } |
|---|
| 29 | else { |
|---|
| 30 | try{ |
|---|
| 31 | String[] pel = split(inStr,aTag) ; // got "sfqdsfds" et "123" |
|---|
| 32 | String newTag = pel[0] ; |
|---|
| 33 | String newVal = pel[1] ; |
|---|
| 34 | tag = newTag ; |
|---|
| 35 | val = int(newVal) ; |
|---|
| 36 | } |
|---|
| 37 | catch(Exception e) { |
|---|
| 38 | tag = "nothing" ; |
|---|
| 39 | val = 666 ; |
|---|
| 40 | print("TAG: Parsing problem"+e+"\n") ; |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | } |
|---|
| 44 | } |
|---|
| 45 | String getString() { // sous la forme "montag.123" si tag, "mot" sinon |
|---|
| 46 | return tag + aTag + val ; |
|---|
| 47 | } |
|---|
| 48 | boolean isListedIn( Vector vect ) { |
|---|
| 49 | boolean res = false ; |
|---|
| 50 | for(int i=0;i<vect.size();i++) { |
|---|
| 51 | if( ((Tag)vect.elementAt(i)).tag.equals(tag) ) res = true ; |
|---|
| 52 | } |
|---|
| 53 | return res ; |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|