• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/33

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

33 Cards in this Set

  • Front
  • Back
() (parentheses)
Grouping and containing expressions and parameters. Parentheses have multiple functions relating to functions and structures. They are used to contain a list of parameters passed to functions and control structures and they are used to group expressions to control the order of execution. Some functions have no parameters and in this case, the space between parentheses is blank.

Syntax
function()
function(p1, ..., pN)
structure(expression)
, (comma)
Separates parameters in function calls and elements during assignment.

Syntax
value1, ..., valueN
. (dot)
Provides access to an object's methods and data. An object is one instance of a class and may contain both methods (object functions) and data (object variables and constants), as specified in the class definition. The dot operator directs the program to the information encapsulated within an object.

Syntax
object.method()
object.data
; (semicolon)
A statement terminator which separates elements of the program. A statement is a complete instruction to the computer and the semicolon is used to separate instructions (this is similar to the period "." in written English). Semicolons are also used to separate the different elements of a for structure.

Syntax
statement;
= (assign)
Assigns a value to a variable. The "=" sign does not mean "equals", but is used to place data within a variable. The "=" operator is formally called the assignment operator. There are many different types of variables (int, floats, strings, etc.) and the assignment operator can only assign values which are the same type as the variable it is assigning. For example, if the variable is of type int, the value must also be an int.

Syntax
var = value
[] (array access)
The array access operator is used to specify a location within an array. The data at this location can be defined with the syntax array[element] = value and read with the syntax value = array[element] as shown in the above example.

Syntax
datatype[]
array[element]
{} (curly braces)
Define the beginning and end of functions blocks and statement blocks such as the for and if structures. Curly braces are also used for defining inital values in array declarations.

Syntax
{ statements }
{ ele0, ..., eleN }
catch
The catch keyword is used with try to handle exceptions. Sun's Java documentation defines an exception as "an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions." This could be, for example, an error while a file is read.

Syntax
try {
tryStatements
} catch (exception) {
catchStatements
}
class
Keyword used to indicate the declaration of a class. A class is a composite of fields (data) and methods (functions that are a part of the class) which may be instantiated as objects. The first letter of a class name is usually uppercase to separate it from other kinds of variables. A related tutorial on Object-Oriented Programming is hosted on the Oracle website.

Syntax
class ClassName {
statements
}
draw()
Called directly after setup(), the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. draw() is called automatically and should never be called explicitly.

It should always be controlled with noLoop(), redraw() and loop(). After noLoop() stops the code in draw() from executing, redraw() causes the code inside draw() to execute once, and loop() will cause the code inside draw() to resume executing continuously.

The number of times draw() executes in each second may be controlled with the frameRate() function.

There can only be one draw() function for each sketch, and draw() must exist if you want the code to run continuously, or to process events such as mousePressed(). Sometimes, you might have an empty call to draw() in your program, as shown in the above example.

Syntax
draw()
exit()
Quits/stops/exits the program. Programs without a draw() function exit automatically after the last line has run, but programs with draw() run continuously until the program is manually stopped or exit() is run.

Rather than terminating immediately, exit() will cause the sketch to exit after draw() has completed (or after setup() completes if called during the setup() function).

For Java programmers, this is not the same as System.exit(). Further, System.exit() should not be used because closing out an application while draw() is running may cause a crash (particularly with P3D).

Syntax
exit()
extends
Allows a new class to inherit the methods and data fields (variables and constants) from an existing class. In code, state the name of the new class, followed by the keyword extends and the name of the base class. The concept of inheritance is one of the fundamental principles of object oriented programming.

Note that in Java, and therefore also Processing, you cannot extend a class more than once. Instead, see implements.
false
Reserved word representing the logical value "false". Only variables of type boolean may be assigned the value false.
final
Keyword used to state that a value, class, or method can't be changed. If the final keyword is used to define a variable, the variable can't be changed within the program. When used to define a class, a final class cannot be subclassed. When used to define a function or method, a final method can't be overridden by subclasses.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.
implements
Implements an interface or group of interfaces. Interfaces are used to establish a protocol between classes; they establish the form for a class (method names, return types, etc.) but no implementation. After implementation, an interface can be used and extended like any other class.

Because Java doesn't allow extending more than one class at a time, you can create interfaces instead, so specific methods and fields can be found in the class which implements it. A Thread is an example; it implements the "Runnable" interface, which means the class has a method called "public void run()" inside it.
import
The keyword import is used to load a library into a Processing sketch. A library is one or more classes that are grouped together to extend the capabilities of Processing. The * character is often used at the end of the import line (see the code example above) to load all of the related classes at once, without having to reference them individually.

The import statement will be created for you by selecting a library from the "Import Library..." item in the Sketch menu.

Syntax
import libraryName
loop()
By default, Processing loops through draw() continuously, executing the code within it. However, the draw() loop may be stopped by calling noLoop(). In that case, the draw() loop can be resumed with loop().

Syntax
loop()
new
Creates a "new" object. The keyword new is typically used similarly to the applications in the above example. In this example, a new object "h1" of the datatype "HLine" is created. On the following line, a new array of floats called "speeds" is created.
noLoop()
Stops Processing from continuously executing the code within draw(). If loop() is called, the code in draw() begins to run continuously again. If using noLoop() in setup(), it should be the last line inside the block.

When noLoop() is used, it's not possible to manipulate or access the screen inside event handling functions such as mousePressed() or keyPressed(). Instead, use those functions to call redraw() or loop(), which will run draw(), which can update the screen properly. This means that when noLoop() has been called, no drawing can happen, and functions like saveFrame() or loadPixels() may not be used.

Note that if the sketch is resized, redraw() will be called to update the sketch, even after noLoop() has been specified. Otherwise, the sketch would enter an odd state until loop() was called.

Syntax
noLoop()
null
Special value used to signify the target is not a valid data element. In Processing, you may run across the keyword null when trying to access data which is not there.
popStyle()
The pushStyle() function saves the current style settings and popStyle() restores the prior settings; these functions are always used together. They allow you to change the style settings and later return to what you had. When a new style is started with pushStyle(), it builds on the current style information. The pushStyle() and popStyle() functions can be embedded to provide more control (see the second example above for a demonstration.)

Syntax
popStyle()
private
Keyword used to disallow other classes access the fields and methods within a class. The private keyword is used before a field or method that you want to be available only within the class. In Processing, all fields and methods are public unless otherwise specified by the private keyword.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.
public
Keyword used to provide other classes access the fields and methods within a class. The public keyword is used before a field or method that you want to make available. In Processing, all fields and methods are public unless otherwise specified by the private keyword.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.
pushStyle()
The pushStyle() function saves the current style settings and popStyle() restores the prior settings. Note that these functions are always used together. They allow you to change the style settings and later return to what you had. When a new style is started with pushStyle(), it builds on the current style information. The pushStyle() and popStyle() functions can be embedded to provide more control. (See the second example above for a demonstration.)

The style information controlled by the following functions are included in the style: fill(), stroke(), tint(), strokeWeight(), strokeCap(), strokeJoin(), imageMode(), rectMode(), ellipseMode(), shapeMode(), colorMode(), textAlign(), textFont(), textMode(), textSize(), textLeading(), emissive(), specular(), shininess(), ambient()

Syntax
pushStyle()
redraw()
Executes the code within draw() one time. This functions allows the program to update the display window only when necessary, for example when an event registered by mousePressed() or keyPressed() occurs.

In structuring a program, it only makes sense to call redraw() within events such as mousePressed(). This is because redraw() does not run draw() immediately (it only sets a flag that indicates an update is needed).

The redraw() function does not work properly when called inside draw(). To enable/disable animations, use loop() and noLoop().

Syntax
redraw()
return
Keyword used to indicate the value to return from a function. The value being returned must be the same datatype as defined in the function declaration. Functions declared with void can't return values and shouldn't include a return value.

The keyword return may also be used to break out of a function, thus not allowing the program to the remaining statements. (See the third example above.)

Syntax
type function {
statements
return value
}
setup()
The setup() function is called once when the program starts. It's used to define initial enviroment properties such as screen size and background color and to load media such as images and fonts as the program starts. There can only be one setup() function for each program and it shouldn't be called again after its initial execution. Note: Variables declared within setup() are not accessible within other functions, including draw().

Syntax
setup()
static
Keyword used to define a variable as a "class variable" and a method as a "class method." When a variable is declared with the static keyword, all instances of that class share the same variable. When a class is defined with the static keyword, it's methods can be used without making an instance of the class. The above examples demonstrate each of these uses.

This keyword is an essential part of Java programming and is not usually used with Processing. Consult a Java language reference or tutorial for more information.
super
Example
// This example is a code fragment;
// it will not compile on its own.

// Create the DragDrop subclass from
// the Button class. Button becomes
// the superclass of DragDrop.
class DragDrop extends Button {
int xoff, yoff;
DragDrop(int x, int y) {
// Runs the superclass' constructor
super(x, y);
}
void press(int mx, int my) {
// Runs the superclass' press() method
super.press();
xoff = mx;
yoff = my;
}
}

Description
Keyword used to reference the superclass of a subclass.
this
Refers to the current object (i.e., "this object"), which will change depending on the context in which this is referenced. In Processing, it's most common to use this to pass a reference from the current object into one of the libraries.

The keyword this can also be used to reference an object's own method from within itself, but such usage is typically not necessary. For example, if you are calling the filter() method of a PImage object named tree from another object, you would write tree.filter(). To call this method inside the PImage object itself, one could simply write filter() or, more explicitly, this.filter(). The additional level of specificity in this.filter() is not necessary, as it is always implied.
true
Reserved word representing the logical value "true". Only variables of type boolean may be assigned the value true.
try
The try keyword is used with catch to handle exceptions. Sun's Java documentation defines an exception as "an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions." This could be, for example, an error while a file is read.

Syntax
try {
tryStatements
} catch (exception) {
catchStatements
}
void
Keyword used indicate that a function returns no value. Each function must either return a value of a specific datatype or use the keyword void to specify it returns nothing.

Syntax
void function {
statements
}