예제 #1
0
        public static TermTuple makeByReferers(TermOrCompoundTermOrVariableReferer[] referers)
        {
            TermTuple result = new TermTuple();

            result.refererOrIntervals = referers.Select(v => RefererOrInterval.makeReferer(v)).ToArray();
            return(result);
        }
예제 #2
0
        public static RefererOrInterval makeReferer(TermOrCompoundTermOrVariableReferer referer)
        {
            RefererOrInterval result = new RefererOrInterval();

            result.isInterval = false;
            result.referer    = referer;
            return(result);
        }
예제 #3
0
        public static RefererOrInterval makeInterval(Interval interval)
        {
            RefererOrInterval result = new RefererOrInterval();

            result.isInterval = true;
            result.interval   = interval;
            return(result);
        }
예제 #4
0
        public static IList <ClassicalTermLink> prepareComponentLinks(CompoundAndTermContext compoundAndTermContext, TermOrCompoundTermOrVariableReferer term, ClassicalTermLink.EnumType type)
        {
            // see https://github.com/opennars/opennars/blob/4515f1d8e191a1f097859decc65153287d5979c5/nars_core/nars/language/Terms.java#L404

            IList <ClassicalTermLink> componentLinks = new List <ClassicalTermLink>();

            // doesn't go down a level because the Concept already does this for us

            Compound compoundOfTerm = compoundAndTermContext.translateTermOfCompoundToCompound(term);

            for (int componentIndex = 0; componentIndex < compoundOfTerm.getComponentLength(compoundAndTermContext); componentIndex++)
            {
                RefererOrInterval refererOfInterval = compoundOfTerm.getComponentByIndex(compoundAndTermContext, (uint)componentIndex);
                Debug.Assert(!refererOfInterval.isInterval);
                TermOrCompoundTermOrVariableReferer refered = refererOfInterval.referer;

                componentLinks.Add(new ClassicalTermLink(refered, type, (uint)componentIndex));
            }

            // TODO< other link types >

            return(componentLinks);
        }