Example usage for com.google.common.collect Lists newArrayListWithExpectedSize

List of usage examples for com.google.common.collect Lists newArrayListWithExpectedSize

Introduction

In this page you can find the example usage for com.google.common.collect Lists newArrayListWithExpectedSize.

Prototype

@GwtCompatible(serializable = true)
public static <E> ArrayList<E> newArrayListWithExpectedSize(int estimatedSize) 

Source Link

Document

Creates an ArrayList instance to hold estimatedSize elements, plus an unspecified amount of padding; you almost certainly mean to call #newArrayListWithCapacity (see that method for further advice on usage).

Usage

From source file:com.android.tools.idea.navigator.nodes.AndroidResFolderTypeNode.java

@NotNull
@Override/*from  w  ww  .j  a  v  a  2 s .co  m*/
public Collection<? extends AbstractTreeNode> getChildren() {
    // all resource folders of a given folder type
    List<PsiDirectory> folders = getValue();

    Multimap<String, PsiFile> multimap = HashMultimap.create();
    for (PsiDirectory res : folders) {
        for (PsiFile file : res.getFiles()) {
            String resName = file.getName();
            multimap.put(resName, file);
        }
    }

    List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(multimap.size());
    for (String resName : multimap.keySet()) {
        List<PsiFile> files = Lists.newArrayList(multimap.get(resName));
        if (files.size() > 1) {
            children.add(new AndroidResGroupNode(myProject, myFacet, files, resName, getSettings()));
        } else {
            children.add(new AndroidResFileNode(myProject, files.get(0), getSettings(), myFacet));
        }
    }
    return children;
}

From source file:com.isotrol.impe3.web20.client.content.counter.GreatestHitsComponent.java

public ComponentResponse execute() {
    final Pagination pag = new Pagination(config.pageSize(), null);
    listing = ContentListingPage.empty(pag);
    // Fetch resources
    final CounterFilterDTO filter = new CounterFilterDTO();
    filter.setCounterType(config.counterType());
    List<ResourceCounterDTO> resources;
    try {//from  ww  w . j a v a 2  s .co m
        resources = service.getGreatestHits("", filter, Math.max(1, config.pageSize()));
    } catch (ServiceException e) {
        // TODO log
        return ComponentResponse.OK;
    }
    if (resources == null || resources.isEmpty()) {
        // Nothing to do
        return ComponentResponse.OK;
    }
    // Turn resources into keys
    final List<ContentKey> keys = Lists.newArrayListWithExpectedSize(resources.size());
    for (ResourceCounterDTO resource : Iterables.filter(resources, Predicates.notNull())) {
        final ContentKey ck = r2ck(resource.getResource());
        if (ck != null) {
            keys.add(ck);
        }
    }
    if (keys.isEmpty()) {
        // Nothing to do
        return ComponentResponse.OK;
    }
    // Perform the search
    ContentCriteria cc = loader.newCriteria();
    cc.setBytes(true);
    Map<ContentKey, Content> map = loader.newCriteria().setBytes(true).getContents(keys);
    if (map.isEmpty()) {
        // Nothing found
        return ComponentResponse.OK;
    }
    // Turn to listing
    final List<Content> contents = Lists.newArrayListWithExpectedSize(keys.size());
    for (ContentKey ck : keys) {
        final Content c = map.get(ck);
        if (c != null) {
            contents.add(c);
        }
    }
    listing = new ContentListingPage(null, pag, contents);
    return ComponentResponse.OK;
}

From source file:org.apache.phoenix.mapreduce.index.DirectHTableWriter.java

public void write(List<Mutation> mutations) throws IOException, InterruptedException {
    Object[] results = new Object[mutations.size()];
    String txnIdStr = conf.get(PhoenixConfigurationUtil.TX_SCN_VALUE);
    if (txnIdStr == null) {
        table.batch(mutations, results);
    } else {//from  ww  w .  ja v a 2s.com
        long ts = Long.parseLong(txnIdStr);
        PhoenixTransactionProvider provider = TransactionFactory.Provider.getDefault().getTransactionProvider();
        String txnProviderStr = conf.get(PhoenixConfigurationUtil.TX_PROVIDER);
        if (txnProviderStr != null) {
            provider = TransactionFactory.Provider.valueOf(txnProviderStr).getTransactionProvider();
        }
        List<Mutation> shadowedMutations = Lists.newArrayListWithExpectedSize(mutations.size());
        for (Mutation m : mutations) {
            if (m instanceof Put) {
                shadowedMutations.add(provider.markPutAsCommitted((Put) m, ts, ts));
            }
        }
        table.batch(shadowedMutations, results);
    }
}

From source file:com.twitter.distributedlog.impl.ZKLogMetadataStore.java

@Override
public Future<Iterator<String>> getLogs() {
    final Promise<Iterator<String>> promise = new Promise<Iterator<String>>();
    final String nsRootPath = namespace.getPath();
    try {//ww w  .  j  av a  2 s . c  o m
        final ZooKeeper zk = zkc.get();
        zk.sync(nsRootPath, new AsyncCallback.VoidCallback() {
            @Override
            public void processResult(int syncRc, String syncPath, Object ctx) {
                if (KeeperException.Code.OK.intValue() == syncRc) {
                    zk.getChildren(nsRootPath, false, new AsyncCallback.Children2Callback() {
                        @Override
                        public void processResult(int rc, String path, Object ctx, List<String> children,
                                Stat stat) {
                            if (KeeperException.Code.OK.intValue() == rc) {
                                List<String> results = Lists.newArrayListWithExpectedSize(children.size());
                                for (String child : children) {
                                    if (!isReservedStreamName(child)) {
                                        results.add(child);
                                    }
                                }
                                promise.setValue(results.iterator());
                            } else if (KeeperException.Code.NONODE.intValue() == rc) {
                                List<String> streams = Lists.newLinkedList();
                                promise.setValue(streams.iterator());
                            } else {
                                promise.setException(new ZKException("Error reading namespace " + nsRootPath,
                                        KeeperException.Code.get(rc)));
                            }
                        }
                    }, null);
                } else if (KeeperException.Code.NONODE.intValue() == syncRc) {
                    List<String> streams = Lists.newLinkedList();
                    promise.setValue(streams.iterator());
                } else {
                    promise.setException(new ZKException("Error reading namespace " + nsRootPath,
                            KeeperException.Code.get(syncRc)));
                }
            }
        }, null);
        zkc.get();
    } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
        promise.setException(e);
    } catch (InterruptedException e) {
        promise.setException(e);
    }
    return promise;
}

From source file:ch.ethz.bsse.quasirecomb.model.Preprocessing.java

/**
 * Entry point. Forwards invokes of the specified workflow.
 *
 * @param input path to the fasta file//from w ww  . j  a v a  2 s. c  o m
 * @param Kmin minimal amount of generators
 * @param Kmax minimal amount of generators
 */
public static void workflow(String input, int Kmin, int Kmax) {
    Utils.mkdir(Globals.getINSTANCE().getSAVEPATH() + "support");
    //parse file
    StatusUpdate.getINSTANCE().print("Parsing");
    Read[] reads = Utils.parseInput(input);
    int L = fixAlignment(reads);
    if (L > 300 && Globals.getINSTANCE().getINTERPOLATE_MU() > 0) {
        Globals.getINSTANCE().setINTERPOLATE_MU(.5);
    }
    int[][] alignment = computeAlignment(reads, L);

    StatusUpdate.getINSTANCE().println("Paired reads\t" + Globals.getINSTANCE().getPAIRED_COUNT());
    computeInsertDist(reads);
    StatusUpdate.getINSTANCE().println("Merged reads\t" + Globals.getINSTANCE().getMERGED() + "\n");
    printAlignment(reads);
    circos(L, alignment);
    if (Globals.getINSTANCE().isDEBUG()) {
        new File(Globals.getINSTANCE().getSAVEPATH() + "support/log/").mkdirs();
    }
    int n = countChars(reads);
    Globals.getINSTANCE().setTAU_OMEGA(reads, L);

    int N = 0;
    for (Read r : reads) {
        if (r.getWatsonLength() > 0) {
            N += r.getCount();
        }
    }

    plot();

    if (Globals.getINSTANCE().isBOOTSTRAP()) {
        String[] truth = FastaParser.parseFarFile(Globals.getINSTANCE().getPRIOR());
        Multimap<Integer, Double> bics = ArrayListMultimap.create();
        List<Read> readList = Lists.newArrayListWithExpectedSize(N);
        int x = 0;
        for (Read r : reads) {
            int count = r.getCount();
            for (int i = 0; i < count; i++) {
                readList.add(new Read(r));
            }
            //                r.setCount(1);
        }
        //            for (Read r : reads) {
        //                Utils.appendFile(Globals.getINSTANCE().getSAVEPATH() + "pi_bootstrap_original.txt", + r.getCount() + "\n");
        //            }
        Read[] readArray = readList.toArray(new Read[readList.size()]);
        for (int i = 0; i < 100; i++) {
            StatusUpdate.getINSTANCE().println("Bootstrap " + i + "\n");
            Map<Integer, Read> hashed = new HashMap<>();
            Random rnd = new Random();
            for (int y = 0; y < N; y++) {
                Read r = readArray[rnd.nextInt(N)];
                int hash = r.hashCode();
                if (hashed.containsKey(hash)) {
                    hashed.get(hash).incCount();
                } else {
                    hashed.put(r.hashCode(), r);
                }
            }

            //                for (Read r : reads) {
            //                    Utils.appendFile(Globals.getINSTANCE().getSAVEPATH() + "pi_bootstrap_" + i + ".txt", (hashed.get(r.hashCode()) == null ? 0 : hashed.get(r.hashCode()).getCount()) + "\n");
            //                }
            Read[] rs = hashed.values().toArray(new Read[hashed.size()]);
            ModelSelection ms = new ModelSelection(rs, Kmin, Kmax, L, n);
            OptimalResult or = ms.getOptimalResult();
            double[] pi = new double[or.getPi()[0].length];
            double piSum = 0;
            for (int j = 0; j < or.getPi().length; j++) {
                for (int k = 0; k < or.getPi()[j].length; k++) {
                    pi[k] += or.getPi()[j][k];
                    piSum += or.getPi()[j][k];
                }
            }
            StringBuilder piSB = new StringBuilder();
            piSB.append(pi[0] / piSum);
            for (int k = 1; k < pi.length; k++) {
                piSB.append("\t");
                piSB.append(pi[k] / piSum);
            }
            new File(Globals.getINSTANCE().getSAVEPATH() + i).mkdirs();
            ModelSampling modelSampling = new ModelSampling(or,
                    Globals.getINSTANCE().getSAVEPATH() + i + File.separator);
            modelSampling.save();
            Map<String, Double> quasispecies = FastaParser.parseQuasispeciesFile(
                    Globals.getINSTANCE().getSAVEPATH() + i + File.separator + "quasispecies.fasta");

            double[] frequencies = new double[truth.length];
            for (Map.Entry<String, Double> e : quasispecies.entrySet()) {
                int distance = Integer.MAX_VALUE;
                int index = -1;
                for (int t = 0; t < truth.length; t++) {
                    int hamming = DistanceUtils.calcHamming(e.getKey(), truth[t]);
                    if (hamming < distance) {
                        index = t;
                        distance = hamming;
                    }
                }
                frequencies[index] += e.getValue();
            }

            StringBuilder fSB = new StringBuilder();
            fSB.append(frequencies[0]);
            for (int f = 1; f < frequencies.length; f++) {
                fSB.append("\t");
                fSB.append(frequencies[f]);
            }

            Utils.appendFile(Globals.getINSTANCE().getSAVEPATH() + "bootstrap.txt", fSB.toString() + "\n");

            Utils.appendFile(Globals.getINSTANCE().getSAVEPATH() + "pi_bootstrap.txt", piSB.toString() + "\n");

            bics.putAll(ms.getMsTemp().getMaxBICs());
        }
        System.exit(0);

        StringBuilder sb = new StringBuilder();

        int bootstraps = bics.asMap().values().iterator().next().size();
        Set<Integer> keySet = bics.keySet();
        for (int i : keySet) {
            sb.append(i).append("\t");
        }
        sb.setLength(sb.length() - 1);
        sb.append("\n");

        for (int l = 0; l < bootstraps; l++) {
            for (int i : keySet) {
                ArrayList arrayList = new ArrayList(bics.get(i));
                if (l < arrayList.size()) {
                    sb.append(arrayList.get(l));
                }
                sb.append("\t");
            }
            sb.setLength(sb.length() - 1);
            sb.append("\n");
        }
        Utils.saveFile(Globals.getINSTANCE().getSAVEPATH() + "support" + File.separator + "bics.txt",
                sb.toString());
        StatusUpdate.getINSTANCE().println("");
        ModelSelectionBootstrapStorage msbt = new ModelSelectionBootstrapStorage(bics);
        Kmin = msbt.getBestK();
        Kmax = Kmin;
        Globals.getINSTANCE().setBOOTSTRAP(false);
    }
    ModelSelection ms = null;
    //        if (Globals.getINSTANCE().isSUBSAMPLE()) {
    //            shuffleArray(reads);
    //            List<Read> subsample = new LinkedList<>();
    //            Map<String, Integer> generators = new HashMap<>();
    //            Globals.getINSTANCE().setDESIRED_REPEATS(0);
    //            for (int i = 0; i < reads.length; i++) {
    //                if (subsample.size() < reads.length / 10 || i + reads.length / 10 > reads.length) {
    //                    subsample.add(reads[i]);
    //                } else {
    //                    Read[] readsSubsample = subsample.toArray(new Read[subsample.size()]);
    //                    ModelSelection msSubsample = new ModelSelection(readsSubsample, Kmin, Kmax, L, n);
    //                    subsample.clear();
    //                    saveSubSample(msSubsample.getOptimalResult().getMu(), generators, L);
    //                }
    //            }
    //            for (Map.Entry<String, Integer> e : generators.entrySet()) {
    //                System.out.println(e.getValue() + "\t" + e.getKey());
    //            }
    //        } else {
    ms = new ModelSelection(reads, Kmin, Kmax, L, n);
    if (!Globals.getINSTANCE().isNOSAMPLE()) {
        ModelSampling modelSampling = new ModelSampling(ms.getOptimalResult(),
                Globals.getINSTANCE().getSAVEPATH());
        modelSampling.save();
        System.out
                .println("\nQuasispecies saved: " + Globals.getINSTANCE().getSAVEPATH() + "quasispecies.fasta");
    }
    if (!Globals.getINSTANCE().isDEBUG()) {
        deleteDirectory(
                new File(Globals.getINSTANCE().getSAVEPATH() + "support" + File.separator + "snapshots"));
    }
    //        }
    //        errorCorrection(ms, reads);

}

From source file:org.apache.distributedlog.feature.DynamicConfigurationFeatureProvider.java

@Override
public void start() throws IOException {
    List<FileConfigurationBuilder> fileConfigBuilders = Lists.newArrayListWithExpectedSize(2);
    String baseConfigPath = conf.getFileFeatureProviderBaseConfigPath();
    checkNotNull(baseConfigPath);//from   www.  ja v  a  2 s.  c  o  m
    File baseConfigFile = new File(baseConfigPath);
    FileConfigurationBuilder baseProperties = new PropertiesConfigurationBuilder(
            baseConfigFile.toURI().toURL());
    fileConfigBuilders.add(baseProperties);
    String overlayConfigPath = conf.getFileFeatureProviderOverlayConfigPath();
    if (null != overlayConfigPath) {
        File overlayConfigFile = new File(overlayConfigPath);
        FileConfigurationBuilder overlayProperties = new PropertiesConfigurationBuilder(
                overlayConfigFile.toURI().toURL());
        fileConfigBuilders.add(overlayProperties);
    }
    try {
        this.featuresConfSubscription = new ConfigurationSubscription(this.featuresConf, fileConfigBuilders,
                executorService, conf.getDynamicConfigReloadIntervalSec(), TimeUnit.SECONDS);
    } catch (ConfigurationException e) {
        throw new IOException("Failed to register subscription on features configuration");
    }
    this.featuresConfSubscription.registerListener(this);
}

From source file:com.android.tools.lint.client.api.OtherFileVisitor.java

/** Analyze other files in the given project */
void scan(@NonNull LintDriver driver, @NonNull Project project, @Nullable Project main) {
    // Collect all project files
    File projectFolder = project.getDir();

    EnumSet<Scope> scopes = EnumSet.noneOf(Scope.class);
    for (Detector detector : mDetectors) {
        OtherFileScanner fileScanner = (OtherFileScanner) detector;
        EnumSet<Scope> applicable = fileScanner.getApplicableFiles();
        if (applicable.contains(Scope.OTHER)) {
            scopes = Scope.ALL;//from w  w w  .  ja v  a 2  s  . c  om
            break;
        }
        scopes.addAll(applicable);
    }

    List<File> subset = project.getSubset();

    if (scopes.contains(Scope.RESOURCE_FILE)) {
        if (subset != null && !subset.isEmpty()) {
            List<File> files = new ArrayList<File>(subset.size());
            for (File file : subset) {
                if (SdkUtils.endsWith(file.getPath(), DOT_XML)
                        && !file.getName().equals(ANDROID_MANIFEST_XML)) {
                    files.add(file);
                }
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.RESOURCE_FILE, files);
            }
        } else {
            List<File> files = Lists.newArrayListWithExpectedSize(100);
            for (File res : project.getResourceFolders()) {
                collectFiles(files, res);
            }
            File assets = new File(projectFolder, FD_ASSETS);
            if (assets.exists()) {
                collectFiles(files, assets);
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.RESOURCE_FILE, files);
            }
        }
    }

    if (scopes.contains(Scope.JAVA_FILE)) {
        if (subset != null && !subset.isEmpty()) {
            List<File> files = new ArrayList<File>(subset.size());
            for (File file : subset) {
                if (file.getPath().endsWith(DOT_JAVA)) {
                    files.add(file);
                }
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.JAVA_FILE, files);
            }
        } else {
            List<File> files = Lists.newArrayListWithExpectedSize(100);
            for (File srcFolder : project.getJavaSourceFolders()) {
                collectFiles(files, srcFolder);
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.JAVA_FILE, files);
            }
        }
    }

    if (scopes.contains(Scope.CLASS_FILE)) {
        if (subset != null && !subset.isEmpty()) {
            List<File> files = new ArrayList<File>(subset.size());
            for (File file : subset) {
                if (file.getPath().endsWith(DOT_CLASS)) {
                    files.add(file);
                }
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.CLASS_FILE, files);
            }
        } else {
            List<File> files = Lists.newArrayListWithExpectedSize(100);
            for (File classFolder : project.getJavaClassFolders()) {
                collectFiles(files, classFolder);
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.CLASS_FILE, files);
            }
        }
    }

    if (scopes.contains(Scope.MANIFEST)) {
        if (subset != null && !subset.isEmpty()) {
            List<File> files = new ArrayList<File>(subset.size());
            for (File file : subset) {
                if (file.getName().equals(ANDROID_MANIFEST_XML)) {
                    files.add(file);
                }
            }
            if (!files.isEmpty()) {
                mFiles.put(Scope.MANIFEST, files);
            }
        } else {
            List<File> manifestFiles = project.getManifestFiles();
            if (manifestFiles != null) {
                mFiles.put(Scope.MANIFEST, manifestFiles);
            }
        }
    }

    for (Map.Entry<Scope, List<File>> entry : mFiles.entrySet()) {
        Scope scope = entry.getKey();
        List<File> files = entry.getValue();
        List<Detector> applicable = new ArrayList<Detector>(mDetectors.size());
        for (Detector detector : mDetectors) {
            OtherFileScanner fileScanner = (OtherFileScanner) detector;
            EnumSet<Scope> appliesTo = fileScanner.getApplicableFiles();
            if (appliesTo.contains(Scope.OTHER) || appliesTo.contains(scope)) {
                applicable.add(detector);
            }
        }
        if (!applicable.isEmpty()) {
            for (File file : files) {
                Context context = new Context(driver, project, main, file);
                for (Detector detector : applicable) {
                    detector.beforeCheckFile(context);
                    detector.run(context);
                    detector.afterCheckFile(context);
                }
                if (driver.isCanceled()) {
                    return;
                }
            }
        }
    }
}

From source file:org.nmdp.ngs.align.BiojavaPairwiseAlignment.java

@Override
public Iterable<AlignmentPair> global(final List<Sequence> queries, final List<Sequence> subjects,
        final GapPenalties gapPenalties) {
    checkNotNull(queries);/*from   www.  j av a2s .  com*/
    checkNotNull(subjects);
    checkNotNull(gapPenalties);

    if (queries.isEmpty() || subjects.isEmpty()) {
        return Collections.<AlignmentPair>emptyList();
    }

    NeedlemanWunsch needlemanWunsch = new NeedlemanWunsch(gapPenalties.match(), gapPenalties.replace(),
            gapPenalties.insert(), gapPenalties.delete(), gapPenalties.extend(), getSubstitutionMatrix());

    List<AlignmentPair> alignmentPairs = Lists.newArrayListWithExpectedSize(queries.size() * subjects.size());
    for (Sequence query : queries) {
        for (Sequence subject : subjects) {
            try {
                AlignmentPair alignmentPair = needlemanWunsch.pairwiseAlignment(query, subject);
                alignmentPairs.add(alignmentPair);
            } catch (BioException e) {
                // todo
            }
        }
    }
    return alignmentPairs;
}

From source file:org.spongepowered.common.data.processor.data.tileentity.SignDataProcessor.java

@Override
public Optional<SignData> from(DataHolder dataHolder) {
    if (dataHolder instanceof TileEntitySign) {
        final SignData signData = new SpongeSignData();
        final IChatComponent[] rawLines = ((TileEntitySign) dataHolder).signText;
        final List<Text> signLines = Lists.newArrayListWithExpectedSize(4);
        for (int i = 0; i < rawLines.length; i++) {
            signLines.add(i, SpongeTexts.toText(rawLines[i]));
        }// w  w  w.j a  v  a 2 s. c  o m
        return Optional.of(signData.set(Keys.SIGN_LINES, signLines));
    } else if (dataHolder instanceof ItemStack) {
        if (!((ItemStack) dataHolder).hasTagCompound()) {
            return Optional.empty();
        } else {
            final NBTTagCompound mainCompound = ((ItemStack) dataHolder).getTagCompound();
            if (!mainCompound.hasKey(NbtDataUtil.BLOCK_ENTITY_TAG, NbtDataUtil.TAG_COMPOUND) || !mainCompound
                    .getCompoundTag(NbtDataUtil.BLOCK_ENTITY_TAG).hasKey(NbtDataUtil.BLOCK_ENTITY_ID)) {
                return Optional.empty();
            }
            final NBTTagCompound tileCompound = mainCompound.getCompoundTag(NbtDataUtil.BLOCK_ENTITY_TAG);
            final String id = tileCompound.getString(NbtDataUtil.BLOCK_ENTITY_ID);
            if (!id.equalsIgnoreCase(NbtDataUtil.SIGN)) {
                return Optional.empty();
            }
            final List<Text> texts = Lists.newArrayListWithCapacity(4);
            texts.add(Texts.legacy().fromUnchecked(tileCompound.getString("Text1")));
            texts.add(Texts.legacy().fromUnchecked(tileCompound.getString("Text2")));
            texts.add(Texts.legacy().fromUnchecked(tileCompound.getString("Text3")));
            texts.add(Texts.legacy().fromUnchecked(tileCompound.getString("Text4")));
            return Optional.of(new SpongeSignData(texts));
        }
    }
    return Optional.empty();
}

From source file:com.yahoo.yqlplus.engine.internal.source.InsertMethod.java

private OperatorNode<PhysicalExprOperator> createInvocation(Location location,
        OperatorNode<PhysicalExprOperator> source, ContextPlanner planner,
        OperatorNode<PhysicalExprOperator> recordOrRecords) {
    List<OperatorNode<PhysicalExprOperator>> callArgs = Lists.newArrayListWithExpectedSize(2);
    callArgs.add(source);/*from w w w.j  a  v  a 2 s  .  c o  m*/
    callArgs.add(OperatorNode.create(PhysicalExprOperator.CURRENT_CONTEXT));
    callArgs.add(recordOrRecords);
    OperatorNode<PhysicalExprOperator> invocation = OperatorNode.create(location,
            invoker.getReturnType().isPromise() ? PhysicalExprOperator.ASYNC_INVOKE
                    : PhysicalExprOperator.INVOKE,
            invoker, callArgs);
    if (minimumBudget > 0 || maximumBudget > 0) {
        OperatorNode<PhysicalExprOperator> ms = planner.constant(TimeUnit.MILLISECONDS);
        OperatorNode<PhysicalExprOperator> subContext = OperatorNode.create(PhysicalExprOperator.TIMEOUT_GUARD,
                planner.constant(minimumBudget), ms, planner.constant(maximumBudget), ms);
        return OperatorNode.create(PhysicalExprOperator.WITH_CONTEXT, subContext,
                OperatorNode.create(PhysicalExprOperator.ENFORCE_TIMEOUT, invocation));
    }
    return invocation;
}