private BIMethod(Environment env) throws TemplateException { TemplateModel model = target.eval(env); m_seq = model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model) ? (TemplateSequenceModel) model : null; // In 2.3.x only, we deny the possibility of collection // access if there's sequence access. This is so to minimize // the change of compatibility issues; without this, objects // that implement both the sequence and collection interfaces // would suddenly start using the collection interface, and if // that's buggy that would surface now, breaking the application // that despite its bugs has worked earlier. m_col = m_seq == null && model instanceof TemplateCollectionModel ? (TemplateCollectionModel) model : null; if (m_seq == null && m_col == null) { throw new NonSequenceOrCollectionException(target, model, env); } m_env = env; }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model, env); } else if (model instanceof TemplateSequenceModel) { return calculateResultForSequence((TemplateSequenceModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return new BIMethodForSequence((TemplateSequenceModel) model, env); } else if (model instanceof TemplateCollectionModel) { return new BIMethodForCollection((TemplateCollectionModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return calculateResultForSequence((TemplateSequenceModel) model); } else if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { if (model instanceof RightUnboundedRangeModel) { throw new _TemplateModelException( "The sequence to join was right-unbounded numerical range, thus it's infinitely long."); } return new BIMethodForCollection(env, (TemplateCollectionModel) model); } else if (model instanceof TemplateSequenceModel) { return new BIMethodForCollection(env, new CollectionAndSequence((TemplateSequenceModel) model)); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return model; } if (!(model instanceof TemplateCollectionModel)) { throw new NonSequenceOrCollectionException(target, model, env); } TemplateCollectionModel coll = (TemplateCollectionModel) model; SimpleSequence seq = coll instanceof TemplateCollectionModelEx ? new SimpleSequence(((TemplateCollectionModelEx) coll).size()) : new SimpleSequence(); for (TemplateModelIterator iter = coll.iterator(); iter.hasNext(); ) { seq.add(iter.next()); } return seq; }
throw new NonSequenceOrCollectionException(env, new _ErrorDescriptionBuilder("The value you try to list is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(listedValue)), )); } else { throw new NonSequenceOrCollectionException( listedExp, listedValue, env);
throw new NonSequenceOrCollectionException(env, new _ErrorDescriptionBuilder("The value you try to list is ", new _DelayedAOrAn(new _DelayedFTLTypeDescription(listedValue)),
private BIMethod(Environment env) throws TemplateException { TemplateModel model = target.eval(env); m_seq = model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model) ? (TemplateSequenceModel) model : null; // In 2.3.x only, we deny the possibility of collection // access if there's sequence access. This is so to minimize // the change of compatibility issues; without this, objects // that implement both the sequence and collection interfaces // would suddenly start using the collection interface, and if // that's buggy that would surface now, breaking the application // that despite its bugs has worked earlier. m_col = m_seq == null && model instanceof TemplateCollectionModel ? (TemplateCollectionModel) model : null; if (m_seq == null && m_col == null) { throw new NonSequenceOrCollectionException(target, model, env); } m_env = env; }
private BIMethod(Environment env) throws TemplateException { TemplateModel model = target.eval(env); m_seq = model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model) ? (TemplateSequenceModel) model : null; // In 2.3.x only, we deny the possibility of collection // access if there's sequence access. This is so to minimize // the change of compatibility issues; without this, objects // that implement both the sequence and collection interfaces // would suddenly start using the collection interface, and if // that's buggy that would surface now, breaking the application // that despite its bugs has worked earlier. m_col = m_seq == null && model instanceof TemplateCollectionModel ? (TemplateCollectionModel) model : null; if (m_seq == null && m_col == null) { throw new NonSequenceOrCollectionException(target, model, env); } m_env = env; }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model, env); } else if (model instanceof TemplateSequenceModel) { return calculateResultForSequence((TemplateSequenceModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return new BIMethodForSequence((TemplateSequenceModel) model, env); } else if (model instanceof TemplateCollectionModel) { return new BIMethodForCollection((TemplateCollectionModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return calculateResultForSequence((TemplateSequenceModel) model); } else if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model, env); } else if (model instanceof TemplateSequenceModel) { return calculateResultForSequence((TemplateSequenceModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return calculateResultForSequence((TemplateSequenceModel) model); } else if (model instanceof TemplateCollectionModel) { return calculateResultForColletion((TemplateCollectionModel) model); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); // In 2.3.x only, we prefer TemplateSequenceModel for // backward compatibility. In 2.4.x, we prefer TemplateCollectionModel. if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return new BIMethodForSequence((TemplateSequenceModel) model, env); } else if (model instanceof TemplateCollectionModel) { return new BIMethodForCollection((TemplateCollectionModel) model, env); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { if (model instanceof RightUnboundedRangeModel) { throw new _TemplateModelException( "The sequence to join was right-unbounded numerical range, thus it's infinitely long."); } return new BIMethodForCollection(env, (TemplateCollectionModel) model); } else if (model instanceof TemplateSequenceModel) { return new BIMethodForCollection(env, new CollectionAndSequence((TemplateSequenceModel) model)); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateCollectionModel) { if (model instanceof RightUnboundedRangeModel) { throw new _TemplateModelException( "The sequence to join was right-unbounded numerical range, thus it's infinitely long."); } return new BIMethodForCollection(env, (TemplateCollectionModel) model); } else if (model instanceof TemplateSequenceModel) { return new BIMethodForCollection(env, new CollectionAndSequence((TemplateSequenceModel) model)); } else { throw new NonSequenceOrCollectionException(target, model, env); } }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return model; } if (!(model instanceof TemplateCollectionModel)) { throw new NonSequenceOrCollectionException(target, model, env); } TemplateCollectionModel coll = (TemplateCollectionModel) model; SimpleSequence seq = coll instanceof TemplateCollectionModelEx ? new SimpleSequence(((TemplateCollectionModelEx) coll).size()) : new SimpleSequence(); for (TemplateModelIterator iter = coll.iterator(); iter.hasNext(); ) { seq.add(iter.next()); } return seq; }
@Override TemplateModel _eval(Environment env) throws TemplateException { TemplateModel model = target.eval(env); if (model instanceof TemplateSequenceModel && !isBuggySeqButGoodCollection(model)) { return model; } if (!(model instanceof TemplateCollectionModel)) { throw new NonSequenceOrCollectionException(target, model, env); } TemplateCollectionModel coll = (TemplateCollectionModel) model; SimpleSequence seq = coll instanceof TemplateCollectionModelEx ? new SimpleSequence(((TemplateCollectionModelEx) coll).size()) : new SimpleSequence(); for (TemplateModelIterator iter = coll.iterator(); iter.hasNext(); ) { seq.add(iter.next()); } return seq; }