Exemplo n.º 1
0
 public void reset() {
   if (seqToCat != null || catToSeq != null) {
     seqToCat = catToSeq = null; // easy - we drop everything ;)
     if (notifyVar) v.NotifyAll(new NotifyMsg(this, Common.NM_VarSeqChange));
     else NotifyAll(new NotifyMsg(this, Common.NM_CatSeqChange));
   }
   return;
 }
Exemplo n.º 2
0
 public boolean moveCatAtPosTo(int p1, int p2) {
   if (p1 == p2) return true;
   if (p1 < 0 || p2 < 0 || p1 >= cats || p2 >= cats)
     return Global.runtimeWarning(
             "SCatSequence on "
                 + ((v == null) ? "<null>" : v.getName())
                 + ": moveCatAtPosTo("
                 + p1
                 + ","
                 + p2
                 + ") out of range ("
                 + cats
                 + " cats)")
         != -1;
   if (seqToCat == null) createFields();
   int c1 = seqToCat[p1];
   if (p1 < p2) { // move to back
     int r = p1;
     while (r < p2) {
       int c = seqToCat[r + 1];
       seqToCat[r] = c;
       catToSeq[c] = r;
       r++;
     }
     seqToCat[r] = c1;
     catToSeq[c1] = r;
   } else { // move to front
     int r = p1;
     while (r > p2) {
       int c = seqToCat[r - 1];
       seqToCat[r] = c;
       catToSeq[c] = r;
       r--;
     }
     seqToCat[r] = c1;
     catToSeq[c1] = r;
   }
   if (notifyVar) v.NotifyAll(new NotifyMsg(this, Common.NM_VarSeqChange));
   else NotifyAll(new NotifyMsg(this, Common.NM_CatSeqChange));
   return true;
 }
Exemplo n.º 3
0
 public boolean swapCats(int c1, int c2) {
   if (c1 < 0 || c2 < 0 || c1 >= cats || c2 >= cats)
     return Global.runtimeWarning(
             "SCatSequence on "
                 + ((v == null) ? "<null>" : v.getName())
                 + ": swapCats("
                 + c1
                 + ","
                 + c2
                 + ") out of range ("
                 + cats
                 + " cats)")
         != -1;
   if (seqToCat == null) createFields();
   int p1 = catToSeq[c1];
   int p2 = catToSeq[c2];
   seqToCat[p1] = c2;
   seqToCat[p2] = c1;
   catToSeq[c1] = p2;
   catToSeq[c2] = p1;
   if (notifyVar) v.NotifyAll(new NotifyMsg(this, Common.NM_VarSeqChange));
   else NotifyAll(new NotifyMsg(this, Common.NM_CatSeqChange));
   return true;
 }