Skip to content

Instantly share code, notes, and snippets.

View theAlgorithmist's full-sized avatar

Jim Armstrong theAlgorithmist

View GitHub Profile
import { BasicMathType } from "./basic-math-type";
// Fraction Type
export interface FractionType extends BasicMathType
{
// is this a mixed number?
get mixed(): boolean
// designate this as a mixed number
set mixed(pIsMixed: boolean);
export type ExtendedMathType =
BasicMathType |
number |
string;
import { MathTypeEnum } from "./math-type-enum";
export interface BasicMathType
{
// what is the current math type?
public evaluate(variables: Array<expressionOperand>): expressionValue
{
if (this._expressionStack.length === 0) return false;
if (variables.length != this._variables.length) return false;
const len: number = variables.length;
let j: number;
for (j = 0; j < len; ++j) {
if (!this.__isValidOperand(variables[j])) return false;
/**
* The current state of a machine with a given name
*/
export interface FSMState
{
name: string;
isAcceptance: boolean;
transition: string;
public setPreviewImage(imgURL: string): void
{
if (this._canvas !== undefined)
{
const img: HTMLImageElement = new Image();
this._url = imgURL;
img.crossOrigin = 'anonymous';
// TODO This only works for a single image load. As an exercise, modify to handle deletion (including handlers)
import { Injectable } from '@angular/core';
import { fabric } from 'fabric';
import { POINT } from '../libs/point';
@Injectable({providedIn: 'root'})
export class FabricService
{
// draw properties are public to keep the demo more compact; but, you break it ... you buy it
import {
MapLegendClasses,
MapLegendData,
LegendMainHeading
} from './map-legends';
export const legendClasses: MapLegendClasses =
{
legendTitleClass: "title-text",
export type IconProps = LegendCircleData | LegendRectData | LegendPolygonData;
export interface MapLegendClasses
{
legendTitleClass: string;
legendContainerClass: Array<string>;
legendHeadingClass: string;
/**
* Manage quaternion data
*
* @author Jim Armstrong
*
* @version 1.0
*/
export class Q
{
public id = '';
import {
createReducer,
on,
createSelector,
createFeatureSelector
} from '@ngrx/store';
import * as CalculatorActions from './calculator.actions';
import { QCalc } from '../../shared/definitions/QCalc';