private boolean link_(long from, long to) { // nice("LINK " + from + ":" + to + " ::: " + name + " : " // + trees.str(left)); Numbers leftLinks = leftNums(from); if (leftLinks.contains(to)) { return false; } // nice("LINK2 " + from + ":" + to + " ::: " + name + // " : " + trees.str(left)); Check.state(manyTos || leftLinks.size() == 0, "The ?-to-one relation %s already has link from %s", name, from); leftLinks = leftLinks.with(to); left.put(from, leftLinks); Numbers rightLinks = rightNums(to); if (!symmetric) { assert !rightLinks.contains(from); } Check.state(manyFroms || rightLinks.size() == 0, "The one-to-? relation %s already has link to %s", name, to); rightLinks = rightLinks.with(from); rightish().put(to, rightLinks); return true; }
private boolean link_(long from, long to) { // nice("LINK " + from + ":" + to + " ::: " + name + " : " // + trees.str(left)); Numbers leftLinks = leftNums(from); if (leftLinks.contains(to)) { return false; } // nice("LINK2 " + from + ":" + to + " ::: " + name + // " : " + trees.str(left)); Check.state(manyTos || leftLinks.size() == 0, "The ?-to-one relation %s already has link from %s", name, from); leftLinks = leftLinks.with(to); left.put(from, leftLinks); Numbers rightLinks = rightNums(to); if (!symmetric) { assert !rightLinks.contains(from); } Check.state(manyFroms || rightLinks.size() == 0, "The one-to-? relation %s already has link to %s", name, to); rightLinks = rightLinks.with(from); rightish().put(to, rightLinks); return true; }
private boolean link_(long from, long to) { // nice("LINK " + from + ":" + to + " ::: " + name + " : " // + trees.str(left)); Numbers leftLinks = leftNums(from); if (leftLinks.contains(to)) { return false; } // nice("LINK2 " + from + ":" + to + " ::: " + name + // " : " + trees.str(left)); Check.state(manyTos || leftLinks.size() == 0, "The ?-to-one relation %s already has link from %s", name, from); leftLinks = leftLinks.with(to); left.put(from, leftLinks); Numbers rightLinks = rightNums(to); if (!symmetric) { assert !rightLinks.contains(from); } Check.state(manyFroms || rightLinks.size() == 0, "The one-to-? relation %s already has link to %s", name, to); rightLinks = rightLinks.with(from); rightish().put(to, rightLinks); return true; }