Skip to content

Commit

Permalink
Merge pull request #130 from Phuire-Research/UI
Browse files Browse the repository at this point in the history
selectUnifiedState() may now possibly return undefined, principles no…
  • Loading branch information
REllEK-IO committed Oct 29, 2023
2 parents 6b719b1 + 33eb773 commit 26b566b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
11 changes: 9 additions & 2 deletions DataOrientedFunctionalInheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ As everything is just data. And data is merely the most important qualities that

# Accessing your Unified State and Functionality
```typescript
export function selectUnifiedState<T>(concepts: Concepts, semaphore: number): T {
return concepts[semaphore].state as T;
export function selectUnifiedState<T>(concepts: Concepts, semaphore: number): T | undefined {
const exists = Object.keys(concepts).includes(`${semaphore}`);
if (exists) {
return concepts[semaphore].state as T;
} else {
return undefined;
}
}
```
This directly relays to the functionality within your "Methods" and "Principles." As by default your Reducer is already based its state upon each successive call. What is orienting the state of your concepts is the same universal concept of spacial location that actions use to call their qualities within Stratimux. This "selectUnifiedState," merely accesses the concept as it is loaded into the Axium. And is handled automatically within the provided helper method functions. Thus the only true place where this would need to be implemented by the developer is the principles themselves, which also are supplied the current location by semaphore in that creation function.

Therefore this allows for each of your concepts to have their own counter functionality, but this likewise limits the implementation of Unified Concepts. That these concepts are only functional via their principles due to the guarantee of a supplied concept semaphore. As such, when creating actions or strategies for a "Unified Concept." Be sure to supply this value to the necessary action creator or action node.

The benefit of this approach. Is that we can determine responsible concepts that only function only via its internal specification, including being responsible for its spatial location within any loaded Axium. Allows for these responsible concepts to be "Unified" without worry of interacting with "Concepts" that may use some functionality it others would depend upon. Therefore the "Axium" can be seen in current terms as a "Composition of Applications" that have a shared interface that is the "Axium" itself.

If the select function returns undefined. It means that the "Unified Concept," has been removed from the Axium. Therefore this denotes when a "Principle" should then disengage any active functionality contained. This further allows for Principles to be fully composable "Applications." And in the scope of "Observers," prevents the possibility of a hot observable with no subscribers.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@phuire/stratimux",
"version": "0.0.55",
"version": "0.0.57",
"description": "Unified Turing Machine",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
3 changes: 2 additions & 1 deletion src/model/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ function unify(base: Concept, target: Concept): Concept {
return base;
}
/**
* Will document the usage of such after UI concept release.
* This will unify concepts while prioritizing qualities later in the provided concepts list via recomposition.
* Then finally unify the emergent concept with final priority.
*/
export function unifyConcepts(
concepts: Concept[],
Expand Down
12 changes: 6 additions & 6 deletions src/model/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const createMethodWithState =
const defaultSubject = new Subject<Action>();
const defaultMethod: Method = defaultSubject.pipe(
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
map(([act, state] : [Action, T]) => {
const methodAction = methodWithState(act, state);
if (methodAction.strategy) {
Expand Down Expand Up @@ -83,7 +83,7 @@ export const createAsyncMethodWithState =
const defaultSubject = new Subject<Action>();
const defaultMethod: Method = defaultSubject.pipe(
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
switchMap(([act, state] : [Action, T]) => createActionController$(act, (controller: ActionController, action: Action) => {
asyncMethodWithState(controller, action, state);
})),
Expand Down Expand Up @@ -121,7 +121,7 @@ export const createMethodDebounceWithState =
const defaultMethod: Method = defaultSubject.pipe(
debounceAction(duration),
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
map(([act, state] : [Action, T]) => {
// Logically Determined axiumConclude
if (act.semaphore[3] !== 3) {
Expand Down Expand Up @@ -161,7 +161,7 @@ export const createAsyncMethodDebounceWithState =
const defaultMethod: Method = defaultSubject.pipe(
debounceAction(duration),
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
switchMap(([act, state] : [Action, T]) => {
return createActionController$(act, (controller: ActionController, action: Action) => {
asyncMethodWithState(controller, action, state);
Expand Down Expand Up @@ -201,7 +201,7 @@ export const createMethodThrottleWithState =
const defaultMethod: Method = defaultSubject.pipe(
throttleAction(duration),
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
map(([act, state] : [Action, T]) => {
// Logically Determined axiumConclude
if (act.semaphore[3] !== 3) {
Expand Down Expand Up @@ -241,7 +241,7 @@ export const createAsyncMethodThrottleWithState =
const defaultMethod: Method = defaultSubject.pipe(
throttleAction(duration),
withLatestFrom(concepts$ as UnifiedSubject),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore)])),
map(([act, concepts] : [Action, Concepts]): [Action, T] => ([act, selectUnifiedState<T>(concepts, semaphore) as T])),
switchMap(([act, state] : [Action, T]) => {
return createActionController$(act, (controller: ActionController, action: Action) => {
asyncMethodWithState(controller, action, state);
Expand Down
13 changes: 10 additions & 3 deletions src/model/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ export function selectConcept(concepts: Concepts, name: string): Concept {
* @within_principles Simply pass the supplied semaphore passed to your PrincipleFunction to gain access to that State.
* @outside_selection Use selectState targeting that Unified Concept Name
*/
export function selectUnifiedState<T>(concepts: Concepts, semaphore: number): T {
return concepts[semaphore].state as T;
}

// Either returns the current concept's unified state, or informs that the concept has been removed and the principles needs shutdown
export function selectUnifiedState<T>(concepts: Concepts, semaphore: number): T | undefined {
const exists = Object.keys(concepts).includes(`${semaphore}`);
if (exists) {
return concepts[semaphore].state as T;
} else {
return undefined;
}
}

0 comments on commit 26b566b

Please sign in to comment.