home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / ed8n1t2i / integratedcircuit.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  3.4 KB  |  88 lines

  1. //****************************************************************************
  2. // ---- version information ----
  3. //
  4. // IntegratedCircuit.java   v 1.00 b1
  5. // Written by:              I. van Rienen / E-mail ivr@bart.nl
  6. // URL:                     http://www/bart.nl/~ivr
  7. // Initial release:
  8. // Released in public domain:
  9. //
  10. // ---- Description ----
  11. // Java class containing methods for a Integrated Circuit
  12. //
  13. // This program and the Java source is in the public domain.
  14. // Permission to use, copy, modify, and distribute this software
  15. // and its documentation for NON-COMMERCIAL purposes and
  16. // without fee is hereby granted.
  17. //
  18. //    Copyright 1996
  19. //
  20. //    Iwan van Rienen
  21. //    Joan Maetsuyckerstr. 145
  22. //    2593 ZG  The Hague
  23. //    The Netherlands
  24. //
  25. // I am not responsible for any bugs in this program and
  26. // possible damage to hard- or software when using this program.
  27. //****************************************************************************
  28. import java.applet.Applet;
  29. import java.awt.*;
  30. import java.util.Vector;
  31.  
  32. class IntegratedCircuit extends ElectronicComponent {
  33.  
  34. //----------------------------------------------------------------------------
  35. // The constructor of an Integrated Circuit
  36. //----------------------------------------------------------------------------
  37.     public IntegratedCircuit(int x, int y, int w, int h,
  38.                              int xh, int yh, int wh, int hh, int i, int o) {
  39.         super (x, y, w, h, xh, yh, wh, hh, i, o);  // x,y,w,h HitBox x,y,w,h, I,O
  40.     }
  41.  
  42. //----------------------------------------------------------------------------
  43. // The constructor of a new IC, which is a copy of CompToCopy
  44. //----------------------------------------------------------------------------
  45.     public IntegratedCircuit (ElectronicComponent CompToCopy, int xo, int yo) {
  46.         super (CompToCopy, xo, yo);
  47.     }
  48.  
  49. //----------------------------------------------------------------------------
  50. // Method for copying this component.
  51. //----------------------------------------------------------------------------
  52.     public ElectronicComponent Copy(int xo, int yo) {
  53.         return this; // Should not occure, But return <this> to avoid problems
  54.     }
  55.  
  56. //----------------------------------------------------------------------------
  57. // Method for drawing this IC
  58. //----------------------------------------------------------------------------
  59.     public void draw(Graphics g, int xp, int yp, int gs) {
  60.         super.draw (g, xp, yp, gs);
  61.         int x = Pos.x - xp;
  62.         int y = Pos.y - yp;
  63.  
  64.         // Draw HitBox and Dimension
  65.         // DrawHitBox(g, x, y, gs);
  66.  
  67.         // Draw all IO Pins
  68.         DrawInputPins(g, x, y, gs);
  69.         DrawOutputPins(g, x, y, gs);
  70.  
  71.         // Draw body
  72.         g.setColor (ComponentColor);
  73.         g.drawRect ((x + HitBox.x) * gs, (y + HitBox.y) * gs, HitBoxSize.width * gs, HitBoxSize.height * gs);
  74.     }
  75.  
  76. //----------------------------------------------------------------------------
  77. // This code is simulating the IC
  78. //----------------------------------------------------------------------------
  79.     public void SimulateLogic() {}
  80.  
  81. //----------------------------------------------------------------------------
  82. // The action of this component every cycle
  83. //----------------------------------------------------------------------------
  84.     public void Simulate(int id) {
  85.         super.Simulate(id);
  86.     }
  87.  
  88. }