Esempio n. 1
0
 /**
  * Swaps two actors. Returns false if the swap did not occur because the actors are not children
  * of this group.
  */
 public boolean swapActor(Actor first, Actor second) {
   int firstIndex = children.indexOf(first, true);
   int secondIndex = children.indexOf(second, true);
   if (firstIndex == -1 || secondIndex == -1) return false;
   children.swap(firstIndex, secondIndex);
   return true;
 }
Esempio n. 2
0
 /**
  * Swaps two actors by index. Returns false if the swap did not occur because the indexes were out
  * of bounds.
  */
 public boolean swapActor(int first, int second) {
   int maxIndex = children.size;
   if (first < 0 || first >= maxIndex) return false;
   if (second < 0 || second >= maxIndex) return false;
   children.swap(first, second);
   return true;
 }