@Test public void testIndentPropositionUnderParent_7() throws HmxException { final Proposition first = this.pericope.getPropositionAt(0); final Proposition second = this.pericope.getPropositionAt(1); final Proposition third = this.pericope.getPropositionAt(2); final Proposition fourth = this.pericope.getPropositionAt(3); final SyntacticalFunction function = (SyntacticalFunction) ModelHandlerImplTest.languageModel.provideFunctions().get(0).get(0); this.modelHandler.indentPropositionUnderParent(second, first, function); this.modelHandler.indentPropositionUnderParent(third, fourth, function); this.modelHandler.indentPropositionUnderParent(third, second, function); Assert.assertEquals(1, first.getLaterChildren().size()); Assert.assertSame(second, first.getLaterChildren().get(0)); Assert.assertEquals(1, second.getLaterChildren().size()); Assert.assertSame(third, second.getLaterChildren().get(0)); Assert.assertTrue(fourth.getPriorChildren().isEmpty()); }
@Override public void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function) throws HmxException { final IPropositionParent formerParent = target.getParent(); Proposition parentPart = parent; do { if (formerParent == parentPart) { this.setSyntacticalFunction(target, function); return; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (formerParent == parent.getParent()) { final List<Proposition> containingList = formerParent.getContainingList(target); final int posTarget = CollectionUtil.indexOfInstance(containingList, target); final int posParent = CollectionUtil.indexOfInstance(containingList, parent); if (posParent == -1 || Math.abs(posTarget - posParent) != 1) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); formerParent.removeChildProposition(target); if (posTarget < posParent) { parent.addFirstPriorChild(target); } else { parent.getLastPart().addLastLaterChild(target); } this.notifyListeners(this.getModel(), false); return; } IPropositionParent checkParent = parent.getParent(); while (checkParent instanceof Proposition) { if (checkParent == target) { throw new HmxException(HmxMessage.ERROR_INDENT_UNDER_OWN_CHILD); } checkParent = ((Proposition) checkParent).getParent(); } parentPart = parent; do { if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(target, parentPart)) { formerParent.removeChildProposition(target); parentPart.addLastPriorChild(target); break; } else if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(parentPart, target)) { if (parentPart.getPartAfterArrow() == null) { formerParent.removeChildProposition(target); parentPart.addFirstLaterChild(target); } else { formerParent.removeChildProposition(target); parentPart.getPartAfterArrow().addFirstPriorChild(target); } break; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (parentPart == null) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); this.notifyListeners(this.getModel(), false); }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function) throws HmxException { final IPropositionParent formerParent = target.getParent(); Proposition parentPart = parent; do { if (formerParent == parentPart) { this.setSyntacticalFunction(target, function); return; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (formerParent == parent.getParent()) { final List<Proposition> containingList = formerParent.getContainingList(target); final int posTarget = CollectionUtil.indexOfInstance(containingList, target); final int posParent = CollectionUtil.indexOfInstance(containingList, parent); if (posParent == -1 || Math.abs(posTarget - posParent) != 1) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); formerParent.removeChildProposition(target); if (posTarget < posParent) { parent.addFirstPriorChild(target); } else { parent.getLastPart().addLastLaterChild(target); } this.notifyListeners(this.getModel(), false); return; } IPropositionParent checkParent = parent.getParent(); while (checkParent instanceof Proposition) { if (checkParent == target) { throw new HmxException(HmxMessage.ERROR_INDENT_UNDER_OWN_CHILD); } checkParent = ((Proposition) checkParent).getParent(); } parentPart = parent; do { if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(target, parentPart)) { formerParent.removeChildProposition(target); parentPart.addLastPriorChild(target); break; } else if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(parentPart, target)) { if (parentPart.getPartAfterArrow() == null) { formerParent.removeChildProposition(target); parentPart.addFirstLaterChild(target); } else { formerParent.removeChildProposition(target); parentPart.getPartAfterArrow().addFirstPriorChild(target); } break; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (parentPart == null) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); this.notifyListeners(this.getModel(), false); } }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function) throws HmxException { final IPropositionParent formerParent = target.getParent(); Proposition parentPart = parent; do { if (formerParent == parentPart) { this.setSyntacticalFunction(target, function); return; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (formerParent == parent.getParent()) { final List<Proposition> containingList = formerParent.getContainingList(target); final int posTarget = CollectionUtil.indexOfInstance(containingList, target); final int posParent = CollectionUtil.indexOfInstance(containingList, parent); if (posParent == -1 || Math.abs(posTarget - posParent) != 1) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); formerParent.removeChildProposition(target); if (posTarget < posParent) { parent.addFirstPriorChild(target); } else { parent.getLastPart().addLastLaterChild(target); } this.notifyListeners(this.getModel(), false); return; } IPropositionParent checkParent = parent.getParent(); while (checkParent instanceof Proposition) { if (checkParent == target) { throw new HmxException(HmxMessage.ERROR_INDENT_UNDER_OWN_CHILD); } checkParent = ((Proposition) checkParent).getParent(); } parentPart = parent; do { if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(target, parentPart)) { formerParent.removeChildProposition(target); parentPart.addLastPriorChild(target); break; } else if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(parentPart, target)) { if (parentPart.getPartAfterArrow() == null) { formerParent.removeChildProposition(target); parentPart.addFirstLaterChild(target); } else { formerParent.removeChildProposition(target); parentPart.getPartAfterArrow().addFirstPriorChild(target); } break; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (parentPart == null) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); this.notifyListeners(this.getModel(), false); } ModelHandlerImpl(final Pericope model); }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function) throws HmxException { final IPropositionParent formerParent = target.getParent(); Proposition parentPart = parent; do { if (formerParent == parentPart) { this.setSyntacticalFunction(target, function); return; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (formerParent == parent.getParent()) { final List<Proposition> containingList = formerParent.getContainingList(target); final int posTarget = CollectionUtil.indexOfInstance(containingList, target); final int posParent = CollectionUtil.indexOfInstance(containingList, parent); if (posParent == -1 || Math.abs(posTarget - posParent) != 1) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); formerParent.removeChildProposition(target); if (posTarget < posParent) { parent.addFirstPriorChild(target); } else { parent.getLastPart().addLastLaterChild(target); } this.notifyListeners(this.getModel(), false); return; } IPropositionParent checkParent = parent.getParent(); while (checkParent instanceof Proposition) { if (checkParent == target) { throw new HmxException(HmxMessage.ERROR_INDENT_UNDER_OWN_CHILD); } checkParent = ((Proposition) checkParent).getParent(); } parentPart = parent; do { if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(target, parentPart)) { formerParent.removeChildProposition(target); parentPart.addLastPriorChild(target); break; } else if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(parentPart, target)) { if (parentPart.getPartAfterArrow() == null) { formerParent.removeChildProposition(target); parentPart.addFirstLaterChild(target); } else { formerParent.removeChildProposition(target); parentPart.getPartAfterArrow().addFirstPriorChild(target); } break; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (parentPart == null) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); this.notifyListeners(this.getModel(), false); } ModelHandlerImpl(final Pericope model); @Override void resetModel(final Pericope model); @Override void setMetaData(final String title, final String author, final String comment, final String originTextFontFamily,
            final int originTextFontSize); @Override void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function); @Override void removeOneIndentation(final Proposition target); @Override boolean removeOneIndentationAffectsOthers(final Proposition target); @Override void mergePropositions(final Proposition prop1, final Proposition prop2); @Override void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart); @Override void resetStandaloneStateOfPartAfterArrow(final Proposition partAfterArrow); @Override void mergeClauseItemWithPrior(final ClauseItem itemTwo); @Override void mergeClauseItemWithFollower(final ClauseItem itemOne); @Override void splitClauseItem(final ClauseItem target, final String firstPart); @Override void setLabelText(final Proposition target, final String labelText); @Override void setSynTranslation(final Proposition target, final String synTranslation); @Override void setSemTranslation(final Proposition target, final String semTranslation); @Override void setComment(final ICommentable target, final String comment); @Override void setSyntacticalFunction(final ICanHaveSyntacticalFunction target, final SyntacticalFunction function); @Override void setClauseItemFontStyle(final ClauseItem target, final Style style); @Override void createRelation(final List<? extends AbstractConnectable> associates, final RelationTemplate template); @Override void rotateAssociateRoles(final Relation target); @Override void alterRelationType(final Relation target, final RelationTemplate template); @Override void removeRelation(final Relation target); @Override void addNewPropositions(final String originText, final boolean inFront); @Override void mergeWithOtherPericope(final Pericope otherPericope, final boolean inFront); @Override void removePropositions(final List<Proposition> targets); }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function) throws HmxException { final IPropositionParent formerParent = target.getParent(); Proposition parentPart = parent; do { if (formerParent == parentPart) { this.setSyntacticalFunction(target, function); return; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (formerParent == parent.getParent()) { final List<Proposition> containingList = formerParent.getContainingList(target); final int posTarget = CollectionUtil.indexOfInstance(containingList, target); final int posParent = CollectionUtil.indexOfInstance(containingList, parent); if (posParent == -1 || Math.abs(posTarget - posParent) != 1) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); formerParent.removeChildProposition(target); if (posTarget < posParent) { parent.addFirstPriorChild(target); } else { parent.getLastPart().addLastLaterChild(target); } this.notifyListeners(this.getModel(), false); return; } IPropositionParent checkParent = parent.getParent(); while (checkParent instanceof Proposition) { if (checkParent == target) { throw new HmxException(HmxMessage.ERROR_INDENT_UNDER_OWN_CHILD); } checkParent = ((Proposition) checkParent).getParent(); } parentPart = parent; do { if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(target, parentPart)) { formerParent.removeChildProposition(target); parentPart.addLastPriorChild(target); break; } else if (this.haveNoPropositionsInBetweenOnSameOrHigherLevel(parentPart, target)) { if (parentPart.getPartAfterArrow() == null) { formerParent.removeChildProposition(target); parentPart.addFirstLaterChild(target); } else { formerParent.removeChildProposition(target); parentPart.getPartAfterArrow().addFirstPriorChild(target); } break; } parentPart = parentPart.getPartAfterArrow(); } while (parentPart != null); if (parentPart == null) { throw new HmxException(HmxMessage.ERROR_INDENT); } target.setFunction(function); this.notifyListeners(this.getModel(), false); } ModelHandlerImpl(final Pericope model); @Override void resetModel(final Pericope model); @Override void setMetaData(final String title, final String author, final String comment, final String originTextFontFamily,
            final int originTextFontSize); @Override void indentPropositionUnderParent(final Proposition target, final Proposition parent, final SyntacticalFunction function); @Override void removeOneIndentation(final Proposition target); @Override boolean removeOneIndentationAffectsOthers(final Proposition target); @Override void mergePropositions(final Proposition prop1, final Proposition prop2); @Override void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart); @Override void resetStandaloneStateOfPartAfterArrow(final Proposition partAfterArrow); @Override void mergeClauseItemWithPrior(final ClauseItem itemTwo); @Override void mergeClauseItemWithFollower(final ClauseItem itemOne); @Override void splitClauseItem(final ClauseItem target, final String firstPart); @Override void setLabelText(final Proposition target, final String labelText); @Override void setSynTranslation(final Proposition target, final String synTranslation); @Override void setSemTranslation(final Proposition target, final String semTranslation); @Override void setComment(final ICommentable target, final String comment); @Override void setSyntacticalFunction(final ICanHaveSyntacticalFunction target, final SyntacticalFunction function); @Override void setClauseItemFontStyle(final ClauseItem target, final Style style); @Override void createRelation(final List<? extends AbstractConnectable> associates, final RelationTemplate template); @Override void rotateAssociateRoles(final Relation target); @Override void alterRelationType(final Relation target, final RelationTemplate template); @Override void removeRelation(final Relation target); @Override void addNewPropositions(final String originText, final boolean inFront); @Override void mergeWithOtherPericope(final Pericope otherPericope, final boolean inFront); @Override void removePropositions(final List<Proposition> targets);  }