001package votorola.a.diff; // Copyright 2012-2013, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. 002 003import votorola.g.lang.*; 004 005 006/** A basic implementation of a difference look. 007 */ 008 @SuppressWarnings("overrides")/* overrides equals, but not hashCode*/ 009public @ThreadSafe final class DiffLook1 implements DiffLook 010{ 011 012 013 /** Constructs a DiffLook1. 014 */ 015 public DiffLook1( String _key, String _selectand, boolean _toPersist ) 016 { 017 key = _key; 018 selectand = _selectand; 019 toPersist = _toPersist; 020 } 021 022 023 024 // - D i f f - L o o k ---------------------------------------------------------------- 025 026 027 public String key() { return key; } 028 029 030 private final String key; 031 032 033 034 public String selectand() { return selectand; } 035 036 037 private final String selectand; 038 039 040 041 public boolean toPersist() { return toPersist; } 042 043 044 private final boolean toPersist; 045 046 047 048 // - O b j e c t ---------------------------------------------------------------------- 049 050 051 public @Override boolean equals( final Object o ) // cf. DiffLookJS.EQUATOR 052 { 053 if( !( o instanceof DiffLook )) return false; 054 055 final DiffLook d = (DiffLook)o; 056 return DiffLook1.this.key.equals(d.key()) && DiffLook1.this.selectand.equals(d.selectand()); 057 } 058 059 060}