1 package org.python.core; 3 import java.util.Vector ; 4 5 public class PyCompoundCallable extends PyObject { 6 private Vector callables; 7 private PySystemState systemState; 8 9 public PyCompoundCallable () { 10 callables = new Vector (); 11 systemState = Py.getSystemState(); 12 } 13 14 public void append(PyObject callable) { 15 callables.addElement(callable); 16 } 17 18 public void clear() { 19 callables.removeAllElements(); 20 } 21 22 public PyObject __call__(PyObject[] args, String [] keywords) { 23 Py.setSystemState(systemState); 25 int n = callables.size(); 26 for (int i=0; i<n; i++) { 28 ((PyObject)callables.elementAt(i)).__call__(args, keywords); 29 } 30 return Py.None; 31 } 32 33 public String toString() { 34 return "<CompoundCallable with "+callables.size()+" callables>"; 35 } 36 } 37 | Popular Tags |