protected override void decorateIdentity(CsList <object> identifiers) { identifiers.Add(_underline); identifiers.Add(_italic); identifiers.Add(_bold); identifiers.Add(_fontSize); identifiers.Add(_fontSizeUnit); identifiers.Add(_alignment); identifiers.Add(_backgroundColor); identifiers.Add(_foregroundColor); } // decorateIdentity()
} // classEquals() /** * {@inheritDoc} */ public bool equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } if (obj is BaseObject) { BaseObject that = (BaseObject)obj; if (classEquals(that)) { CsList <object> list1 = new CsList <object>(); CsList <object> list2 = new CsList <object>(); decorateIdentity(list1); that.decorateIdentity(list2); if (list1.Count != list2.Count) { throw new InvalidOperationException("Two instances of the same class (" + GetType().Name + ") returned different size decorated identity lists"); } if (EnumerableUtils.IsEmpty <object>(list1)) { Debug.Assert(EnumerableUtils.IsEmpty <object>(list2)); list1.Add(ToString()); list2.Add(that.ToString()); } EqualsBuilder eb = new EqualsBuilder(); while (list1.HasNext()) { Debug.Assert(list2.HasNext()); object next1 = list1.Next(); object next2 = list2.Next(); eb.append(next1, next2); } Debug.Assert(!list2.HasNext()); return(eb.isEquals()); } } return(false); } // equals()
//protected FromItem clone() //{ // FromItem f = new FromItem(); // f._alias = _alias; // f._join = _join; // f._table = _table; // f._expression = _expression; // if (_subQuery != null) // { // f._subQuery = _subQuery.clone(); // } // if (_leftOn != null && _leftSide != null && _rightOn != null && _rightSide != null) // { // f._leftSide = _leftSide.clone(); // f._leftOn = _leftOn.clone(); // f._rightSide = _rightSide.clone(); // f._rightOn = _rightOn.clone(); // } // return f; //} // clone() protected override void decorateIdentity(CsList <Object> identifiers) { identifiers.add(_table); identifiers.add(_alias); identifiers.add(_subQuery); identifiers.add(_join); identifiers.add(_leftSide); identifiers.add(_rightSide); identifiers.add(_leftOn); identifiers.add(_rightOn); identifiers.add(_expression); } // decorateIdentity()
} // ToString() /** * {@inheritDoc} */ public int hashCode() { logger.debug("{}.hashCode()", this); int hash_code = -1; CsList <object> list = new CsList <object>(); decorateIdentity(list); if (EnumerableUtils.IsEmpty <object>(list)) { list.Add(ToString()); } hash_code -= list.Count; foreach (object obj in list) { hash_code += hashCode(obj); } return(hash_code); } // hashCode()
} // constructor /** * Subclasses should implement this method and add all fields to the list * that are to be included in equals(...) and hashCode() evaluation * * @param identifiers */ protected override void decorateIdentity(CsList <Object> identifiers) { identifiers.add(_expression); identifiers.add(_alias); identifiers.add(_column); identifiers.add(_function); identifiers.add(_functionApproximationAllowed); if (_fromItem == null && _column != null && _column.getTable() != null) { // add a FromItem representing the column's table - this makes equal // comparison work when the only difference is whether or not // FromItem is specified identifiers.add(new FromItem(_column.getTable())); } else { identifiers.add(_fromItem); } identifiers.add(_subQuerySelectItem); } // decorateIdentity()
public static CsList <T> List <T>(CsList <T> list, T item) { list.Add(item); return(list); }
} // HasNext() public static object Next(this CsList<object>.Enumerator iterator) { object o = null; return o; } // HasNext()
// CsList<object>.Enumerator // This is the extension method. // The first parameter takes the "this" modifier // and specifies the type for which the method is defined. public static bool HasNext(this CsList<object> list) { return false; } // HasNext()
} // equals() /** * Subclasses should implement this method and add all fields to the list * that are to be included in equals(...) and hashCode() evaluation * * @param identifiers */ protected abstract void decorateIdentity(CsList <object> identifiers);