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     * Represents the solution to a system of Data Flow equations.
019     * Namely, a function mapping Objects to DF_LatticeCells
020     */
021    public class DF_Solution extends HashMap<Object, DF_LatticeCell> {
022      /** Support for serialization */
023      static final long serialVersionUID = -335649266901802532L;
024    
025      /**
026       * Return a string representation of the dataflow solution
027       * @return a string representation of the dataflow solution
028       */
029      @Override
030      public String toString() {
031        String result = "";
032        for (DF_LatticeCell cell : values()) {
033          result = result + cell + "\n";
034        }
035        return result;
036      }
037    
038      /**
039       * Return the lattice cell corresponding to an object
040       * @param k the object to look up
041       * @return its lattice cell
042       */
043      public Object lookup(Object k) {
044        return get(k);
045      }
046    }