The Joy of Dissecting Weave Dawn Finney. Creating Useful SongNodes Introducing the SongNodes Creating the SongNodes Creating a List to Work With.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Sequential Logic Circuits. Set-Reset Latch The Set-Reset latch or bistable is a simple sequential logic circuit that remembers what has happened to the.
Computer Programming Lab(7).
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
1 Calling within Static method /* We can call a non static method from a static method but by only through an object of that class. */ class Test1{ public.
SFTW241 Group A4 Presentation of Grouping Process.
Computer Programming Lab 8.
START DEFINITIONS values (3) N1 = (8, 1,-9) i N1 average N3,2 sum N2 = 0 temp N1 Do not guess or assume any values! Follow the values of the variables.
Today’s topics: I/O (Input/Output). Scribbler Inputs & Outputs  What are the Scribbler’s inputs and outputs?  reset button  motors/wheel  light sensor.
CS 106 Introduction to Computer Science I 12 / 04 / 2006 Instructor: Michael Eckmann.
The Design and Analysis of Algorithms
Practice for Midterm 1. Practice problems These slides have six programming problems for in-class practice There are an additional seven programming problems.
Generic Java 21/ What is generics? To be able to assign type variables to a class These variables are not bound to any specific type until the.
Passing Other Objects Strings are called immutable which means that once a String object stores a value, it never changes –recall when we passed a message.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Data Structures Trees.
P13363 Touch Sensitive Piano Keys Justine Converse (ISE) James Cover (CE) Alexander Eschbach (EE) Jason Hang (ME) Ashley Trode (EE)
Object Oriented Programming Concepts OOP – reasoning about a program as a set of objects rather than as a set of actions Object – a programming entity.
Local Variables A local variable is a variable that is declared within a method declaration. Local variables are accessible only from the method in which.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Java Classes Methods Objects. Classes Classes We have been using classes ever since we started programming in Java Whenever we use the keyword class.
Structuring Music CS1316: Representing Structure and Behavior.
Problem of the Day  Why are manhole covers round?
First Courses Workshop Day 4 Mark Guzdial College of Computing Georgia Institute of Technology
Media Computation Workshop Day 3 Mark Guzdial College of Computing Georgia Institute of Technology
Can we talk?. In Hello World we already saw how to do Standard Output. You simply use the command line System.out.println(“text”); There are different.
Lecture 8 Using casts, Strings and WordUtil. Agenda Generating random numbers Casts – Casting a double into an int – Casting an int into a char – Casting.
Information Systems Engineering
Java Arrays and Methods MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation ©Akhilesh.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Generic Instructor : Sarah Alodan. Problem?! Java code used to look like this: public class Courses { public static void main(String[] args) { ArrayList.
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
CS 115 OBJECT ORIENTED PROGRAMMING I LECTURE 9 GEORGE KOUTSOGIANNAKIS Copyright: 2014 Illinois Institute of Technology- George Koutsogiannakis 1.
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
Calling Methods. Review  We can declare and create objects: Dinosaur dino; dino = new Dinosaur();  We can also shortcut the first two lines: Dinosaur.
Principles of Programming - NI Simple Recursion Recursion is where a function calls itself. Concept of recursive function: A recursive function is.
Building java programs, chapter 3 Parameters, Methods and Objects.
Unit Testing Part 2: Drivers and Stubs
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
Recursion. Recursive Methods  A recursive method is a method that calls itself.  General Form of Simple Recursive Methods  Every recursive method has.
Hash Tables Ellen Walker CPSC 201 Data Structures Hiram College.
Classes - Intermediate

Java Scanner Class Keyboard Class. User Interaction So far when we created a program there was no human interaction Our programs just simply showed one.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Methods. Creating your own methods Java allows you to create custom methods inside its main body. public class Test { // insert your own methods right.
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 9: Lists and Trees for Structuring Sounds.
An Introduction to the Java Language App Design Flat Rock Community Schools Introductory Java Programming.
Methods Matthew Harrison. Overview ● There are five main aspects of methods... ● 1) Modifiers – public, private ● 2) Method Name ● 3) Parameters ● 4)
Structuring Music CS1316: Representing Structure and Behavior.
BlueJ Tester By Pepper.
Chapter 5 – Making Music: An On-Screen Piano (Part 2 – Using Arrays)
CSE 8A Lecture 17 Reading for next class: None (interm exam 4)
The Design and Analysis of Algorithms
Sum of natural numbers class SumOfNaturalNumbers {
CS1316: Representing Structure and Behavior
CS1316: Representing Structure and Behavior
JavaDoc CECS277 Mimi Opkins.
Writing Methods.
Stack Memory 2 (also called Call Stack)
Exercise 11.1 Write a code fragment that performs the same function as the statement below without using the crash method Toolbox.crash(amount < 0,
AP Java Warm-up Boolean Array.
BlueJ Tester By Pepper.
Code Animation Examples
class PrintOnetoTen { public static void main(String args[]) {
Building Java Programs
Binary Search Trees reading: 17.3 – 17.4
How do you know when one more is too much?
loops revisited I/O arrays
Presentation transcript:

The Joy of Dissecting Weave Dawn Finney

Creating Useful SongNodes Introducing the SongNodes Creating the SongNodes Creating a List to Work With

Coding the SongNodes Within the SongPhrase class: //code for a1 static public Phrase A1() { double[] phrasedata = {JMC.A1,JMC.EN,JMC.A1,JMC.EN,JMC.A1,JMC.EN,JMC.A1,JMC.EN}; Phrase myPhrase = new Phrase(); myPhrase.addNoteList(phrasedata); return myPhrase; } //code for dg5 static public Phrase DG5() { double[] phrasedata = {JMC.G5,JMC.EN,JMC.G5,JMC.EN,JMC.G5,JMC.EN,JMC.G5,JMC.DEN}; Phrase myPhrase = new Phrase(); myPhrase.addNoteList(phrasedata); return myPhrase; } //code for c2 static public Phrase C2() { double[] phrasedata = {JMC.C2,JMC.EN,JMC.C2,JMC.EN,JMC.C2,JMC.EN,JMC.C2,JMC.DEN}; Phrase myPhrase = new Phrase(); myPhrase.addNoteList(phrasedata); return myPhrase; }

Introducing the SongNodes a1dg5c2 Distinct SongNodes will make it easier to see how weave works.

Creating the SongNodes SongNode a1 = new SongNode(); a1.setPhrase(SongPhrase.A1()); SongNode dg5 = new SongNode(); dg5.setPhrase(SongPhrase.DG5()); SongNode c2 = new SongNode(); c2.setPhrase(SongPhrase.C2());

Creating a List to Work With a1.repeatNextInserting(dg5, 5);

Dissection Analyzing the Inputs Cases

Analyzing the Inputs

Case: skip amount = 0 a1.weave(c2, 2, 0);

Case: skip amount = 1 Surprisingly a1.weave(c2, 2, 0); or a1.weave(c2, 2, 1); will yield the same result. a1.weave(c2, 2, 1);

Case: skip amount >=2 a1.weave(c2, 2, 2); Weave actually works fairly normally with cases with the skip amount is greater 2

Case: the list is too short a1.weave(c2, 2, 4); I do not think it is possible to draw any conclusions until we see another case.

Case: the list is too short again a1.weave(c2, 2, 8); So when the list is too short to accommodate the amount we want to skip, it will do what it can (like in the previous case) and then insert the node at the end of list regardless of the amount we wanted to skip or the number of times we wanted to weave the node into the list.

The Code import jm.music.data.*; import jm.JMC; import jm.util.*; import jm.music.tools.*; public class tester{ public static void main(String[]args){ SongNode a1 = new SongNode(); a1.setPhrase(SongPhrase.A1()); SongNode dg5 = new SongNode(); dg5.setPhrase(SongPhrase.DG5()); SongNode c2 = new SongNode(); c2.setPhrase(SongPhrase.C2()); a1.repeatNextInserting(dg5, 5); a1.showFromMeOn(JMC.PIANO); //show original list //case amount to skip = 0 a1.weave(c2, 2, 0); a1.showFromMeOn(JMC.PIANO); //case amount to skip = 1 a1.repeatNext(dg5, 5); //resets the list to the original a1.weave(c2, 2, 1); a1.showFromMeOn(JMC.PIANO); //case amount to skip >=2 a1.repeatNext(dg5, 5); a1.weave(c2, 2, 2); a1.showFromMeOn(JMC.PIANO); //case list is too short a1.repeatNext(dg5, 5); a1.weave(c2, 2, 4); a1.showFromMeOn(JMC.PIANO); //case list is too short again a1.repeatNext(dg5, 5); a1.weave(c2, 2, 8); a1.showFromMeOn(JMC.PIANO); }}