Project: engagement_generation License: BSD Dependencies:
Used by:
None |
engagement_generation/src/edu/wpi/hri/gen/comm/GazeListener.javaGo to the documentation of this file.00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Worcester Polytechnic Institute All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * * Redistributions of source code must retain the above copyright notice, this 00010 * list of conditions and the following disclaimer. * Redistributions in binary 00011 * form must reproduce the above copyright notice, this list of conditions and 00012 * the following disclaimer in the documentation and/or other materials provided 00013 * with the distribution. * Neither the name of Worcester Polytechnic Institute. 00014 * nor the names of its contributors may be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 package edu.wpi.hri.gen.comm; 00030 00040 public abstract class GazeListener { 00041 00042 protected final GazeListener next; 00043 protected String target; 00044 00045 protected GazeListener(GazeListener next) { 00046 this.next = next; 00047 } 00048 00049 protected boolean setTarget(String target) { 00050 this.target = target; 00051 return this.trySetGaze(target); 00052 } 00053 00062 public boolean trySetGaze(String target) { 00063 if (this.target == null || this.target.isEmpty()) 00064 return next.trySetGaze(target); 00065 else 00066 return next.trySetGaze(this.target); 00067 } 00068 00081 public abstract void gazeChanged(String target, boolean face, boolean lock); 00082 } |