Esempio n. 1
0
        public override void Run()
        {
            if (elink == null)
            {
                // Pick a link ending now.
                elink = workspace.expectations.PickRandomLinkWithEndTime(workspace.measures.Count - 1);
            }

            if (elink == null)
            {
                return;
            }

            // Add to attention history.
            workspace.RecordCodeletAttentionHistory(this, elink.m1.Location, elink.m2.Location);

            // Get the real measures for this expectation.
            Measure m1 = workspace.measures[elink.m1.Location];
            Measure m2 = workspace.measures[elink.m2.Location];

            // Make new codelet to link!
            MeasureLinkerCodelet mlc = new MeasureLinkerCodelet((int)this.rawUrgency, this, coderack, workspace, slipnet, elink.m1, elink.m2);

            coderack.AddCodelet(mlc);
        }
Esempio n. 2
0
        public ExpectedMeasureLink MakeNewExpectedMeasureLink(int location1, int location2, int offset, float strength)
        {
            ExpectedMeasure em1 = workspace.expectations.GetExpectedMeasure(location1 + offset);
            ExpectedMeasure em2 = workspace.expectations.GetExpectedMeasure(location2 + offset);

            ExpectedMeasureLink expectedLink = new ExpectedMeasureLink(null, em1, em2, strength);

            links.Add(expectedLink);
            return(expectedLink);
        }
Esempio n. 3
0
        public ExpectedMeasureLink MakeNewExpectedMeasureLink(MeasureLink sourceLink, int offset, float strength)
        {
            int location1 = sourceLink.m1.number;
            int location2 = sourceLink.m2.number;

            ExpectedMeasure em1 = workspace.expectations.GetExpectedMeasure(location1 + offset);
            ExpectedMeasure em2 = workspace.expectations.GetExpectedMeasure(location2 + offset);

            ExpectedMeasureLink expectedLink = new ExpectedMeasureLink(sourceLink, em1, em2, strength);

            links.Add(expectedLink);
            return(expectedLink);
        }
Esempio n. 4
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public SuggestLinkFromExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, ExpectedMeasureLink elink)
     : base("Suggest Link From Expectation", urgency, parent, coderack, workspace, slipnet)
 {
     this.elink = elink;
 }