123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- package classes;
- public class CpsEdge {
- float maxCapacity;
- float flow;
- boolean isWorking;
- boolean infinite;
-
- CpsObject A;
- CpsObject B;
- public CpsEdge(CpsObject A, CpsObject B){
- setA(A);
- setB(B);
- this.A.AddConnection(this);
- this.B.AddConnection(this);
- this.maxCapacity = 100;
- flow = 0;
- isWorking = true;
- }
-
- public CpsEdge(CpsObject A, CpsObject B, float maxCap){
- setA(A);
- setB(B);
- this.A.AddConnection(this);
- this.B.AddConnection(this);
- this.maxCapacity = maxCap;
- flow = 0;
- isWorking = true;
- }
-
-
- /**
- * @return the capacity
- */
- public float getCapacity() {
- return maxCapacity;
- }
- /**
- * @param cap the Capacity to set
- */
- public void setCapacity(float cap) {
- this.maxCapacity = cap;
- }
- /**
- * @return the flow
- */
- public float getFlow() {
- return flow;
- }
- /**
- * @param flow the flow to set
- */
- public void setFlow(float flow) {
- this.flow = flow;
- if(flow > maxCapacity){
- isWorking = false;
- }else{
- isWorking = true;
- }
- }
-
- /**
- * @return the a
- */
- public CpsObject getA() {
- return A;
- }
- /**
- * @param a the a to set
- */
- public void setA(CpsObject a) {
- A = a;
- }
- /**
- * @return the b
- */
- public CpsObject getB() {
- return B;
- }
- /**
- * @param b the b to set
- */
- public void setB(CpsObject b) {
- B = b;
- }
-
- public boolean getState(){
- return isWorking;
- }
-
- public void setInfinite(boolean inf){
- infinite = inf;
- }
-
- public boolean getInfinite(){
- return infinite;
- }
- }
|