import EDU.neu.ccs.demeter.dj.*; // Written by Sunita Kanchinadam. // This class is the base class for the FileSystem. import java.util.*; public abstract class Node { // constructor Node() { } // constructor Node (String name) { _nName = name; _nSize = 10; } /*********************************************************/ // method : getSize // parameters : none // return value : integer // Description : returns the size allocated to the node. /*********************************************************/ public int getSize() { return (_nSize); } /*********************************************************/ // method : setSize // parameters : integer // return value : void // Description : sets the size allocated to the node. /*********************************************************/ public void setSize(int size) { _nSize = size; } /*********************************************************/ // method : getName // parameters : none // return value : String // Description : returns the name of the node. /*********************************************************/ public String getName() { return _nName; } /*********************************************************/ // method : setName // parameters : String // return value : void // Description : sets the name of the node. /*********************************************************/ public void setName(String name) { _nName = name; } /*********************************************************/ // method : Accept // parameters : DuVisitor // return value : void // Description : calls the relevant GetTotalSize() for Node. // This is introduced to implement Composite // pattern. /*********************************************************/ // // Not needed with DJ // abstract void Accept(DuVisitor du); /*********************************************************/ // method : GetTotalSize // parameters : String // return value : int // Description : returns the size of the node. /*********************************************************/ // now implemented in this class abstract int GetTotalSize(String option); // The following methods have been implemented for future reference. // String getGroup() // void setGroup(String grp) // String getAccessedDate() // void setAccessedDate(String date) // private members for File type, Owner of the file, group of the owner, // accessed date and name of the node. private char _fType; private String _nOwner; private String _nGroup; public int _nSize; private String _accessedDate; private String _nName; // added by Karl Lieberherr /* public int GetTotalSize(String option) { System.out.println("1"); Strategy sg = new Strategy( "from {Node, Directory, File, Link} to {File,Link}"); System.out.println("2"); TraversalGraph tg = TraversalGraph.compute(OS.cg, sg); System.out.println("3"); System.out.println(tg); System.out.println("3"); DuVisitor v = new DuVisitor(option); System.out.println("4"); tg.traverse(this, v); System.out.println("5"); return (v.getSize()); } */ }