OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [test/] [java.io/] [HairyGraph.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
 
2
import java.io.*;
3
 
4
class GraphNode implements Serializable
5
{
6
  GraphNode( String s )
7
  {
8
    this.s = s;
9
  }
10
 
11
  public String toString()
12
  {
13
    return this.s;
14
  }
15
 
16
  String s;
17
  GraphNode a;
18
  GraphNode b;
19
  GraphNode c;
20
  GraphNode d;
21
}
22
 
23
 
24
public class HairyGraph implements Serializable
25
{
26
  GraphNode A;
27
  GraphNode B;
28
  GraphNode C;
29
  GraphNode D;
30
 
31
  HairyGraph()
32
  {
33
    A = new GraphNode( "A" );
34
    B = new GraphNode( "B" );
35
    C = new GraphNode( "C" );
36
    D = new GraphNode( "D" );
37
 
38
    A.a = B;
39
    A.b = C;
40
    A.c = D;
41
    A.d = A;
42
 
43
    B.a = C;
44
    B.b = D;
45
    B.c = A;
46
    B.d = B;
47
 
48
    C.a = D;
49
    C.b = A;
50
    C.c = B;
51
    C.d = C;
52
 
53
    D.a = A;
54
    D.b = B;
55
    D.c = C;
56
    D.d = D;
57
  }
58
 
59
  public boolean equals( Object o )
60
  {
61
    HairyGraph hg = (HairyGraph)o;
62
 
63
    return (A.a == B.d) && (A.a == C.c) && (A.a == D.b)
64
      && (A.b == B.a) && (A.b == C.d) && (A.b == D.c)
65
      && (A.c == B.b) && (A.c == C.a) && (A.c == D.d)
66
      && (A.d == B.c) && (A.d == C.b) && (A.d == D.a);
67
  }
68
 
69
  void printOneLevel( GraphNode gn )
70
  {
71
    System.out.println( "GraphNode< " + gn + ": " + gn.a + ", " + gn.b
72
                        + ", " + gn.c + ", " + gn.d + " >" );
73
  }
74
 
75
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.