// --------------------------------------------------- // University of California Santa Barbara // Media Arts and Technology // MAT 259 | Visualizing Information | Winter 2011 // // Patrick Rudolph // Project 3 | Animation // // Level 1 data structures // --------------------------------------------------- class Level1 extends Circle { // aesthetics String src; PImage img; float fixRot; // level 1 data ArrayList[] data = new ArrayList[dayMax+5]; // contains raw data from file ArrayList recent = new ArrayList(); // data for the last period(default:30) days = trend int maxCount; // max number of items // level 2 data Level2[] dewey = new Level2[10]; float deweySum; public Level1(Level1 parent,String name,String src,float x,float y,float radius,float fixRot) { super(parent,name,x,y,radius); this.fixRot = fixRot; this.src = src; if(src != null) this.img = loadImage(src+".png"); maxCount = 0; if(parent != null) { // create level 2 circles for(int i = 0; i < dewey.length; i++) { String n = ""+i*100; if(i==0) n = "000"; dewey[i] = new Level2(this,n,i*100,sin(TWO_PI*i/11+fixRot),-cos(TWO_PI*i/11+fixRot),0); } // initialize array for raw data for(int i=0;i= period) { // recent is full (after first period(default:30) days) int diff = recent.size()-period+1; for(int i = 0; i < diff; i++) { parent.sum -= ((Integer)recent.get(0)).intValue(); sum -= ((Integer)recent.remove(0)).intValue(); } } if(!data[d].isEmpty()) { // there are checkouts for day d int num = data[d].size(); // number of checkouts for day d // add to level 1 recent.add(num); parent.sum += num; sum += num; boolean[] dirty = new boolean[10]; for(int i=0;i<10;i++) dirty[i] = false; // add to level 2 for(int i=0;i 80) this.img = loadImage(src+".png"); // sum dewey items deweySum = 0; for(int i=0;i