Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/catlog-wasm/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use tsify_next::Tsify;
use wasm_bindgen::prelude::*;

use catlog::dbl::model::{self as dbl_model, FgDblModel, InvalidDiscreteDblModel};
use catlog::dbl::model::{self as dbl_model, FgDblModel, InvalidDblModel};
use catlog::one::fin_category::UstrFinCategory;
use catlog::one::{Category as _, FgCategory, Path};
use catlog::validate::Validate;
Expand Down Expand Up @@ -198,15 +198,15 @@ impl DblModel {
#[wasm_bindgen]
pub fn objects(&self) -> Vec<Ob> {
all_the_same!(match &self.0 {
DblModelBox::[Discrete](model) => model.object_generators().map(|x| x.into()).collect()
DblModelBox::[Discrete](model) => model.objects().map(|x| x.into()).collect()
})
}

/// Returns array of all basic morphisms in the model.
#[wasm_bindgen]
pub fn morphisms(&self) -> Vec<Mor> {
all_the_same!(match &self.0 {
DblModelBox::[Discrete](model) => model.morphism_generators().map(Mor::Basic).collect()
DblModelBox::[Discrete](model) => model.morphisms().map(|f| f.into()).collect()
})
}

Expand All @@ -216,7 +216,7 @@ impl DblModel {
all_the_same!(match &self.0 {
DblModelBox::[Discrete](model) => {
let ob_type = ob_type.try_into()?;
Ok(model.object_generators_with_type(&ob_type).map(Ob::Basic).collect())
Ok(model.objects_with_type(&ob_type).map(|ob| ob.into()).collect())
}
})
}
Expand All @@ -227,7 +227,7 @@ impl DblModel {
all_the_same!(match &self.0 {
DblModelBox::[Discrete](model) => {
let mor_type = mor_type.try_into()?;
Ok(model.morphism_generators_with_type(&mor_type).map(Mor::Basic).collect())
Ok(model.morphisms_with_type(&mor_type).map(|mor| mor.into()).collect())
}
})
}
Expand All @@ -247,7 +247,7 @@ impl DblModel {
/// Result of validating a model of a double theory.
#[derive(Serialize, Deserialize, Tsify)]
#[tsify(into_wasm_abi, from_wasm_abi)]
pub struct ModelValidationResult(pub JsResult<(), Vec<InvalidDiscreteDblModel<Uuid>>>);
pub struct ModelValidationResult(pub JsResult<(), Vec<InvalidDblModel<Uuid>>>);

#[cfg(test)]
pub(crate) mod tests {
Expand Down
16 changes: 8 additions & 8 deletions packages/catlog-wasm/src/model_diagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl DblModelDiagram {
all_the_same!(match &self.0 {
DblModelDiagramBox::[Discrete](diagram) => {
let (_, model) = diagram.into();
model.object_generators().map(|x| x.into()).collect()
model.objects().map(|x| x.into()).collect()
}
})
}
Expand All @@ -132,7 +132,7 @@ impl DblModelDiagram {
all_the_same!(match &self.0 {
DblModelDiagramBox::[Discrete](diagram) => {
let (_, model) = diagram.into();
model.morphism_generators().map(Mor::Basic).collect()
model.morphisms().map(|f| f.into()).collect()
}
})
}
Expand All @@ -144,7 +144,7 @@ impl DblModelDiagram {
DblModelDiagramBox::[Discrete](diagram) => {
let (_, model) = diagram.into();
let ob_type = ob_type.try_into()?;
Ok(model.object_generators_with_type(&ob_type).map(Ob::Basic).collect())
Ok(model.objects_with_type(&ob_type).map(|x| x.into()).collect())
}
})
}
Expand All @@ -156,7 +156,7 @@ impl DblModelDiagram {
DblModelDiagramBox::[Discrete](diagram) => {
let (_, model) = diagram.into();
let mor_type = mor_type.try_into()?;
Ok(model.morphism_generators_with_type(&mor_type).map(Mor::Basic).collect())
Ok(model.morphisms_with_type(&mor_type).map(|f| f.into()).collect())
}
})
}
Expand All @@ -167,10 +167,10 @@ impl DblModelDiagram {
all_the_same!(match &self.0 {
DblModelDiagramBox::[Discrete](diagram) => {
let (mapping, model) = diagram.into();
let decls = model.object_generators().map(|x| {
let decls = model.ob_generators().map(|x| {
DiagramObDecl {
id: x,
ob_type: model.ob_gen_type(&x).into(),
ob_type: model.ob_generator_type(&x).into(),
over: mapping.apply_ob(&x).map(|ob| ob.into())
}
});
Expand All @@ -185,10 +185,10 @@ impl DblModelDiagram {
all_the_same!(match &self.0 {
DblModelDiagramBox::[Discrete](diagram) => {
let (mapping, model) = diagram.into();
let decls = model.morphism_generators().map(|f| {
let decls = model.mor_generators().map(|f| {
DiagramMorDecl {
id: f,
mor_type: model.mor_gen_type(&f).into(),
mor_type: model.mor_generator_type(&f).into(),
over: mapping.apply_basic_mor(&f).map(|mor| mor.into()),
dom: model.get_dom(&f).cloned().map(|ob| ob.into()),
cod: model.get_cod(&f).cloned().map(|ob| ob.into()),
Expand Down
2 changes: 1 addition & 1 deletion packages/catlog-wasm/src/model_morphism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
.collect();

// Order motifs from small to large.
images.sort_by_key(|im| (im.object_generators().count(), im.morphism_generators().count()));
images.sort_by_key(|im| (im.ob_generators().count(), im.mor_generators().count()));

// Remove duplicates: different morphisms can have the same image.
retain_unique(&mut images);
Expand Down
Loading
Loading