Package gnu.trove

Examples of gnu.trove.TObjectIntHashMap$EqProcedure


    }

    public void resetRuntimeState() {
        m_targetBoundedName = null;
        m_thisBoundedName = null;
        m_exprIndexToTargetIndex = new TObjectIntHashMap();
        m_targetWithRuntimeCheck = false;
    }
View Full Code Here


  TObjectIntHashMap feat2index;
  ArrayList<Object> index2feat;
  boolean canGrow;

  public Alphabet() {
    feat2index = new TObjectIntHashMap();
    index2feat = new ArrayList<Object>();
    canGrow = true;
  }
View Full Code Here

    if (inid != serialVersionUID)
      throw new IOException("Serial version mismatch: expected "
          + serialVersionUID + " got " + inid);
    canGrow = in.readBoolean();
    index2feat = (ArrayList<Object>) in.readObject();
    feat2index = new TObjectIntHashMap();
    for (int i = 0; i < index2feat.size(); i++) {
      if (feat2index.contains(index2feat.get(i)))
        throw new IOException("duplicate feature in file. feature: "
            + index2feat.get(i));
      feat2index.put(index2feat.get(i), i);
View Full Code Here

            // to sort the method list before computation.
            // TODO: filter init/clinit/prefixed methods
            final List sortedMethods = Arrays.asList(methods);
            Collections.sort(sortedMethods, JavassistMethodComparator.getInstance());

            final TObjectIntHashMap methodSequences = new TObjectIntHashMap();
            final List sorteMethodTuples = new ArrayList(sortedMethods.size());
            for (Iterator methodsIt = sortedMethods.iterator(); methodsIt.hasNext();) {
                CtMethod method = (CtMethod)methodsIt.next();
                MethodMetaData methodMetaData = JavassistMetaDataMaker.createMethodMetaData(method);

                int sequence = 1;
                if (methodSequences.containsKey(method.getName())) {
                    sequence = methodSequences.get(method.getName());
                    methodSequences.remove(method.getName());
                    sequence++;
                }
                methodSequences.put(method.getName(), sequence);

                MethodSequenceTuple tuple = new MethodSequenceTuple(method, sequence);
                tuple.setStatus(methodFilter(definition, classMetaData, methodMetaData, method));
                // todo filter out "skip" status
                sorteMethodTuples.add(tuple);
View Full Code Here

            return objectsCacheOnWrite.get(obj);
        }
    }

    private TObjectIntHashMap findProperImmutableCache(Class clazz) {
        TObjectIntHashMap properCache = (TObjectIntHashMap) immutableCache.get(clazz);
        if (properCache == null) {
            properCache = new TObjectIntHashMap(regularHashStrategy);
            immutableCache.put(clazz, properCache);
        }
        return properCache;
    }
View Full Code Here

      }
   }

   private TObjectIntHashMap findProperImmutableCache(Class clazz)
   {
      TObjectIntHashMap properCache = (TObjectIntHashMap)immutableCache.get(clazz);
      if (properCache == null)
      {
         properCache = new TObjectIntHashMap(regularHashStrategy);
         immutableCache.put(clazz, properCache);
      }
      return properCache;
   }
View Full Code Here

            // to sort the method list before computation.
            // TODO: filter init/clinit/prefixed methods
            final List sortedMethods = Arrays.asList(methods);
            Collections.sort(sortedMethods, JavassistMethodComparator.getInstance());

            final TObjectIntHashMap methodSequences = new TObjectIntHashMap();
            final List sorteMethodTuples = new ArrayList(sortedMethods.size());
            for (Iterator methodsIt = sortedMethods.iterator(); methodsIt.hasNext();) {
                CtMethod method = (CtMethod)methodsIt.next();
                MethodMetaData methodMetaData = JavassistMetaDataMaker.createMethodMetaData(method);

                int sequence = 1;
                if (methodSequences.containsKey(method.getName())) {
                    sequence = methodSequences.get(method.getName());
                    methodSequences.remove(method.getName());
                    sequence++;
                }
                methodSequences.put(method.getName(), sequence);

                MethodSequenceTuple tuple = new MethodSequenceTuple(method, sequence);
                tuple.setStatus(methodFilter(definition, classMetaData, methodMetaData, method));
                // todo filter out "skip" status
                sorteMethodTuples.add(tuple);
View Full Code Here

        // keep track of the state we already had
        String targetSoFar = context.m_targetBoundedName;
        String thisSoFar = context.m_thisBoundedName;
        boolean targetWithRuntimeCheckSoFar = context.m_targetWithRuntimeCheck;
        TObjectIntHashMap exprIndexToTargetIndexSoFar = (TObjectIntHashMap) context.m_exprIndexToTargetIndex.clone();

        context.resetRuntimeState();
        Boolean match = referenced.matchUndeterministic(context);

        // merge the state
        if (context.m_targetBoundedName == null) {
            context.m_targetBoundedName = targetSoFar;
        } else if (targetSoFar != null) {
            if (node.jjtGetNumChildren() == 1) {
                String referenceCallArg = ((ASTArgParameter) node.jjtGetChild(0)).getTypePattern().getPattern();
                if (!targetSoFar.equals(referenceCallArg)) {
                    throw new UnsupportedOperationException("should not occur");
                }
            }
        }
        if (context.m_thisBoundedName == null) {
            context.m_thisBoundedName = thisSoFar;
        } else if (thisSoFar != null) {
            if (node.jjtGetNumChildren() == 1) {
                String referenceCallArg = ((ASTArgParameter) node.jjtGetChild(0)).getTypePattern().getPattern();
                if (!thisSoFar.equals(referenceCallArg)) {
                    throw new UnsupportedOperationException("should not occur");
                }
            }
        }
        if (!context.m_targetWithRuntimeCheck) {
            // restore
            context.m_targetWithRuntimeCheck = targetWithRuntimeCheckSoFar;
        }
        if (context.m_exprIndexToTargetIndex.isEmpty()) {
            // restore
            context.m_exprIndexToTargetIndex = exprIndexToTargetIndexSoFar;
        } else if (!exprIndexToTargetIndexSoFar.isEmpty()) {
            //should merge ?
            throw new UnsupportedOperationException("should not occur");
        }


        // update the this and target bounded name from this last visit as well as args
        TObjectIntHashMap exprToTargetArgIndexes = new TObjectIntHashMap();
        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
            String referenceCallArg = ((ASTArgParameter) node.jjtGetChild(i)).getTypePattern().getPattern();
            String referentArg = expressionInfo.getArgumentNameAtIndex(i);
            if (referentArg.equals(context.m_targetBoundedName)) {
                context.m_targetBoundedName = referenceCallArg;
                assertIsInstanceOf(
                        expressionInfo.getArgumentType(referentArg),
                        m_expressionInfo.getArgumentType(referenceCallArg)
                );
            } else if (referentArg.equals(context.m_thisBoundedName)) {
                context.m_thisBoundedName = referenceCallArg;
                assertIsInstanceOf(
                        expressionInfo.getArgumentType(referentArg),
                        m_expressionInfo.getArgumentType(referenceCallArg)
                );
            } else {
                int adviceArgIndex = i;
                if (context.m_exprIndexToTargetIndex.containsKey(referentArg)) {
                    int targetArgIndex = context.m_exprIndexToTargetIndex.get(referentArg);
                    exprToTargetArgIndexes.put(referenceCallArg, targetArgIndex);
                }

            }
        }
        // merge with index found so far (inlined args() f.e.)
        Object[] soFar = exprIndexToTargetIndexSoFar.keys();
        for (int i = 0; i < soFar.length; i++) {
            String name = (String) soFar[i];
            if (!exprToTargetArgIndexes.containsKey(name)) {
                exprToTargetArgIndexes.put(name, exprIndexToTargetIndexSoFar.get(name));
            }
        }
        context.m_exprIndexToTargetIndex = exprToTargetArgIndexes;
        return match;
    }
View Full Code Here

        // keep track of the state we already had
        String targetSoFar = context.m_targetBoundedName;
        String thisSoFar = context.m_thisBoundedName;
        boolean targetWithRuntimeCheckSoFar = context.m_targetWithRuntimeCheck;
        TObjectIntHashMap exprIndexToTargetIndexSoFar = (TObjectIntHashMap) context.m_exprIndexToTargetIndex.clone();

        context.resetRuntimeState();
        Boolean match = referenced.matchUndeterministic(context);

        // TODO FIX ME merge the state
        if (context.m_targetBoundedName == null) {
            context.m_targetBoundedName = targetSoFar;
        } else if (targetSoFar != null) {
            // cflow target
        }
        if (context.m_thisBoundedName == null) {
            context.m_thisBoundedName = thisSoFar;
        } else if (thisSoFar != null) {
            // cflow this
        }
        if (!context.m_targetWithRuntimeCheck) {
            // restore
            context.m_targetWithRuntimeCheck = targetWithRuntimeCheckSoFar;
        }
        if (context.m_exprIndexToTargetIndex.isEmpty()) {
            // restore
            context.m_exprIndexToTargetIndex = exprIndexToTargetIndexSoFar;
        } else if (!exprIndexToTargetIndexSoFar.isEmpty()) {
            //should merge ?
            for (int i = 0; i < exprIndexToTargetIndexSoFar.keys().length; i++) {
                Object o = exprIndexToTargetIndexSoFar.keys()[i];
                context.m_exprIndexToTargetIndex.put(o, exprIndexToTargetIndexSoFar.get(o));
            }
        }
        return match;
    }
View Full Code Here

        m_targetBoundedName = null;

        m_thisBoundedName = null;

        m_exprIndexToTargetIndex = new TObjectIntHashMap();

        m_targetWithRuntimeCheck = false;

    }
View Full Code Here

TOP

Related Classes of gnu.trove.TObjectIntHashMap$EqProcedure

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.