Package edu.umd.cs.piccolo.util
Class PUtil
java.lang.Object
edu.umd.cs.piccolo.util.PUtil
PUtil util methods for the Piccolo framework.
- Version:
- 1.0
- Author:
- Jesse Grosjean
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intRate in milliseconds at which the activity timer will get invoked.static longPActivities are broken into steps, this is how many milliseconds should pass between steps.static EnumerationA utility enumeration with no elements.static IteratorAn iterator that iterates over an empty collection.static OutputStreamDeprecated.This has been moved into a private static class of PObjectOutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PCameraCreates the simplest possible scene graph.static GeneralPathReads a path from the provided inputStream in accordance with the serialization policy defined in writePath.static StrokeReconstitutes a stroke from the provided Object Input Stream.static voidwritePath(GeneralPath path, ObjectOutputStream out) Serializes the given path to the provided Object Output Stream.static voidwriteStroke(Stroke stroke, ObjectOutputStream out) Serializes the given stroke object to the object output stream provided.
-
Field Details
-
DEFAULT_ACTIVITY_STEP_RATE
public static long DEFAULT_ACTIVITY_STEP_RATEPActivities are broken into steps, this is how many milliseconds should pass between steps. -
ACTIVITY_SCHEDULER_FRAME_DELAY
public static int ACTIVITY_SCHEDULER_FRAME_DELAYRate in milliseconds at which the activity timer will get invoked. -
NULL_ITERATOR
An iterator that iterates over an empty collection. -
NULL_ENUMERATION
A utility enumeration with no elements. -
NULL_OUTPUT_STREAM
Deprecated.This has been moved into a private static class of PObjectOutputStream
-
-
Constructor Details
-
PUtil
public PUtil()
-
-
Method Details
-
createBasicScenegraph
Creates the simplest possible scene graph. 1 Camera, 1 Layer, 1 Root- Returns:
- a basic scene with 1 camera, layer and root
-
writeStroke
Serializes the given stroke object to the object output stream provided. By default strokes are not serializable. This method solves that problem.- Parameters:
stroke- stroke to be serializeout- stream to which the stroke is to be serialized- Throws:
IOException- can occur if exception occurs with underlying output stream
-
readStroke
Reconstitutes a stroke from the provided Object Input Stream. According to the scheme found in writeStroke. By default strokes are not serializable.- Parameters:
in- stream from which Stroke is to be read- Returns:
- a stroke object
- Throws:
IOException- occurs if an exception occurs reading from in streamClassNotFoundException- should never happen, but can if somehow the stroke class is not on the classpath
-
readPath
Reads a path from the provided inputStream in accordance with the serialization policy defined in writePath.- Parameters:
in- stream from which to read the path.- Returns:
- reconstituted path
- Throws:
IOException- if an unknown path type is read from the streamClassNotFoundException- should never happen, but can if somehow the classpath is seriously messed up
-
writePath
Serializes the given path to the provided Object Output Stream.- Parameters:
path- path to be serializedout- stream to which the path should be serialized- Throws:
IOException- if unknown path segment type is encountered, or an exception occurs writing to the output stream
-