⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employee.java

📁 源码为科学出版社出版的英文<java设计模式>(影印版)所用的所有例子程序
💻 JAVA
字号:
import java.util.*;

public class Employee extends AbstractEmployee
{
   
   public Employee(String _name, float _salary) {
      name = _name;
      salary = _salary;
      leaf = true;
   }
   //--------------------------------------
   public Employee(Employee _parent, String _name, float _salary) {
      name = _name;
      salary = _salary;
      parent = _parent;
      leaf = true;
   }
   //--------------------------------------
   public float getSalary() {
      return salary;
   }
   //--------------------------------------
   public String getName() {
      return name;
   }
   //--------------------------------------
   public boolean add(Employee e) throws NoSuchElementException {
     throw new NoSuchElementException("No subordinates");    
   }
   //--------------------------------------
   public void remove(Employee e) throws NoSuchElementException {
     throw new NoSuchElementException("No subordinates"); 
   }
   //--------------------------------------
   public Enumeration subordinates () {
      Vector v = new Vector();
      return v.elements ();      
   }
   //--------------------------------------
   public Employee getChild(String s) throws NoSuchElementException {
        throw new NoSuchElementException("No children");
     }

   //--------------------------------------
   public float getSalaries() {
      return salary;
   }
   //--------------------------------------
   public Employee getParent() {
      return parent;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -