package com.poco.Extractor;

import com.poco.PoCoParser.PoCoParser;

/**
 * Created by caoyan on 10/28/14.
 */
public class VarTypeVal {
    public enum ClosureType {
        RE_TYPE,
        SRE_TYPE
    }

    private ClosureType varType;
    private PoCoParser.ReContext reContext;
    private PoCoParser.SreContext sreContext;


    public VarTypeVal(ClosureType type) {
        this.varType = type;
        this.reContext = null;
        this.sreContext = null;
    }

    public VarTypeVal(ClosureType type, PoCoParser.ReContext reContext, PoCoParser.SreContext sreContext) {
        this.varType = type;
        this.reContext = reContext;
        this.sreContext = sreContext;
    }

    public ClosureType getVarType() {
        return varType;
    }

    public void setVarType(ClosureType varType) {
        this.varType = varType;
    }

    public PoCoParser.ReContext getReContext() {
        return reContext;
    }

    public void setReContext(PoCoParser.ReContext reContext) {
        this.reContext = reContext;
    }

    public PoCoParser.SreContext getSreContext() {
        return sreContext;
    }

    public void setSreContext(PoCoParser.SreContext sreContext) {
        this.sreContext = sreContext;
    }

    @Override
    public String toString() {
        String reStr = "null";
        String sreStr = "null";
        if (reContext != null)
            reStr = reContext.getText().toString();
        if (sreContext != null)
            sreStr = sreContext.getText().toString();

        return "VarTypeVal{\n" +
                "varType = " + varType +
                "," +
                "\n sreContext= '" + sreStr + '\'' +
                ",\n reContext='" + reStr + '\'' +
                '}' +
                "\n";
    }
}

@@ -133,78 +133,8 @@
 al %7B
-%0A    public enum ClosureType %7B%0A        RE_TYPE,%0A        SRE_TYPE%0A    %7D
 %0A%0A  
@@ -143,27 +143,22 @@
 private 
-ClosureType
+String
  varType
@@ -192,25 +192,23 @@
 Context 
-reContext
+varLink
 ;%0A    pr
@@ -217,33 +217,18 @@
 ate 
-PoCoParser.SreContext sre
+String var
 Cont
@@ -233,17 +233,16 @@
 ntext;%0A%0A
-%0A
     publ
@@ -255,32 +255,16 @@
 TypeVal(
-ClosureType type
 ) %7B%0A    
@@ -285,39 +285,8 @@
 pe =
- type;%0A        this.reContext =
  nul
@@ -301,26 +301,23 @@
    this.
-sreContext
+varLink
  = null;
@@ -350,21 +350,19 @@
 Val(
-ClosureType t
+String varT
 ype,
@@ -387,44 +387,27 @@
 ext 
-reContext, PoCoParser.SreContext sre
+varLink, String var
 Cont
@@ -436,17 +436,20 @@
 rType = 
-t
+varT
 ype;%0A   
@@ -458,37 +458,33 @@
    this.
-reContext = reContext
+varLink = varLink
 ;%0A      
@@ -482,35 +482,35 @@
 k;%0A        this.
-sre
+var
 Context = sreCon
@@ -495,35 +495,35 @@
 is.varContext = 
-sre
+var
 Context;%0A    %7D%0A%0A
@@ -537,30 +537,39 @@
 lic 
-ClosureType
+PoCoParser.ReContext
  getVar
-Type
+Link
 () %7B
@@ -583,28 +583,28 @@
   return var
-Type
+Link
 ;%0A    %7D%0A%0A   
@@ -626,32 +626,41 @@
 tVar
-Type(ClosureType varType
+Link(PoCoParser.ReContext varLink
 ) %7B%0A
@@ -671,38 +671,38 @@
     this.var
-Type
+Link
  = var
-Type
+Link
 ;%0A    %7D%0A%0A   
@@ -713,34 +713,21 @@
 lic 
-PoCoParser.ReContext
+String
  get
-Re
+Var
 Cont
@@ -749,18 +749,19 @@
  return 
+va
 r
-e
 Context;
@@ -791,18 +791,19 @@
  set
-Re
+Var
 Context(
 PoCo
@@ -802,31 +802,18 @@
 ext(
-PoCoParser.ReContext re
+String var
 Cont
@@ -832,18 +832,19 @@
    this.
+va
 r
-e
 Context 
@@ -845,18 +845,19 @@
 ntext = 
+va
 r
-e
 Context;
@@ -879,43 +879,25 @@
 lic 
-PoCoParser.SreContext getSreContext
+String getVarType
 () %7B
@@ -912,26 +912,23 @@
  return 
-sreContext
+varType
 ;%0A    %7D%0A
@@ -951,377 +951,117 @@
  set
-SreContext(PoCoParser.SreContext sreContext) %7B%0A        this.sreContext = sreContext;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        String reStr = %22null%22;%0A        String sreStr = %22null%22;%0A        if (reContext != null)%0A            reStr = reContext.getText().toString();%0A        if (sreContext != null)%0A            sreStr = sreContext.getText().toString();%0A
+VarType(String varType) %7B%0A        this.varType = varType;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B
 %0A   
@@ -1084,18 +1084,16 @@
 TypeVal%7B
-%5Cn
 %22 +%0A    
@@ -1112,19 +1112,18 @@
 %22varType
- = 
+='
 %22 + varT
@@ -1131,81 +1131,54 @@
 pe +
-%0A                %22,%22 +%0A                %22%5Cn sreContext= '%22 + sreStr + '%5C''
+ '%5C'' +%0A                %22, varLink=%22 + varLink
  +%0A 
@@ -1198,13 +1198,12 @@
   %22,
-%5Cn re
+ var
 Cont
@@ -1215,13 +1215,18 @@
 %22 + 
-reStr
+varContext
  + '
@@ -1254,31 +1254,8 @@
  '%7D'
- +%0A                %22%5Cn%22
 ;%0A  

Update VarTypeVal.java