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.*; 004import votorola.g.web.gwt.*; 005 006 007/** A difference look implemented as a JavaScript overlay type. 008 */ 009public class DiffLookJS extends JavaScriptObjectX implements DiffLook 010{ 011 012 013 protected DiffLookJS() {} // "precisely one constructor... protected, empty, and no-argument" 014 015 016 017 // ------------------------------------------------------------------------------------ 018 019 020 /** An equator that implements DiffLook.{@linkplain DiffLook#equals(Object) #equals} 021 * for use in GWT clients. 022 */ 023 public static @ThreadSafe final Equator<DiffLook> EQUATOR = new Equator<DiffLook>() 024 { 025 public boolean equals( final DiffLook d1, final DiffLook d2 ) // cf. DiffLook1.equals 026 { 027 if( d1 == null ) return d2 == null; 028 029 if( d2 == null ) return false; 030 031 return d1.key().equals(d2.key()) && d1.selectand().equals(d2.selectand()); 032 } 033 }; 034 035 036 037 // - D i f f - L o o k ---------------------------------------------------------------- 038 039 040 public final native String key() /*-{ return this.key; }-*/; 041 042 043 044 public final native String selectand() /*-{ return this.selectand? this.selectand: "a"; }-*/; 045 046 047 048 public final native boolean toPersist() 049 /*-{ 050 return this.toPersist == null? true: this.toPersist; 051 }-*/; 052 053 054}