parent
55b2c4ec56
commit
703292a799
|
@ -1,5 +1,3 @@
|
||||||
use std::ops::Deref;
|
|
||||||
use bitvec::prelude::{AsBits};
|
|
||||||
use crate::model::processing_input::processing_input;
|
use crate::model::processing_input::processing_input;
|
||||||
use crate::model::check_correct_input::check_correct_input;
|
use crate::model::check_correct_input::check_correct_input;
|
||||||
use crate::model::from_string_to_vec_bits::from_string_to_vec_bits;
|
use crate::model::from_string_to_vec_bits::from_string_to_vec_bits;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// ошибочная позиция 7 false false false
|
// ошибочная позиция 7 false false false
|
||||||
|
|
||||||
pub mod hamming_code{
|
pub mod hamming_code{
|
||||||
use std::borrow::Borrow;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub fn hamming_encrypt_data(data: &Vec<u8>, result_string: &mut String, length_of_code: usize) -> () {
|
pub fn hamming_encrypt_data(data: &Vec<u8>, result_string: &mut String, length_of_code: usize) -> () {
|
||||||
|
@ -68,7 +67,7 @@ pub mod hamming_code{
|
||||||
|
|
||||||
let error_position = syndromes
|
let error_position = syndromes
|
||||||
.iter()
|
.iter()
|
||||||
.find(move |&(&error_position, &error)| error == checked_bits).
|
.find(move |&(&index, &error)| error == checked_bits).
|
||||||
unwrap().0;
|
unwrap().0;
|
||||||
|
|
||||||
let correctly_code : Vec<u8> = data_bits
|
let correctly_code : Vec<u8> = data_bits
|
||||||
|
|
|
@ -15,6 +15,11 @@ fn clearing(output : &TextView, input: &TextView){
|
||||||
|
|
||||||
pub fn laboratory_work_first_section(wrapper: &Box) -> (){
|
pub fn laboratory_work_first_section(wrapper: &Box) -> (){
|
||||||
|
|
||||||
|
let header = Label::builder()
|
||||||
|
.halign(Align::Start)
|
||||||
|
.label("Лабораторная работа №8: Код Хэмминга")
|
||||||
|
.build();
|
||||||
|
|
||||||
// input
|
// input
|
||||||
|
|
||||||
let hamming_text_view_input_label = Label::builder()
|
let hamming_text_view_input_label = Label::builder()
|
||||||
|
@ -120,6 +125,7 @@ pub fn laboratory_work_first_section(wrapper: &Box) -> (){
|
||||||
interactive_components_wrapper.append(&crypt_mode_wrapper);
|
interactive_components_wrapper.append(&crypt_mode_wrapper);
|
||||||
interactive_components_wrapper.append(&hamming_crypt_button);
|
interactive_components_wrapper.append(&hamming_crypt_button);
|
||||||
|
|
||||||
|
wrapper.append(&header);
|
||||||
wrapper.append(&hamming_text_view_input_label);
|
wrapper.append(&hamming_text_view_input_label);
|
||||||
wrapper.append(&hamming_text_view_input_frame);
|
wrapper.append(&hamming_text_view_input_frame);
|
||||||
wrapper.append(&interactive_components_wrapper);
|
wrapper.append(&interactive_components_wrapper);
|
||||||
|
|
Loading…
Reference in New Issue