我有以下课程:
class Point
{
double x, y;
// .... constructor and other functions here
public boolean equals(Point p)
{
if(p==null) return(false);
return(x==p.x && y==p.y);
}
public int hashCode()
{
int result=17;
long c1=Double.doubleToLongBits(x);
long c2=Double.doubleToLongBits(y);
int ci1=(int)(c1 ^ (c1 >>> 32));
int ci2=(int)(c2 ^ (c2 >>> 32));
result = 31 * result + ci1;
result = 31 * result + ci2;
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我写下面的代码:
Point x=new Point(11,7);
Point y=new Point(11,7);
System.out.println("hash-code of x=" + x.hashCode());
System.out.println("hash-code of y=" …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
module s(clock, direction, readWrite, LA1, LA2, LA3, LA4, LD1, LD2, LD3, LD4, RA1, RA2, RA3, RA4, RD1, RD2, RD3, RD4);
// parameters
input clock, direction, readWrite;
inout reg [7:0] LD1, LD2, LD3, LD4, RD1, RD2, RD3, RD4;
inout reg [11:0] LA1, LA2, LA3, LA4, RA1, RA2, RA3, RA4;
// code
always @(posedge clock) begin
if(direction==1) begin // left to right
assign RA1 = LA1 | LA2 | LA3 | LA4;
assign RD1 = LD1 | LD2 | LD3 | …Run Code Online (Sandbox Code Playgroud)