Warning: session_start(): open(/var/lib/php/sessions/sess_pk6qnlvvki62oq9kb8tiicklhs, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
//set flag SimpleCRUD_v2_debug.
//set flag formLayouter1_debug.
beaConcept BPattern {
S text;
toString { ret "[\*id*/] " + shortDynName(this) + " " + quote(text); }
void reactWith(BInput input, IBEAReactor reactor) {}
}
beaConcept BStarPattern > BPattern {
void reactWith(BInput input, IBEAReactor reactor) {
LS mapping = matchesToStringList(flexMatchIC_first(text, input.text));
if (mapping == null) ret;
reactor.uniqResult(BEAObject,
type := "match",
+input,
pattern := this,
+mapping);
}
}
beaConcept BAngleVarPattern > BPattern {
void reactWith(BInput input, IBEAReactor reactor) {
SS mapping = flexMatchAngleBracketVarsIC_first(text, input.text);
if (mapping == null) ret;
reactor.uniqResult(BEAObject,
type := "match",
+input,
pattern := this,
+mapping);
}
}
beaConcept BMatch {
new Ref pattern;
new Ref input;
SS mapping;
}
beaConcept BMatchToScenario {
void reactWith(BMatch match, IBEAReactor reactor) {
reactor.uniqResult(BEAObject,
type := "scenario",
text := mapToLines(match.mapping,
(a, b) -> format_curly("* is a *.", b, a));
}
}
beaConcept BScenarioToOutput {
bool canReactWith(BEAObject o) {
ret o.typeIs("scenario");
}
void reactWith(BEAObject scenario, IBEAReactor reactor) {
reactor.uniqResult(BOutput,
type := "Output",
text := scenario~.text);
}
}
beaConcept BFeedback {
new Ref on;
S text;
}
cmodule2 > DynBEAReactor_textInOut {
{ input = "UBports community delivers 'second-largest release of Ubuntu Touch ever'"; }
transient JButton btnSaveAsPattern;
start {
crud.showClassNameSelectors = true;
crud.allowNewFields = true;
crud.emptyStringsToNull = true;
crud.humanizeFieldNames = false;
dm_watchField input(r updateButtons);
}
void createInitialObjects {
uniq BMatchToScenario();
uniq BScenarioToOutput();
//uniq BPattern(text := "* delivers *");
uniq BAngleVarPattern(text := " delivers ");
}
afterVisualize {
JConceptsTable ct = new(BMatch);
ct.humanizeFieldNames = false;
ct.itemToMap_inner2 = m -> litorderedmap(
input := m.input,
pattern := m.pattern,
mapping := m.mapping);
addTab(bottomTabs, "Matches", withRightAlignedButtons(ct,
tableDependentButton(ct.table(), rThreadEnter {
addFeedbackDialog(ct.selected());
})));
addComponent(inputButtons, btnSaveAsPattern = jThreadedButton("Save as pattern", r saveInputAsPattern));
updateButtons();
}
void saveInputAsPattern {
uniq(BAngleVarPattern, text := trim(input));
}
void updateButtons {
setEnabled(btnSaveAsPattern, containsAngleBracketVars(input));
}
void addFeedbackDialog(BEAObject item) {
}
}