package 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. import votorola.g.lang.*; import votorola.g.web.gwt.*; /** A difference look implemented as a JavaScript overlay type. */ public class DiffLookJS extends JavaScriptObjectX implements DiffLook { protected DiffLookJS() {} // "precisely one constructor... protected, empty, and no-argument" // ------------------------------------------------------------------------------------ /** An equator that implements DiffLook.{@linkplain DiffLook#equals(Object) #equals} * for use in GWT clients. */ public static @ThreadSafe final Equator EQUATOR = new Equator() { public boolean equals( final DiffLook d1, final DiffLook d2 ) // cf. DiffLook1.equals { if( d1 == null ) return d2 == null; if( d2 == null ) return false; return d1.key().equals(d2.key()) && d1.selectand().equals(d2.selectand()); } }; // - D i f f - L o o k ---------------------------------------------------------------- public final native String key() /*-{ return this.key; }-*/; public final native String selectand() /*-{ return this.selectand? this.selectand: "a"; }-*/; public final native boolean toPersist() /*-{ return this.toPersist == null? true: this.toPersist; }-*/; }