This action will force synchronization from serv/JavaDesigner, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
/*** A Component with some common function implementation* You can abstract it.*/import java.util.*;public class Employee {String name;float salary;Vector subordinates;boolean isLeaf;Employee parent = null;//-------------------------------------------public Employee(String _name, float _salary) {name = _name;salary = _salary;subordinates = new Vector();isLeaf = false;}//-------------------------------------------public Employee(Employee _parent, String _name, float _salary) {name = _name;salary = _salary;parent = _parent;subordinates = new Vector();isLeaf = false;}//-------------------------------------------public void setLeaf(boolean b) {isLeaf = b; //if true, do not allow children}//-------------------------------------------public float getSalary() {return salary;}//-------------------------------------------public String getName() {return name;}//-------------------------------------------public boolean add(Employee e) {if (! isLeaf) {subordinates.addElement(e);}return isLeaf; //false if unsuccessful}//-------------------------------------------public void remove(Employee e) {if (! isLeaf) {subordinates.removeElement(e);}}//-------------------------------------------public Enumeration elements() {return subordinates.elements();}//-------------------------------------------public Employee getChild(String s) {Employee newEmp = null;if(getName().equals(s)) {return this;} else {boolean found = false;Enumeration e = elements();while(e.hasMoreElements() && (! found)) {newEmp = (Employee)e.nextElement();found = newEmp.getName().equals(s);if (! found) {newEmp = newEmp.getChild(s);found =(newEmp != null);}}if (found) {return newEmp;} else {return null;}}}//-------------------------------------------public float getSalaries() {float sum = salary;for(int i = 0; i < subordinates.size(); i++) {sum += ((Employee)subordinates.elementAt(i)).getSalaries();}return sum;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。