--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.utils;\r
+\r
+/**\r
+ * This class is intended to be used as anonymous \r
+ * inner class\r
+ * \r
+ * \r
+ * @author Toni Kalajainen\r
+ */\r
+public class RunnableWithObject implements Runnable {\r
+\r
+ protected Object object, object2;\r
+ \r
+ protected Object objs[];\r
+ \r
+ public RunnableWithObject(Object o) {\r
+ object = o;\r
+ objs = new Object[] {o};\r
+ }\r
+\r
+ public RunnableWithObject(Object o, Object o2) {\r
+ object = o;\r
+ object2 = o2;\r
+ objs = new Object[] {o, o2};\r
+ }\r
+\r
+ public RunnableWithObject(Object... objs) {\r
+ this.objs = objs;\r
+ if (objs.length>=1)\r
+ object = objs[0];\r
+ if (objs.length>=2)\r
+ object2 = objs[1];\r
+ }\r
+ \r
+ public void run() {\r
+ }\r
+ \r
+ public Object getObject() {\r
+ return object;\r
+ }\r
+ \r
+ public int count() {\r
+ return objs.length;\r
+ }\r
+ \r
+ public Object getObject(int index) {\r
+ return objs[index];\r
+ }\r
+\r
+}\r