use of catdata.Unit in project fql by CategoricalData.
the class SpellChecker method parse.
@Override
public ParseResult parse(RSyntaxDocument doc1, String style) {
boolean spNow = IdeOptions.theCurrentOptions.getBool(IdeOption.SPELL_CHECK);
if (spNow != spPrev) {
spPrev = spNow;
result.clearNotices();
return parse(doc1, style);
}
spPrev = spNow;
doc = doc1;
Element root = doc.getDefaultRootElement();
int lineCount = root.getElementCount();
result.clearNotices();
result.setParsedLines(0, lineCount - 1);
if (!spNow) {
return result;
}
// try {
for (Token t : doc) {
if (t.isComment()) {
int startOffs = t.getOffset();
String comment = t.getLexeme();
Matcher matcher = pattern.matcher(comment);
while (matcher.find()) {
String word = matcher.group();
String word2 = word.toLowerCase().replaceAll("[^a-z ]", "");
if (word2.length() > 0 && !getWords().contains(word2) && !local.apply(new Unit()).contains(word.replace("`", "").replaceAll("\"", "").replaceAll(".", "").replaceAll(",", "").replaceAll(":", ""))) {
spellingError(word, startOffs + matcher.start());
}
}
}
}
return result;
}
use of catdata.Unit in project fql by CategoricalData.
the class MplDriver method makeEnv.
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Environment<MplObject> makeEnv(@SuppressWarnings("unused") String str, Program<MplExp<String, String>> init) {
Environment<MplObject> ret = new Environment<>();
for (String k : init.order) {
MplExp se = init.exps.get(k);
try {
MplObject xxx = (MplObject) se.accept(new Unit(), new MplOps(ret));
ret.put(k, xxx);
} catch (Throwable t) {
t.printStackTrace();
throw new LineException(t.getLocalizedMessage(), k, "");
}
}
return ret;
}
use of catdata.Unit in project fql by CategoricalData.
the class Constraints method triggers.
public <X, Y, Gen, Sk> Collection<Pair<ED<Ty, En, Sym, Fk, Att>, Row<WHICH, X>>> triggers(Instance<Ty, En, Sym, Fk, Att, Gen, Sk, X, Y> I, AqlOptions options) {
Collection<Pair<ED<Ty, En, Sym, Fk, Att>, Row<WHICH, X>>> T = new LinkedList<>();
for (ED<Ty, En, Sym, Fk, Att> ed : eds) {
Query<Ty, En, Sym, Fk, Att, WHICH, Unit, Void> Q = ed.Q;
EvalInstance<Ty, En, Sym, Fk, Att, Gen, Sk, WHICH, Unit, Void, X, Y> QI = new EvalInstance<>(Q, I, options);
outer: for (Row<WHICH, X> e : QI.algebra().en(WHICH.FRONT)) {
for (Row<WHICH, X> a : QI.algebra().en(WHICH.BACK)) {
if (QI.algebra().fk(new Unit(), a).equals(e)) {
continue outer;
}
}
T.add(new Pair<>(ed, e));
}
}
return T;
}
use of catdata.Unit in project fql by CategoricalData.
the class XOptions method display.
// @Override
@Override
public Pair<JComponent, Function<Unit, Unit>> display() {
JSplitPane generalsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
JPanel x_1 = new JPanel(new GridLayout(Options.biggestSize, 1));
JPanel x_2 = new JPanel(new GridLayout(Options.biggestSize, 1));
generalsplit.add(x_1);
generalsplit.add(x_2);
JCheckBox reorder_joins_box = new JCheckBox("", reorder_joins);
JLabel reorder_joins_label = new JLabel("Re-order FROM clauses:");
x_1.add(reorder_joins_label);
x_2.add(reorder_joins_box);
JCheckBox fast_amalgams_box = new JCheckBox("", fast_amalgams);
JLabel fast_amalgams_label = new JLabel("Use fast amalgams on saturated presentations:");
x_1.add(fast_amalgams_label);
x_2.add(fast_amalgams_box);
JCheckBox validate_amalgams_box = new JCheckBox("", validate_amalgams);
JLabel validate_amalgams_label = new JLabel("Validate amalgams (if validating categories):");
x_1.add(validate_amalgams_label);
x_2.add(validate_amalgams_box);
JCheckBox x_typing_box = new JCheckBox("", x_typing);
JLabel typing_label = new JLabel("Type check:");
x_1.add(typing_label);
x_2.add(x_typing_box);
JTextField x_path_length_box = new JTextField(Integer.toString(MAX_PATH_LENGTH), 12);
JLabel x_path_length_label = new JLabel("Max path length:");
x_2.add(wrap(x_path_length_box));
x_1.add(x_path_length_label);
JPanel xArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
JCheckBox x_cat_box = new JCheckBox("Cat", x_cat);
JCheckBox x_graph_box = new JCheckBox("Graph", x_graph);
JCheckBox x_textual_box = new JCheckBox("Text", x_text);
JCheckBox x_tabular_box = new JCheckBox("Table", x_tables);
JCheckBox x_adom_box = new JCheckBox("ADom", x_adom);
JCheckBox x_elem_box = new JCheckBox("Elements", x_elements);
JCheckBox x_json_box = new JCheckBox("JSON", x_json);
xArea.add(x_textual_box);
xArea.add(x_graph_box);
xArea.add(x_cat_box);
xArea.add(x_tabular_box);
xArea.add(x_adom_box);
xArea.add(x_elem_box);
xArea.add(x_json_box);
x_1.add(new JLabel("Viewers:"));
x_2.add(xArea);
for (int i = 0; i < Options.biggestSize - size(); i++) {
x_1.add(new JLabel());
x_2.add(new JLabel());
}
Function<Unit, Unit> fn = (Unit t) -> {
int mpl = MAX_PATH_LENGTH;
try {
try {
mpl = Integer.parseInt(x_path_length_box.getText());
} catch (NumberFormatException nfe) {
}
if (mpl < 1) {
mpl = MAX_PATH_LENGTH;
}
} catch (NumberFormatException nfe) {
}
MAX_PATH_LENGTH = mpl;
x_adom = x_adom_box.isSelected();
x_cat = x_cat_box.isSelected();
x_graph = x_graph_box.isSelected();
x_tables = x_tabular_box.isSelected();
x_adom = x_adom_box.isSelected();
fast_amalgams = fast_amalgams_box.isSelected();
validate_amalgams = validate_amalgams_box.isSelected();
reorder_joins = reorder_joins_box.isSelected();
x_typing = x_typing_box.isSelected();
x_elements = x_elem_box.isSelected();
x_json = x_json_box.isSelected();
return new Unit();
};
return new Pair<>(generalsplit, fn);
}
use of catdata.Unit in project fql by CategoricalData.
the class XProd method subst2.
public static <C> List subst2(String yyy, List<String> eq, Map<String, Triple<C, C, List<C>>> tuple, Set<String> keys, Set xxx) {
List ret = (List) eq.stream().flatMap(x -> {
List l = new LinkedList<>();
if (x.equals("!__Q")) {
l.add(yyy);
return l.stream();
}
if (tuple.containsKey(x)) {
l.add(yyy);
l.add(tuple.get(x).first);
l.addAll(tuple.get(x).third);
return l.stream();
} else if (keys.contains(x)) {
l.add(x);
xxx.add(new Unit());
return l.stream();
} else {
l.add(x);
return l.stream();
}
}).collect(Collectors.toList());
return ret;
}
Aggregations