text:
#ifndef __GUI_H
#define __GUI_H

#ifdef _MSC_VER
#    define _CRT_SECURE_NO_DEPRECATE
#    define _SCL_SECURE_NO_DEPRECATE
#endif

#include "stdafx.h"
#include "resource.h"

/*
Enums
*/
enum STATE {
	SELECT, ADD_JOINT, ADD_MEMBER, ADD_CURVED_MEMBER, ADD_RECT_AREA, ADD_QUAD_AREA, QUICK_DRAW_MEMBER, LINE_SELECT, RUBBER_ZOOM, PAN
};
enum VIEW {
	VIEW_XY, VIEW_XZ, VIEW_YZ, VIEW_3D
};
enum {
	NOARROW, SARROW, DARROW
};
const int NORMGRID[3] = {
	IUZ, IUY, IUX
};
enum {
	SURFACE, UNIAXIAL, BIAXIAL
};
enum {
	EXCEL, ACCESS
};
enum {
	MODELBLANK, MODELGRID, MODELBEAM, MODEL2DTRUSS, MODEL3DTRUSS, MODEL2DFRAME, MODEL3DFRAME, MODELSLAB, MODELWALL, MODELSHELL
};
enum {
	MAJOR, MINOR, AXIAL
};
/*
Numeric Edit
*/
class CNumericEdit : public CEdit {
public:
	CNumericEdit();
	CNumericEdit(LPCTSTR fmt);
	void SetWindowText(DOUBLE val, LPCTSTR fmt = NULL);
	void SetWindowText(LPCTSTR val);
protected:
	LPCTSTR deffmt;
};
/*
Gird control
*/
class GRIDCTRLDATA {
public:
	int type;
	int data_type;
	void* pdata;
	CList<CString,CString&> list;
	enum {NONE,EDIT,COMBO,COLOR};
	enum {TINT,TDBL,TDBL_F,TTEXT,TBOOL,TINDEX};
public:
	GRIDCTRLDATA() {
		type = NONE;
		pdata = NULL;
		data_type = TTEXT;
	}
	void operator = (const GRIDCTRLDATA& right) {
		type = right.type;
		data_type = right.data_type;
		pdata = right.pdata;
		if(type == COMBO) {
			CString v;
			list.RemoveAll();
			POSITION pos = right.list.GetHeadPosition();
			while(pos) {
				v = right.list.GetNext(pos);
				list.AddTail(v);
			}
		}
	}
};

class CGridCtrl : public CListCtrl {
public:
	int type;
	CWnd* pControl;
	int selItem;
	int selSubItem;
	int MyItemCount;
	enum {TYPE1,TYPE2,TYPE3};
public:
	CGridCtrl() {
		pControl = NULL;
		MyItemCount = 0;
	}
	CGridCtrl(int tp) {
		type = tp;
		pControl = NULL;
		MyItemCount = 0;
	}
	~CGridCtrl();
	void GetData();
	void PreSubclassWindow();
	void SetTwoHeaders();
	void InsertMyItem(int type,int data_type,void* pdata,CString,CString* = 0);
	int InsertItem(const LVITEM* pItem);
	int InsertItem(const LVITEM* pItem,GRIDCTRLDATA*);
	afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg BOOL OnClick(LPNMHDR pnmhdr, LRESULT* /*pResult*/);
    DECLARE_MESSAGE_MAP();
};
/*
Interaction chart
*/
class CChartDia;

class CChart : public CStatic {
public:
	CChartDia* parent;
public:
	afx_msg void OnMouseMove(UINT,CPoint);
	DECLARE_MESSAGE_MAP();
};

class CChartDia:public CDialog {
public:
	CPoint  Center;
	CPoint  Corner;
	DOUBLE  Scale;
	RPoint  eye;
	int type;
	UINT isection;
	UINT WDIV;
	UINT QDIV;
	DESIGN* design;
	RPOINTLIST** allrplist;
	RPOINTLIST* rplist;
public:
	void Fill(DESIGN*);
	void DrawGrid(CDC*,int);
	void DrawChart(BOOL = FALSE);
	void DrawOrigin(CDC*);
	void DrawArrow(CDC* pDC,RPoint& rp1,RPoint& rp2);
	CPoint RPtoCP(RPoint);
	RPoint CPtoRP(CPoint);
public:
	CChart c_Drawing;
	CEdit c_Index;
	CEdit c_Current;
public:
	CChartDia(CWnd* parent,DESIGN*);
	~CChartDia();
	afx_msg void OnPlot(UINT nID);
	afx_msg void OnPaint();
	void OnCoordinate(CPoint&);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Template Define Database class
*/
template <class T>
class CDefineDia : public CDialog {
public:
	T* pT;
    CList<T,T&>* list;
	CListBox c_List;
	CButton c_Delete;
	CButton c_Modify;
	CButton c_Import;
	CButton c_Export;
	CString title;
	BOOL import;
	void* other;
	void* other1;
	BOOL modify;
public:
	CDefineDia(CWnd* parent,CList<T,T&>*,CString,void* = NULL,void* = NULL,BOOL = FALSE);
	void Clear();
protected:
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnOK();
	afx_msg void OnCancel();
	afx_msg void OnAdd();
	afx_msg void OnDelete();
	afx_msg void OnModify();
	afx_msg void OnImport();
	afx_msg void OnExport();
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP();
};
/*
Template Select Database class
*/
template <class T>
class CSelectDia : public CDialog {
public:
	CList<CString,CString&> selected_list;
    CList<T,T&>* list;
	CListBox c_List;
	CString title;
public:
	CSelectDia(CWnd* parent,CList<T,T&>*,CString);
protected:
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnOK();
};
/*
Group property Dialog
*/
class CGroupPropertyDia:public CDialog {
public:
    GROUP* group;
	CEdit c_Name;
	CListBox c_JList;
	CListBox c_MList;
	CListBox c_SList;
public:
	CGroupPropertyDia(CWnd* parent,GROUP*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Curved member
*/
class CCurvedMemberDia : public CDialog {
public:
	int nDiv;
	int type;
	BOOL single;
	RPoint rp;
	CComboBox c_Type;
	enum {STRAIGHT,CIRCULAR,PARABOLIC};
public:
	CCurvedMemberDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
};
/*
New model Dialog
*/
class CNewDia : public CDialog {
public:
	int type;
public:
	CNewDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Frame Dialog
*/
class CmyDocument;
class CmyView;

class CNewFrameDia : public CDialog {
public:
	int type;
	int frame_type;
	int N[3];
	DOUBLE D[3];
	DOUBLE gap;
	CEdit c_Cover;
	CStatic c_GapText;
	CEdit c_Gap;
	BOOL restraint;
	CComboBox c_FrameType;
	enum {PORTAL,BRACED_CONCENTRIC,BRACED_ECCENTRIC};
	enum {OPEN_FRAME,PERIMETER_FRAME,BEAM_SLAB,FLAT_PLATE};
public:
	CNewFrameDia(CWnd* parent,int);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP();
};
/*
Slab Dialog
*/
class CNewSlabDia : public CDialog {
public:
	int N[2];
	DOUBLE D[2];
	DOUBLE M[2];
	BOOL restraint;
public:
	CNewSlabDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	DECLARE_MESSAGE_MAP();
};
/*
Wall Dialog
*/
class CNewWallDia : public CDialog {
public:
	int N[2];
	DOUBLE D[2];
	BOOL restraint;
public:
	CNewWallDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	DECLARE_MESSAGE_MAP();
};
/*
Shell Dialog
*/
class CNewShellDia : public CDialog {
public:
	CComboBox c_Type;
	int type;
	int N[2];
	DOUBLE D[2];
	BOOL restraint;
	enum {CYLINDER};
public:
	CNewShellDia(CWnd* parent);
	afx_msg void OnUpdateControls();
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	DECLARE_MESSAGE_MAP();
};
/*
Beam Dialog
*/
class CNewBeamDia : public CDialog {
public:
	int nspan;
	DOUBLE spanlength;
	BOOL restraint;
public:
	CNewBeamDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void OnOK();
};
/*
2D truss Dialog
*/
class CNewTruss2DDia : public CDialog {
public:
	/*for pratt truss*/
	DOUBLE L1;
	DOUBLE L2;
	int N1;
	int N2;
	DOUBLE H1;
	DOUBLE H2;
	DOUBLE H3;
	/*other*/
	int ndiv;
	DOUBLE divlength;
	DOUBLE height;
	/*other*/
	enum {SLOPED,VERTICAL,PRATT};
	BOOL restraint;
	int type;
	CComboBox c_Type;
	CEdit c_Cover1;
	CEdit c_Cover2;
public:
	CNewTruss2DDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnType();
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP();
};
/*
3D truss
*/
class TOWER {
public:
    DOUBLE d[4];
public:
	TOWER() {
		for(int i = 0;i < 4;i++)
			d[i] = 0;
	}
	friend int operator == (const TOWER& left,const TOWER& right) {
		return (left.d[0] == right.d[0]);
	}
};

#define TOWERLIST     CList<TOWER,TOWER&>
#define PTOWERLIST    CList<TOWER,TOWER&>*

class CNewTruss3DDia : public CDialog {
public:
	/*for roof truss*/
	int Nx;
	int Ny;
	int Ndx;
	int Ndy;
	DOUBLE Sx;
	DOUBLE Sy;
	DOUBLE H;
	/*tower*/
	TOWERLIST tower;
	/*other*/
	BOOL restraint;
	int type;
	int tower_shape;
	CComboBox c_Type;
	CComboBox c_Tower;
	CEdit c_Cover1;
	CEdit c_Cover2;
	enum {ROOF,TELE_TOWER};
	enum {RECTANGULAR, TRIANGULAR};
	CListBox c_List[4];
	CEdit c_Value[4];
public:
	CNewTruss3DDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnType();
	afx_msg void OnUpdateControls();
	afx_msg void OnAdd();
	afx_msg void OnMove();
	afx_msg void OnDelete();
	afx_msg void OnDeleteAll();
	afx_msg void OnUpdateLocTh();
	afx_msg void OnUpdateLocTw();
	afx_msg void OnUpdateLocTah();
	afx_msg void OnUpdateLocTaw();
	afx_msg void OnUpdateLoc(UINT);
	afx_msg void OnTower();
	DECLARE_MESSAGE_MAP();
};
/*
Grid Dialog
*/
class CSystemPage:public CPropertyPage {
public:
	SYSTEM* system;
	BOOL cartesian;
	DOUBLE grids[3];
	int ngrid[3];
public:
	CSystemPage(UINT,SYSTEM*);
protected:
	virtual void OnOK();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
property sheet
*/
class CNewSystemSht : public CPropertySheet {
public:
    CSystemPage cartesian;
    CSystemPage radial;
public:
    CNewSystemSht(CWnd*, SYSTEM*);
};
/*
System Origin Dialog
*/
class CSystemOriginDia:public CDialog {
public:
    SYSTEM* system;
	RPoint origin;
	RPoint rotation;
public:
	CSystemOriginDia(CWnd* parent,SYSTEM*);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void OnOK();
};
/*
Edit Grid Dialog
*/
class CSystemPropertyDia:public CDialog {
public:
	SYSTEM system;
	SYSTEM* psystem;
	CListBox c_List;
	CEdit c_Location;
	CEdit c_Name;
	CButton c_Z;
	CButton c_Y;
	CButton c_X;
	CButton c_Origin;
	int selected;
public:
	CSystemPropertyDia(CWnd* parent,SYSTEM*);
	afx_msg void OnUpdateLoc();
	afx_msg void OnUpdateControls();
	afx_msg void OnAddGrid();
	afx_msg void OnMoveGrid();
	afx_msg void OnDeleteGrid();
	afx_msg void OnDeleteAll();
	afx_msg void OnNew();
	afx_msg void OnOrigin();
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Function Property Dialog
*/
class CFunctionDrawing : public CStatic {
public:
	CListBox c_Lx;
    CListBox c_Ly;
	CEdit c_Ex;
	CEdit c_Ey;
	CButton c_Add;
	CButton c_Move;
	CButton c_Delete;
	CButton c_DeleteAll;
	CEdit c_FunctionValue;
	FUNCTION* function;
	DOUBLE ScaleX;
	DOUBLE section;
	int type;
	enum {VIEWONLY,EDITABLE};
public:
	CFunctionDrawing(int type);
	void Plot(BOOL);
	void Init();
	void AcceptMessage(UINT nID);
	afx_msg void OnUpdateLoc(UINT nID);
	afx_msg void OnUpdateControls();
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT,CPoint);
	afx_msg void OnAdd();
	afx_msg void OnMove();
	afx_msg void OnDelete();
	afx_msg void OnDeleteAll();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};

class CFunctionPropertyDia:public CDialog {
public:
	FUNCTION function;
	FUNCTION* pfunc;
	CEdit c_Name;
	CFunctionDrawing c_Drawing;
	CComboBox c_Type;
	CEdit c_Amplitude;
    CEdit c_Period;
	CEdit c_Cycles;
	CEdit c_Divisions;
	CEdit c_Ag;
	CEdit c_Cover1;
	CEdit c_Cover2;
	CButton c_Browse;
	CEdit c_File;
	CComboBox c_Soil;
public:
	CFunctionPropertyDia(CWnd* parent,FUNCTION*);
	void RelayMessage(UINT nID);
	afx_msg void OnUpdateControls();
	afx_msg void OnType();
	afx_msg void OnPaint();
	afx_msg void OnBrowse();
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Function Plot Dialog
*/
class CFunctionPlotDia:public CDialog {
public:
	FUNCTION* function;
	CFunctionDrawing c_Drawing;
	CEdit c_FuncValue;
public:
	CFunctionPlotDia(CWnd* parent,FUNCTION*);
	afx_msg void OnPaint();
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Result Plot dialog
*/
class CResultPlotDia:public CDialog {
public:
	FUNCTION function;
	CComboBox c_Dir;
	CComboBox c_Type;
	CListBox c_JointL;
	CEdit c_Section;
	CEdit c_Cover1;
	enum {JOINT_DISPLACEMENT,JOINT_FORCE,MEMBER_FORCE};
public:
	CResultPlotDia(CWnd* parent);
protected:
	void OnDisplay();
	afx_msg void OnUpdateControls();
	afx_msg void OnType();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Loadcase property Dialog
*/
class CLoadCasePropertyDia:public CDialog {
public:
    LOADCASE* loadcase;
	CComboBox c_List;
	CEdit c_Name;
public:
	CLoadCasePropertyDia(CWnd* parent,LOADCASE*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Modalcase property Dialog
*/
class CModalCasePropertyDia:public CDialog {
public:
    MODALCASE* modalcase;
	CEdit c_Name;
public:
	CModalCasePropertyDia(CWnd* parent,MODALCASE*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Damping Dialog
*/
class CDampingDia:public CDialog {
public:
	CComboBox c_Type;
	CEdit c_Cover1;
	CEdit c_Cover2;
	DAMPING damping;
	CEdit c_W2;
	CEdit c_Constant;
	CFunctionDrawing c_Drawing;
	CEdit c_FuncValue;
public:
	CDampingDia(CWnd* parent,DAMPING*);
	void RelayMessage(UINT nID);
protected:
	afx_msg void OnUpdateControls();
	afx_msg void OnType();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Response Property Dialog
*/
class CResponsePropertyDia:public CDialog {
public:
    RESPONSE* response;
	DAMPING damping;
	PMODALCASELIST modalcases;
	PFUNCTIONLIST functions;
	CEdit c_Name;
	CComboBox c_ModalList;
	CComboBox c_Func;
	CComboBox c_Dir;
	CEdit c_Scale;
	CListBox c_DirList;
	CListBox c_FuncList;
	CListBox c_ScaleList;
	UINT rID;
public:
	CResponsePropertyDia(UINT mID,CWnd* parent,RESPONSE*,PMODALCASELIST,PFUNCTIONLIST);
protected:
	afx_msg void OnDamping();
	afx_msg void OnAdd();
	afx_msg void OnMove();
	afx_msg void OnDelete();
	afx_msg void OnDeleteAll();
	void OnUpdateLoc(UINT nID);
	afx_msg void OnUpdateLocDir();
    afx_msg void OnUpdateLocFunc();
	afx_msg void OnUpdateLocScale();
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Loadcombo property Dialog
*/
class CLoadComboPropertyDia:public CDialog {
public:
    COMB_TYPE* combo;
	PANALYSISCASELIST loadcase[CASETYPES];
	CComboBox c_CaseList;
	CComboBox c_Type;
	CListBox c_List;
	CEdit c_Name;
	CEdit c_FS;
	int type;
	enum {TCOMBO,TNL,TBUCKLING};
public:
	CLoadComboPropertyDia(CWnd* parent,UINT,COMB_TYPE*,PANALYSISCASELIST*,int);
	afx_msg void OnAdd();
	afx_msg void OnMove();
	afx_msg void OnDelete();
	afx_msg void OnDeleteAll();
	afx_msg void OnUpdateLoc();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};

class CCombinationPropertyDia : public CLoadComboPropertyDia {
public:
    CCombinationPropertyDia(CWnd* parent,COMB_TYPE*,PANALYSISCASELIST*);
};
class CNLcasePropertyDia : public CLoadComboPropertyDia {
public:
	NLCASE* pnl_case;
public:
    CNLcasePropertyDia(CWnd* parent,NLCASE*,PANALYSISCASELIST*);
	virtual void DoDataExchange(CDataExchange* pDX);
};
class CBucklingPropertyDia : public CLoadComboPropertyDia {
public:
	BUCKLINGCASE* pbkl_case;
public:
    CBucklingPropertyDia(CWnd* parent,BUCKLINGCASE*,PANALYSISCASELIST*);
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Rigid body property Dialog
*/
class CConstraintPropertyDia:public CDialog {
public:
	int dof[6];
    CONSTRAINT constraint;
	CONSTRAINT* pconst;
	CListBox c_List;
    CComboBox c_Type;
	CComboBox c_System;
	CEdit c_Cover;
	CButton c_Check[6];
	CButton c_Radio[4];
    PSYSTEMLIST systems;
public:
	CConstraintPropertyDia(CWnd* parent,CONSTRAINT*,PSYSTEMLIST);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnUpdateControls();
	afx_msg void OnType();
	DECLARE_MESSAGE_MAP();
};
/*
Joint Restraint Dialog
*/
class CJointRestraintDia:public CDialog {
public:
	BOOL res[6];
	BOOL con[6];
public:
	CJointRestraintDia(CWnd* parent,JOINT* pjoint);
	afx_msg void OnFastRestraint(UINT nID);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Joint Load Dialog
*/
class CJointLoadDia:public CDialog {
public:
	LOADCASE* ploadcase;
	SYSTEM* system;
	PLOADCASELIST loadcases;
	PSYSTEMLIST systems;
	JOINT* joint;
	int type;
	DOUBLE Q[6];
	int mode;
	CComboBox c_List;
	CComboBox c_System;
	CEdit c_Cover;
public:
	CJointLoadDia(CWnd* parent,PLOADCASELIST,PSYSTEMLIST,JOINT* pjoint,int,LOADCASE*);
protected:
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void OnOK();
};
/*
Joint Local Axis Dialog
*/
class CJointAxisDia:public CDialog {
public:
	JOINT* joint;
	RPoint rotation;
public:
	CJointAxisDia(CWnd* parent,JOINT* pjoint);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual void OnOK();
};
/*
Joint Load Dialog
*/
class CJointReactionsDia:public CDialog {
public:
	int type;
	JOINT* joint;
	CGridCtrl c_List;
public:
	CJointReactionsDia(CWnd* parent,JOINT* pjoint,int);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
};
/*
Member Local Axis Dialog
*/
class CAxisRotationDia : public CDialog {
public:
	DOUBLE alpha;
	CString title;
public:
	CAxisRotationDia(CWnd* parent,DOUBLE,CString);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
};
/*
Member Load Dialog
*/
enum {
	GRAVITYD = 3
};
class CMemberLoadDia:public CDialog {
public:
	LOADCASE* ploadcase;
	PLOADCASELIST loadcases;
	SYSTEM* system;
	PSYSTEMLIST systems;
	DOUBLE d[4];
	DOUBLE Q[4];
	DOUBLE Qu;
	int mode;
	int dir;
	int loadtype;
	CComboBox c_List;
	CComboBox c_LoadDir;
	CComboBox c_System;
	CEdit c_Cover;
	BOOL use_relative;
	enum {TFORCE,TMOMENT};
	BOOL distributed;
public:
	CMemberLoadDia(CWnd* parent,PLOADCASELIST,PSYSTEMLIST,BOOL,LOADCASE*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP();
};
/*
Slab Distributed Load Dialog
*/
class CSlabDistLoadDia:public CDialog {
public:
	LOADCASE* ploadcase;
	PLOADCASELIST loadcases;
	SYSTEM* system;
	PSYSTEMLIST systems;
	DOUBLE Qu;
	int mode;
	int dir;
	int loadtype;
	CComboBox c_List;
	CComboBox c_System;
	CComboBox c_LoadDir;
	enum {TFORCE,TMOMENT};
public:
	CSlabDistLoadDia(CWnd* parent,PLOADCASELIST,PSYSTEMLIST,LOADCASE*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP();
};
/*
Strain loading
*/
class CStrainLoadDia:public CDialog {
public:
	LOADCASE* ploadcase;
	PLOADCASELIST loadcase;
	DOUBLE Value;
	int type;
	int dir;
	int mode;
	int stype;
	CComboBox c_List;
	CComboBox c_Type;
	enum {TEMP_STRAIN,FAB_STRAIN};
	enum {TMEMBER,TSLAB};
public:
	CStrainLoadDia(CWnd* parent,PLOADCASELIST,LOADCASE*,UINT);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Reinforcement Dialog
*/
class CRebarDia:public CDialog {
public:
    REBAR* rebar;
public:
	CButton c_Rectangular;
	CButton c_Circular;
	CButton c_Coulmn;
	CEdit c_Ny;
	CEdit c_Nz;
	CEdit c_Total;
	CEdit c_BarSize;
	CEdit c_SBarSize;
	CRebarDia(CWnd* parent,REBAR*);
protected:
	afx_msg void OnUpdateControls();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Material Property Dialog
*/
class CMaterialPropertyDia:public CDialog {
public:
    MATERIAL* material;
	CComboBox c_List;
	CEdit c_Elasticity;
	CEdit c_Poisson;
	CEdit c_Thermal;
	CEdit c_Fctk;
	CEdit c_Fck;
	CEdit c_Fyks;
	CEdit c_Fyk;
	CEdit c_Ftks;
	CEdit c_Ftk;
	CEdit c_Es;
	CEdit c_Name;
public:
	CMaterialPropertyDia(CWnd* parent,MATERIAL*);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP()
};
/*
Section Stiffness Modifiers dialog
*/
class CSectionModifiersDia : public CDialog {
public:
	SECTION* section;
	CGridCtrl c_Table;
public:
	CSectionModifiersDia(CWnd* parent,SECTION*);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Section Property Dialog
*/
class CSectionPropertyDia:public CDialog {
public:
	PMATERIALLIST materials;
    SECTION* section;
	DETAILING* detailing;
	CComboBox c_List;
	CComboBox c_TypeList;
	CStatic c_Drawing;
	CButton c_Rebar;
	CButton c_Chart;
	CEdit c_Name;
	CEdit c_Radius;
	CEdit c_Width;
	CEdit c_Height;
	CEdit c_Tw;
	CEdit c_Th;
	CEdit c_Bd;
	CNumericEdit c_A;
	CNumericEdit c_Ay;
	CNumericEdit c_Az;
    CNumericEdit c_Zy;
	CNumericEdit c_Zz;
	CNumericEdit c_Sy;
	CNumericEdit c_Sz;
	CNumericEdit c_ry;
	CNumericEdit c_rz;
	CNumericEdit c_Ix;
	CNumericEdit c_Iy;
	CNumericEdit c_Iz;
public:
	CSectionPropertyDia(CWnd* parent,SECTION*,PMATERIALLIST);
protected:
	afx_msg void OnEditMaterial();
    afx_msg void OnEditRebar();
	afx_msg void OnSetModifiers();
	afx_msg void OnChart();
	afx_msg void OnPaint();
	afx_msg void OnUpdateControls();
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP()
};
/*
Section Property Dialog
*/
class CASectionPropertyDia:public CDialog {
public:
	PMATERIALLIST materials;
    ASECTION* section;
	CComboBox c_List;
	CComboBox c_TypeList;
	CComboBox c_StateTypeList;
	CButton c_Rebar;
	CEdit c_Name;
	CEdit c_Height;
public:
	CASectionPropertyDia(CWnd* parent,ASECTION*,PMATERIALLIST);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnEditMaterial();
    afx_msg void OnEditRebar();
	afx_msg void OnUpdateControls();
	DECLARE_MESSAGE_MAP()
};
/*
Joint Information Dialog
*/
class CJointInfoDia:public CDialog {
public:
	JOINT* joint;
	PLOADCASELIST loadcase;
	CListBox c_FList;
	CGridCtrl c_Jpoint;
public:
	CJointInfoDia(CWnd* parent,JOINT* pjoint,PLOADCASELIST);
protected:
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnEditRestraint();
	afx_msg void OnEditAxis();
	virtual void OnOK();
	DECLARE_MESSAGE_MAP();
};
/*
Member Information Dialog
*/
class CMemberInfoDia:public CDialog {
public:
	MEMBER* member;
	PSECTIONLIST sections;
	PMATERIALLIST materials;
	PLOADCASELIST loadcases;
	CListBox c_FList;
public:
	CMemberInfoDia(CWnd* parent,MEMBER* pmember,
		PSECTIONLIST psection,
		PMATERIALLIST pmaterial,
		PLOADCASELIST ploadcase);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnEditSection();
    afx_msg void OnEditRelease();
	afx_msg void OnEditJoint(UINT nID);
	afx_msg void OnEditAxis();
	afx_msg void OnEditDivisions();
	DECLARE_MESSAGE_MAP();
};
/*
Member break dialog
*/
class CMemberBreakDia:public CDialog {
public:
	UINT breakn;
	DOUBLE breakr;
public:
	CMemberBreakDia(CWnd* parent);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Member Tapered Section
*/
class CTaperedSectionDia:public CDialog {
public:
	MEMBER* member;
	SECTION* s_sec;
	SECTION* e_sec;
	int EIyy;
	int EIzz;
	DOUBLE soff;
	DOUBLE eoff;
	PSECTIONLIST sections;
	PMATERIALLIST materials;
	CComboBox c_Start;
    CComboBox c_End;
	CComboBox c_EIyy;
	CComboBox c_EIzz;
public:
	CTaperedSectionDia(CWnd* parent,PSECTIONLIST,PMATERIALLIST,MEMBER* = 0);
protected:
	virtual void OnOK();
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	afx_msg void OnEditSection(UINT nID);
	DECLARE_MESSAGE_MAP();
};

/*
Slab Information Dialog
*/
class CSlabInfoDia:public CDialog {
public:
	SLAB* slab;
	PASECTIONLIST section;
	PMATERIALLIST material;
	PLOADCASELIST loadcase;
	CComboBox c_List;
	CListBox c_FList;
public:
	CSlabInfoDia(CWnd* parent,SLAB* pslab,
		PASECTIONLIST psection,
		PMATERIALLIST pmaterial,
		PLOADCASELIST ploadcase);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnEditSection();
	afx_msg void OnEditAxis();
	afx_msg void OnEditDivisions();
	DECLARE_MESSAGE_MAP();
};
/*
Internal Member force diagrams
*/
class CForceDiagramDia:public CDialog {
public:
	int dir;
	int fill;
	int value;
public:
	CForceDiagramDia(CWnd* parent);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Slab Force diagrams
*/
class CSlabForceDiagramDia:public CDialog {
public:
	int dir;
	int average;
	CComboBox c_Type;
	CComboBox c_Stress;
public:
	CSlabForceDiagramDia(CWnd* parent);
protected:
	virtual void OnOK();
	virtual BOOL OnInitDialog();
    afx_msg void OnUpdateControls();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Member Releases Dialog
*/
class CMemberReleaseDia:public CDialog {
public:
	int r[12];
	CButton c_R[12];
public:
	CMemberReleaseDia(CWnd*,MEMBER*);
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnUpdateControls(UINT nID);
	DECLARE_MESSAGE_MAP();
};
/*
Member Divisons
*/
class CMemberDivisionsDia:public CDialog {
public:
	int nMinDiv;
	int nMinFrameDiv;
	BOOL DivAtInterim;
public:
	CMemberDivisionsDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Slab Divisons
*/
class CSlabDivisionsDia:public CDialog {
public:
	int nDivx;
	int nDivy;
	BOOL constraint;
public:
	CSlabDivisionsDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
};

/*
Select Tables Dialog
*/
class CmyTreeCtrl : public CTreeCtrl {
public:
	afx_msg void OnLButtonDown(UINT,CPoint);
	void SelectSiblings(HTREEITEM,BOOL);
    void SelectParents(HTREEITEM,BOOL);
	DECLARE_MESSAGE_MAP();
};
class CSelectTableDia:public CDialog {
public:
	PANALYSISCASELIST* analysis_cases;
	CListBox c_Cases;
	CmyTreeCtrl c_Table;
	HTREEITEM  m_rghItem[NTABLES];
	BOOL state[NTABLES];
//*/
	enum {
		     Model
			,MGeneral
			,GSettings
			,GCoordinate_systems
			,Property_definitions
			,DMaterial
			,DSection
			,Function_definitions
			,LR_history
			,LR_spectrum
			,Joint
			,JCoordinates
			,JRestraints
			,JLoads
			,JAddedMass
			,JLocal_axis
			,JConstraints
			,Member
			,MConnectivity
			,MSection
			,MLoads
			,MStrain_loads
			,MLocal_axis
			,MRelease
			,MDivisions
			,Slab
			,SConnectivity
			,SSection
			,SLoads
			,SLocal_axis
			,Analysis_cases
			,ADefinitions
			,ALoad_cases
			,ANonLinear_cases
            ,AModal_cases
			,ABuckling_cases
			,ARH_cases
			,ARS_cases
			,ACombinations
			,Analysis
			,AGeneral
			,GModes
			,GBucklingModes
			,AJoint
			,JReactions
			,JDisplacements
			,JMasses
			,AMember
			,MInternal_forces
			,ASlab
			,SMoments
			,Design
			,DResult
	};
	//*/
public:
	CSelectTableDia(CWnd* parent,PANALYSISCASELIST*);
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	ANALYSISCASE* find_case();
};
/*
Table view
*/
class CTableViewDia : public CDialog {
public:
	CGridCtrl c_Table;
    CComboBox c_List;
	CEdit c_Index;
	CEdit c_Max;
	CmyDatabase* pdatabase;
public:
    CTableViewDia(CWnd* parent,CmyDatabase*);
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	afx_msg void OnTableChange();
	afx_msg void OnSelectChange(LPNMHDR pnmhdr, LRESULT* /*pResult*/);
	DECLARE_MESSAGE_MAP();
};
/*
Analysis Dialog
*/
class CAnalysisDia:public CDialog {
public:
	PANALYSISCASELIST* analysis_cases;
	CListBox c_List;
	CStatic c_Action;
	CStatic c_Status;
	CComboBox c_Stiffness;
public:
	CAnalysisDia(CWnd*,PANALYSISCASELIST*);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnRun();
	afx_msg void OnUpdateLoc();
	afx_msg void OnChangeAction();
	afx_msg void OnUpdateStiffness();
	ANALYSISCASE* find_case();
	DECLARE_MESSAGE_MAP();
};
/*
Timer update dialog
*/
class CmyView;

class CTimerUpdateDia : public CDialog {
public:
	UINT_PTR myTimer;
	MEMBER* member;
	CmyView* pView;
	BOOL blink;
public:
	CTimerUpdateDia(CWnd*,UINT,MEMBER*,CmyView*);
	virtual BOOL OnInitDialog();
	afx_msg void OnTimer(UINT);
	DECLARE_MESSAGE_MAP();
};
/*
Analysis Update Dialog
*/
class CmyListBox : public CListBox {
public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
};

class CAnalysisProgressDia:public CDialog {
public:
	CmyListBox c_List;
	CEvent* pEvent;
	CTime beginTime;
	CStatic c_Begin;
	CStatic c_End;
	CStatic c_Elapsed;
	CButton c_Ok;
    CButton c_Cancel;
	UINT_PTR myTimer;
public:
	CAnalysisProgressDia(CWnd*,CEvent*);
	void AnalysisEnd();
	afx_msg void OnTimer(UINT);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	DECLARE_MESSAGE_MAP();
};
/*
Display mode
*/
class DISPLAY : public CObject{
	DECLARE_SERIAL(DISPLAY)
public:
	BOOL JointLabel;
	BOOL JointRestraint;
	BOOL JointShow;
	BOOL JointLoad;
	BOOL JointAxis;
	BOOL MemberLabel;
	BOOL MemberSection;
    BOOL MemberMaterial;
	BOOL MemberLoad;
	BOOL MemberAxis;
	BOOL MemberRelease;
	BOOL SlabLabel;
	BOOL SlabSection;
    BOOL SlabMaterial;
	BOOL SlabLoad;
	BOOL SlabAxis;
	BOOL Origin;
	BOOL Grid;
	BOOL FillDiagram;
	BOOL ShowValues;
	BOOL Constraints;
	BOOL Numbering;
	BOOL Extrude;
	DISPLAY() {
        JointLabel = FALSE;
        JointRestraint = TRUE;
		JointShow = FALSE;
		JointLoad = TRUE;
		JointAxis = FALSE;
		MemberLabel = FALSE;
		MemberSection = FALSE;
		MemberMaterial = FALSE;
		MemberLoad = TRUE;
		MemberAxis = FALSE;
		MemberRelease = TRUE;
		SlabLabel = FALSE;
		SlabSection = FALSE;
		SlabMaterial = FALSE;
		SlabLoad = TRUE;
		SlabAxis = FALSE;
		Origin = TRUE;
		Grid = TRUE;
		FillDiagram = TRUE;
		Constraints = TRUE;
		Numbering = FALSE;
		ShowValues = FALSE;
		Extrude = FALSE;
	}
	void operator = (const DISPLAY& right) {
		memcpy(this,&right,sizeof(right));
	}
	void Serialize(CSerializer& ar);
};
/*
Display Options Dialog
*/
class CDisplayOptionsDia:public CDialog {
public:
	DISPLAY mydisplay;
	BOOL ApplyToAll;
public:
	CDisplayOptionsDia(CWnd* parent,DISPLAY* pdisplay);
protected:
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Color Options Dialog
*/
class CColorsDia:public CDialog {
public:
	CGridCtrl c_List1;
    CGridCtrl c_List2;
    CGridCtrl c_List3;
public:
	CColorsDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
};
/*
Paste Dialog
*/
class CPasteDia:public CDialog {
public:
	RPoint v;
public:
	CPasteDia(CWnd* parent);
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Result Dialog
*/
class CResultDia:public CDialog {
public:
	UINT Total;
	int selected;
	CComboBox c_List;
	int type;
	enum {NORMAL,MINMAX};
public:
	CResultDia(CWnd* parent,UINT,UINT,int = NORMAL);
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
};
/*
Select Labels Dialog
*/
class CmyDocument;

class CSelectLabelsDia:public CDialog {
public:
	CComboBox c_Type;
	CListBox c_List;
	BOOL select;
	int minid;
	int maxid;
	int inc;
	CEdit c_Min;
	CEdit c_Max;
	CEdit c_Inc;
	enum {JOINTT,MEMBERT,SLABT};
public:
	CSelectLabelsDia(CWnd* parent,BOOL);
	afx_msg void OnType();
	afx_msg void OnSelect(UINT nID);
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Display Analysis Options Dialog
*/
class CAnalysisOptionsDia:public CDialog {
public:
	int deflection;
	int divisions;
	BOOL sdof[6];
	BOOL ddof[3];
	UBMP8* sdofs;
	UBMP8* ddofs;
	CEdit c_Div;
public:
	CAnalysisOptionsDia(CWnd* parent,UBMP8*,UBMP8*);
	afx_msg void OnFastDof(UINT nID);
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Display Design Options Dialog
*/
class CDesignOptionsDia:public CDialog {
public:
	DETAILING detail;
	DETAILING* pdetail;
	CListBox c_BarList;
	CListBox c_List[4];
	CComboBox c_Type;
    CComboBox c_Layers;
	CGridCtrl c_Options;
	enum {SHEART,BEAMT,COLUMNT,SLABT};
public:
	CDesignOptionsDia(CWnd* parent,DETAILING*);
	afx_msg void OnType();
	afx_msg void OnAdd();
    afx_msg void OnDelete();
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Misc Options Dialog
*/
class CmyDocument;

class CMiscOptionsDia:public CDialog {
public:
	BOOL AnalysisResult;
	int deflection;
	DOUBLE scale_deflection;
	DOUBLE scale_stress;
	DOUBLE scale_load;
public:
	CMiscOptionsDia(CWnd* parent);
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Stress Diagram Dialog
*/
class CStressDiagramDia;

class CStressControl : public CStatic {
public:
	CStressDiagramDia* parent;
public:
	void UpdateParent(CPoint&);
	afx_msg void OnLButtonDown(UINT,CPoint);
    afx_msg void OnMouseMove(UINT,CPoint);
	DECLARE_MESSAGE_MAP();
};
class CStressDiagramDia : public CTimerUpdateDia {
public:
	int dir;
	int scroll;
	MEMBER* member;
	CComboBox c_Dir;
    CComboBox c_Scroll;
	ANALYSISCASE* analysis_case;
	CStressControl c_Drawing[3];
	CStressControl c_Value[3];
	CEdit c_Section;
	DOUBLE xscale;
	DOUBLE yscale;
	int Width;
	int Height;
	DOUBLE section;
	int deflection_type;
	static const int OFFSET;
	enum {SCROLL,SHOWMAX,SHOWMIN};
	enum {DABSOLUTE,DRELATIVE};
public:
	void DrawDiagram(int,int,BOOL);
	void UpdateDrawing(BOOL = FALSE);
	void DrawRectangle(CDC*,DOUBLE,DOUBLE,DOUBLE,DOUBLE);
	CStressDiagramDia(CWnd* parent,MEMBER*,ANALYSISCASE*,CmyView*);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg void OnChangeDir();
	afx_msg void OnScroll();
	afx_msg void OnSection();
	afx_msg void OnDeflectionType(UINT nID);
	DECLARE_MESSAGE_MAP();
};
/*
Design Overwrites dialog
*/
class CDesignOverwritesDia : public CDialog {
public:
	MEMBER* member;
	CGridCtrl c_Table;
public:
	CDesignOverwritesDia(CWnd* parent,MEMBER*);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	DECLARE_MESSAGE_MAP();
};
/*
Design result dialog
*/
class CDesignResultDia : public CTimerUpdateDia {
public:
	MEMBER* member;
	ANALYSISCASE* analysis_case;
	CGridCtrl c_Table;
public:
	CDesignResultDia(CWnd* parent,MEMBER*,ANALYSISCASE*,CmyView*);
	virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
	afx_msg void OnDesignOverwrites();
	DECLARE_MESSAGE_MAP();
};
/*
Animation Dialog
*/
class CAnimationDia:public CDialog {
public:
	CEdit c_Time;
	BOOL sound;
	UINT interval;
	BOOL stop;
	BOOL finished;
	CmyView* pView;
	CButton c_Redo;
public:
	CAnimationDia(CWnd* parent,CmyView*);
	void Finish();
public:
	virtual void OnOK();
	afx_msg void OnRedo();
	afx_msg void OnSpeed(UINT nID);
	afx_msg void OnSound();
	virtual BOOL OnInitDialog();
	virtual void DoDataExchange(CDataExchange* pDX);
	DECLARE_MESSAGE_MAP();
};
/*
Document
*/
class UndoData {
public:
	BOOL adding;
	int type;
	CString name;
	JOINTLIST joints;
	enum {TJOINT,TMEMBER,TSLAB};
	enum {ADD, REMOVE};
public:
	UndoData() {
	}
	UndoData(UndoData& right) {
		*this = right;
	}
	void operator = (const UndoData& right) {
		adding = right.adding;
		type = right.type;
		name = right.name;
		JOINT v;
		joints.RemoveAll();
		POSITION pos = right.joints.GetHeadPosition();
		while(pos) {
			v = right.joints.GetNext(pos);
			joints.AddTail(v);
		}
	}
};

class CUndoRedo {
public:
	int current;
	int count;
	CList<UndoData,UndoData&> data;
public:
	CUndoRedo();
    void Do(CmyDocument*,int);
	void Save(JOINT*,BOOL = TRUE);
    void Save(MEMBER*,BOOL = TRUE);
	void Save(SLAB*,BOOL = TRUE);
	void Clear();
	void Add(UndoData&);
};

class CmyDocument : public CDocument {
	DECLARE_DYNCREATE(CmyDocument)
public:
	static CmyDocument* Current_Document;

	SYSTEM* global;
	SYSTEMLIST systems;
	/*objects*/
	JOINTLIST joints;
	MEMBERLIST members;
	SLABLIST slabs;
	PENTITYLIST entities[NENTITIES];
	/*removed objects*/
	MEMBERLIST removed_members;
	SLABLIST removed_slabs;
	/*meshed objects*/
	SLABPLIST_PLIST slab_elements;
	MEMBERPLIST_PLIST member_elements;
	/*others*/
	MATERIALLIST materials;
	SECTIONLIST sections;
	ASECTIONLIST asections;
	GROUPLIST groups;
	LOADCASELIST loadcases;
	MODALCASELIST modalcases;
	RESPONSECASELIST responsecases;
	RESPONSESPECLIST responsespecs;
	COMBOLIST combinations;
	NLCASELIST nlcases;
	BUCKLINGCASELIST bucklingcases;
	PANALYSISCASELIST all_analysis_cases[CASETYPES];
	CONSTRAINTLIST constraints;
	FUNCTIONLIST rhfunctions;
	FUNCTIONLIST rsfunctions;
	MEMBERLIST copyMembers;
	SLABLIST copySlabs;
	JOINTLIST copyJoints;
	BOOL cutStatus;
	UBMP8 static_dofs;
	UBMP8 dynamic_dofs;
	DETAILING detailing;
	CmyDatabase myTables;

	DOUBLE load_scale;
	DOUBLE force_scale[6];
	DOUBLE disp_scale;
	DOUBLE user_load_scale;
	DOUBLE user_force_scale;
	DOUBLE user_disp_scale;
	BOOL select_all;
	STATE state;
	UINT nClicks;
	RPoint selrp[20];
	BOOL Lock;
	BOOL AnalysisResult;
	BOOL DesignResult;
	BOOL DisplacementResult;
	CComboBox* LoadCaseListBox;
	ANALYSISCASE* c_AnalysisCase;
	static UINT nViews;
	CEvent threadStart;
	CAnalysisProgressDia* volatile pAnalysisProgressDia;
	BOOL Snap_To_Grid;
	BOOL Snap_To_Joint;
	BOOL Snap_To_MemberMid;
	BOOL Snap_To_Member;
    CUndoRedo UndoRedo;
public:
	CmyDocument();
	~CmyDocument();
	BOOL OnNewDocument();
	BOOL OnSaveDocument(LPCTSTR);
	void InitViews(LPCSTR);
	void DeleteContents();
	void Serialize(CArchive&);
	void Serialize(CSerializer&);
	void SerializeAnalysisResult(CSerializer&);
	void SerializeGeneral(CSerializer&);
	void DeleteSlab(SLAB*);
	SLAB* AddSlab(JOINT*,JOINT*,JOINT*,JOINT*);
	SLAB* AddSlab(JOINT**,UINT);
	SLAB* AddSlab(JOINT*,UINT);
    SLAB* AddSlab(SLAB*);
	void DeleteMember(MEMBER*);
	MEMBER* AddMember(JOINT*,JOINT*);
	void DeleteJoint(JOINT*);
	JOINT* AddJoint(JOINT*);
	ENTITY* FindEntity(CString&,int);
	void RefreshConstraints();
	void CombineLoad(COMB_TYPE*);
	void CombineModes(RESPONSESPEC*);
	void ApplyDeadLoad();
	void RemoveTemporaryLoads();
	void LumpMasses();
	void AllocMemory(int);
	void FreeMemory(int);
	void PrintOutput();
	void CalculateForces(VECTOR,VECTOR,UINT,int,BOOL = FALSE);
	void CalculateEffectiveLength(MEMBER*);
	void ShowFile(int);
	void ExportToAutocad(CString);
	void ImportFromAutocad(CString);
	void CheckCaseInCombo(int);
	void CheckCaseInResp();
	void FillCases();
	void FillAnalysisCases();
	void PrintProgress(CString,BOOL = FALSE);
	void PrintStylish(CString str,BOOL year = FALSE);
	void RunAnalysis();
	void AssignIndex(int);
	void DetermineScale();
	void DetermineHistoryScale();
	void FreeAnalysis();
	void FreeAnalysis(ENTITY*);
	BOOL Export(UINT nID,CmyDatabase* = 0);
	BOOL Import(UINT nID,CmyDatabase* = 0);
	void NumberJoint(JOINT*,UINT& N,UINT& SUN,UINT& DUN,UINT& RUN,INTEGER*);
	void NumberDofs(UINT& N,UINT& SUN,UINT& DUN,UINT& RUN,INTEGER*);
	void RestrainK(MATRAN K,UINT N,UINT NB,INTEGER* dof_flags,DOUBLE = 1,DOUBLE = SMALLNUMBER);
	void FormK(MATRAN K,UINT N,UINT NB,BOOL = FALSE);
	BOOL FactorK(MATRAN K,MATRAN FAC,UINT N,UINT NB,INTEGER* dof_flags,INTEGER* IPVT = NULL);
	void DetermineBandwidth(UINT N,UINT& NB);
	void GetExcitationLoad(RESPONSEHIST* responsecase,VECTOR P,VECTOR M,INTEGER* Dir,UINT N,UINT SJ,VECTOR E,DOUBLE step);
	void SolveStaticAnalysisCases(MATRAN K,MATRAN FAC,UINT N,UINT NB,INTEGER* dof_flags,INTEGER& index);
	void SolveStaticNonLinearAnalysisCases(UINT N,UINT NB,INTEGER* dof_flags,INTEGER& index);
	void SolveModalAnalysisCases(MATRAN K,MATRAN M,UINT N,UINT DUN,UINT NB,INTEGER* dof_flags,INTEGER& index);
	void SolveBucklingAnalysisCases(MATRAN K,UINT N,UINT DUN,UINT NB,INTEGER* dof_flags,INTEGER& index);
	void SolveTimeHistoryAnalysisCases(MATRAN K,MATRAN M,INTEGER* Dir,UINT N,UINT NB,INTEGER* dof_flags,INTEGER& index);
    void SolveResponseSpectrumAnalysisCases(MATRAN K,MATRAN M,MATRAN FAC,INTEGER* Dir,UINT N,UINT NB,INTEGER* dof_flags,INTEGER& index);
	void SolveCombination(INTEGER& index);
	void ConvertToEquivalentFrame();
	void UpdateDrawing();
	void RemoveDesignCombos();
	void AddDesignCombos();
	void RestoreObjects();
	void GetGridInfo(GRIDINFO*);

	afx_msg void OnRunAnalysis();
	afx_msg void OnAnalysisOptions();
	afx_msg void OnDesignOptions();
	afx_msg void OnDesignVerify();
	afx_msg void OnMiscOptions();
	afx_msg void OnDesign(UINT nID);
	afx_msg void OnJointLoad(UINT nID);
	afx_msg void OnJointAxis();
	afx_msg void OnJointRestraint();
    afx_msg void OnJointConstraint(UINT nID);
	afx_msg void OnMemberPointLoad();
    afx_msg void OnMemberDistLoad();
	afx_msg void OnMemberRelease();
	afx_msg void OnMemberAxis();
	afx_msg void OnMemberDivisions();
	afx_msg void OnSlabDistLoad();
	afx_msg void OnSlabAxis();
	afx_msg void OnSlabDivisions();
	afx_msg void OnDefineMaterial();
    afx_msg void OnDefineFrameSection();
    afx_msg void OnDefineSlabSection();
	afx_msg void OnDefineSystem();
    afx_msg void OnDefineLoadCase();
	afx_msg void OnDefineModalCase();
	afx_msg void OnDefineResponseHistory();
    afx_msg void OnDefineResponseSpectrum();
    afx_msg void OnDefineLoadCombo();
	afx_msg void OnDefineNonLinearCase();
    afx_msg void OnDefineBucklingCase();
	afx_msg void OnDefineConstraint();
	afx_msg void OnDefineTimeHistoryFunction();
	afx_msg void OnDefineSpectrumFunction();
	afx_msg void OnDefineGroup();
	afx_msg void OnSelectAllJoints();
    afx_msg void OnSelectAllMembers();
	afx_msg void OnSelectAllSlabs();
	afx_msg void OnSelectAll();
    afx_msg void OnDeselectAllJoints();
    afx_msg void OnDeselectAllMembers();
	afx_msg void OnDeselectAllSlabs();
	afx_msg void OnDeselectAll();
	afx_msg void OnSelectLabels(UINT nID);
	afx_msg void OnSelectSection(UINT nID);
	afx_msg void OnSelectSlabSection(UINT nID);
	afx_msg void OnSelectConstraint(UINT nID);
	afx_msg void OnSelectGroup(UINT nID);
	afx_msg void OnSelectFromAll();
	afx_msg void OnUpdateSelectFromAllUI(CCmdUI* pCmdUI);
    afx_msg void OnInvertSelection();
	afx_msg void OnAssignSection();
	afx_msg void OnAssignTaperedSection();
	afx_msg void OnAssignSlabSection();
	afx_msg void OnAssignGroup();
	afx_msg void OnJoinMembers();
    afx_msg void OnBreakMember();
	afx_msg void OnJoinSlabs();
    afx_msg void OnBreakSlab();
	afx_msg void OnUpdateDeselectUI(CCmdUI* pCmdUI);
	afx_msg void OnUpdateAssignJointUI(CCmdUI* pCmdUI);
	afx_msg void OnUpdateAssignMemberUI(CCmdUI* pCmdUI);
	afx_msg void OnUpdateAssignSlabUI(CCmdUI* pCmdUI);
	afx_msg void OnLock();
	afx_msg void OnUpdateLockUI(CCmdUI* pCmdUI);
	afx_msg void OnShowResult();
    afx_msg void OnUpdateAnalysisResultUI(CCmdUI* pCmdUI);
	afx_msg void OnShowDesignResult();
	afx_msg void OnUpdateDesignResultUI(CCmdUI* pCmdUI);
	afx_msg void OnUpdateDesignUI(CCmdUI* pCmdUI);
	afx_msg void OnMemberStrain();
	afx_msg void OnSlabStrain();
	afx_msg void OnStrain(UINT nID);
	afx_msg void OnSelectLoadCase();
	afx_msg void OnPaste();
	afx_msg void OnCopy(UINT nID);
	afx_msg void OnDelete();
	afx_msg void OnEnter();
	afx_msg void OnUpdateLockMenuUI(CCmdUI* pCmdUI);
	afx_msg void OnExport(UINT nID);
	afx_msg void OnImport(UINT nID);
	afx_msg void OnPrepareDrawing(UINT nID);
	afx_msg void OnPlotFunctions();
	afx_msg void OnUpdatePlotFunctionsUI(CCmdUI* pCmdUI);
	afx_msg void OnSnapTo(UINT nID);
	afx_msg void OnUpdateSnapToUI(CCmdUI* pCmdUI);
	afx_msg void OnShowTables();
	afx_msg void OnUndoRedo(UINT nID);
	afx_msg void OnUpdateUndoRedoUI(CCmdUI* pCmdUI);
	afx_msg void OnAddDesignCombos();
	afx_msg void OnReverseSlabAxis();
	afx_msg void OnColors();
	DECLARE_MESSAGE_MAP()
};
/*
View
*/

class CmyView : public CView {
	DECLARE_DYNCREATE(CmyView)
public:
	VIEW view;
	VIEW perspective_toggle;
	DOUBLE  pvalue;
	int position;
	CPoint  Center;
	CPoint  Corner;
	DOUBLE  Scale;
	RPoint  eye;
	RPoint  reye;
	RPoint  gcenter;
	static UINT nViews;

	VIEW oldview;
	DOUBLE oldpvalue;
	BOOL hasGridPoint;
	BOOL hadGridPoint;
	RPoint oldGridPoint;

	BOOL   has_tracker;
	BOOL   had_tracker;
	CPoint prev_mouse_cp;
	BOOL   has_plane;
	BOOL   had_plane;
	DOUBLE SELSIZE;
	DISPLAY mydisplay;
	int force_diagram;
	BOOL average_stress;
	BOOL DrawingHasChanged;

	static VIEW CREATION[4];

	CDC memDC;
	CBitmap memBmp;
	int memX;
	int memY;

	DOUBLE min_stress;
	DOUBLE max_stress;

	TOOLINFO m_ti;
	CToolTipCtrl m_toolTip;
	CAnimationDia* pAnimationDia;

	enum {SNAP_GRID = 1,SNAP_JOINT,SNAP_MEMBERMID,SNAP_MEMBER};
	enum {LINE_TRACK,RECT_TRACK,MEMBER_TRACK};

	static COLORREF BackColor;
	static COLORREF JointColor;
	static COLORREF MemberColor;
	static COLORREF SlabColor;
	static COLORREF HighlightColor;
	static COLORREF SelectionColor;
	static COLORREF RestraintColor;
	static COLORREF ConstraintColor;
	static COLORREF AxisColor;
	static COLORREF ReleaseColor;
	static COLORREF TextColor;
	static COLORREF GridColor;
	static COLORREF PositiveColor;
	static COLORREF NegativeColor;
	static COLORREF ContorColors[];
	static UINT NCONTORS;
public:
	CmyView();
	~CmyView();
	CmyDocument* GetDocument() {
		return (CmyDocument*) m_pDocument;
	}
	static void ResetColors();
	void Serialize(CSerializer&);
	static void SerializeColors(CSerializer&);
	BOOL InPlane(RPoint);
	RPoint RPtoRP(RPoint,SYSTEM*,BOOL = FALSE);
	CPoint RPtoCP(RPoint,SYSTEM* = 0,BOOL = FALSE);
	RPoint CPtoRP(CPoint);
	RPoint SnapToGrid(CPoint&,int&,JOINT** = NULL);
	RPoint SnapToGridLocal(SYSTEM*,CPoint&,BOOL&);
	void InitView();
	void OnDraw(CDC*);
	BOOL OnPreparePrinting(CPrintInfo* pInfo);
	void OnPrint(CDC* pDC,CPrintInfo* pInfo);
	void AdjustCenter();
	void AdjustScale();
	void AdjustPosition();
	void InitMinMaxStress();
	DOUBLE FindStress(SLAB* slab,RPoint);
	void GetEdgeStress(SLAB* slab,DOUBLE* V);
	void DrawCircle(CDC*,RPoint&,int,COLORREF);
	void DrawGridPoint(RPoint&,BOOL);
	void DrawJoint(JOINT&,BOOL = FALSE,CDC* pDC = NULL);
	void DrawMember(MEMBER&,CDC* pDC = NULL);
	void DrawColorTable(CDC* pDC);
	void DrawSlab(SLAB&,CDC* pDC = NULL);
	void DrawSlabMiniBlockStress(CDC*,DOUBLE*,RPoint*);
	void DrawSlabBlockStress(CDC*,SLAB&,RPoint*);
	void DrawSlabStress(CDC*,SLAB&,MATRIX);
	void DrawDeflectedShape(CDC*,MEMBER&);
	void DrawTracker(CPoint&,int);
	void DrawPlaneGrid(CDC*,SYSTEM*,DOUBLE*,int,int);
	void DrawGridOnView(CDC*,SYSTEM*,int,DOUBLE);
	void DrawGrids(CDC*);
	void DrawView(CDC*);
	void DrawPlane(CmyView*);
	void DrawOrigin(CDC*);
	void DrawAxis(CDC*,RPoint&,MATRIX,DOUBLE);
    void DrawRestraint(CDC*,JOINT*,MATRIX);
	void DrawArrow(CDC*,RPoint&,RPoint&,int = NOARROW);
	void DrawText(CDC*,CString,CPoint*,CPoint* = NULL);
	void DrawRectangle(CDC*,RPoint&,RPoint&,RPoint&,RPoint&);
	void DrawTriangle(CDC*,RPoint&,RPoint&,RPoint&);
	void UpdatePlanes(BOOL);
	BOOL IsNear(RPoint,RPoint,RPoint);
	JOINT* FindJoint(RPoint,BOOL OriginalPos = FALSE);
	MEMBER* FindMember(RPoint,RPoint* = 0,DOUBLE* = 0);
	SLAB* FindSlab(RPoint);
	BOOL SelectJoint(RPoint);
	BOOL SelectMember(RPoint);
    BOOL SelectSlab(RPoint);
	void Animate();
	RPoint GetJointPoint(JOINT* joint,CmyDocument* pDoc);
	void SetTitle();
	void CalculateReye();
public:
	BOOL PreCreateWindow(CREATESTRUCT&);
	afx_msg  int OnCreate(LPCREATESTRUCT);
	afx_msg void OnSize(UINT nType,int cx,int cy);
	afx_msg void OnLButtonDown(UINT,CPoint);
	afx_msg void OnRButtonDown(UINT,CPoint);
	afx_msg void OnLButtonUp(UINT,CPoint);
	afx_msg void OnMouseMove(UINT,CPoint);
	afx_msg BOOL OnMouseWheel(UINT,short,CPoint);
	afx_msg LRESULT OnMouseLeave(WPARAM wPawam, LPARAM lParam);
    afx_msg void OnChangeView(UINT nID);
	afx_msg void OnCoordinate(CCmdUI *pCmdUI);
	afx_msg BOOL OnSetCursor(CWnd* pWnd,UINT nHitTest,UINT message);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnKillFocus(CWnd* pOldWnd);
	afx_msg void OnEscape();
	afx_msg void OnAdd(UINT nID);
	afx_msg void OnUpdateAddUI(CCmdUI* pCmdUI);
	afx_msg void OnMoveView(UINT nID);
	afx_msg void OnUpdateMoveViewUI(CCmdUI* pCmdUI);
	afx_msg void OnZoomIn();
    afx_msg void OnZoomOut();
	afx_msg void OnRestoreView();
    afx_msg void OnRubberZoom();
    afx_msg void OnPan();
	afx_msg void OnDisplayOptions();
	afx_msg void OnDiagrams();
	afx_msg void OnSlabDiagrams();
	afx_msg void OnUpdateDiagramsUI(CCmdUI* pCmdUI);
	afx_msg void OnDeflected();
	afx_msg void OnReactions();
	afx_msg void OnDisplacement();
	afx_msg void OnRotate(UINT nID);
	afx_msg void OnUpdateRotateUI(CCmdUI* pCmdUI);
	afx_msg void OnShowLoads();
    afx_msg void OnShowGrids();
	afx_msg void OnShowOrigin();
	afx_msg void OnRefresh();
	afx_msg void OnAnimate();
    afx_msg void OnUpdateAnimateUI(CCmdUI* pCmdUI);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPerspective();
	DECLARE_MESSAGE_MAP()
};
/*
Child Frame
*/
class CChildFrame:public CMDIChildWnd  {
	DECLARE_DYNCREATE(CChildFrame)
public:
	CChildFrame() {};
	~CChildFrame() {};
	afx_msg void OnClose();
	BOOL PreCreateWindow(CREATESTRUCT&);
	DECLARE_MESSAGE_MAP()
};
/*
Custom tool bar
*/
class CCommonToolBar : public CToolBar {
};

class CMyToolBar : public CCommonToolBar {
public:
	CComboBox c_List;
public:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    DECLARE_MESSAGE_MAP()
};
/*
Main Frame
*/
class CMainFrame : public CMDIFrameWnd {
	DECLARE_DYNCREATE(CMainFrame)
public:
	CStatusBar myStatusBar;
	CMyToolBar myToolBar;
	CCommonToolBar myAnalysisToolBar;
	CCommonToolBar myDesignToolBar;
	CCommonToolBar myDrawToolBar;
	CCommonToolBar mySelectToolBar;
	CCommonToolBar myViewToolBar;
	CCommonToolBar mySnapToolBar;
	CCommonToolBar myEditToolBar;
	CCommonToolBar myAssignToolBar;
public:
	CMainFrame() {};
	~CMainFrame() {};
	CToolBar* GetTool(UINT nID);
	afx_msg void OnToolbar(UINT nID);
    afx_msg void OnUpdateToolbarUI(CCmdUI* pCmdUI);
	afx_msg void ResetToolBars();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnUpdateLoadcaseUI(CCmdUI* pCmdUI);
	afx_msg void OnSize(UINT nType,int cx,int cy);
	void DockControlBarBottomOf(CToolBar* Bar,CToolBar* LeftOf);
	DECLARE_MESSAGE_MAP()
};
/*
Application
*/
class CmyApplication : public CWinApp {
public:
	BOOL skip_model;
	char app_path[256];
public:
	CmyApplication() {
		skip_model = FALSE;
	};
	virtual BOOL InitInstance();

	void CreateMyView();
	void DestroyMyView();
	void OpenViews(UINT count);
	afx_msg void OnAppAbout();
	afx_msg void OnFileNew();
	afx_msg void OnFileOpen();
	afx_msg void OnWindows(UINT nID);
	afx_msg void OnImport(UINT nID);
protected:
	DECLARE_MESSAGE_MAP()
};
/*
Get Document
*/
__inline CmyDocument* GetMyDocument() {
	return CmyDocument::Current_Document;
}
#endif


text:
 <its:rules version="2.0" xmlns:its="http://www.w3.org/2005/11/its" xmlns:h="http://www.w3.org/1999/xhtml">
  <its:param name="targetFolder">targetfolder</its:param>
  <its:param name="targetFile">targetfile</its:param>
  <its:targetPointerRule selector="//h:div[@id='one']/h:p[@class='srcfolder']"  targetPointer="../h:p[@class=$targetFolder]"/>
  <its:targetPointerRule selector="//h:div[@id='two']/h:p[@class='srcfile']"  targetPointer="../h:p[@class=$targetFile]"/>
 </its:rules>

redpajama_set_name: RedPajamaGithub


text:
'use strict';

module.exports = {
    templateUrl: 'components/header/header.html',
    controller: ['$scope', '$location', function($scope, $location) {
        $scope.isActiveUrl = function(templateUrl) {
            return templateUrl === $location.path();
        };
    }]
};


text:
"""This platform allows several binary sensor to be grouped into one binary sensor."""
from __future__ import annotations

import voluptuous as vol

from homeassistant.components.binary_sensor import (
    DEVICE_CLASSES_SCHEMA,
    DOMAIN as BINARY_SENSOR_DOMAIN,
    PLATFORM_SCHEMA,
    BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
    ATTR_ENTITY_ID,
    CONF_DEVICE_CLASS,
    CONF_ENTITIES,
    CONF_NAME,
    CONF_UNIQUE_ID,
    STATE_ON,
    STATE_UNAVAILABLE,
    STATE_UNKNOWN,
)
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, entity_registry as er
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from . import GroupEntity

DEFAULT_NAME = "Binary Sensor Group"

CONF_ALL = "all"
REG_KEY = f"{BINARY_SENSOR_DOMAIN}_registry"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Required(CONF_ENTITIES): cv.entities_domain(BINARY_SENSOR_DOMAIN),
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
        vol.Optional(CONF_UNIQUE_ID): cv.string,
        vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA,
        vol.Optional(CONF_ALL): cv.boolean,
    }
)

async def async_setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    async_add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the Binary Sensor Group platform."""
    async_add_entities(
        [
            BinarySensorGroup(
                config.get(CONF_UNIQUE_ID),
                config[CONF_NAME],
                config.get(CONF_DEVICE_CLASS),
                config[CONF_ENTITIES],
                config.get(CONF_ALL),
            )
        ]
    )

async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Initialize Binary Sensor Group config entry."""
    registry = er.async_get(hass)
    entities = er.async_validate_entity_ids(
        registry, config_entry.options[CONF_ENTITIES]
    )
    mode = config_entry.options[CONF_ALL]

    async_add_entities(
        [
            BinarySensorGroup(
                config_entry.entry_id, config_entry.title, None, entities, mode
            )
        ]
    )

class BinarySensorGroup(GroupEntity, BinarySensorEntity):
    """Representation of a BinarySensorGroup."""

    def __init__(
        self,
        unique_id: str | None,
        name: str,
        device_class: str | None,
        entity_ids: list[str],
        mode: str | None,
    ) -> None:
        """Initialize a BinarySensorGroup entity."""
        super().__init__()
        self._entity_ids = entity_ids
        self._attr_name = name
        self._attr_extra_state_attributes = {ATTR_ENTITY_ID: entity_ids}
        self._attr_unique_id = unique_id
        self._device_class = device_class
        self.mode = any
        if mode:
            self.mode = all

    async def async_added_to_hass(self) -> None:
        """Register callbacks."""

        @callback
        def async_state_changed_listener(event: Event) -> None:
            """Handle child updates."""
            self.async_set_context(event.context)
            self.async_defer_or_update_ha_state()

        self.async_on_remove(
            async_track_state_change_event(
                self.hass, self._entity_ids, async_state_changed_listener
            )
        )

        await super().async_added_to_hass()

    @callback
    def async_update_group_state(self) -> None:
        """Query all members and determine the binary sensor group state."""
        all_states = [self.hass.states.get(x) for x in self._entity_ids]

        # filtered_states are members currently in the state machine
        filtered_states: list[str] = [x.state for x in all_states if x is not None]

        # Set group as unavailable if all members are unavailable
        self._attr_available = any(
            state != STATE_UNAVAILABLE for state in filtered_states
        )

        valid_state = self.mode(
            state not in (STATE_UNKNOWN, STATE_UNAVAILABLE) for state in filtered_states
        )
        if not valid_state:
            # Set as unknown if any / all member is not unknown or unavailable
            self._attr_is_on = None
        else:
            # Set as ON if any / all member is ON
            states = list(map(lambda x: x == STATE_ON, filtered_states))
            state = self.mode(states)
            self._attr_is_on = state

    @property
    def device_class(self) -> str | None:
        """Return the sensor class of the binary sensor."""
        return self._device_class


text:
'use strict';

var isString = require('./isString');

/**
 * Sentence-case the characters in `string`.
 *
 * ```js
 * sentencecase("foo bar baz.");
 * //=> 'Foo bar baz.'
 * ```
 *
 * @name .sentencecase
 * @param  {String} `string`
 * @return {String}
 * @api public
 */

module.exports = function sentencecase(str) {
  if (!isString(str)) return '';
  if (str.length === 1) {return str.toUpperCase(); }
  return str.charAt(0).toUpperCase() + str.slice(1);
};


text:
<?php

/**
 * PHPUnit test for D2LWS_Authenticate
 * @author Adam Lundrigan <adamlundrigan@cdli.ca>
 *
 * @group D2LWS
 * @group D2LWS_Core
 */
class D2LWS_AuthenticateTest extends GenericTestCase
{

    /**
     * Test our ability to load up a mock instance manager
     */
    public function testCanGetInstanceManagerWithAuthenticateInstance()
    {
        $o = $this->_getInstanceManagerWithMockSoapClient();
        $this->assertInstanceOf("D2LWS_Instance", $o);
        $this->assertInstanceOf("D2LWS_Authenticate", $o->getAuthManager());
    }

    /**
     * Test that getToken() will work on valid SOAP result, but fail if we
     * access the token too many time
     */
    public function testGetTokenEnforcesTokenUsageLimitProperly()
    {
        $o = $this->_getInstanceManagerWithMockSoapClient();
        $o->getSoapClient()->addCallback("AuthenticationToken", "Authenticate2",
           function ($args) {
               static $call = 1;

               $result = new stdClass();
               $result->status = "Success";
               $result->token = 'MYTESTTOKEN' . $call;
               $result->tokenSettings = new stdClass();
               $result->tokenSettings->maxUsageCount = 2;
               $result->tokenSettings->lifetimeInSeconds = time() + 30;

               $call++;

               return $result;
           }
        );

        // First call will create a new token
        $token1 = $o->getAuthManager()->getToken();
        $this->assertEquals('MYTESTTOKEN1', $token1);

        // Second call will reuse the existing token
        $this->assertEquals($token1, $o->getAuthManager()->getToken());

        // Third call should generate a new token since we've set maxUsageCount to 2
        $token2 = $o->getAuthManager()->getToken();
        $this->assertEquals('MYTESTTOKEN2', $token2);
        $this->assertNotEquals($token1, $token2);
    }

    /**
     * Test that getToken() will work on valid SOAP result
     */
    public function testGetTokenWillWorkWithValidResult()
    {
        $o = $this->_getInstanceManagerWithMockSoapClient();
        $o->getSoapClient()->addCallback("AuthenticationToken", "Authenticate2",
           function ($args) {
               $result = new stdClass();
               $result->status = "Success";
               $result->token = 'MYTESTTOKEN12345';
               $result->tokenSettings = new stdClass();
               $result->tokenSettings->maxUsageCount = 2;
               $result->tokenSettings->lifetimeInSeconds = time() + 30;
               return $result;
           }
        );
        $this->assertEquals('MYTESTTOKEN12345', $o->getAuthManager()->getToken());
    }

    /**
     * Test that authenticate() will return false on exception
     * We know this because getToken() will throw an exception only if authenticate() returns false
     * @expectedException D2LWS_Soap_Client_Exception_AuthenticationFailed
     */
    public function testAuthenticateWillReturnFalseOnException()
    {
        $o = $this->_getInstanceManagerWithMockSoapClient();
        $o->getSoapClient()->addCallback("AuthenticationToken", "Authenticate2",
           function ($args) {
               throw new Exception("bogus");
           }
        );

        $o->getAuthManager()->getToken();
    }

    /**
     * Test that getToken() will trigger exception on failure
     * @expectedException D2LWS_Soap_Client_Exception_AuthenticationFailed
     */
    public function testGetTokenWillTriggerExceptionOnFailure()
    {
        $o = $this->_getInstanceManagerWithMockSoapClient();
        $o->getSoapClient()->addCallback("AuthenticationToken", "Authenticate2",
           function ($args) {
               return false;
           }
        );
        $this->assertFalse($o->getAuthToken());
    }

}


text:
package org.cloudfoundry.client.v2.applications;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.immutables.value.Value;

/**
 * The response payload for the Get Application operation
 */
@JsonDeserialize
@Value.Immutable
abstract class _GetApplicationResponse extends AbstractApplicationResource {

}


text:
from __future__ import division

class Skill:
	def __init__(self, character):
		self.chr = character

	def getValue(self):
		pass

class Escape(Skill):
	def getValue(self):
		return int(self.chr.SPE / 4)

class Intimidate(Skill):
	def getValue(self):
		return int(self.chr.CHA / 6 + self.chr.STR / 12)

class Charm(Skill):
	def getValue(self):
		return int(self.chr.CHA / 4)

class Search(Skill):
	def getValue(self):
		return int(self.chr.INT / 6 + self.chr.SPI / 12)

class Stealth(Skill):
	def getValue(self):
		return int(self.chr.SPE / 6 + self.chr.INT / 12)


text:
package java.util;

/**
 * A very simple emulation of Locale for shared-code patterns like
 * {@code String.toUpperCase(Locale.US)}.
 * <p>
 * Note: Any changes to this class should put into account the assumption that
 * was made in rest of the JRE emulation.
 */
public class Locale {

	static class RootLocale extends Locale {
		@Override
		public String toString() {
			return "";
		}
	}

	static class EnglishLocale extends Locale {
		@Override
		public String toString() {
			return "en";
		}
	}
	static class FrenchLocale extends Locale {
		@Override
		public String toString() {
			return "fr";
		}
	}

	static class USLocale extends Locale {
		@Override
		public String toString() {
			return "en_US";
		}
	}

	static class UKLocale extends Locale {
		@Override
		public String toString() {
			return "en-gb";
		}
	}

	static class DefaultLocale extends Locale {
		@Override
		public String toString() {
			return "fr";
		}
	}

	public static final Locale ROOT = new RootLocale();

	public static final Locale ENGLISH = new EnglishLocale();

	public static final Locale US = new USLocale();

	public static final Locale FRANCE = new FrenchLocale();

	public static final Locale UK = new UKLocale();

	private static Locale defaultLocale = new DefaultLocale();

	/**
	 * Returns an instance that represents the browser's default locale (not
	 * necessarily the one defined by 'gwt.locale').
	 */
	public static Locale getDefault() {
		return defaultLocale;
	}

	// Hidden as we don't support manual creation of Locales.
	private Locale() {
	}
}


text:
package uk.ac.ed.ph.snuggletex.definitions;

import uk.ac.ed.ph.snuggletex.ErrorCode;
import uk.ac.ed.ph.snuggletex.ErrorGroup;

/**
 * Enumerates the various types of client-induced errors that can arise when using the
 * functionality provided by the core SnuggleTeX module.
 *
 *
Developer Notes

 *
 *

 *

 *     See the <tt>core-error-messages_en.properties</tt> file for descriptions of each code.
 *

 *

 *     To make things easier to read, add a comment whenever raising an error that briefly
 *     summarises the error.
 *

 *

 *     I'm using a kind of naming convention for these, as mentioned
 *     in the error-messages_en.properties. Note that the 3rd character
 *     indicates the type of error, which in all cases so far is 'E' for Error.
 *

 *

 *
 * @since 1.2.0
 *
 * @author  David McKain
 * @version $Revision:179 $
 */
public enum CoreErrorCode implements ErrorCode {

    /* ================ Errors in the normal SnuggleTeX -> MathML Process (T) =============== */

    /* Tokenisation errors */
    TTEG00(CoreErrorGroup.TTE),
    TTEG01(CoreErrorGroup.TTE),
    TTEG02(CoreErrorGroup.TTE),
    TTEG03(CoreErrorGroup.TTE),
    TTEG04(CoreErrorGroup.TTE),
    TTEG05(CoreErrorGroup.TTE),
    TTEM00(CoreErrorGroup.TTE),
    TTEM01(CoreErrorGroup.TTE),
    TTEM02(CoreErrorGroup.TTE),
    TTEM03(CoreErrorGroup.TTE),
    TTEM04(CoreErrorGroup.TTE),
    TTEV00(CoreErrorGroup.TTE),
    TTEV01(CoreErrorGroup.TTE),
    TTEC00(CoreErrorGroup.TTE),
    TTEC01(CoreErrorGroup.TTE),
    TTEC02(CoreErrorGroup.TTE),
    TTEC03(CoreErrorGroup.TTE),
    TTEC04(CoreErrorGroup.TTE),
    TTEE00(CoreErrorGroup.TTE),
    TTEE01(CoreErrorGroup.TTE),
    TTEE02(CoreErrorGroup.TTE),
    TTEE03(CoreErrorGroup.TTE),
    TTEE04(CoreErrorGroup.TTE),
    TTEE05(CoreErrorGroup.TTE),
    TTEE06(CoreErrorGroup.TTE),
    TTEU00(CoreErrorGroup.TTE),
    TTEUC0(CoreErrorGroup.TTE),
    TTEUC1(CoreErrorGroup.TTE),
    TTEUC2(CoreErrorGroup.TTE),
    TTEUC3(CoreErrorGroup.TTE),
    TTEUC4(CoreErrorGroup.TTE),
    TTEUC5(CoreErrorGroup.TTE),
    TTEUC6(CoreErrorGroup.TTE),
    TTEUC7(CoreErrorGroup.TTE),
    TTEUC8(CoreErrorGroup.TTE),
    TTEUC9(CoreErrorGroup.TTE),
    TTEUCA(CoreErrorGroup.TTE),
    TTEUE0(CoreErrorGroup.TTE),
    TTEUE1(CoreErrorGroup.TTE),
    TTEUE2(CoreErrorGroup.TTE),
    TTEUE3(CoreErrorGroup.TTE),
//    TTEUE4(CoreErrorGroup.TTE),
    TTEUE5(CoreErrorGroup.TTE),
    TTEUE6(CoreErrorGroup.TTE),

    /* Fixing errors */
    TFEG00(CoreErrorGroup.TFE),
    TFEL00(CoreErrorGroup.TFE),
    TFEM00(CoreErrorGroup.TFE),
    TFEM01(CoreErrorGroup.TFE),
    TFEM02(CoreErrorGroup.TFE),
    TFEM03(CoreErrorGroup.TFE),
    TFEM04(CoreErrorGroup.TFE),
    TFETB0(CoreErrorGroup.TFE),

    /* DOM Building errors */
    TDEG00(CoreErrorGroup.TDE),
    TDEX00(CoreErrorGroup.TDE),
    TDEX01(CoreErrorGroup.TDE),
    TDEX02(CoreErrorGroup.TDE),
    TDEX03(CoreErrorGroup.TDE),
    TDEX04(CoreErrorGroup.TDE),
    TDEX05(CoreErrorGroup.TDE),
    TDEXU0(CoreErrorGroup.TDE),
    TDEXU1(CoreErrorGroup.TDE),
    TDEM00(CoreErrorGroup.TDE),
    TDEM01(CoreErrorGroup.TDE),
    TDEMA0(CoreErrorGroup.TDE),
    TDEMA1(CoreErrorGroup.TDE),
    TDEMA2(CoreErrorGroup.TDE),
    TDEMM0(CoreErrorGroup.TDE),
    TDEL00(CoreErrorGroup.TDE),
    TDETA0(CoreErrorGroup.TDE),
    TDETA1(CoreErrorGroup.TDE),
    TDETA2(CoreErrorGroup.TDE),
    TDETB0(CoreErrorGroup.TDE),
    TDETB1(CoreErrorGroup.TDE),
    TDETB2(CoreErrorGroup.TDE),
    TDETB3(CoreErrorGroup.TDE),
    TDEUN0(CoreErrorGroup.TDE),
    TDEUN1(CoreErrorGroup.TDE),
    TDEUN2(CoreErrorGroup.TDE),

    ;

    private final CoreErrorGroup errorGroup;

    private CoreErrorCode(CoreErrorGroup errorGroup) {
        this.errorGroup = errorGroup;
    }

    public String getName() {
        return name();
    }

    public ErrorGroup getErrorGroup() {
        return errorGroup;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>org.mule.examples</groupId>
	<artifactId>foreach-processing-and-choice-routing</artifactId>
	<packaging>mule</packaging>

    <parent>
        <groupId>org.mule.examples</groupId>
        <artifactId>examples-catalog</artifactId>
        <version>1.3.3-SNAPSHOT</version>
    </parent>

<dependencies>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-spring-config</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>


text:
import asyncio
import motor.motor_asyncio
import pytest
from functools import wraps

from asyncio_mongo_reflection.deque_reflection import *
from asyncio_mongo_reflection.dict_reflection import *

loop = asyncio.get_event_loop_policy().new_event_loop()
asyncio.set_event_loop(loop)
loop.set_debug(False)
loop._close = loop.close
loop.close = lambda: None

lrun_uc = loop.run_until_complete

client = motor.motor_asyncio.AsyncIOMotorClient()
db = client.test_db

@pytest.fixture(scope="session", autouse=True)
def test_shutdown():
    yield None
    # clear all tasks before loop stops
    pending = asyncio.Task.all_tasks()
    for task in pending:
        task.cancel()

    lrun_uc(asyncio.sleep(1))
    loop.close()

def async_test(testf):
    @wraps(testf)
    def tmp(*args, **kwargs):
        return lrun_uc(testf(*args, **kwargs))
    return tmp

def flattern_list_nested(nlist, dumps=None, lists_to_deque=True):
    fdumps = lambda arg: dumps(arg) if callable(dumps) else arg

    for ix, el in enumerate(nlist):
        if isinstance(el, DequeReflection) or isinstance(el, deque):
            if lists_to_deque:
                nlist[ix] = deque(list(el), maxlen=el.maxlen)
            else:
                nlist[ix] = list(el)
            flattern_list_nested(nlist[ix], dumps=dumps, lists_to_deque=lists_to_deque)
        elif isinstance(el, DictReflection) or type(el) is dict:
            nlist[ix] = flattern_dict_nested(dict(el), dumps, lists_to_deque=lists_to_deque)
        else:
            nlist[ix] = fdumps(el)

    return nlist

def flattern_dict_nested(dct, dumps=None, lists_to_deque=False):
    fdumps = lambda arg: dumps(arg) if callable(dumps) else arg

    for key, val in dct.items():
        if isinstance(val, DictReflection) or isinstance(val, dict):
            dct[key] = flattern_dict_nested(dict(val), dumps, lists_to_deque=lists_to_deque)
        elif type(val) is list or isinstance(val, DequeReflection) or isinstance(val, deque):
            val = deque(val) if lists_to_deque else list(val)
            dct[key] = flattern_list_nested(val, dumps, lists_to_deque=lists_to_deque)
        else:
            dct[key] = fdumps(val)
    return dct

def compare_nested_dict(m, tested):
    for key, val in tested.items():
        if isinstance(val, DictReflection):
            assert hasattr(val, '_deque_cls')
            compare_nested_dict(m[key], val)
        elif isinstance(val, DequeReflection):
            assert hasattr(val, '_dict_cls')
            compare_nested_list(m[key], val)

        assert m[key] == val
        assert m.key == tested.key

def compare_nested_list(m, tested):
    for ix, el in enumerate(tested):
        if isinstance(el, DequeReflection):
            assert hasattr(el, '_dict_cls')
            compare_nested_list(m[ix], el)
        elif isinstance(el, DictReflection):
            assert hasattr(el, '_deque_cls')
            compare_nested_dict(m[ix], el)

        assert m[ix] == el
        # assert m.maxlen == tested.maxlen
        assert m.key == tested.key

async def mongo_compare(ex, m):
    obj = await db[m.col.name].find_one(m.obj_ref)

    nested = m.key.split(sep='.')
    for k in nested:
        obj = obj[k]

    assert obj == ex


text:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation=" http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-3.2.xsd
                            http://www.springframework.org/schema/aop
                            http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
                            http://www.springframework.org/schema/tx
                            http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
    <!-- 引用java配置文件 -->
    <context:property-placeholder location="classpath:db.properties"/>

    <!-- 配置数据源,使用c3p0接池 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${jdbc.driver}" />
        <property name="jdbcUrl" value="${jdbc.url}" />
        <property name="user" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />

    </bean>

    <!--创建SQLSessionFactory单例-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <!-- mybatis的配置文件路径 -->
        <property name="configLocation" value="classpath:SqlMapperConfig.xml"></property>
        <!-- SqlSessionFactory需要数据源信息,之前是写在sqlmapconfig.xml,现在需要重新指定 -->
        <property name="dataSource" ref="dataSource"></property>
    </bean>
    <!-- mapper代理开发方式之批量mapper配置 -->
    <!-- bean的名字默认为mapper接口类名的首字母小写 -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <!-- 指定批量mapper配置的包名 -->
        <property name="basePackage" value="com.sh.crm.hr.mapper;
                                            com.sh.crm.classes.mapper;
                                            com.sh.crm.refer.mapper;
                                            com.sh.crm.student.mapper"></property>

        <!-- 指定使用的SqlSessionFactory -->
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
    </bean>

    <!--加入事务管理-->
    <!-- 事务管理器 -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <!-- 数据源 -->
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- 通知 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <!-- 传播行为 -->
            <tx:method name="findALlStaff" propagation="REQUIRED"/>
            <!--<tx:method name="insert*" propagation="REQUIRED"/>
            <tx:method name="delete*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
            <tx:method name="get*" propagation="SUPPORTS" read-only="true"/>-->
        </tx:attributes>
    </tx:advice>

    <!-- 切面 -->
    <aop:config>
        <aop:advisor advice-ref="txAdvice"
                     pointcut="execution(* com.sh.crm.hr.service.impl.*.*(..))"/>
    </aop:config>

    <!--指定serviceBean-->

    <context:component-scan base-package="com.sh.crm.hr.service.impl"/>
    <context:component-scan base-package="com.sh.crm.classes.service.impl"/>
    <context:component-scan base-package="com.sh.crm.refer.service.impl"/>
    <context:component-scan base-package="com.sh.crm.student.service.impl"/>
    <!--<bean id="staffService" class="StaffServiceImpl"/>
    <bean id="departmentService" class="DepartmentServiceImpl"/>-->

</beans>


text:
/* rest_description.cc
   Mathieu Stefani, 27 février 2016

   Example of how to use the Description mechanism
*/

#include <pistache/description.h>
#include <pistache/endpoint.h>
#include <pistache/http.h>

#include <pistache/serializer/rapidjson.h>

using namespace Pistache;

namespace Generic
{

    void handleReady(const Rest::Request&, Http::ResponseWriter response)
    {
        response.send(Http::Code::Ok, "1");
    }

}

class BankerService
{
public:
    BankerService(Address addr)
        : httpEndpoint(std::make_shared<Http::Endpoint>(addr))
        , desc("Banking API", "0.1")
    { }

    void init(size_t thr = 2)
    {
        auto opts = Http::Endpoint::options()
                        .threads(static_cast<int>(thr));
        httpEndpoint->init(opts);
        createDescription();
    }

    void start()
    {
        router.initFromDescription(desc);

        Rest::Swagger swagger(desc);
        swagger
            .uiPath("/doc")
            .uiDirectory("/home/octal/code/web/swagger-ui-2.1.4/dist")
            .apiPath("/banker-api.json")
            .serializer(&Rest::Serializer::rapidJson)
            .install(router);

        httpEndpoint->setHandler(router.handler());
        httpEndpoint->serve();
    }

private:
    void createDescription()
    {
        desc
            .info()
            .license("Apache", "http://www.apache.org/licenses/LICENSE-2.0");

        auto backendErrorResponse = desc.response(Http::Code::Internal_Server_Error, "An error occured with the backend");

        desc
            .schemes(Rest::Scheme::Http)
            .basePath("/v1")
            .produces(MIME(Application, Json))
            .consumes(MIME(Application, Json));

        desc
            .route(desc.get("/ready"))
            .bind(&Generic::handleReady)
            .response(Http::Code::Ok, "Response to the /ready call")
            .hide();

        auto versionPath = desc.path("/v1");

        auto accountsPath = versionPath.path("/accounts");

        accountsPath
            .route(desc.get("/all"))
            .bind(&BankerService::retrieveAllAccounts, this)
            .produces(MIME(Application, Json), MIME(Application, Xml))
            .response(Http::Code::Ok, "The list of all account");

        accountsPath
            .route(desc.get("/:name"), "Retrieve an account")
            .bind(&BankerService::retrieveAccount, this)
            .produces(MIME(Application, Json))
            .parameter<Rest::Type::String>("name", "The name of the account to retrieve")
            .response(Http::Code::Ok, "The requested account")
            .response(backendErrorResponse);

        accountsPath
            .route(desc.post("/:name"), "Create an account")
            .bind(&BankerService::createAccount, this)
            .produces(MIME(Application, Json))
            .consumes(MIME(Application, Json))
            .parameter<Rest::Type::String>("name", "The name of the account to create")
            .response(Http::Code::Ok, "The initial state of the account")
            .response(backendErrorResponse);

        auto accountPath = accountsPath.path("/:name");
        accountPath.parameter<Rest::Type::String>("name", "The name of the account to operate on");

        accountPath
            .route(desc.post("/budget"), "Add budget to the account")
            .bind(&BankerService::creditAccount, this)
            .produces(MIME(Application, Json))
            .response(Http::Code::Ok, "Budget has been added to the account")
            .response(backendErrorResponse);
    }

    void retrieveAllAccounts(const Rest::Request&, Http::ResponseWriter response)
    {
        response.send(Http::Code::Ok, "No Account");
    }

    void retrieveAccount(const Rest::Request&, Http::ResponseWriter response)
    {
        response.send(Http::Code::Ok, "The bank is closed, come back later");
    }

    void createAccount(const Rest::Request&, Http::ResponseWriter response)
    {
        response.send(Http::Code::Ok, "The bank is closed, come back later");
    }

    void creditAccount(const Rest::Request&, Http::ResponseWriter response)
    {
        response.send(Http::Code::Ok, "The bank is closed, come back later");
    }

    std::shared_ptr<Http::Endpoint> httpEndpoint;
    Rest::Description desc;
    Rest::Router router;
};

int main(int argc, char* argv[])
{
    Port port(9080);

    int thr = 2;

    if (argc >= 2)
    {
        port = static_cast<uint16_t>(std::stol(argv[1]));

        if (argc == 3)
            thr = std::stoi(argv[2]);
    }

    Address addr(Ipv4::any(), port);

    std::cout << "Cores = " << hardware_concurrency() << std::endl;
    std::cout << "Using " << thr << " threads" << std::endl;

    BankerService banker(addr);

    banker.init(thr);
    banker.start();
}


text:
package geoip

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// DataInfos is a nested struct in geoip response
type DataInfos struct {
	DataInfo []DataInfo `json:"DataInfo" xml:"DataInfo"`
}


text:
<?php
class PropertyAmenity extends ActiveRecord\Model
{
	static $table_name = 'property_amenities';
	static $primary_key = 'id';

	static $belongs_to = array(
		array('amenity'),
		array('property')
	);
};
?>


text:
<?php

namespace App\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use App\Entity\Ingredient;

class IngredientType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('quantity', IntegerType::class, array(
                'label' => false,
            ))
            ->add('quantityUnit', ChoiceType::class, array(
                'choices' => Ingredient::MESUREMENT_UNIT,
                'label' => false,
            ))
            ->add('name', TextType::class, array(
                'label' => false,
            ))
        ;
    }

    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => Ingredient::class
        ));
    }
}


text:
package com.google.template.soy.data;

import static com.google.common.truth.Truth.assertThat;
import static com.google.template.soy.data.SoyValueUnconverter.unconvert;
import static com.google.template.soy.data.UnsafeSanitizedContentOrdainer.ordainAsSafe;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.html.types.SafeHtml;
import com.google.common.html.types.SafeScript;
import com.google.common.html.types.SafeStyle;
import com.google.common.html.types.SafeStyleSheet;
import com.google.common.html.types.SafeUrl;
import com.google.common.html.types.TrustedResourceUrl;
import com.google.protobuf.Message;
import com.google.template.soy.data.SanitizedContent.ContentKind;
import com.google.template.soy.data.restricted.BooleanData;
import com.google.template.soy.data.restricted.FloatData;
import com.google.template.soy.data.restricted.IntegerData;
import com.google.template.soy.data.restricted.NullData;
import com.google.template.soy.data.restricted.StringData;
import com.google.template.soy.testing.SomeEmbeddedMessage;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Unit tests for SoyValueConverter.
 *
 */
@RunWith(JUnit4.class)
public class SoyValueUnconverterTest {

  private static final SoyValueConverter CONVERTER = SoyValueConverter.INSTANCE;

  @Test
  public void testUnconvert() {
    assertThat(unconvert(NullData.INSTANCE)).isNull();
    assertThat(unconvert(StringData.forValue("boo"))).isEqualTo("boo");
    assertThat(unconvert(BooleanData.TRUE)).isEqualTo(true);
    assertThat(unconvert(IntegerData.forValue(8))).isEqualTo(8L);
    assertThat(unconvert(FloatData.forValue(8.2))).isEqualTo(8.2D);

    Message message = SomeEmbeddedMessage.newBuilder().setSomeEmbeddedString("foo").build();
    assertThat(unconvert(SoyProtoValue.create(message))).isEqualTo(message);

    List<String> list = ImmutableList.of("a", "b", "c");
    assertThat((List<?>) unconvert(CONVERTER.convert(list))).isEqualTo(list);

    Map<String, String> map = ImmutableMap.of("k1", "v1", "k2", "v2");
    assertThat((Map<?, ?>) unconvert(CONVERTER.convert(map))).isEqualTo(map);

    SafeHtml safeHtml = ordainAsSafe("
foo
", ContentKind.HTML).toSafeHtml();
    assertThat(unconvert(CONVERTER.convert(safeHtml))).isEqualTo(safeHtml);

    SafeStyle style = ordainAsSafe("background-color: red;", ContentKind.CSS).toSafeStyle();
    assertThat(unconvert(CONVERTER.convert(style))).isEqualTo(style);

    SafeStyleSheet styleSheet =
        ordainAsSafe(".foo { background-color: red; }", ContentKind.CSS).toSafeStyleSheet();
    assertThat(unconvert(CONVERTER.convert(styleSheet))).isEqualTo(styleSheet);

    SafeScript script = SafeScript.EMPTY;
    assertThat(unconvert(CONVERTER.convert(script))).isEqualTo(script);

    TrustedResourceUrl resourceUrl =
        ordainAsSafe("https://google.com/a", ContentKind.TRUSTED_RESOURCE_URI)
            .toTrustedResourceUrl();
    assertThat(unconvert(CONVERTER.convert(resourceUrl))).isEqualTo(resourceUrl);

    SafeUrl url = ordainAsSafe("https://google.com/a", ContentKind.URI).toSafeUrl();
    assertThat(unconvert(CONVERTER.convert(url))).isEqualTo(url);
  }
}


text:
import { NavigationComponent, Options } from 'react-native-navigation';

class ExperimentScreen extends NavigationComponent {
  static options(): Options {
    const ExperimentsManager = require('./ExperimentsManager');
    const food = ExperimentsManager.isActive('VeganExperiment') ? 'Tofu' : 'Hamburger';

    return {
      topBar: {
        title: {
          text: `Hello ${food}!`,
        },
      },
    };
  }
}


text:
This project have good example functions in Angular 2.

Demo.: Movies

Code made with :heart: by Alison Vilela

## MIT License

You can use this code for whatever you want! =D


text:
package org.wildfly.extras.creaper.core;

/**
 * AS7 or WildFly.
 */
public enum ServerType {
    AS7,
    WILDFLY;
}


text:
package net.lecousin.framework.core.test.collections.maps;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Random;

import org.junit.Assert;
import org.junit.Test;

import net.lecousin.framework.collections.map.LongMap;
import net.lecousin.framework.core.test.LCCoreAbstractTest;

public abstract class TestLongMap extends LCCoreAbstractTest {

	public abstract LongMap<Object> createLongMap();

	@Test
	public void testLongMapIncrement() {
		LongMap<Object> map = createLongMap();
		HashMap<Long, Object> checkMap = new HashMap<>();
		checkEmpty(map);
		map.remove(123);
		checkEmpty(map);
		for (long i = 0; i < 200; ++i)
			put(i, map, checkMap, i % 2 == 0);
		for (long i = 5000; i < 10000; i += 7)
			put(i, map, checkMap, i % 2 == 0);
		for (long i = 1000000000L; i < 1000020000L; i += 1500)
			put(i, map, checkMap, i % 2 == 0);
		for (long i = 0; i < 300; i += 3)
			remove(i, map, checkMap, i % 2 == 0);
		for (long i = 4500; i < 11000; i += 5)
			remove(i, map, checkMap, i % 2 == 0);
		for (long i = 1000000007L; i < 1000020007L; i += 13)
			remove(i, map, checkMap, i % 2 == 0);
		for (long i = -5000; i > -7000; i -= 3)
			put(i, map, checkMap, i % 2 == 0);
		for (long i = 600; i < 800; ++i) {
			put(i, map, checkMap, i % 2 == 0);
			put(i, map, checkMap, i % 2 == 0);
		}
	}

	@Test
	public void testLongMapRandom() {
		LongMap<Object> map = createLongMap();
		HashMap<Long, Object> checkMap = new HashMap<>();
		checkEmpty(map);
		LinkedList<Long> values = new LinkedList<>();
		Random rand = new Random();
		long value = 0;
		for (int i = 0; i < 2500; ++i) {
			value += rand.nextLong();
			values.add(Long.valueOf(value));
		}
		while (!values.isEmpty())
			put(values.remove(rand.nextInt(values.size())).longValue(), map, checkMap, values.size() % 2 == 0);
		values.clear();
		values.addAll(checkMap.keySet());
		while (!values.isEmpty())
			remove(values.remove(rand.nextInt(values.size())).longValue(), map, checkMap, values.size() % 2 == 0);
		checkEmpty(map);
	}

	@Test
	public void testLongMapRandomWithNegativeValues() {
		LongMap<Object> map = createLongMap();
		HashMap<Long, Object> checkMap = new HashMap<>();
		checkEmpty(map);
		LinkedList<Long> values = new LinkedList<>();
		Random rand = new Random();
		long value = 0;
		for (int i = 0; i < 2500; ++i) {
			value += rand.nextLong();
			if (rand.nextBoolean())
				value = -value;
			values.add(Long.valueOf(value));
		}
		while (!values.isEmpty())
			put(values.remove(rand.nextInt(values.size())).longValue(), map, checkMap, values.size() % 2 == 0);
		values.clear();
		values.addAll(checkMap.keySet());
		while (!values.isEmpty())
			remove(values.remove(rand.nextInt(values.size())).longValue(), map, checkMap, values.size() % 2 == 0);
		checkEmpty(map);
	}

	@Test
	public void testClear() {
		LongMap<Object> map = createLongMap();
		checkEmpty(map);
		map.clear();
		checkEmpty(map);
		for (int i = 10; i < 100; ++i)
			map.put(i, Integer.valueOf(i));
		map.clear();
		checkEmpty(map);
	}

	@Test
	public void testValuesIterator() {
		LongMap<Object> map = createLongMap();
		List<Long> list = new LinkedList<>();
		for (long i = 0; i < 100; ++i) {
			map.put(i, Long.valueOf(i));
			list.add(Long.valueOf(i));
		}
		Assert.assertEquals(100, map.size());
		Iterator<Object> it = map.values();
		while (it.hasNext()) {
			Object o = it.next();
			Assert.assertTrue(o instanceof Long);
			long i = ((Long)o).longValue();
			Assert.assertTrue(i < 100 && i >= 0);
			Assert.assertTrue(list.remove(o));
		}
		Assert.assertTrue(list.isEmpty());
		try {
			it.next();
			throw new AssertionError("NoSuchElement");
		} catch (NoSuchElementException e) {
			// ok
		}
		// test remove half
		try {
			it = map.values();
			int i = 0;
			while (it.hasNext()) {
				it.next();
				if ((i % 2) == 0) it.remove();
				++i;
			}
			Assert.assertEquals(50, map.size());
			i = 0;
			it = map.values();
			while (it.hasNext()) {
				i++;
				it.next();
			}
			Assert.assertEquals(50, i);
		} catch (UnsupportedOperationException e) {
			// ok if not supported
		}
	}

	protected void checkEmpty(LongMap<Object> map) {
		Assert.assertEquals(0, map.size());
		Assert.assertTrue(map.isEmpty());
		Assert.assertFalse(map.containsKey(0));
		Assert.assertFalse(map.containsKey(1));
		Assert.assertNull(map.get(0));
		Assert.assertNull(map.get(1));
		Assert.assertFalse(map.values().hasNext());
	}

	protected void checkMap(LongMap<Object> map, HashMap<Long, Object> checkMap) {
		Assert.assertEquals(checkMap.size(), map.size());
		Assert.assertTrue(checkMap.isEmpty() == map.isEmpty());
		for (Map.Entry<Long, Object> e : checkMap.entrySet()) {
			Assert.assertTrue("containsKey(" + e.getKey() + ") returns false", map.containsKey(e.getKey().longValue()));
			Assert.assertEquals(e.getValue(), map.get(e.getKey().longValue()));
		}
		Iterator<Object> values = map.values();
		for (int i = 0; i < checkMap.size(); ++i) {
			Assert.assertTrue(values.hasNext());
			Assert.assertTrue(checkMap.containsValue(values.next()));
		}
		Assert.assertFalse(values.hasNext());
	}

	protected void put(long i, LongMap<Object> map, HashMap<Long, Object> checkMap, boolean doCheck) {
		try { map.put(i, Long.valueOf(i)); }
		catch (Throwable t) {
			throw new RuntimeException("Error in put(" + i + ")", t);
		}
		checkMap.put(Long.valueOf(i), Long.valueOf(i));
		if (doCheck)
			checkMap(map, checkMap);
	}

	protected void remove(long i, LongMap<Object> map, HashMap<Long, Object> checkMap, boolean doCheck) {
		if (!checkMap.containsKey(Long.valueOf(i))) {
			Assert.assertFalse(map.containsKey(i));
			Assert.assertTrue(map.remove(i) == null);
			return;
		}
		try { map.remove(i); }
		catch (Throwable t) {
			throw new RuntimeException("Error in remove(" + i + ")", t);
		}
		checkMap.remove(Long.valueOf(i));
		if (doCheck)
			checkMap(map, checkMap);
	}

}


text:
import com.hp.hpl.jena.query.*;
import org.openjena.riot.Lang;
import com.hp.hpl.jena.sparql.core.DatasetImpl;
import oracle.rdf.kv.client.jena.*;

/**
 * Example5c describes how to execute a SPARQL query using timeout and graceful
 * timeout policies in an Oracle NoSQL database.
 *
 *
 Query execution in the Jena adapter for Oracle NoSQL database provides
 * additional performance features such as timeout and graceful timeout policies
 * used in query execution.
 *
 *
 The timeout policy allows to execute the SPARQL query before the
 * time out (in seconds) is reached, else it stop its executions and generates an
 * error. This feature is specified as as a hint in the ORACLE_SEM_FS_NS
 * namespace as timeout=N. By default, a timeout of 0 is used, and query
 * execution must wait until it is completed.
 *
 *
 An additional feature called best effort policy can be set
 * to retrieve partial results if the timeout is reached. This feature is
 * specified as as a hint in the ORACLE_SEM_FS_NS namespace as
 * best_effort_query=t. By default, the best effort policy is set to
 * false.
 *
 */

public class Example5c
{

  public static void main(String[] args) throws Exception
  {

    String szStoreName  = args[0];
    String szHostName   = args[1];
    String szHostPort   = args[2];

    // create connection
    OracleNoSqlConnection conn = OracleNoSqlConnection.createInstance(szStoreName,
                                                                      szHostName,
                                                                      szHostPort);

    // Create datasetgraph
    OracleGraphNoSql graph = new OracleGraphNoSql(conn);
    DatasetGraphNoSql datasetGraph = DatasetGraphNoSql.createFrom(graph);

    // Close graph, as it is no longer needed
    graph.close();

    // Clear the dataset
    datasetGraph.clearRepository();

    Dataset ds = DatasetImpl.wrap(datasetGraph);

    // Load data from file into the dataset
    DatasetGraphNoSql.load("example.nt", Lang.NQUADS, conn, "http://example.com");

    // Add a hint best_effort_query=t to use a graceful timeout policy
    String szQuery =
        " PREFIX ORACLE_SEM_FS_NS: <http://oracle.com/semtech#timeout=1>"       +
        " PREFIX foaf: <http://xmlns.com/foaf/0.1/>"                            +
        " SELECT ?name1 ?name2 ?homepage2 "                                     +
        " WHERE { "                                                             +
        "   graph <http://example.org/alice/foaf.rdf> { "                       +
        "     ?person1 foaf:knows ?person2 . "                                  +
        "     ?person1 foaf:name ?name1 . "                                     +
        "     ?person2 foaf:name ?name2 . "                                     +
        "     ?person2 foaf:homepage ?homepage2 . "                             +
        "   } "                                                                 +
        " } ";

    System.out.println("Execute query " + szQuery);

    Query query = QueryFactory.create(szQuery);
    QueryExecution qexec = QueryExecutionFactory.create(query, ds);

    try {
      ResultSet results = qexec.execSelect();
      ResultSetFormatter.out(System.out, results, query);
    }

    finally {
      qexec.close();
    }

    ds.close();
    conn.dispose();

  }
}


text:
/*
 * Created on 14 fevr. 2004
 */
package com.foc.gui;

import java.awt.event.*;

import javax.swing.*;

import com.foc.Globals;
import com.foc.property.*;

/**
 * @author 01Barmaja
 */
@SuppressWarnings("serial")
public class FGCheckBox extends JCheckBox implements FPropertyListener, ItemListener{
	protected FBoolean booleanProperty = null;

	public FGCheckBox(Icon icon) {
		super(icon);
  	init();
	}

	public FGCheckBox(String text, Icon icon) {
		super(text, icon);
  	init();
	}

	public FGCheckBox(String text) {
		super(text);
  	init();
	}

  public FGCheckBox() {
  	init();
  }

  public void dispose(){
    removeItemListener(this);

    if(booleanProperty != null){
      booleanProperty.removeListener(this);
      booleanProperty = null;
    }
  }

  private void init(){
  	if(Globals.getDisplayManager() != null){
  		setFont(Globals.getDisplayManager().getDefaultFont());
  		addItemListener(this);
  		setBackground(Globals.getDisplayManager().getBackgroundColor());
  	}
  }

  public void setEnabled(boolean b) {
    super.setEnabled(b);
    StaticComponent.setEnabledNoBackground(this, b, booleanProperty != null ? booleanProperty.isOutput() : false);
  }

  public void setProperty(FProperty prop){
    if(prop != booleanProperty){
      if(booleanProperty != null){
        booleanProperty.removeListener(this);
      }
      booleanProperty = (FBoolean) prop;
      propertyModified(booleanProperty);
      if(booleanProperty != null){
        booleanProperty.addListener(this);
      }
    }
  }

  public void itemStateChanged(ItemEvent e) {
    if(booleanProperty != null){
      booleanProperty.setBoolean(isSelected());
    }
  }

  /* (non-Javadoc)
   * @see b01.foc.property.FPropertyListener#propertyModified(b01.foc.property.FProperty)
   */
  public void propertyModified(FProperty property) {
    if(booleanProperty != null){
      setSelected(booleanProperty.getBoolean());
    }
  }
}