Skip to content

Commit

Permalink
Model tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
uberFoo committed Feb 29, 2024
1 parent e5f171f commit f166b7a
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 225 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sarzak"
version = "2.13.16"
version = "2.13.17"
edition = "2021"
authors = ["Keith T. Star <[email protected]>"]
categories = ["compilers", "memory-management"]
Expand Down
2 changes: 1 addition & 1 deletion models/lu_dog.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions src/v2/lu_dog/types/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub struct Enumeration {
pub x_path: String,
/// R105: [`Enumeration`] 'may have a first' [`EnumGeneric`]
pub first_generic: Option<Uuid>,
/// R84: [`Enumeration`] 'may have an' [`ImplementationBlock`]
pub implementation: Option<Uuid>,
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-implementation"}}}
Expand All @@ -45,7 +43,6 @@ impl Enumeration {
name: String,
x_path: String,
first_generic: Option<&Rc<RefCell<EnumGeneric>>>,
implementation: Option<&Rc<RefCell<ImplementationBlock>>>,
store: &mut LuDogStore,
) -> Rc<RefCell<Enumeration>> {
let id = Uuid::new_v4();
Expand All @@ -54,8 +51,6 @@ impl Enumeration {
name,
x_path,
first_generic: first_generic.map(|enum_generic| enum_generic.borrow().id),
implementation: implementation
.map(|implementation_block| implementation_block.borrow().id),
}));
store.inter_enumeration(new.clone());
new
Expand All @@ -71,18 +66,6 @@ impl Enumeration {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-forward-cond-to-implementation"}}}
/// Navigate to [`ImplementationBlock`] across R84(1-*c)
pub fn r84_implementation_block<'a>(
&'a self,
store: &'a LuDogStore,
) -> Vec<Rc<RefCell<ImplementationBlock>>> {
match self.implementation {
Some(ref implementation) => {
vec![store.exhume_implementation_block(&implementation).unwrap()]
}
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-1_M-to-enum_field"}}}
/// Navigate to [`EnumField`] across R88(1-M)
Expand All @@ -102,6 +85,23 @@ impl Enumeration {
.collect()
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-one-bi-cond-to-implementation_block"}}}
/// Navigate to [`ImplementationBlock`] across R84(1c-1c)
pub fn r84c_implementation_block<'a>(
&'a self,
store: &'a LuDogStore,
) -> Vec<Rc<RefCell<ImplementationBlock>>> {
let implementation_block = store
.iter_implementation_block()
.find(|implementation_block| {
implementation_block.borrow().enumeration == Some(self.id)
});
match implementation_block {
Some(ref implementation_block) => vec![implementation_block.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-impl-nav-subtype-to-supertype-data_structure"}}}
// Navigate to [`DataStructure`] across R95(isa)
pub fn r95_data_structure<'a>(
Expand Down
27 changes: 15 additions & 12 deletions src/v2/lu_dog/types/implementation_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use crate::v2::lu_dog::store::ObjectStore as LuDogStore;
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ImplementationBlock {
pub id: Uuid,
/// R84: [`ImplementationBlock`] 'may exist for an' [`Enumeration`]
pub enumeration: Option<Uuid>,
/// R8: [`ImplementationBlock`] 'adds functions to a' [`WoogStruct`]
pub model_type: Option<Uuid>,
/// R83: [`ImplementationBlock`] 'may refer to an' [`ZObjectStore`]
Expand All @@ -36,13 +38,15 @@ impl ImplementationBlock {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-new"}}}
/// Inter a new 'Implementation Block' in the store, and return it's `id`.
pub fn new(
enumeration: Option<&Rc<RefCell<Enumeration>>>,
model_type: Option<&Rc<RefCell<WoogStruct>>>,
object_store: Option<&Rc<RefCell<ZObjectStore>>>,
store: &mut LuDogStore,
) -> Rc<RefCell<ImplementationBlock>> {
let id = Uuid::new_v4();
let new = Rc::new(RefCell::new(ImplementationBlock {
id,
enumeration: enumeration.map(|enumeration| enumeration.borrow().id),
model_type: model_type.map(|woog_struct| woog_struct.borrow().id),
object_store: object_store.map(|z_object_store| z_object_store.borrow().id),
}));
Expand All @@ -51,6 +55,15 @@ impl ImplementationBlock {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-to-model_type"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-cond-to-enumeration"}}}
/// Navigate to [`Enumeration`] across R84(1-*c)
pub fn r84_enumeration<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<Enumeration>>> {
match self.enumeration {
Some(ref enumeration) => vec![store.exhume_enumeration(&enumeration).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-cond-to-model_type"}}}
/// Navigate to [`WoogStruct`] across R8(1-*c)
pub fn r8_woog_struct<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<WoogStruct>>> {
Expand All @@ -68,18 +81,8 @@ impl ImplementationBlock {
) -> Vec<Rc<RefCell<ZObjectStore>>> {
match self.object_store {
Some(ref object_store) => vec![store.exhume_z_object_store(&object_store).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-backward-one-bi-cond-to-enumeration"}}}
/// Navigate to [`Enumeration`] across R84(1c-1c)
pub fn r84c_enumeration<'a>(&'a self, store: &'a LuDogStore) -> Vec<Rc<RefCell<Enumeration>>> {
let enumeration = store
.iter_enumeration()
.find(|enumeration| enumeration.borrow().implementation == Some(self.id));
match enumeration {
Some(ref enumeration) => vec![enumeration.clone()],
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-backward-one-bi-cond-to-enumeration"}}}
None => Vec::new(),
}
}
Expand Down
35 changes: 17 additions & 18 deletions src/v2/lu_dog_ndrwlock_vec/types/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub struct Enumeration {
pub x_path: String,
/// R105: [`Enumeration`] 'may have a first' [`EnumGeneric`]
pub first_generic: Option<usize>,
/// R84: [`Enumeration`] 'may have an' [`ImplementationBlock`]
pub implementation: Option<usize>,
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-implementation"}}}
Expand All @@ -45,7 +43,6 @@ impl Enumeration {
name: String,
x_path: String,
first_generic: Option<&Arc<RwLock<EnumGeneric>>>,
implementation: Option<&Arc<RwLock<ImplementationBlock>>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<Enumeration>> {
store.inter_enumeration(|id| {
Expand All @@ -54,8 +51,6 @@ impl Enumeration {
name: name.to_owned(),
x_path: x_path.to_owned(),
first_generic: first_generic.map(|enum_generic| enum_generic.read().unwrap().id),
implementation: implementation
.map(|implementation_block| implementation_block.read().unwrap().id),
}))
})
}
Expand All @@ -73,18 +68,6 @@ impl Enumeration {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-forward-cond-to-implementation"}}}
/// Navigate to [`ImplementationBlock`] across R84(1-*c)
pub fn r84_implementation_block<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<ImplementationBlock>>> {
match self.implementation {
Some(ref implementation) => {
vec![store.exhume_implementation_block(&implementation).unwrap()]
}
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-one-to-enum_field"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-1_M-to-enum_field"}}}
Expand All @@ -111,6 +94,23 @@ impl Enumeration {
.collect()
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-one-bi-cond-to-implementation_block"}}}
/// Navigate to [`ImplementationBlock`] across R84(1c-1c)
pub fn r84c_implementation_block<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<ImplementationBlock>>> {
let implementation_block = store
.iter_implementation_block()
.find(|implementation_block| {
implementation_block.read().unwrap().enumeration == Some(self.id)
});
match implementation_block {
Some(ref implementation_block) => vec![implementation_block.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-impl-nav-subtype-to-supertype-data_structure"}}}
// Navigate to [`DataStructure`] across R95(isa)
pub fn r95_data_structure<'a>(
Expand Down Expand Up @@ -170,7 +170,6 @@ impl PartialEq for Enumeration {
self.name == other.name
&& self.x_path == other.x_path
&& self.first_generic == other.first_generic
&& self.implementation == other.implementation
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
33 changes: 19 additions & 14 deletions src/v2/lu_dog_ndrwlock_vec/types/implementation_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use crate::v2::lu_dog_ndrwlock_vec::store::ObjectStore as LuDogNdrwlockVecStore;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ImplementationBlock {
pub id: usize,
/// R84: [`ImplementationBlock`] 'may exist for an' [`Enumeration`]
pub enumeration: Option<usize>,
/// R8: [`ImplementationBlock`] 'adds functions to a' [`WoogStruct`]
pub model_type: Option<usize>,
/// R83: [`ImplementationBlock`] 'may refer to an' [`ZObjectStore`]
Expand All @@ -36,20 +38,34 @@ impl ImplementationBlock {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-new"}}}
/// Inter a new 'Implementation Block' in the store, and return it's `id`.
pub fn new(
enumeration: Option<&Arc<RwLock<Enumeration>>>,
model_type: Option<&Arc<RwLock<WoogStruct>>>,
object_store: Option<&Arc<RwLock<ZObjectStore>>>,
store: &mut LuDogNdrwlockVecStore,
) -> Arc<RwLock<ImplementationBlock>> {
store.inter_implementation_block(|id| {
Arc::new(RwLock::new(ImplementationBlock {
id,
enumeration: enumeration.map(|enumeration| enumeration.read().unwrap().id),
model_type: model_type.map(|woog_struct| woog_struct.read().unwrap().id),
object_store: object_store.map(|z_object_store| z_object_store.read().unwrap().id),
}))
})
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-to-model_type"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-cond-to-enumeration"}}}
/// Navigate to [`Enumeration`] across R84(1-*c)
pub fn r84_enumeration<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<Enumeration>>> {
match self.enumeration {
Some(ref enumeration) => vec![store.exhume_enumeration(&enumeration).unwrap()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-forward-cond-to-model_type"}}}
/// Navigate to [`WoogStruct`] across R8(1-*c)
pub fn r8_woog_struct<'a>(
Expand All @@ -75,19 +91,6 @@ impl ImplementationBlock {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-backward-one-bi-cond-to-enumeration"}}}
/// Navigate to [`Enumeration`] across R84(1c-1c)
pub fn r84c_enumeration<'a>(
&'a self,
store: &'a LuDogNdrwlockVecStore,
) -> Vec<Arc<RwLock<Enumeration>>> {
let enumeration = store
.iter_enumeration()
.find(|enumeration| enumeration.read().unwrap().implementation == Some(self.id));
match enumeration {
Some(ref enumeration) => vec![enumeration.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-struct-impl-nav-backward-1_Mc-to-function"}}}
/// Navigate to [`Function`] across R9(1-Mc)
Expand Down Expand Up @@ -123,7 +126,9 @@ impl ImplementationBlock {
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"implementation_block-implementation"}}}
impl PartialEq for ImplementationBlock {
fn eq(&self, other: &Self) -> bool {
self.model_type == other.model_type && self.object_store == other.object_store
self.enumeration == other.enumeration
&& self.model_type == other.model_type
&& self.object_store == other.object_store
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
33 changes: 15 additions & 18 deletions src/v2/lu_dog_pl_vec/types/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub struct Enumeration {
pub x_path: String,
/// R105: [`Enumeration`] 'may have a first' [`EnumGeneric`]
pub first_generic: Option<usize>,
/// R84: [`Enumeration`] 'may have an' [`ImplementationBlock`]
pub implementation: Option<usize>,
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-implementation"}}}
Expand All @@ -45,7 +43,6 @@ impl Enumeration {
name: String,
x_path: String,
first_generic: Option<&Arc<RwLock<EnumGeneric>>>,
implementation: Option<&Arc<RwLock<ImplementationBlock>>>,
store: &mut LuDogPlVecStore,
) -> Arc<RwLock<Enumeration>> {
store.inter_enumeration(|id| {
Expand All @@ -54,8 +51,6 @@ impl Enumeration {
name: name.to_owned(),
x_path: x_path.to_owned(),
first_generic: first_generic.map(|enum_generic| enum_generic.read().id),
implementation: implementation
.map(|implementation_block| implementation_block.read().id),
}))
})
}
Expand All @@ -73,18 +68,6 @@ impl Enumeration {
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-forward-cond-to-implementation"}}}
/// Navigate to [`ImplementationBlock`] across R84(1-*c)
pub fn r84_implementation_block<'a>(
&'a self,
store: &'a LuDogPlVecStore,
) -> Vec<Arc<RwLock<ImplementationBlock>>> {
match self.implementation {
Some(ref implementation) => {
vec![store.exhume_implementation_block(&implementation).unwrap()]
}
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-1_M-to-enum_field"}}}
/// Navigate to [`EnumField`] across R88(1-M)
Expand All @@ -107,6 +90,21 @@ impl Enumeration {
.collect()
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-struct-impl-nav-backward-one-bi-cond-to-implementation_block"}}}
/// Navigate to [`ImplementationBlock`] across R84(1c-1c)
pub fn r84c_implementation_block<'a>(
&'a self,
store: &'a LuDogPlVecStore,
) -> Vec<Arc<RwLock<ImplementationBlock>>> {
let implementation_block = store
.iter_implementation_block()
.find(|implementation_block| implementation_block.read().enumeration == Some(self.id));
match implementation_block {
Some(ref implementation_block) => vec![implementation_block.clone()],
None => Vec::new(),
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
// {"magic":"","directive":{"Start":{"directive":"ignore-orig","tag":"enumeration-impl-nav-subtype-to-supertype-data_structure"}}}
// Navigate to [`DataStructure`] across R95(isa)
pub fn r95_data_structure<'a>(
Expand Down Expand Up @@ -163,7 +161,6 @@ impl PartialEq for Enumeration {
self.name == other.name
&& self.x_path == other.x_path
&& self.first_generic == other.first_generic
&& self.implementation == other.implementation
}
}
// {"magic":"","directive":{"End":{"directive":"ignore-orig"}}}
Expand Down
Loading

0 comments on commit f166b7a

Please sign in to comment.