scale.score.dependence.omega.omegaLib
Class Mapping

java.lang.Object
  extended by scale.score.dependence.omega.omegaLib.Mapping

public final class Mapping
extends java.lang.Object

Mapping for relations.

$Id: Mapping.java,v 1.12 2007-01-04 16:46:02 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

This version of the Omega Libray is a translation from C++ to Java of the Omega Library developed at the University of Maryland.

Copyright (C) 1994-1996 by the Omega Project

All rights reserved.

NOTICE: This software is provided ``as is'', without any warranty, including any implied warranty for merchantability or fitness for a particular purpose. Under no circumstances shall the Omega Project or its agents be liable for any use of, misuse of, or inability to use this software, including incidental and consequential damages.

License is hereby given to use, modify, and redistribute this software, in whole or in part, for any purpose, commercial or non-commercial, provided that the user agrees to the terms of this copyright notice, including disclaimer of warranty, and provided that this copyright notice, including disclaimer of warranty, is preserved in the source code and documentation of anything derived from this software. Any redistributor of this software or anything derived from this software assumes responsibility for ensuring that any parties to whom such a redistribution is made are fully aware of the terms of this license and disclaimer.

The Omega project can be contacted at omega@cs.umd.edu or http://www.cs.umd.edu/projects/omega

When a relation operation needs to re-arrange the variables, it describes the re-arragement with a mapping, and then calls align to re-arrange them.

In a mapping, map_in (map_out/map_set) gives the new type and position of each of the old input (output/set) variables. For variables being mapped to Input, Output, or Set variables, the position is the new position in the tuple. For variables being mapped to EXISTS_VAR, FORALL_VAR, or WILDCARD_VAR, the positions can be used to map multiple variables to the same quantified variable, by providing the same position. Each variable with a negative position is given a unique quantified variable that is NOT listed in the seen_exists_ids list. We are not sure what the positions mean for GLOBAL_VARs - perhaps they are ignored?

Currently, align supports only mapping to Set, Input, Output, and Exists vars.


Constructor Summary
Mapping(int no_set)
           
Mapping(int n_input, int n_output)
           
Mapping(Mapping m)
           
 
Method Summary
 int getInputFate(int prefix)
           
 int getInReq()
           
 int getMapInKind(int pos)
           
 int getMapInPos(int pos)
           
 int getMapOutKind(int pos)
           
 int getMapOutPos(int pos)
           
 int getOutputFate(int prefix)
           
 int getOutReq()
           
 void getRelationArityFromMappings(Mapping m2)
          Scan mappings to see how many input and output variables they require.
 void getRelationArityFromOneMapping()
           
 int getSetFate(int prefix)
           
 int getTupleFate(int t, int prefix)
          If a tuple as a whole becomes the new Input or Output tuple, return the Tuple if they will become (Input, Output).
 boolean hasExistentials()
          Determine if a mapping requires an f_exists node.
static Mapping Identity(int setvars)
           
static Mapping Identity(int inp, int outp)
           
 int numberInput()
           
 int numberOutput()
           
 void setMap_in(int pos, int type, int map)
           
 void setMap_out(int pos, int type, int map)
           
 void setMap_set(int pos, int type, int map)
           
 void setMap(int in_kind, int pos, int type, int map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapping

public Mapping(int n_input,
               int n_output)

Mapping

public Mapping(int no_set)

Mapping

public Mapping(Mapping m)
Method Detail

setMap

public void setMap(int in_kind,
                   int pos,
                   int type,
                   int map)

setMap_in

public void setMap_in(int pos,
                      int type,
                      int map)

setMap_set

public void setMap_set(int pos,
                       int type,
                       int map)

setMap_out

public void setMap_out(int pos,
                       int type,
                       int map)

getMapInKind

public int getMapInKind(int pos)

getMapInPos

public int getMapInPos(int pos)

getMapOutKind

public int getMapOutKind(int pos)

getMapOutPos

public int getMapOutPos(int pos)

numberInput

public int numberInput()

numberOutput

public int numberOutput()

getTupleFate

public int getTupleFate(int t,
                        int prefix)
If a tuple as a whole becomes the new Input or Output tuple, return the Tuple if they will become (Input, Output). Return UNKNOWN_TUPLE otherwise.


getSetFate

public int getSetFate(int prefix)

getInputFate

public int getInputFate(int prefix)

getOutputFate

public int getOutputFate(int prefix)

Identity

public static Mapping Identity(int inp,
                               int outp)

Identity

public static Mapping Identity(int setvars)

hasExistentials

public boolean hasExistentials()
Determine if a mapping requires an f_exists node.


getRelationArityFromOneMapping

public void getRelationArityFromOneMapping()

getRelationArityFromMappings

public void getRelationArityFromMappings(Mapping m2)
Scan mappings to see how many input and output variables they require.


getOutReq

public int getOutReq()

getInReq

public int getInReq()