fn density_level(mut self, density_level: &str) -> Self {
        let i = match density_level {
            "M" | "m" | "most" => 0,
            "L" | "l" | "least" => 2,
            _ => 1, // "N", "nominal"
        };
        let (toe, heel, side, courtyard) = match self.package_type {
            PackageType::Chip => {
                let len = self.lead_span.nom(); //(self.lead_span.0 + self.lead_span.1) / 2.0;
                if len <= 0.5 {
                    // 01005 & Less
                    (
                        vec![0.06, 0.05, 0.04][i],    // Toe
                        vec![-0.02, -0.03, -0.04][i], // Heel
                        vec![-0.02, -0.03, -0.04][i], // Side
                        vec![0.2, 0.15, 0.1][i],      // Coutyard
                    )
                } else if len <= 0.75 {
                    // 0201
                    (
                        vec![0.12, 0.1, 0.08][i],     // Toe
                        vec![-0.01, -0.02, -0.03][i], // Heel
                        vec![-0.01, -0.02, -0.03][i], // Side
                        vec![0.2, 0.15, 0.1][i],      // Coutyard
                    )
                } else if len <= 1.3 {
                    // 0402, 0306 & 0502
                    (
                        vec![0.25, 0.2, 0.15][i],   // Toe
                        vec![0.0, -0.01, -0.02][i], // Heel
                        vec![0.0, -0.01, -0.02][i], // Side
                        vec![0.2, 0.15, 0.1][i],    // Coutyard
                    )
                } else if len <= 2.85 {
                    // 0603, 0705 & 0805
                    (
                        vec![0.4, 0.3, 0.2][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else if len <= 3.85 {
                    // 1206, 1210 & 0612
                    (
                        vec![0.45, 0.35, 0.25][i], // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else if len <= 4.75 {
                    // 1812 & 1825
                    (
                        vec![0.5, 0.4, 0.3][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else {
                    // 2010 & Greater
                    (
                        vec![0.6, 0.5, 0.4][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                }
            }
            _ => (
                vec![0.55, 0.35, 0.15][i], // Toe
                vec![0.45, 0.35, 0.25][i], // Heel
                vec![0.05, 0.03, 0.01][i], // Side
                vec![0.5, 0.25, 0.12][i],  // Coutyard
            ),
        };
        self.toe = toe;
        self.heel = heel;
        self.side = side;
        self.courtyard = courtyard;
        self
    }
// Set goals according to the density level
Set goals according to the density level
Set goals according to the density level
fn density_level(mut self, density_level: &str) -> Self {
        let i = match density_level {
            "M" | "m" | "most" => 0,
            "L" | "l" | "least" => 2,
            _ => 1, // "N", "nominal"
        };
        let (toe, heel, side, courtyard) = match self.package_type {
            PackageType::Chip => {
                let len = self.lead_span.nom(); //(self.lead_span.0 + self.lead_span.1) / 2.0;
                if len <= 0.5 {
                    // 01005 & Less
                    (
                        vec![0.06, 0.05, 0.04][i],    // Toe
                        vec![-0.02, -0.03, -0.04][i], // Heel
                        vec![-0.02, -0.03, -0.04][i], // Side
                        vec![0.2, 0.15, 0.1][i],      // Coutyard
                    )
                } else if len <= 0.75 {
                    // 0201
                    (
                        vec![0.12, 0.1, 0.08][i],     // Toe
                        vec![-0.01, -0.02, -0.03][i], // Heel
                        vec![-0.01, -0.02, -0.03][i], // Side
                        vec![0.2, 0.15, 0.1][i],      // Coutyard
                    )
                } else if len <= 1.3 {
                    // 0402, 0306 & 0502
                    (
                        vec![0.25, 0.2, 0.15][i],   // Toe
                        vec![0.0, -0.01, -0.02][i], // Heel
                        vec![0.0, -0.01, -0.02][i], // Side
                        vec![0.2, 0.15, 0.1][i],    // Coutyard
                    )
                } else if len <= 2.85 {
                    // 0603, 0705 & 0805
                    (
                        vec![0.4, 0.3, 0.2][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else if len <= 3.85 {
                    // 1206, 1210 & 0612
                    (
                        vec![0.45, 0.35, 0.25][i], // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else if len <= 4.75 {
                    // 1812 & 1825
                    (
                        vec![0.5, 0.4, 0.3][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                } else {
                    // 2010 & Greater
                    (
                        vec![0.6, 0.5, 0.4][i],    // Toe
                        vec![0.0, 0.0, 0.0][i],    // Heel
                        vec![0.05, 0.0, -0.05][i], // Side
                        vec![0.4, 0.2, 0.1][i],    // Coutyard
                    )
                }
            }
            _ => (
                vec![0.55, 0.35, 0.15][i], // Toe
                vec![0.45, 0.35, 0.25][i], // Heel
                vec![0.05, 0.03, 0.01][i], // Side
                vec![0.5, 0.25, 0.12][i],  // Coutyard
            ),
        };
        self.toe = toe;
        self.heel = heel;
        self.side = side;
        self.courtyard = courtyard;
        self
    }
fn density_level ( mut self , density_level : & str ) -> Self { let i = match density_level { " " | " " | " " => 0 , " " | " " | " " => 2 , _ => 1 , // "N", "nominal" } ; let ( toe , heel , side , courtyard ) = match self . package_type { PackageType :: Chip => { let len = self . lead_span . nom ( ) ; //(self.lead_span.0 + self.lead_span.1) / 2.0; if len <= 0.5 { // 01005 & Less ( vec ! [ 0.06 0.05 0.04 ] [ i ] , // Toe vec ! [ 0.02 0.03 0.04 ] [ i ] , // Heel vec ! [ 0.02 0.03 0.04 ] [ i ] , // Side vec ! [ 0.2 0.15 0.1 ] [ i ] , // Coutyard ) } else if len <= 0.75 { // 0201 ( vec ! [ 0.12 0.1 0.08 ] [ i ] , // Toe vec ! [ 0.01 0.02 0.03 ] [ i ] , // Heel vec ! [ 0.01 0.02 0.03 ] [ i ] , // Side vec ! [ 0.2 0.15 0.1 ] [ i ] , // Coutyard ) } else if len <= 1.3 { // 0402, 0306 & 0502 ( vec ! [ 0.25 0.2 0.15 ] [ i ] , // Toe vec ! [ 0.0 0.01 0.02 ] [ i ] , // Heel vec ! [ 0.0 0.01 0.02 ] [ i ] , // Side vec ! [ 0.2 0.15 0.1 ] [ i ] , // Coutyard ) } else if len <= 2.85 { // 0603, 0705 & 0805 ( vec ! [ 0.4 0.3 0.2 ] [ i ] , // Toe vec ! [ 0.0 0.0 0.0 ] [ i ] , // Heel vec ! [ 0.05 0.0 0.05 ] [ i ] , // Side vec ! [ 0.4 0.2 0.1 ] [ i ] , // Coutyard ) } else if len <= 3.85 { // 1206, 1210 & 0612 ( vec ! [ 0.45 0.35 0.25 ] [ i ] , // Toe vec ! [ 0.0 0.0 0.0 ] [ i ] , // Heel vec ! [ 0.05 0.0 0.05 ] [ i ] , // Side vec ! [ 0.4 0.2 0.1 ] [ i ] , // Coutyard ) } else if len <= 4.75 { // 1812 & 1825 ( vec ! [ 0.5 0.4 0.3 ] [ i ] , // Toe vec ! [ 0.0 0.0 0.0 ] [ i ] , // Heel vec ! [ 0.05 0.0 0.05 ] [ i ] , // Side vec ! [ 0.4 0.2 0.1 ] [ i ] , // Coutyard ) } else { // 2010 & Greater ( vec ! [ 0.6 0.5 0.4 ] [ i ] , // Toe vec ! [ 0.0 0.0 0.0 ] [ i ] , // Heel vec ! [ 0.05 0.0 0.05 ] [ i ] , // Side vec ! [ 0.4 0.2 0.1 ] [ i ] , // Coutyard ) } } _ => ( vec ! [ 0.55 0.35 0.15 ] [ i ] , // Toe vec ! [ 0.45 0.35 0.25 ] [ i ] , // Heel vec ! [ 0.05 0.03 0.01 ] [ i ] , // Side vec ! [ 0.5 0.25 0.12 ] [ i ] , // Coutyard ) , } ; self . toe = toe ; self . heel = heel ; self . side = side ; self . courtyard = courtyard ; self }
Set goals according to the density level
Set goals according to the density level
mut self
density_level
&str
mut self
density_level
&str