CpsEdge.java 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package classes;
  2. public class CpsEdge {
  3. float maxCapacity;
  4. float flow;
  5. boolean isWorking;
  6. CpsObject A;
  7. CpsObject B;
  8. public CpsEdge(CpsObject A, CpsObject B){
  9. setA(A);
  10. setB(B);
  11. this.A.AddConnection(this);
  12. this.B.AddConnection(this);
  13. this.maxCapacity = 100;
  14. flow = 0;
  15. isWorking = true;
  16. }
  17. /**
  18. * @return the capacity
  19. */
  20. public float getCapacity() {
  21. return maxCapacity;
  22. }
  23. /**
  24. * @param cap the Capacity to set
  25. */
  26. public void setCapacity(float cap) {
  27. this.maxCapacity = cap;
  28. }
  29. /**
  30. * @return the flow
  31. */
  32. public float getFlow() {
  33. return flow;
  34. }
  35. /**
  36. * @param flow the flow to set
  37. */
  38. public void setFlow(float flow) {
  39. this.flow = flow;
  40. if(flow > maxCapacity){
  41. isWorking = false;
  42. }
  43. }
  44. /**
  45. * @return the a
  46. */
  47. public CpsObject getA() {
  48. return A;
  49. }
  50. /**
  51. * @param a the a to set
  52. */
  53. public void setA(CpsObject a) {
  54. A = a;
  55. }
  56. /**
  57. * @return the b
  58. */
  59. public CpsObject getB() {
  60. return B;
  61. }
  62. /**
  63. * @param b the b to set
  64. */
  65. public void setB(CpsObject b) {
  66. B = b;
  67. }
  68. }