Package hw4
Class Counter
- java.lang.Object
-
- hw4.AbstractComponent
-
- hw4.AbstractStatefulComponent
-
- hw4.Counter
-
- All Implemented Interfaces:
IComponent
,IStatefulComponent
public class Counter extends AbstractStatefulComponent
Implementation of a binary counter with a fixed number of bits.- Author:
- smkautz
-
-
Constructor Summary
Constructors Constructor Description Counter(int size)
Constructs a counter with the given number of bits.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the internal state, if any (sets to all zeros).void
tick()
Updates the internal state, if any, provided that the component is enabled.-
Methods inherited from class hw4.AbstractStatefulComponent
invalidateOutputs, propagate, setEnabled
-
Methods inherited from class hw4.AbstractComponent
inputs, inputsValid, invalidateInputs, outputs, outputsValid
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface api.IComponent
inputs, inputsValid, invalidateInputs, outputs, outputsValid
-
-
-
-
Method Detail
-
tick
public void tick()
Description copied from interface:IStatefulComponent
Updates the internal state, if any, provided that the component is enabled.
-
clear
public void clear()
Description copied from interface:IStatefulComponent
Clears the internal state, if any (sets to all zeros).- Specified by:
clear
in interfaceIStatefulComponent
- Overrides:
clear
in classAbstractStatefulComponent
-
-