@Override public INode getSubByYesNo(Speaker speaker, String yesNo) { if (speaker.isNo(yesNo)) { return this.getNoBranch(); } if (speaker.isYes(yesNo)) { return this.getYesBranch(); } return this; // To change body of implemented methods use File | Settings | File Templates. }
@Override public INode learn(Speaker speaker, Memoizer memoizer) { String head = memoizer.consumeHead(); if (speaker.isNo(head)) return new NonLeafNode( this.getYesBranch(), this.getQuestion(), this.getNoBranch().learn(speaker, memoizer)); if (speaker.isYes(head)) return new NonLeafNode( this.getYesBranch().learn(speaker, memoizer), this.getQuestion(), this.getNoBranch()); return null; }