aa
com.cliffc.aa.type.Type< T extends Type< T >.Pool Class Reference
Collaboration diagram for com.cliffc.aa.type.Type< T extends Type< T >.Pool:
[legend]

Package Functions

 Pool (byte t, Type gold)
 
< T extends Type > T free (T t1, T t2)
 
< T extends Type > T malloc ()
 

Package Attributes

int _clone
 
int _free
 
int _pool
 

Private Attributes

final Ary< Type_frees
 
final Type _gold
 
int _malloc
 

Detailed Description

Definition at line 283 of file Type.java.

Constructor & Destructor Documentation

◆ Pool()

com.cliffc.aa.type.Type< T extends Type< T >.Pool.Pool ( byte  t,
Type  gold 
)
package

Definition at line 287 of file Type.java.

287  {
288  gold._type = t;
289  _gold=gold;
290  _frees= new Ary<>(new Type[1],0);
291  POOLS[t] = this;
292  }

References com.cliffc.aa.type.Type< T extends Type< T >._type, and com.cliffc.aa.type.Type< T extends Type< T >.POOLS.

Member Function Documentation

◆ free()

<T extends Type> T com.cliffc.aa.type.Type< T extends Type< T >.Pool.free ( t1,
t2 
)
package

Definition at line 297 of file Type.java.

297  {
298  _frees.push(t1);
299  _free++;
300  return t2;
301  }

References com.cliffc.aa.util.Ary< E >.push().

Here is the call graph for this function:

◆ malloc()

<T extends Type> T com.cliffc.aa.type.Type< T extends Type< T >.Pool.malloc ( )
package

Definition at line 293 of file Type.java.

293  {
294  if( _frees.isEmpty() ) { _malloc++; _clone--; return (T)_gold.clone(); }
295  else { _pool ++; return (T)_frees.pop(); }
296  }

References com.cliffc.aa.type.Type< T extends Type< T >.clone(), com.cliffc.aa.util.Ary< E >.isEmpty(), and com.cliffc.aa.util.Ary< E >.pop().

Here is the call graph for this function:

Member Data Documentation

◆ _clone

int com.cliffc.aa.type.Type< T extends Type< T >.Pool._clone
package

◆ _free

int com.cliffc.aa.type.Type< T extends Type< T >.Pool._free
package

Definition at line 284 of file Type.java.

◆ _frees

final Ary<Type> com.cliffc.aa.type.Type< T extends Type< T >.Pool._frees
private

Definition at line 285 of file Type.java.

◆ _gold

final Type com.cliffc.aa.type.Type< T extends Type< T >.Pool._gold
private

Definition at line 286 of file Type.java.

◆ _malloc

int com.cliffc.aa.type.Type< T extends Type< T >.Pool._malloc
private

Definition at line 284 of file Type.java.

◆ _pool

int com.cliffc.aa.type.Type< T extends Type< T >.Pool._pool
package

Definition at line 284 of file Type.java.


The documentation for this class was generated from the following file:
com.cliffc.aa.type.Type.clone
Type clone()
Definition: Type.java:304
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.util.Ary
Definition: Ary.java:11
com.cliffc.aa.type.Type.Pool._gold
final Type _gold
Definition: Type.java:286
com.cliffc.aa.type.Type._type
byte _type
Definition: Type.java:98
com.cliffc.aa.type.Type.Pool._malloc
int _malloc
Definition: Type.java:284
com.cliffc.aa.type.Type.Pool._clone
int _clone
Definition: Type.java:284
com.cliffc.aa.type.Type.Pool._pool
int _pool
Definition: Type.java:284
com.cliffc.aa.type.Type.POOLS
static final Pool[] POOLS
Definition: Type.java:281
com.cliffc.aa.type.Type.Pool._frees
final Ary< Type > _frees
Definition: Type.java:285
com.cliffc.aa.type.Type.Pool._free
int _free
Definition: Type.java:284