1 package org.kit.furia.fragment.asm;
2
3 import org.objectweb.asm.tree.analysis.Value;
4 /*
5 Furia-chan: An Open Source software license violation detector.
6 Copyright (C) 2008 Kyushu Institute of Technology
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 /**
23 * PhiFunctionValue represents a selection function that can return
24 * any of its parameters.
25 *
26 * @author Arnoldo Jose Muller Molina
27 */
28 public class PhiFunctionValue
29 extends AbstractFunction {
30
31 @Override
32 protected String printFunctionName() {
33 return "p";
34 }
35
36 public void merge(PhiFunctionValue other){
37 if(this != other){
38 for(Value v : other.params){
39 super.addParam(v);
40 }
41 }
42 }
43
44 /**
45 * Generate the hash code for the function name.
46 */
47 protected int hashCodeFunctionName(){
48 return Integer.MAX_VALUE;
49 }
50
51 protected boolean equalFunctions(Value x){
52 if(x == this){
53 return true;
54 }else if(x instanceof PhiFunctionValue){
55 return true;
56 }else{
57 return false;
58 }
59 }
60
61 }