@Test(expected = IllegalArgumentException.class) public void testSplitProposition_3() throws HmxException { this.modelHandler.splitProposition(this.pericope.getPropositionAt(0), this.pericope.getPropositionAt(1).getItems().get(0)); }
@Override public void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart) throws HmxException { final List<ClauseItem> firstPartItems = target.getItems(); if (!CollectionUtil.containsInstance(firstPartItems, lastItemInFirstPart)) { throw new IllegalArgumentException(); } final int lastItemIndex = CollectionUtil.indexOfInstance(firstPartItems, lastItemInFirstPart); if (lastItemIndex + 1 < firstPartItems.size()) { final List<ClauseItem> secondPartItems = new ArrayList<>(firstPartItems.subList(lastItemIndex + 1, firstPartItems.size())); target.removeClauseItems(secondPartItems); final List<Proposition> laterChildren = target.getLaterChildren(); target.setLaterChildren(null); final Proposition secondPart = new Proposition(target.getParent(), secondPartItems); secondPart.setLaterChildren(laterChildren); this.handleRelationsWhenSplittingProposition(target, secondPart); final Proposition partAfterArrow = target.getPartAfterArrow(); target.setPartAfterArrow(null); secondPart.setPartAfterArrow(partAfterArrow); target.getParent().insertChildPropositionAfterPrior(secondPart, target); this.notifyListeners(this.getModel(), false); return; } final Proposition partAfterArrow = target.getPartAfterArrow(); if (partAfterArrow == null) { throw new HmxException(HmxMessage.ERROR_SPLIT_PROP); } AbstractConnectable currentFocus = partAfterArrow.getFollowingConnectableProposition(); if (currentFocus != null) { Relation superOrdinated; while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) { if (currentFocus != superOrdinated.getAssociates().get(0)) { superOrdinated.kill(); break; } currentFocus = superOrdinated; } } target.setPartAfterArrow(null); target.getParent().insertChildPropositionAfterPrior(partAfterArrow, target); this.notifyListeners(this.getModel(), false); }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart) throws HmxException { final List<ClauseItem> firstPartItems = target.getItems(); if (!CollectionUtil.containsInstance(firstPartItems, lastItemInFirstPart)) { throw new IllegalArgumentException(); } final int lastItemIndex = CollectionUtil.indexOfInstance(firstPartItems, lastItemInFirstPart); if (lastItemIndex + 1 < firstPartItems.size()) { final List<ClauseItem> secondPartItems = new ArrayList<>(firstPartItems.subList(lastItemIndex + 1, firstPartItems.size())); target.removeClauseItems(secondPartItems); final List<Proposition> laterChildren = target.getLaterChildren(); target.setLaterChildren(null); final Proposition secondPart = new Proposition(target.getParent(), secondPartItems); secondPart.setLaterChildren(laterChildren); this.handleRelationsWhenSplittingProposition(target, secondPart); final Proposition partAfterArrow = target.getPartAfterArrow(); target.setPartAfterArrow(null); secondPart.setPartAfterArrow(partAfterArrow); target.getParent().insertChildPropositionAfterPrior(secondPart, target); this.notifyListeners(this.getModel(), false); return; } final Proposition partAfterArrow = target.getPartAfterArrow(); if (partAfterArrow == null) { throw new HmxException(HmxMessage.ERROR_SPLIT_PROP); } AbstractConnectable currentFocus = partAfterArrow.getFollowingConnectableProposition(); if (currentFocus != null) { Relation superOrdinated; while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) { if (currentFocus != superOrdinated.getAssociates().get(0)) { superOrdinated.kill(); break; } currentFocus = superOrdinated; } } target.setPartAfterArrow(null); target.getParent().insertChildPropositionAfterPrior(partAfterArrow, target); this.notifyListeners(this.getModel(), false); } }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart) throws HmxException { final List<ClauseItem> firstPartItems = target.getItems(); if (!CollectionUtil.containsInstance(firstPartItems, lastItemInFirstPart)) { throw new IllegalArgumentException(); } final int lastItemIndex = CollectionUtil.indexOfInstance(firstPartItems, lastItemInFirstPart); if (lastItemIndex + 1 < firstPartItems.size()) { final List<ClauseItem> secondPartItems = new ArrayList<>(firstPartItems.subList(lastItemIndex + 1, firstPartItems.size())); target.removeClauseItems(secondPartItems); final List<Proposition> laterChildren = target.getLaterChildren(); target.setLaterChildren(null); final Proposition secondPart = new Proposition(target.getParent(), secondPartItems); secondPart.setLaterChildren(laterChildren); this.handleRelationsWhenSplittingProposition(target, secondPart); final Proposition partAfterArrow = target.getPartAfterArrow(); target.setPartAfterArrow(null); secondPart.setPartAfterArrow(partAfterArrow); target.getParent().insertChildPropositionAfterPrior(secondPart, target); this.notifyListeners(this.getModel(), false); return; } final Proposition partAfterArrow = target.getPartAfterArrow(); if (partAfterArrow == null) { throw new HmxException(HmxMessage.ERROR_SPLIT_PROP); } AbstractConnectable currentFocus = partAfterArrow.getFollowingConnectableProposition(); if (currentFocus != null) { Relation superOrdinated; while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) { if (currentFocus != superOrdinated.getAssociates().get(0)) { superOrdinated.kill(); break; } currentFocus = superOrdinated; } } target.setPartAfterArrow(null); target.getParent().insertChildPropositionAfterPrior(partAfterArrow, target); this.notifyListeners(this.getModel(), false); } ModelHandlerImpl(final Pericope model); }
ModelHandlerImpl extends AbstractModelHandler<Pericope> implements HmxModelHandler { @Override public void splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart) throws HmxException { final List<ClauseItem> firstPartItems = target.getItems(); if (!CollectionUtil.containsInstance(firstPartItems, lastItemInFirstPart)) { throw new IllegalArgumentException(); } final int lastItemIndex = CollectionUtil.indexOfInstance(firstPartItems, lastItemInFirstPart); if (lastItemIndex + 1 < firstPartItems.size()) { final List<ClauseItem> secondPartItems = new ArrayList<>(firstPartItems.subList(lastItemIndex + 1, firstPartItems.size())); target.removeClauseItems(secondPartItems); final List<Proposition> laterChildren = target.getLaterChildren(); target.setLaterChildren(null); final Proposition secondPart = new Proposition(target.getParent(), secondPartItems); secondPart.setLaterChildren(laterChildren); this.handleRelationsWhenSplittingProposition(target, secondPart); final Proposition partAfterArrow = target.getPartAfterArrow(); target.setPartAfterArrow(null); secondPart.setPartAfterArrow(partAfterArrow); target.getParent().insertChildPropositionAfterPrior(secondPart, target); this.notifyListeners(this.getModel(), false); return; } final Proposition partAfterArrow = target.getPartAfterArrow(); if (partAfterArrow == null) { throw new HmxException(HmxMessage.ERROR_SPLIT_PROP); } AbstractConnectable currentFocus = partAfterArrow.getFollowingConnectableProposition(); if (currentFocus != null) { Relation superOrdinated; while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) { if (currentFocus != superOrdinated.getAssociates().get(0)) { superOrdinated.kill(); break; } currentFocus = superOrdinated; } } target.setPartAfterArrow(null); target.getParent().insertChildPropositionAfterPrior(partAfterArrow, target); 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 splitProposition(final Proposition target, final ClauseItem lastItemInFirstPart) throws HmxException { final List<ClauseItem> firstPartItems = target.getItems(); if (!CollectionUtil.containsInstance(firstPartItems, lastItemInFirstPart)) { throw new IllegalArgumentException(); } final int lastItemIndex = CollectionUtil.indexOfInstance(firstPartItems, lastItemInFirstPart); if (lastItemIndex + 1 < firstPartItems.size()) { final List<ClauseItem> secondPartItems = new ArrayList<>(firstPartItems.subList(lastItemIndex + 1, firstPartItems.size())); target.removeClauseItems(secondPartItems); final List<Proposition> laterChildren = target.getLaterChildren(); target.setLaterChildren(null); final Proposition secondPart = new Proposition(target.getParent(), secondPartItems); secondPart.setLaterChildren(laterChildren); this.handleRelationsWhenSplittingProposition(target, secondPart); final Proposition partAfterArrow = target.getPartAfterArrow(); target.setPartAfterArrow(null); secondPart.setPartAfterArrow(partAfterArrow); target.getParent().insertChildPropositionAfterPrior(secondPart, target); this.notifyListeners(this.getModel(), false); return; } final Proposition partAfterArrow = target.getPartAfterArrow(); if (partAfterArrow == null) { throw new HmxException(HmxMessage.ERROR_SPLIT_PROP); } AbstractConnectable currentFocus = partAfterArrow.getFollowingConnectableProposition(); if (currentFocus != null) { Relation superOrdinated; while ((superOrdinated = currentFocus.getSuperOrdinatedRelation()) != null) { if (currentFocus != superOrdinated.getAssociates().get(0)) { superOrdinated.kill(); break; } currentFocus = superOrdinated; } } target.setPartAfterArrow(null); target.getParent().insertChildPropositionAfterPrior(partAfterArrow, target); 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);  }