00001 /* 00002 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 00003 * Copyright (C) 2008 - INRIA 00004 * 00005 * This file must be used under the terms of the CeCILL. 00006 * This source file is licensed as described in the file COPYING, which 00007 * you should have received as part of this distribution. The terms 00008 * are also available at 00009 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt 00010 * 00011 */ 00012 00013 package org.scilab.modules.gui.events; 00014 00020 public final class BlockingResult { 00021 00022 private static BlockingResult me; 00023 00024 private String theResult; 00025 00029 private BlockingResult() { 00030 theResult = null; 00031 } 00032 00037 public static BlockingResult getInstance() { 00038 if (me == null) { 00039 me = new BlockingResult(); 00040 } 00041 return me; 00042 } 00043 00048 public String getResult() { 00049 synchronized (me) { 00050 try { 00051 me.wait(); 00052 } catch (InterruptedException e) { 00053 // TODO Auto-generated catch block 00054 e.printStackTrace(); 00055 } 00056 } 00057 return me.theResult; 00058 } 00059 00064 public void setResult(String theResult) { 00065 this.theResult = theResult; 00066 synchronized (me) { 00067 me.notify(); 00068 } 00069 } 00070 00071 00072 00073 }
1.5.5