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.radio
Class Channel

    java.lang.Object
      avrora.sim.radio.Channel

public class Channel
extends java.lang.Object

The `Channel` class implements a serial channel that represents a communication channel where bits are sent one by one. The channel allows bits to be written into the channel at a particular time and represents their serial transmission over time by an array.

The channel is used in simulating radio transmissions; all transmissions write into the channel, and all samples read from the channel.

Field Summary
`protected long` | `bitPeriod`
`protected int` | `bits`
`protected boolean[]` | `channelValues`
`protected boolean[]` | `channelWritten`
`protected long` | `globalTime`
`protected boolean` | `invert`
`protected long` | `period`

Constructor Summary
`Channel(int bits, long period, boolean invert)`

Method Summary
`void` | `advance()` The `advance()` method advances the channel to the next period.
`protected int` | `channelOffset(long gtime)`
`boolean` | `occupied(long start, long end)` The `occupied()` method tests whether this channel has been written to in the window of time specified.
`int` | `read(long time, int bits)` The `read()` method reads the value of the channel at the current time, going back by the number of bits.
`void` | `write(int value, int bits, long time)` The `write()` method writes a value into the channel, with the given bit length at the given global time.

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

Field Detail

### bits

    protected final int bits

### period

    protected final long period

### bitPeriod

    protected final long bitPeriod

### globalTime

    protected long globalTime

### invert

    protected final boolean invert

### channelValues

    protected final boolean[] channelValues

### channelWritten

    protected final boolean[] channelWritten

Constructor Detail

### Channel

    public Channel(int bits,
                   long period,
                   boolean invert)

Method Detail

### write

    public void write(int value,
                      int bits,
                      long time)

  The `write()` method writes a value into the channel, with the given bit length at the given global time.

  Parameters:
    `value` - the value to write into the channel
    `bits` - the number of bits to write
    `time` - the global time at which the write takes place

### advance

    public void advance()

  The `advance()` method advances the channel to the next period.

### read

    public int read(long time,
                    int bits)

  The `read()` method reads the value of the channel at the current time, going back by the number of bits.

  Parameters:
    `time` - the global time at which to read the channel
  Returns:
    a value representing the channel contents at this global time

### occupied

    public boolean occupied(long start,
                            long end)

  The `occupied()` method tests whether this channel has been written to in the window of time specified.

  Parameters:
    `start` - the start of the interval to check
    `end` - the end of the interval to check
  Returns:
    true if the channel was written to during the specified time interval; false otherwise

### channelOffset

    protected int channelOffset(long gtime)

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