home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / edtplug / classes / netscape / plugin / composer / io / JavaScriptEntity.java < prev    next >
Encoding:
Java Source  |  1998-04-08  |  1.8 KB  |  61 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. package netscape.plugin.composer.io;
  20.  
  21. /** A JavaScript entity is a html expression of the form "&{" javascript "};".
  22.  * It is used to provide run-time evaluation of the value of parameters.
  23.  * At design time (i.e. in the editor) the value of a JavaScript entity is
  24.  * not known.
  25.  */
  26.  
  27. public class JavaScriptEntity extends Token {
  28.   private String text;
  29.  
  30.   public JavaScriptEntity(StringBuffer buf) {
  31.     text = buf.toString();
  32.   }
  33.  
  34.   JavaScriptEntity(FooStringBuffer buf) {
  35.     text = buf.toString();
  36.   }
  37.  
  38.   public String getScript() {
  39.     return text;
  40.   }
  41.  
  42.   public String toString() {
  43.     return "&{" + text + "}";
  44.   }
  45.  
  46.   public int hashCode() {
  47.     return text.hashCode() + 1;
  48.   }
  49.  
  50.   /** Note: Equality means that the expression string is identical
  51.    * not that the result of the expressions are equal.
  52.    */
  53.   public boolean equals(Object other) {
  54.     if ((other != null) && (other instanceof JavaScriptEntity)) {
  55.       JavaScriptEntity o = (JavaScriptEntity) other;
  56.       return text.equals(o.text);
  57.     }
  58.     return false;
  59.   }
  60. }
  61.