Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim.clock
Class ClockDomain

    java.lang.Object
      avrora.sim.clock.ClockDomain

public class ClockDomain
extends java.lang.Object

The `ClockDomain` class represents a collection of clocks for a device or platform, including the main clock used for the microcontroller.

Field Summary
`protected java.util.HashMap` | `clockMap`
`protected MainClock` | `mainClock`

Constructor Summary
`ClockDomain(long mainHz)` The constructor for the `ClockDomain` class constructs the main clock (from which all other clocks are derived).

Method Summary
`void` | `addClock(Clock c)` The `addClock()` method adds a clock to this clock domain.
`Clock` | `getClock(java.lang.String name)` The `getClock()` method looks for a clock with the specified name in this clock domain.
`MainClock` | `getMainClock()` The `getMainClock()` method returns the main clock for this clock domain.
`boolean` | `hasClock(java.lang.String name)` The `hasClock()` method queries the clock domain whether it contains a particular named clock.
`Clock` | `newClock(java.lang.String name, long hz)` The `newClock()` method creates a new clock derived from the main clock of this clock domain with the given name and clockspeed.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### clockMap

    protected final java.util.HashMap clockMap

### mainClock

    protected final MainClock mainClock

Constructor Detail

### ClockDomain

    public ClockDomain(long mainHz)

  The constructor for the `ClockDomain` class constructs the main clock (from which all other clocks are derived). It accepts as a parameter the speed of the main clock.

Parameters:
  `mainHz` - the speed of the main clock in cycles per second

Method Detail

### getMainClock

    public MainClock getMainClock()

  The `getMainClock()` method returns the main clock for this clock domain.

  Returns:
    an instance of the `MainClock` class that contains the main clock for this clock domain.

### getClock

    public Clock getClock(java.lang.String name)

  The `getClock()` method looks for a clock with the specified name in this clock domain.

  Parameters:
    `name` - the name of the clock as a string
  Returns:
    an instance of the `Clock` interface for the specified clock name
  Throws:
    `java.util.NoSuchElementException` - if no clock with the specified name exists in this domain

### addClock

    public void addClock(Clock c)

  The `addClock()` method adds a clock to this clock domain. It will be indexed by the name returned by the clock's `getName()` method. If there is a clock already in this domain with the name specified, the new clock will be returned for subsequent calls to `getClock()`, and the old clock will no longer be accessible.

  Parameters:
    `c` - the clock to add to this domain

### newClock

    public Clock newClock(java.lang.String name,
                          long hz)

  The `newClock()` method creates a new clock derived from the main clock of this clock domain with the given name and clockspeed. The clock will automatically be added to this clock domain with the specified name.

  Parameters:
    `name` - the name of the new clock
    `hz` - the clockspeed of the new clock in cycles per second
  Returns:
    a new `Clock` instance with the specified properties

### hasClock

    public boolean hasClock(java.lang.String name)

  The `hasClock()` method queries the clock domain whether it contains a particular named clock.

  Parameters:
    `name` - the name of the clock to check for
  Returns:
    true if a clock in this domain exists with the specified name; false otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD