/* GoodPath.java: a name path without bugs in it * * Copyright (c) 1998 The Regents of the University of California. * All Rights Reserved. See the COPYRIGHT filtcltk98.InvalidPathExceptione for details. */ package tutorial.tcltk98; public class GoodPath { StringBuffer path; public void append (String element) throws PathException { if (element.indexOf('/') >= 0 ) { throw new PathException("Malformed path"); } if (!element.equals("")) { if (path == null) { path = new StringBuffer(); } else { path.append("/"); } path.append(element); } } public String getPath () { if (path == null) { return "./"; } else { return path.toString(); } } }