Package org.apache.imperius.spl.parser.compiler.symboltable

Examples of org.apache.imperius.spl.parser.compiler.symboltable.Symbol


                referenceTypeName=CIMSPLTypeConstants.getReferenceTypeName(path);
              }

              if(logger.isLoggable(Level.FINE))
                logger.fine(Thread.currentThread().getName()+" symboltable does not currently contain the given property, so creating property symbol");
              Symbol symbol =new PropertySymbol(qualifiedPropertyName,type,referenceTypeName,cimproperty.isArray(),_isKey(cimproperty),true);
              //add property to properties list
              if(logger.isLoggable(Level.FINE))
                logger.fine(Thread.currentThread().getName()+" adding property to Map in datacollector : "+qualifiedPropertyName);
              symbols.put(qualifiedPropertyName, symbol);

            }
            else
            {
              if(logger.isLoggable(Level.FINE))
                logger.fine(Thread.currentThread().getName()+" symboltable already contains the given symbol "+cimproperty.getName().toLowerCase());
              logger.severe(qualifiedPropertyName+" symbol Already exists in SymbolTable");
              throw new SPLException("symbol Already exists in SymbolTable");
            }

          }
          if(logger.isLoggable(Level.FINE))
            logger.fine(Thread.currentThread().getName()+" done adding all the properties");
          if(logger.isLoggable(Level.FINE))
            logger.fine(Thread.currentThread().getName()+" get all methods of the class and iterate over them");






          //get all methods of the class and iterate over them
          for(int i=0;i<cimclass.getMethodCount();i++)
          {
            CIMMethod cimMethod= cimclass.getMethod(i);

            if(logger.isLoggable(Level.FINE))
              logger.fine(Thread.currentThread().getName()+" method : "+cimMethod.getName()+ " Parameter count "+cimMethod.getParameterCount()+" is of type "+cimMethod.getType());
//            //ArrayList argTypeList=new ArrayList ();
            List methodArgs=new ArrayList();
            SPLSymbolTable methodArgsSymbolTable=new SPLSymbolTable();

            for(int j=0;j<cimMethod.getParameterCount();j++)
            {
              CIMParameter cimparameter=cimMethod.getParameter(j);
              String parameterName=cimparameter.getName();
              boolean isArr=cimparameter.isArray();
              int type=CIMSPLTypeConstants.convertCIMTypeToInternalType(cimparameter.getType().getType());

              String referenceTypeName="";

              if(type == TypeConstants.referenceType)
              { 
                referenceTypeName = CIMSPLTypeConstants.getReferenceTypeName(cimparameter.getReferenceClassName());
              }
              Argument arg=new ArgumentImpl(type, parameterName, isArr, referenceTypeName);

              methodArgsSymbolTable.insertVariableSymbol(parameterName, type, referenceTypeName, isArr, false, false);
              //System.out.println(" inserted variable symbol into methodArgsSymbolTable "+parameterName);
              methodArgs.add(arg);
            }
            String methodName=cimMethod.getName();
            if( ! symbols.containsKey(methodName))
            {
              int localReturnType=CIMSPLTypeConstants.convertCIMTypeToInternalType(cimMethod.getType());

              Symbol methodSymbol=new MethodSymbol(methodName,localReturnType,CIMSPLTypeConstants.getIsArray(localReturnType),cimclass.getName(),methodArgs,methodArgsSymbolTable);
              //add property to properties list
              if(logger.isLoggable(Level.FINE))
                logger.fine(Thread.currentThread().getName()+" adding method to symbol table" + methodName);
              symbols.put(methodName, methodSymbol);
            }
View Full Code Here


        }
        boolean isPropertyOfClass = true;
        boolean isKey = false;

        // create a new property symbol object
        Symbol s = new PropertySymbol(f.getName(), internalType,
            referenceTypeName, isArray, isKey, isPropertyOfClass);

        // insert into map
        // xiping's test 06/19/09
        // a Java class field name must be unique
View Full Code Here

            throw new SPLException(e.getMessage());
          }
        }

        // construct a method symbol
        Symbol s = new MethodSymbol(methodName, internalReturnType, isReturnArray, returnReferenceTypeName, argTypeList, null);

//        // Insert into map
//        symbolMap.put(methodName, s);

        // xiping's test 06/19/09
View Full Code Here

      throw new NonExistentSymbolException(targetClassName + "." + targetClassPropertyName + " does not exist");
    }
    else
    {
      // xiping's modification to support Java overloading, 06/21/09
      Symbol propSymbol = (Symbol)symTab.getSymbol(targetClassName + "." + targetClassPropertyName);
//      Collection c = symTab.getSymbol(targetClassName + "." + targetClassPropertyName);
//      Iterator it = c.iterator();
//      Symbol propSymbol = (Symbol) it.next();
     
      this._dataType=new TypeInfoImpl(propSymbol.getType());
      this._dataType.setIsArray(true);
      expressionForTarget = (Expression)paramList.get(6); // 6th param is an expression involving properties of the targetclass
      if(expressionForTarget.validate())
      {
        if(expressionForTarget.getType().getType() != TypeConstants.booleanType) // this expression is used to filter instances hence needs to be boolean
View Full Code Here

            returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable,
                  _classType, qualifier, _identifier, _paramList, instance);
        }
        else // PropertySymbol
        {
            Symbol sym = null;
            try
            {
                sym = (Symbol)_symbolTable.getSymbol(_classType + "." + _identifier);
                returnValue = sym.getValue();
            }
            catch(SPLException splex)
            {
                String accessorMethodName = getAccessorMethodName(_identifier, "get");
                try
View Full Code Here

            returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable,
                _classType, qualifier, _identifier, _paramList, parentObject);
        }
        else // PropertySymbol
        {
            Symbol sym = null;
            try
            {
                sym = (Symbol)_symbolTable.getSymbol(_classType + "." + _identifier);
                returnValue = sym.getValue();
            }
            catch(SPLException splex)
            {
                String accessorMethodName = getAccessorMethodName(_identifier, "get");
                try
View Full Code Here

                          + _identifier }));
                }
            }
        }
   
    Symbol sym = null;
    if (obj instanceof Vector) { // MethodSymbol
      Collection c = (Collection) obj;
      for (Iterator it = c.iterator(); it.hasNext();) {
        sym = (Symbol) it.next();
        List aList = ((MethodSymbol)sym).getArgumentList();
     
        if (aList.size() != _paramList.size()) {
          continue;
        }
       
        boolean typeNotEqual = false;
        for (int i = 0; i < aList.size(); i++) {
          Expression exp = (Expression)_paramList.get(i);
          Argument arg = (Argument)aList.get(i);
          TypeInfo expDataType = exp.getType();
          TypeInfo argDataType = arg.getType();
//          if (expDataType.getIsArray() != argDataType.getIsArray() ||
//              expDataType.getType() != argDataType.getType()) {
          if (expDataType.getType() != argDataType.getType()) {
            typeNotEqual = true;
            break;
          }
        }
       
        if (typeNotEqual) {
          continue;
        }

        break;
      }
    } else { // PropertySymbol
      sym = (Symbol) obj;
    }

        if(_isMethod)
        {
            if(sym instanceof MethodSymbol)
            {
                typeInfo = _validateActualParameters(sym,classTypeOrVariableName);
               
            }
            else
            {
                throw new SPLException("Symbol " + _identifier + "is not a method");
            }
        }
        else
        {
            TypeInfo tp = sym.getType();
            boolean isArray = sym.isArray();
            if(_arrExp != null) // expression is like A.b[2] which means
            { // the result is not an array
                isArray = false;
            }
            String resultClass = null;
            if(TypeResolver.isReference(tp))
            {
                resultClass = sym.getReferenceTypeName();
                typeInfo.setReferenceTypeName(resultClass);
                typeInfo.setType(tp.getType());
                typeInfo.setIsArray(isArray);
            }
            else
View Full Code Here

        }
        boolean isArray = CIMSPLTypeConstants.getIsArray(cimproperty.getType().getType());

        if(logger.isLoggable(Level.FINE))
          logger.fine(Thread.currentThread().getName()+" symboltable does not currently contain the given property, so creating property symbol");
        Symbol symbol = new PropertySymbol(qualifiedPropertyName,type,referenceTypeName,isArray,_isKey(cimproperty),true);
        //add property to properties list
        if(logger.isLoggable(Level.FINE))
          logger.fine(Thread.currentThread().getName()+" adding property to Map in datacollector : "+qualifiedPropertyName);
        symbols.put(qualifiedPropertyName, symbol);
View Full Code Here

      String methodName=cimMethod.getName();
      if( ! symbols.containsKey(methodName))
      {
        int localReturnType=CIMSPLTypeConstants.convertCIMTypeToInternalType(cimMethod.getType().getType());

        Symbol methodSymbol = new MethodSymbol(methodName,localReturnType,
            CIMSPLTypeConstants.getIsArray(localReturnType),cimClass.getName(),methodArgs,methodArgsSymbolTable);
        //add property to properties list
        if(logger.isLoggable(Level.FINE))
          logger.fine(Thread.currentThread().getName()+" adding method to symbol table" + methodName);
        symbols.put(methodName, methodSymbol);
View Full Code Here

        else // local constant
        {
            boolean symbolExists = _symTab.symbolExists(_classNameOrInstanceVariableName, true);
            if( symbolExists )
            {
              Symbol sym = (Symbol)_symTab.getSymbol(_classNameOrInstanceVariableName);
             
//              // xiping's modification, 06/19/09
//              // contains only one local constant
//              Collection c = _symTab.getSymbol(_classNameOrInstanceVariableName);
//              Iterator it = c.iterator();
//              Symbol sym = (Symbol) it.next();

                _dataType.copy(sym.getType());
                // _isArray = sym.isArray();
                _referenceTypeName = sym.getReferenceTypeName();
            }
            else if(_symTab.getInstance(_classNameOrInstanceVariableName)!=null)
            {
                // validate! happens when the identifier is an import variable
            }
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.compiler.symboltable.Symbol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.