public EqualsBuilder append(Object o1, Object o2) { if (equals) { equals = equals(o1, o2); } return this; }
public EqualsBuilder append(Object o1, Object o2) { if (equals) { equals = equals(o1, o2); } return this; }
/** * Sets the background (fill) color of the style * * @param color * the color to use * @return the {@link StyleBuilder} self (for cascading method calls) */ public StyleBuilder background(Color color) { if (EqualsBuilder.equals(_defaultBackgroundColor, color)) { _backgroundColor = null; } else { _backgroundColor = color; } return this; }
/** * Sets the foreground (text) color of the style * * @param color * the color to use * @return the {@link StyleBuilder} self (for cascading method calls) */ public StyleBuilder foreground(Color color) { if (EqualsBuilder.equals(_defaultForegroundColor, color)) { _foregroundColor = null; } else { _foregroundColor = color; } return this; }
/** * Sets the background (fill) color of the style * * @param color * the color to use * @return the {@link StyleBuilder} self (for cascading method calls) */ public StyleBuilder background(Color color) { if (EqualsBuilder.equals(_defaultBackgroundColor, color)) { _backgroundColor = null; } else { _backgroundColor = color; } return this; }
/** * Sets the foreground (text) color of the style * * @param color * the color to use * @return the {@link StyleBuilder} self (for cascading method calls) */ public StyleBuilder foreground(Color color) { if (EqualsBuilder.equals(_defaultForegroundColor, color)) { _foregroundColor = null; } else { _foregroundColor = color; } return this; }
@Override public int compare(String o1, String o2) { if (EqualsBuilder.equals(o1, o2)) { return 0; } // use length as the primary differentiator, to make sure long // packages are placed before short ones. int diff = o1.length() - o2.length(); if (diff == 0) { diff = o1.compareTo(o2); } return diff; } };
@Override public void setComponentRequirement(final ComponentRequirement requirement) { if (!EqualsBuilder.equals(_componentRequirement, requirement)) { _componentRequirement = requirement; onRequirementChanged(); } }
@Override public void setComponentRequirement(final ComponentRequirement requirement) { if (!EqualsBuilder.equals(_componentRequirement, requirement)) { _componentRequirement = requirement; onRequirementChanged(); } }
final Object value1 = _properties.get(propertyDescriptor); final Object value2 = otherProperties.get(propertyDescriptor); final boolean equals = EqualsBuilder.equals(value1, value2); if (!equals) { return false;
final Object value1 = _properties.get(propertyDescriptor); final Object value2 = otherProperties.get(propertyDescriptor); final boolean equals = EqualsBuilder.equals(value1, value2); if (!equals) { return false;
@Override protected void setValue(final CoalesceUnit[] value) { if (value == null) { return; } if (EqualsBuilder.equals(value, getValue())) { return; } setCoalesceUnits(value); }
@Override protected void setValue(Class[] value) { if (EqualsBuilder.equals(value, getValue())) { return; } if (value == null) { value = new Class[0]; } final String[] keys = KeysAndTypesPropertyWidget.this.getValue(); if (keys.length != value.length) { // disregard this invalid value update return; } for (int i = 0; i < keys.length; i++) { final DCComboBox<Class<?>> comboBox = _comboBoxes.get(i); final Class<?> selectedClass = value[i]; comboBox.setSelectedItem(selectedClass); } }
@Override public void onValueTouched(final E value) { if (isUpdating()) { // prevent update loops from a widget's own configuration change // notification return; } final E existingValue = getValue(); if (EqualsBuilder.equals(value, existingValue)) { return; } setValue(value); }
public void updateComponents(N values) { if (values == null) { values = createArray(2); } final N previousValues = getValue(); if (!EqualsBuilder.equals(values, previousValues)) { for (int i = 0; i < Math.min(Array.getLength(previousValues), Array.getLength(values)); i++) { // modify text boxes if (!EqualsBuilder.equals(Array.get(previousValues, i), Array.get(values, i))) { final JTextComponent component = (JTextComponent) _textFieldPanel.getComponent(i); component.setText(_numberFormat.format(Array.get(values, i))); } } while (_textFieldPanel.getComponentCount() < Array.getLength(values)) { // add text boxes if there are too few final Object nextValue = Array.get(values, _textFieldPanel.getComponentCount()); addTextField(nextValue, false); } while (_textFieldPanel.getComponentCount() > Array.getLength(values)) { // remove text boxes if there are too many _textFieldPanel.remove(_textFieldPanel.getComponentCount() - 1); } _textFieldPanel.updateUI(); } }
@Override protected void setValue(String[] values) { if (values == null || values.length == 0) { values = new String[1]; } final String[] previousValues = getValue(); if (!EqualsBuilder.equals(values, previousValues)) { for (int i = 0; i < Math.min(previousValues.length, values.length); i++) { // modify combo boxes if (!EqualsBuilder.equals(previousValues[i], values[i])) { final SourceColumnComboBox comboBox = _comboBoxes.get(i); comboBox.setEditable(true); comboBox.setSelectedItem(values[i]); comboBox.setEditable(false); } } while (_comboBoxes.size() < values.length) { // add combo boxes if there are too few final String nextValue = values[_comboBoxes.size()]; addComboBox(nextValue, false); } while (_comboBoxes.size() > values.length) { // remove text boxes if there are too many removeComboBox(); } _comboBoxPanel.updateUI(); } }
public void updateComponents(Class<?>[] values) { if (values == null) { values = new Class[2]; } final Class<?>[] previousValues = getValue(); if (!EqualsBuilder.equals(values, previousValues)) { for (int i = 0; i < Math.min(previousValues.length, values.length); i++) { // modify comboboxes if (!EqualsBuilder.equals(previousValues[i], values[i])) { final Component decoration = _outerPanel.getComponent(i); final DCComboBox<Class<?>> component = _comboBoxDecorations.get(decoration); component.setSelectedItem(values[i]); } } while (_outerPanel.getComponentCount() < values.length) { // add comboboxes if there are too few final Class<?> nextValue = values[_outerPanel.getComponentCount()]; addComboBox(nextValue, false); } while (_outerPanel.getComponentCount() > values.length) { removeComboBox(); } _outerPanel.updateUI(); } }
public void updateComponents(String[] values) { if (values == null) { values = new String[2]; } final String[] previousValues = getValue(); if (!EqualsBuilder.equals(values, previousValues)) { for (int i = 0; i < Math.min(previousValues.length, values.length); i++) { // modify text boxes if (!EqualsBuilder.equals(previousValues[i], values[i])) { final Component decoration = _textFieldPanel.getComponent(i); final JXTextField component = _textFieldDecorations.get(decoration); component.setText(values[i]); } } while (_textFieldPanel.getComponentCount() < values.length) { // add text boxes if there are too few final String nextValue = values[_textFieldPanel.getComponentCount()]; addTextField(nextValue, false); } while (_textFieldPanel.getComponentCount() > values.length) { removeTextField(); } _textFieldPanel.updateUI(); } }
private boolean matchesNumber(final Token token, final TokenizerConfiguration configuration) { final boolean discriminateNegativeNumbers = configuration.isDiscriminateNegativeNumbers(); final boolean discriminateDecimalNumbers = configuration.isDiscriminateDecimalNumbers(); if (!discriminateDecimalNumbers && !discriminateNegativeNumbers) { return true; } final String str2 = token.getString(); final Character minusSign = configuration.getMinusSign(); if (discriminateNegativeNumbers && minusSign != null) { final boolean negative1 = isNegative(); final boolean negative2 = EqualsBuilder.equals(minusSign, str2.charAt(0)); if (negative1 != negative2) { return false; } } final Character decimalSeparator = configuration.getDecimalSeparator(); if (discriminateDecimalNumbers && decimalSeparator != null) { final boolean decimal1 = isDecimal(); final boolean decimal2 = str2.indexOf(decimalSeparator.charValue()) != -1; if (decimal1 != decimal2) { return false; } } return true; }
@Override public boolean matches(final Token token, final TokenizerConfiguration configuration) { if (EqualsBuilder.equals(_tokenType, token.getType())) { if (configuration.isDistriminateTokenLength(_tokenType)) { if (toSymbolicString().length() != token.getString().length()) { // not a match, based on length return false; } } switch (_tokenType) { case TEXT: return matchesText(token, configuration); case NUMBER: return matchesNumber(token, configuration); case DELIM: return matchesDelim(token, configuration); case WHITESPACE: return matchesWhitespace(token, configuration); case MIXED: return matchesMixed(token, configuration); case PREDEFINED: return matchesPredefined(token); default: throw new UnsupportedOperationException("Unsupported token type for matching: " + _tokenType); } } return false; }