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

## org.encog.app.quant.util
Class BarBuffer

    java.lang.Object
      org.encog.app.quant.util.BarBuffer

    public class BarBuffer

extends Object

A buffer of bar segments.

Constructor Summary
`BarBuffer(int thePeriods)` Construct the object.

Method Summary
`void` | `add(double d)` Add a bar.
`void` | `add(double[] d)` Add a bar.
`double` | `average(int idx)` Average all of the bars.
`double` | `averageGain(int idx)` Get the average gain.
`double` | `averageLoss(int idx)` Get the average loss.
`List<double[]>` | `getData()`
`boolean` | `getFull()` Determine if the buffer is full.
`double` | `max(int idx)` Get the max for the specified index.
`double` | `min(int idx)` Get the min for the specified index.
`double[]` | `pop()` Pop (and remove) the oldest bar in the buffer.

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

Constructor Detail

### BarBuffer

    public BarBuffer(int thePeriods)

  Construct the object.

  Parameters:
    `thePeriods` - The number of periods.

Method Detail

### add

    public final void add(double d)

  Add a bar.

  Parameters:
    `d` - The bar data.

### add

    public final void add(double[] d)

  Add a bar.

  Parameters:
    `d` - The bar data.

### average

    public final double average(int idx)

  Average all of the bars.

  Parameters:
    `idx` - The bar index to average.
  Returns:
    The average.

### averageGain

    public final double averageGain(int idx)

  Get the average gain.

  Parameters:
    `idx` - The field to get the average gain for.
  Returns:
    The average gain.

### averageLoss

    public final double averageLoss(int idx)

  Get the average loss.

  Parameters:
    `idx` - The index to check for.
  Returns:
    The average loss.

### getData

    public final List<double[]> getData()

  Returns:
    The data.

### getFull

    public final boolean getFull()

  Determine if the buffer is full.

  Returns:
    True if the buffer is full.

### max

    public final double max(int idx)

  Get the max for the specified index.

  Parameters:
    `idx` - The index to check.
  Returns:
    The max.

### min

    public final double min(int idx)

  Get the min for the specified index.

  Parameters:
    `idx` - The index to check.
  Returns:
    The min.

### pop

    public final double[] pop()

  Pop (and remove) the oldest bar in the buffer.

  Returns:
    The oldest bar in the buffer.

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

Copyright © 2014. All Rights Reserved.