コード例 #1
0
 public synchronized void focus(Variable... vars) {
   if (currentFocus == null) {
     currentFocus = new FocusConstraint();
   }
   Vector<Variable> scopeVars = new Vector<Variable>();
   for (Variable v : currentFocus.getScope()) scopeVars.add(v);
   for (Variable v : vars) scopeVars.add(v);
   currentFocus.setScope(scopeVars.toArray(new Variable[scopeVars.size()]));
 }
コード例 #2
0
 public synchronized void removeFromCurrentFocus(Variable... vars) {
   if (currentFocus == null) throw new NoFocusDefinedException(vars);
   Vector<Variable> newScope = new Vector<Variable>();
   for (Variable vOld : currentFocus.getScope()) {
     boolean found = false;
     for (Variable vToRem : vars) {
       if (vOld.equals(vToRem)) found = true;
     }
     if (!found) newScope.add(vOld);
   }
   currentFocus.setScope(newScope.toArray(new Variable[newScope.size()]));
 }
コード例 #3
0
 public synchronized void setFocus(Variable... vars) {
   currentFocus = new FocusConstraint();
   currentFocus.setScope(vars);
 }
コード例 #4
0
 public synchronized Variable[] getFocused() {
   if (currentFocus != null) return currentFocus.getScope();
   return null;
 }