A brief language tour
Lisp
(defstruct Thing a b c d)
C
typdef struct { Type a, b, c, d; } Thing;
Java
package net.chkno.javasucks;
/**
* Thing
*/
public class Thing implements java.io.Serializable {
// Fields
private Type a;
private Type b;
private Type c;
private Type d;
// Constructors
/** default constructor */
public ThingId() {
}
/** full constructor */
public ThingId(Type a, Type b, Type c, Type d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
// Property accessors
public Type getA() {
return this.a;
}
public void setA(Type a) {
this.a = a;
}
public Type getB() {
return this.b;
}
public void setB(Type b) {
this.b = b;
}
public Type getC() {
return this.c;
}
public void setC(Type c) {
this.c = c;
}
public Type getD() {
return this.d;
}
public void setD(Type d) {
this.d = d;
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof ThingId) ) return false;
ThingId castOther = ( ThingId ) other;
return ( (this.getA()==castOther.getA()) || ( this.getA()!=null && castOther.getA()!=null && this.getA().equals(castOther.getA()) ) )
&& ( (this.getB()==castOther.getB()) || ( this.getB()!=null && castOther.getB()!=null && this.getB().equals(castOther.getB()) ) )
&& ( (this.getC()==castOther.getC()) || ( this.getC()!=null && castOther.getC()!=null && this.getC().equals(castOther.getC()) ) )
&& ( (this.getD()==castOther.getD()) || ( this.getD()!=null && castOther.getD()!=null && this.getD().equals(castOther.getD()) ) );
}
public int hashCode() {
int result = 17;
result = 37 * result + ( getA() == null ? 0 : this.getA().hashCode() );
result = 37 * result + ( getB() == null ? 0 : this.getB().hashCode() );
result = 37 * result + ( getC() == null ? 0 : this.getC().hashCode() );
result = 37 * result + ( getD() == null ? 0 : this.getD().hashCode() );
return result;
}
}