public bool evaluateAsLeaf(CellData cell) { Scanner scan = new Scanner(expr); string first = scan.next(); string op = scan.next(); string second = scan.rest(); if (first.Equals("") || op.Equals("") || second.Equals("")) { return(false); } PhysicellVariable pv1 = getVal(cell, first); PhysicellVariable pv2 = getVal(cell, second); Vector3 v1 = pv1.getData(); Vector3 v2 = pv2.getData(); if (op.Equals("<")) { return(lessThan(pv1, pv2)); } else if (op.Equals("<=")) { return(lessThanEqualTo(pv1, pv2)); } else if (op.Equals(">")) { return(greaterThan(pv1, pv2)); } else if (op.Equals(">=")) { return(greaterThanEqualTo(pv1, pv2)); } else if (op.Equals("=")) { return(equalTo(pv1, pv2)); } else if (op.Equals("!=")) { return(notEqualTo(pv1, pv2)); } else { return(false); } }
public bool lessThan(PhysicellVariable pv1, PhysicellVariable pv2) { Vector3 v1 = pv1.getData(); Vector3 v2 = pv2.getData(); if (v1.x >= v2.x) { return(false); } if ((pv1.isVector && pv2.isVector) && v1.y >= v2.y) { return(false); } if ((pv1.isVector && pv2.isVector) && v1.z >= v2.z) { return(false); } return(true); }
public bool notEqualTo(PhysicellVariable pv1, PhysicellVariable pv2) { Vector3 v1 = pv1.getData(); Vector3 v2 = pv2.getData(); if (Math.Abs(v1.x - v2.x) > 0.00001) { return(true); } if ((pv1.isVector && pv2.isVector) && Math.Abs(v1.y - v2.y) > 0.00001) { return(true); } if ((pv1.isVector && pv2.isVector) && Math.Abs(v1.z - v2.z) > 0.00001) { return(true); } return(false); }
public bool greaterThanEqualTo(PhysicellVariable pv1, PhysicellVariable pv2) { Vector3 v1 = pv1.getData(); Vector3 v2 = pv2.getData(); if (v1.x < v2.x) { return(false); } if ((pv1.isVector && pv2.isVector) && v1.y < v2.y) { return(false); } if ((pv1.isVector && pv2.isVector) && v1.z < v2.z) { return(false); } return(true); }