Implement optimization for collapse instruction.
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class Ruleset {
|
||||
@@ -35,6 +36,24 @@ namespace Cryville.Crtr {
|
||||
public Dictionary<string, JudgeDefinition> judges;
|
||||
public Dictionary<string, ScoreDefinition> scores;
|
||||
public Constraint constraints;
|
||||
public void Optimize(PdtEvaluatorBase etor) {
|
||||
foreach (var i in inputs.Values) {
|
||||
if (i.pass != null) foreach (var e in i.pass.Values) {
|
||||
etor.Optimize(e);
|
||||
}
|
||||
}
|
||||
foreach (var j in judges.Values) {
|
||||
if (j.clip != null) etor.Optimize(j.clip);
|
||||
if (j.hit != null) etor.Optimize(j.hit);
|
||||
if (j.scores != null) foreach (var e in j.scores.Values) {
|
||||
etor.Optimize(e);
|
||||
}
|
||||
}
|
||||
foreach (var s in scores.Values) {
|
||||
if (s.value != null) etor.Optimize(s.value);
|
||||
}
|
||||
constraints.Optimize(etor);
|
||||
}
|
||||
public void PrePatch(Chart chart) {
|
||||
constraints.PrePatch(chart);
|
||||
}
|
||||
@@ -54,6 +73,15 @@ namespace Cryville.Crtr {
|
||||
public Dictionary<RulesetSelectors, Constraint> Elements = new Dictionary<RulesetSelectors, Constraint>();
|
||||
[PropertyList]
|
||||
public Dictionary<PropertyKey, PdtExpression> Properties = new Dictionary<PropertyKey, PdtExpression>();
|
||||
public void Optimize(PdtEvaluatorBase etor) {
|
||||
foreach (var e in Properties.Values) {
|
||||
etor.Optimize(e);
|
||||
}
|
||||
foreach (var e in Elements) {
|
||||
e.Key.Optimize(etor);
|
||||
e.Value.Optimize(etor);
|
||||
}
|
||||
}
|
||||
public void PrePatch(ChartEvent ev) {
|
||||
var etor = ChartPlayer.etor;
|
||||
PropSrc src;
|
||||
|
Reference in New Issue
Block a user