All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gwt.dev.jjs.impl.gflow.Graph Maven / Gradle / Ivy

Go to download

Vaadin is a web application framework for Rich Internet Applications (RIA). Vaadin enables easy development and maintenance of fast and secure rich web applications with a stunning look and feel and a wide browser support. It features a server-side architecture with the majority of the logic running on the server. Ajax technology is used at the browser-side to ensure a rich and interactive user experience.

There is a newer version: 8.25.2
Show newest version
/*
 * Copyright 2009 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.dev.jjs.impl.gflow;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Directed graph abstraction for flow analysis. We specifically define all
 * navigation methods in graph interface and do not ask nodes and edges to
 * conform to any interface. This way graphs can be memory-efficient.
 *
 * The graph can have one or more incoming edges (i.e. edges, which end on
 * some nodes in the graph, but originate somewhere outside the graph), and one
 * or more outgoing edges.
 *
 * @param  graph node type.
 * @param  graph edge type.
 * @param  transformer type. Transformer instances can be used
 *          to change the graph and its underlying representation to apply
 *          optimizations.
 */
public interface Graph {

  Object getEdgeData(EdgeType edge);

  /**
   * Returns edge end node.
   */
  NodeType getEnd(EdgeType edge);

  /**
   * Returns graph incoming edges.
   */
  ArrayList getGraphInEdges();

  /**
   * Returns graph outgoing edges.
   */
  ArrayList getGraphOutEdges();

  /**
   * Returns edges coming into node.
   */
  List getInEdges(NodeType n);

  /**
   * Returns all nodes in the graph.
   */
  ArrayList getNodes();

  /**
   * Returns edges originating from the node.
   */
  List getOutEdges(NodeType node);

  /**
   * Returns edge start node.
   */
  NodeType getStart(EdgeType edge);

  /**
   * Returns string representation of the graph.
   */
  String print();

  /**
   * Returns string representation of the graph with all assumptions along its
   * edges.
   */
  > String printWithAssumptions(
      Map assumptions);

  void setEdgeData(EdgeType edge, Object data);

  /**
   * Transforms the node with transformer. This will be called by solver to
   * apply optimizations.
   *
   * @return true if there were changes made by transformer. While
   * transformation should be always sound, it might be impossible to apply
   * it in current context due to complexities of underlying structures. E.g.
   * it is impossible to delete if statement test expression, while it is not
   * evaluated if statement is not reachable. In this case transformer can
   * return false and do no changes.
   */
  boolean transform(NodeType node, TransformerType transformer);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy