Access Millions of academic & study documents

Consider the code given in class TernaryLogic This class contains s

Content type
User Generated
Showing Page:
1/2
Consider the code given in class TernaryLogic. This class
contains several subclasses of Simulation.Event.
It might make sense to crack initPrint and PrintEvent into
a separate source file. It is easy enough to rip them out of
TernaryLogic, but they need access to a variable or
variables that are private to TernaryLogic.
Suppose we name the new class PrintEvent, with the static
method initPrint local to PrintEvent. This architectural
change has consequences.
a.) What variable or variables pose difficulties?
b.) In light of part a, what are the parameters to initPrint?
c.) In light of parts a and b, what private static variables
should be in class PrintEvent? (These may replace or
supplement existing variables.)
Solution
a. The variable \'gates\' creates problem as it is a static
member of the outer class
b. The LinkedList gates will become a parameter for
initPrint
c. No other private static variable is needed in the class
PrintEvent

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Consider the code given in class TernaryLogic. This class contains several subclasses of Simulation.Event. It might make sense to crack initPrint and PrintEvent into a separate source file. It is easy enough to rip them out of TernaryLogic, but they need access to a variable or variables that are private to TernaryLogic. Suppose we name the new class PrintEvent, with the static method initPrint local to PrintEvent. This architectural change has consequences. a.) What variable or variables pose difficu lties? b.) In light of part a, what are the parameters to initPrint? c.) In light of parts a ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4