edu.jas.ps
Class Coefficients<C extends RingElem<C>>

java.lang.Object
  extended by edu.jas.ps.Coefficients<C>
Type Parameters:
C - ring element type

public abstract class Coefficients<C extends RingElem<C>>
extends java.lang.Object

Abstract class for generating functions for coefficients of power series. Was an interface, now this class handles the caching itself.

Author:
Heinz Kredel

Field Summary
 java.util.HashMap<java.lang.Integer,C> coeffCache
          Cache for already computed coefficients.
 
Constructor Summary
Coefficients()
          Public no arguments constructor.
Coefficients(java.util.HashMap<java.lang.Integer,C> cache)
          Public constructor with pre-filled cache.
 
Method Summary
protected abstract  C generate(int index)
          Generate coefficient.
 C get(int index)
          Get cached coefficient or generate coefficient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coeffCache

public final java.util.HashMap<java.lang.Integer,C extends RingElem<C>> coeffCache
Cache for already computed coefficients.

Constructor Detail

Coefficients

public Coefficients()
Public no arguments constructor.


Coefficients

public Coefficients(java.util.HashMap<java.lang.Integer,C> cache)
Public constructor with pre-filled cache.

Parameters:
cache - pre-filled coefficient cache.
Method Detail

get

public C get(int index)
Get cached coefficient or generate coefficient.

Parameters:
index - of requested coefficient.
Returns:
coefficient at index.

generate

protected abstract C generate(int index)
Generate coefficient.

Parameters:
index - of requested coefficient.
Returns:
coefficient at index.