DefaultFigureStyle extends PropertyContainer implements FigureStyle { @Override public boolean equals(Object obj) { if (!(obj instanceof DefaultFigureStyle)) { return false; } DefaultFigureStyle other = (DefaultFigureStyle) obj; Property[] properties = this.getProperties(); for (Property property : properties) { Property otherProperty = other.getProperty(property.getName()); if (otherProperty == null || otherProperty.getValue() != null && property.getValue() == null || (property.getValue() != null && !property.getValue().equals(otherProperty.getValue()))) { return false; } } return true; } DefaultFigureStyle();  DefaultFigureStyle(String name);  DefaultFigureStyle(FigureStyle parentStyle);  DefaultFigureStyle(String name, FigureStyle parentStyle); @Deprecated static FigureStyle createFromCSS(String css); static FigureStyle createFromCss(String css); static FigureStyle createPointStyle(Symbol symbol); static FigureStyle createPointStyle(Symbol symbol, Paint strokePaint, Stroke stroke); static FigureStyle createPointStyle(Symbol symbol, Paint fillPaint, Paint strokePaint, Stroke stroke); static FigureStyle createLineStyle(Paint strokePaint); static FigureStyle createLineStyle(Paint strokePaint, Stroke stroke); static DefaultFigureStyle createPolygonStyle(Paint fillPaint); static DefaultFigureStyle createPolygonStyle(Paint fillPaint, Paint strokePaint); static DefaultFigureStyle createPolygonStyle(Paint fillPaint, Paint strokePaint, Stroke stroke); @Override String getName(); @Override T getValue(String name); @Override void setValue(String name, Object value); @Override Symbol getSymbol(); @Override String getSymbolName(); void setSymbolName(String symbolName); @Override String getSymbolImagePath(); void setSymbolImagePath(String symbolName); @Override double getSymbolRefX(); void setSymbolRefX(double refX); @Override double getSymbolRefY(); void setSymbolRefY(double refY); @Override Stroke getStroke(); @Override Stroke getStroke(double scale); @Override Paint getStrokePaint(); @Override Color getStrokeColor(); void setStrokeColor(Color strokeColor); @Override double getStrokeOpacity(); void setStrokeOpacity(double opacity); @Override double getStrokeWidth(); void setStrokeWidth(double width); @Override Paint getFillPaint(); @Override Color getFillColor(); void setFillColor(Color fillColor); @Override double getFillOpacity(); void setFillOpacity(double opacity); @Override String toCssString(); @Override void fromCssString(String css); @Override boolean equals(Object obj); static final PropertyDescriptor FILL_COLOR; static final PropertyDescriptor FILL_OPACITY; static final PropertyDescriptor STROKE_COLOR; static final PropertyDescriptor STROKE_OPACITY; static final PropertyDescriptor STROKE_WIDTH; static final PropertyDescriptor SYMBOL_NAME; static final PropertyDescriptor SYMBOL_IMAGE; static final PropertyDescriptor SYMBOL_REF_X; static final PropertyDescriptor SYMBOL_REF_Y; }
@Test public void testEquals() { FigureStyle oneStyle = DefaultFigureStyle.createPointStyle(ImageSymbol.createIcon("TestSymbolIcon.png", 2.0, 6.0)); FigureStyle sameStyle = DefaultFigureStyle.createPointStyle(ImageSymbol.createIcon("TestSymbolIcon.png", 2.0, 6.0)); FigureStyle otherStyle = DefaultFigureStyle.createPointStyle(NamedSymbol.STAR, Color.ORANGE, new BasicStroke(2.5f)); FigureStyle sameOtherStyle = DefaultFigureStyle.createPointStyle(NamedSymbol.STAR, Color.ORANGE, new BasicStroke(2.5f)); assertEquals(true, oneStyle.equals(oneStyle)); assertEquals(true, oneStyle.equals(sameStyle)); assertEquals(false, oneStyle.equals(otherStyle)); assertEquals(false, oneStyle.equals(sameOtherStyle)); assertEquals(true, otherStyle.equals(sameOtherStyle)); }