public class

ZIndexComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ sofia.graphics.ZIndexComparator

Class Overview

A comparator for shapes that orders them by increasing z-index, or for identical z-indices, orders them by increasing insertion time (i.e., newer shapes are after older shapes).

Summary

Public Constructors
ZIndexComparator()
Public Methods
int compare(Shape shape1, Shape shape2)
Protected Methods
int compareTimestamps(Shape shape1, Shape shape2)
Compare the insertion times of two shapes.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Public Constructors

public ZIndexComparator ()

Public Methods

public int compare (Shape shape1, Shape shape2)

Protected Methods

protected int compareTimestamps (Shape shape1, Shape shape2)

Compare the insertion times of two shapes.

Parameters
shape1 The first shape.
shape2 The second shape.
Returns
  • -1 if shape1 was added to the ShapeSet before shape2, 0 if they were added at the same time, or 1 if shape2 was added before shape1.