?? defaultdrawingsupplier.java
字號:
result[0] = new Rectangle2D.Double(-delta, -delta, size, size);
// circle
result[1] = new Ellipse2D.Double(-delta, -delta, size, size);
// up-pointing triangle
xpoints = intArray(0.0, delta, -delta);
ypoints = intArray(-delta, delta, delta);
result[2] = new Polygon(xpoints, ypoints, 3);
// diamond
xpoints = intArray(0.0, delta, 0.0, -delta);
ypoints = intArray(-delta, 0.0, delta, 0.0);
result[3] = new Polygon(xpoints, ypoints, 4);
// horizontal rectangle
result[4] = new Rectangle2D.Double(-delta, -delta / 2, size, size / 2);
// down-pointing triangle
xpoints = intArray(-delta, +delta, 0.0);
ypoints = intArray(-delta, -delta, delta);
result[5] = new Polygon(xpoints, ypoints, 3);
// horizontal ellipse
result[6] = new Ellipse2D.Double(-delta, -delta / 2, size, size / 2);
// right-pointing triangle
xpoints = intArray(-delta, delta, -delta);
ypoints = intArray(-delta, 0.0, delta);
result[7] = new Polygon(xpoints, ypoints, 3);
// vertical rectangle
result[8] = new Rectangle2D.Double(-delta / 2, -delta, size / 2, size);
// left-pointing triangle
xpoints = intArray(-delta, delta, delta);
ypoints = intArray(0.0, -delta, +delta);
result[9] = new Polygon(xpoints, ypoints, 3);
return result;
}
/**
* Tests this object for equality with another object.
*
* @param obj the other object.
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj instanceof DefaultDrawingSupplier) {
DefaultDrawingSupplier supplier = (DefaultDrawingSupplier) obj;
boolean b0 = Arrays.equals(this.paintSequence, supplier.paintSequence);
boolean b1 = (this.paintIndex == supplier.paintIndex);
boolean b2 = Arrays.equals(this.outlinePaintSequence, supplier.outlinePaintSequence);
boolean b3 = (this.outlinePaintIndex == supplier.outlinePaintIndex);
boolean b4 = Arrays.equals(this.strokeSequence, supplier.strokeSequence);
boolean b5 = (this.strokeIndex == supplier.strokeIndex);
boolean b6 = Arrays.equals(this.outlineStrokeSequence, supplier.outlineStrokeSequence);
boolean b7 = (this.outlineStrokeIndex == supplier.outlineStrokeIndex);
boolean b8 = true; // something is going wrong here?
// Arrays.equals(this.shapeSequence, supplier.shapeSequence);
boolean b9 = (this.shapeIndex == supplier.shapeIndex);
return b0 && b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8 && b9;
}
return false;
}
/**
* Handles serialization.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O problem.
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
int paintCount = this.paintSequence.length;
stream.writeInt(paintCount);
for (int i = 0; i < paintCount; i++) {
SerialUtilities.writePaint(this.paintSequence[i], stream);
}
int outlinePaintCount = this.outlinePaintSequence.length;
stream.writeInt(outlinePaintCount);
for (int i = 0; i < outlinePaintCount; i++) {
SerialUtilities.writePaint(this.outlinePaintSequence[i], stream);
}
int strokeCount = this.strokeSequence.length;
stream.writeInt(strokeCount);
for (int i = 0; i < strokeCount; i++) {
SerialUtilities.writeStroke(this.strokeSequence[i], stream);
}
int outlineStrokeCount = this.outlineStrokeSequence.length;
stream.writeInt(outlineStrokeCount);
for (int i = 0; i < outlineStrokeCount; i++) {
SerialUtilities.writeStroke(this.outlineStrokeSequence[i], stream);
}
int shapeCount = this.shapeSequence.length;
stream.writeInt(shapeCount);
for (int i = 0; i < shapeCount; i++) {
SerialUtilities.writeShape(this.shapeSequence[i], stream);
}
}
/**
* Restores a serialized object.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O problem.
* @throws ClassNotFoundException if there is a problem loading a class.
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
int paintCount = stream.readInt();
this.paintSequence = new Paint[paintCount];
for (int i = 0; i < paintCount; i++) {
this.paintSequence[i] = SerialUtilities.readPaint(stream);
}
int outlinePaintCount = stream.readInt();
this.outlinePaintSequence = new Paint[outlinePaintCount];
for (int i = 0; i < outlinePaintCount; i++) {
this.outlinePaintSequence[i] = SerialUtilities.readPaint(stream);
}
int strokeCount = stream.readInt();
this.strokeSequence = new Stroke[strokeCount];
for (int i = 0; i < strokeCount; i++) {
this.strokeSequence[i] = SerialUtilities.readStroke(stream);
}
int outlineStrokeCount = stream.readInt();
this.outlineStrokeSequence = new Stroke[outlineStrokeCount];
for (int i = 0; i < outlineStrokeCount; i++) {
this.outlineStrokeSequence[i] = SerialUtilities.readStroke(stream);
}
int shapeCount = stream.readInt();
this.shapeSequence = new Shape[shapeCount];
for (int i = 0; i < shapeCount; i++) {
this.shapeSequence[i] = SerialUtilities.readShape(stream);
}
}
/**
* Helper method to avoid lots of explicit casts in getShape(). Returns
* an array containing the provided doubles cast to ints.
*
* @param a x
* @param b y
* @param c z
*
* @return int[3] with converted params.
*/
private static int[] intArray(double a, double b, double c) {
return new int[] {(int) a, (int) b, (int) c};
}
/**
* Helper method to avoid lots of explicit casts in getShape(). Returns
* an array containing the provided doubles cast to ints.
*
* @param a x
* @param b y
* @param c z
* @param d t
*
* @return int[3] with converted params.
*/
private static int[] intArray(double a, double b, double c, double d) {
return new int[] {(int) a, (int) b, (int) c, (int) d};
}
/**
* Returns a clone.
*
* @return A clone.
*
* @throws CloneNotSupportedException if a component of the supplier does not support cloning.
*/
public Object clone() throws CloneNotSupportedException {
DefaultDrawingSupplier clone = (DefaultDrawingSupplier) super.clone();
//public static final Paint[] DEFAULT_PAINT_SEQUENCE = ChartColor.createDefaultPaintArray();
//public static final Paint[] DEFAULT_OUTLINE_PAINT_SEQUENCE
//public static final Stroke[] DEFAULT_STROKE_SEQUENCE
//public static final Stroke[] DEFAULT_OUTLINE_STROKE_SEQUENCE
//public static final Shape[] DEFAULT_SHAPE_SEQUENCE = createStandardSeriesShapes();
//private transient Paint[] paintSequence;
//private int paintIndex;
//private transient Paint[] outlinePaintSequence;
//private int outlinePaintIndex;
// private transient Stroke[] strokeSequence;
//private int strokeIndex;
//private transient Stroke[] outlineStrokeSequence;
//private int outlineStrokeIndex;
//private transient Shape[] shapeSequence;
//clone.shapeSequence =
//private int shapeIndex <-- primitive
return clone;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -