codesimian
Class HuffmanNode

java.lang.Object
  extended by codesimian.CS<CSGeneric>
      extended by codesimian.DefaultCS
          extended by codesimian.JavaObject
              extended by codesimian.HuffmanNode
All Implemented Interfaces:
CodeSimian

public class HuffmanNode
extends JavaObject

A Huffman Node has an [object or non-double primitive] value, and a double weight, and represents the end of a sequence of values (each with a huffman node).

Other types of CS could be designed as huffman nodes. They would have to allow their values to be read and written as double for frequency of sequences ending at this node, and read and written as the thing the sequences are made of, like char in a string or java.awt.Component in a list of GUI objects. Normal Huffman has 1 bit value per node, but CodeSimian's huffman nodes may include any type of object. Your Huffman Node is only required to support the objects and primitives you expect it to be used with, but you MUST support type double and your data can not be type double. TODO: THIS TEXT NEEDS TO BE SUMMARIZED/SHORTENED

For simple huffman nodes, P(0) is the 0 bit, and P(1) is the 1 bit. Optionally, use P(2) and above for other symbols, or map the symbols any way you want, but you must use indexs 0 to countP()-1, for any countP(), but try to keep X small.


Field Summary
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
HuffmanNode()
           
 
Method Summary
 int maxP()
          Maximum quantity of Params
 int minP()
          For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.
static double weightOfChildsAndParent(CS parent)
          sum of all D() for this CS and all childs, but not childs of childs, because that is done recursively.
 
Methods inherited from class codesimian.JavaObject
description, DForProxy, keyword, LForProxy, setD, setL, setP
 
Methods inherited from class codesimian.DefaultCS
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL1, setMyFuel, setName, setObject, setPrevExec, setPType, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, L, L, L, L, maxD, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HuffmanNode

public HuffmanNode()
Method Detail

minP

public int minP()
Description copied from class: DefaultCS
For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.

Overrides:
minP in class JavaObject

maxP

public int maxP()
Description copied from class: CS
Maximum quantity of Params

Overrides:
maxP in class CS

weightOfChildsAndParent

public static double weightOfChildsAndParent(CS parent)
sum of all D() for this CS and all childs, but not childs of childs, because that is done recursively.