1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is The ECLiPSe Constraint Logic Programming System. 15// The Initial Developer of the Original Code is Cisco Systems, Inc. 16// Portions created by the Initial Developer are 17// Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 18// 19// Contributor(s): 20// 21// END LICENSE BLOCK 22 23package com.parctechnologies.eclipse.visualisation; 24import com.parctechnologies.eclipse.*; 25import java.util.Map; 26import java.io.Serializable; 27 28public abstract class VisEvent implements Serializable 29{ 30 private String viewableName; 31 32 static VisEvent eventFromCompoundTerm(CompoundTerm term) 33 throws VisException 34 { 35 if(term.functor().equals("viewable_create")) 36 { 37 return(CreateEvent.parseFromCompoundTerm(term)); 38 } 39 if(term.functor().equals("viewable_destroy")) 40 { 41 return(DestroyEvent.parseFromCompoundTerm(term)); 42 } 43 if(term.functor().equals("viewable_expand")) 44 { 45 return(ExpandEvent.parseFromCompoundTerm(term)); 46 } 47 if(term.functor().equals("viewable_contract")) 48 { 49 return(ContractEvent.parseFromCompoundTerm(term)); 50 } 51 if(term.functor().equals("update")) 52 { 53 return(UpdateEvent.parseFromCompoundTerm(term)); 54 } 55 56 57 throw(new VisException("Could not parse VisEvent from "+term)); 58 } 59 60 public String getViewableName() 61 { 62 return(viewableName); 63 } 64 65 protected void setViewableName(String viewableName) 66 { 67 this.viewableName = viewableName; 68 } 69 70 public boolean unifies(VisEvent e2, Map map) { 71 if (getClass() == e2.getClass()) { 72 return true; 73 } 74 return false ; 75 } 76 77 public abstract String getDescription(); 78} 79