Class FrameCube

java.lang.Object
  |
  +--net.fractalkiss.util.Util
        |
        +--FrameCube

public class FrameCube
extends Util

Cube alignment application and tools for working with text. Works a little differently from FramePlane, here -frame0 option causes looped processing of entire file.


Constructor Summary
FrameCube()
          Creates new FrameCube
 
Method Summary
static void align(char[][][] cube, java.lang.String name, int len, int brk)
          Performs so-called "alignment" by processing fragmented sets.
static void alignFrames(char[][][] cube, int res, int frame, java.io.InputStream in, java.lang.String name)
          Performs frame fragmentation
static void loopRead(char[] looped, int c, int counter)
          Reserved for looping inputstream, not implemented
static void main(java.lang.String[] args)
          java FrameCube -h
static int[] parse(java.io.InputStream in, java.lang.String name, int res)
          Parses text and writes 9 layers of increasing fragmenticity.
static boolean readCube(char[][][] cube, java.lang.String name, int res)
          Reads a char cube of size res*res*res from the name file
static boolean repeat(char[] bef, char[] aft)
          checks if to char arrays have the same value
static java.lang.String showBinary(char[] bin)
          Displays spaced 8-bit presentation of char array
static java.lang.String showDecimal(char[] bin)
          Displays spaced 3-digit decimal presentation of char array
static void writeCube(char[][][] cube, java.lang.String name, int res)
          writes cube to name file
static char[] xorNext(char[] sb)
          performs XOR operation on every char with the next in the array, the last char XORs with the first
 
Methods inherited from class net.fractalkiss.util.Util
and, fill02, fill03, nand, or, writeBytes, writePlane, xor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameCube

public FrameCube()
Creates new FrameCube
Method Detail

main

public static void main(java.lang.String[] args)
java FrameCube -h
Parameters:
args - java FrameCube -h

alignFrames

public static void alignFrames(char[][][] cube,
                               int res,
                               int frame,
                               java.io.InputStream in,
                               java.lang.String name)
                        throws java.lang.Exception
Performs frame fragmentation
Parameters:
cube - 3D char array
res - resolution 128 or 256
frame - bytes per frame
in - stream of framed input
name - stored cube if present
Throws:
java.lang.Exception - file I/O exceptions

loopRead

public static void loopRead(char[] looped,
                            int c,
                            int counter)
Reserved for looping inputstream, not implemented
Parameters:
looped - char array, records frame*levels chars from beginning
c - character to write
counter - position to write

readCube

public static boolean readCube(char[][][] cube,
                               java.lang.String name,
                               int res)
Reads a char cube of size res*res*res from the name file
Parameters:
cube - 3D array to store the cube
name - file to read
res - size of cube sides
Returns:
returns false if file can't be opened

writeCube

public static void writeCube(char[][][] cube,
                             java.lang.String name,
                             int res)
writes cube to name file
Parameters:
cube - 3D char array to write
name - file name
res - size of cube sides

xorNext

public static char[] xorNext(char[] sb)
performs XOR operation on every char with the next in the array, the last char XORs with the first
Parameters:
sb - char array
Returns:
char array

repeat

public static boolean repeat(char[] bef,
                             char[] aft)
checks if to char arrays have the same value
Parameters:
bef - char array before NANDing
aft - char array after NANDing
Returns:
returns true if same, false otherwise

showDecimal

public static java.lang.String showDecimal(char[] bin)
Displays spaced 3-digit decimal presentation of char array
Parameters:
bin - char array
Returns:
String of spaced 3-digit decimal numbers

showBinary

public static java.lang.String showBinary(char[] bin)
Displays spaced 8-bit presentation of char array
Parameters:
bin - char array
Returns:
String of '*'s and '-'s for 1 and 0 respectively

parse

public static int[] parse(java.io.InputStream in,
                          java.lang.String name,
                          int res)
Parses text and writes 9 layers of increasing fragmenticity.
1st layer is text,
 2nd layer frag[0] = xor[0] NAND text
   xor[0]  = text XOR loopLeft(text)
 3rd layer frag[1] = xor[1] NAND xor[0] NAND text
   xor[1]  = xor[0] XOR loopLeft xor[0]
 ...
 9th layer frag[7] = xor[7] NAND ... xor[0] NAND text
 X NAND Y = NOT X AND Y : key fractal operation
 XOR operation on FRAMEs calculates overlaps
 NAND operation on overlaps and FRAMEs calculates fragments
 NAND operation on overlap(n+1) and overlap(n) calculates fragment shapes
 IXOR is the iterative XOR on frames, essentially it cleans overlaps
 IXOR(n,b) = IXOR(n-1,b) XOR IXOR(n-1,b plus 1)
 IXOR(0,b) = FRAME(b) XOR FRAME(b plus 1)
 FRAG calculates n increasingly fragmented copies of a given frame b
 FRAG(n,b) = INAND (n-1,b) NAND FRAME(b)
 INAND is iterative NAND of one xor mask with the previous from left to right
 INAND(n,b) = IXOR(n,b) NAND IXOR(n-1,b) NAND ... IXOR(0,b)
 
if we view text as one frame, then looping text left by one letter will produce more frames. By looping xor mask we'll model consecutive xors of one frame with the next. parse frags only top frame (text itself) producing 8 copies FRAG(0,0-7) because text is repetitive. Those copies are, of course, of same length and are layered one after another below the text itself.
Parameters:
res - resolution 128 or 256
in - reader text stream
name - workfile to write, "work.acube" is default
Returns:
returns int[2] parameters param[0] is length of text param[1] is number of copies with text, normally 9

align

public static void align(char[][][] cube,
                         java.lang.String name,
                         int len,
                         int brk)
Performs so-called "alignment" by processing fragmented sets. Depending on how many bits are in your input and how many different values your input allows, your cube may have different dimensions. For instance, if you process english text, then you only need first half of ASCII table, which is 128 characters, All your characters are numbered from 0 to 127, which allows you to use character codes as indexes. And since every byte can set 8 bits, you only need 8 fragmented copies every time. This function works with 128 bytes per side. let's say you have cube[x][y][z], index x is your character code, index y is the byte that happens to be in any of the 8 copies under your character, index z is the next n-th character code, where n is the copy number or fragmentation level, which is one of the 8. cube[x][y][z] value has every bit set according to on which level y occured under character x and pointed to character z, if you nuber your levels n=0..7 then the bit is set by
cube[x][y][z] = cube[x][y][z] | 1 shiftLeft n
 
Now, it is enough to align text once, because of its inherent periodicity, but you need to perform alignment on every frame of other kinds of input, like video and audio. For every frame calculate 8 fragments and get to work. The alignment cube will grow with periodicity records.
Parameters:
cube - 3D char array
name - stored cube file
len - file length
brk - number of fragments