MCPcopy Create free account
hub / github.com/Rust-API/Rust-API-Bypass-Checker / add_term

Method add_term

src/analysis/numerical/linear_constraint.rs:65–76  ·  view source on GitHub ↗

Add term `n*x` to the linear expression

(&mut self, x: Rc<Path>, n: Integer)

Source from the content-addressed store, hash-verified

63
64 /// Add term `n*x` to the linear expression
65 pub fn add_term(&mut self, x: Rc<Path>, n: Integer) {
66 if let Some(num) = self.cof_map.get(&x) {
67 let r = num + n;
68 if r == 0 {
69 self.cof_map.remove(&x);
70 } else {
71 self.cof_map.insert(x.clone(), r);
72 }
73 } else if n != 0 {
74 self.cof_map.insert(x.clone(), n);
75 }
76 }
77}
78
79impl<Num> From<Num> for LinearExpression

Callers 3

addMethod · 0.80
subMethod · 0.80
test_linear_expressionFunction · 0.80

Calls 3

removeMethod · 0.80
getMethod · 0.45
insertMethod · 0.45

Tested by 1

test_linear_expressionFunction · 0.64