001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.compilers.opt.dfsolver;
014    
015    import java.util.HashMap;
016    
017    /**
018     * DF_Solution.java
019     *
020     * Represents the solution to a system of Data Flow equations.
021     * Namely, a function mapping Objects to DF_LatticeCells
022     */
023    public class DF_Solution extends HashMap<Object, DF_LatticeCell> {
024      /** Support for serialization */
025      static final long serialVersionUID = -335649266901802532L;
026    
027      /**
028       * Return a string representation of the dataflow solution
029       * @return a string representation of the dataflow solution
030       */
031      public String toString() {
032        String result = "";
033        for (DF_LatticeCell cell : values()) {
034          result = result + cell + "\n";
035        }
036        return result;
037      }
038    
039      /**
040       * Return the lattice cell corresponding to an object
041       * @param k the object to look up
042       * @return its lattice cell
043       */
044      public Object lookup(Object k) {
045        return get(k);
046      }
047    }