コード例 #1
0
ファイル: MaxWeightFunc.cs プロジェクト: TheByte/sones
        public override Exceptional<FuncParameter> ExecFunc(DBContext dbContext, params FuncParameter[] myParams)
        {
            var result = new Exceptional<FuncParameter>();

            if (!(CallingObject is EdgeTypeWeighted))
            {
                return result.PushIErrorT(new Error_FunctionParameterTypeMismatch(typeof(EdgeTypeWeighted), CallingObject.GetType()));
            }

            result.Value = new FuncParameter(((EdgeTypeWeighted)CallingObject).GetMaxWeight());

            return result;
        }
コード例 #2
0
ファイル: CountFunc.cs プロジェクト: TheByte/sones
        public override Exceptional<FuncParameter> ExecFunc(DBContext dbContext, params FuncParameter[] myParams)
        {
            var pResult = new Exceptional<FuncParameter>();

            if (CallingObject is IListOrSetEdgeType)
            {
                pResult.Value = new FuncParameter(new DBUInt64(((IListOrSetEdgeType)CallingObject).Count()));
            }
            else if (CallingObject is ASingleReferenceEdgeType)
            {
                pResult.Value = new FuncParameter(new DBUInt64(1));
            }
            else if (CallingObject is IEnumerable<ObjectUUID>)
            {
                pResult.Value = new FuncParameter(new DBUInt64((CallingObject as IEnumerable<ObjectUUID>).LongCount()));
            }
            else
            {
                return pResult.PushIErrorT(new Error_FunctionParameterTypeMismatch(typeof(IEdgeType), CallingObject.GetType()));
            }

            return pResult;
        }