Package nexj.core.util

Examples of nexj.core.util.LinkedHashTab


   public void resolveInheritance(MessagePart baseMessagePart)
   {
      if (baseMessagePart instanceof CompositeMessagePartInstance)
      {
         CompositeMessagePartInstance baseMessagePartComp = (CompositeMessagePartInstance)baseMessagePart;
         LookupDeque orderedPartSet = new LinkedHashTab(m_partList.size());

         for (int i = 0; i < m_partList.size(); i++)
         {
            MessagePart part = (MessagePart)m_partList.get(i);

            orderedPartSet.put(part.getName(), part);
         }

         int nSize = baseMessagePartComp.m_partList.size();
         Lookup oldPartMap = m_partMap;

         m_partList = new ArrayList(nSize + m_partList.size());
         m_partMap = new HashTab(nSize);

         // Add parts defined in the base message.
         for (int i = 0; i < nSize; i++)
         {
            MessagePart baseMessageChildPart = (MessagePart)baseMessagePartComp.m_partList.get(i);
            MessagePart childPart = (MessagePart)oldPartMap.get(baseMessageChildPart.getName());

            if (childPart == null)
            {
               addPart(baseMessageChildPart.copy(this));
            }
            else
            {
               orderedPartSet.remove(childPart.getName());
               addPart(childPart);
               childPart.resolveInheritance(baseMessageChildPart);
            }
         }

         // Add parts defined in the derived message.
         for (Iterator itr = orderedPartSet.valueIterator(); itr.hasNext(); )
         {
            addPart((MessagePart)itr.next());
         }

         // Inherit the mapping
View Full Code Here


   {
      verifyNotReadOnly();

      if (m_schemaResourceLookupDeque == null)
      {
         m_schemaResourceLookupDeque = new LinkedHashTab();
      }

      Object oldDestination = m_schemaResourceLookupDeque.put(sSourceURL, destination);

      if (oldDestination != null)
View Full Code Here

         if (baseRootMapping.m_schemaResourceLookupDeque != null)
         {
            if (m_schemaResourceLookupDeque == null)
            {
               m_schemaResourceLookupDeque = new LinkedHashTab();
            }

            for (Lookup.Iterator itr = baseRootMapping.m_schemaResourceLookupDeque.iterator(); itr.hasNext(); )
            {
               String sSrcURL = (String)itr.next();
View Full Code Here

      {
         m_compositionAttributeMap = null;
      }
      else
      {
         m_compositionAttributeMap = new LinkedHashTab();
         getCompositionMap(attributes, m_compositionAttributeMap);
      }
   }
View Full Code Here

      assert key != null;
      assert function != null;

      if (m_synchronizerMap == null)
      {
         m_synchronizerMap = new LinkedHashTab();
      }

      m_synchronizerMap.put(key, function);
   }
View Full Code Here

      assert key != null;
      assert function != null;

      if (m_compensatorMap == null)
      {
         m_compensatorMap = new LinkedHashTab();
      }

      m_compensatorMap.put(key, function);
   }
View Full Code Here

    * @param progress The progress listener. Can be null.
    */
   public void loadResources(String sExt, String sMarkerTypeName, String sMarkerPropertyName,
      ResourceNameHandler handler, ProgressListener progress)
   {
      Lookup resourceMap = new LinkedHashTab(256);

      addResources(resourceMap, sExt, sMarkerTypeName, sMarkerPropertyName);

      int nCount = 0;

      for (Lookup.Iterator itr = resourceMap.iterator(); itr.hasNext();)
      {
         String sBaseName = (String)itr.next();
         String sFullName = (String)itr.getValue();
         String sResourceNameSaved = m_sCurResourceName;
         int nCookie = pushMarker(MetadataValidationException.RESOURCE_NAME, sFullName);

         pushMarker(MetadataValidationException.TYPE_NAME, sMarkerTypeName);
         pushMarker(sMarkerPropertyName, sBaseName);
         m_sCurResourceName = sFullName;

         try
         {
            if (progress != null)
            {
               progress.progress("info.meta.loadingResource", new Object[]{sFullName},
                  (double)nCount++ / resourceMap.size());
            }

            handler.handleResource(sBaseName, sFullName);
         }
         catch (UncheckedException e)
View Full Code Here

   public Element mergeDescriptorElements(List baseList, List rootList) throws MetadataException
   {
      Document doc = XMLUtil.parse(new StringReader("<Metadata/>"));
      Element descriptorElement = doc.getDocumentElement();
      Lookup2D resourceMap = new HashTab2D();
      Lookup refNameMap = new LinkedHashTab();
      Lookup mixinMap = new LinkedHashTab();
      String sBaseNamespace = null;
      String sBaseVersion = null;
      String sBaseChecksum = null;
      String sBaseName = null;
      String sBaseRevision = null;
      String sBaseDescription = null;
      String sBaseCoreVersion = null;
      String sBaseModule = null;
      String sBaseOverride = null;
      String sRootNamespace = null;
      String sRootVersion = null;
      String sRootDescription = null;
      String sRootName = null;
      String sRootRevision = null;
      String sRootCoreVersion = null;
      String sRootModule = null;
      String sRootOverride = null;
      Element baseElement = getDescriptorElement(false);
      Element rootElement = getDescriptorElement(true);

      if (baseElement != null)
      {
         sBaseNamespace = XMLUtil.getReqStringAttr(baseElement, "namespace");
         sBaseVersion = XMLUtil.getReqStringAttr(baseElement, "version");
         sBaseName = XMLUtil.getReqStringAttr(baseElement, "name");
         sBaseRevision = XMLUtil.getReqStringAttr(baseElement, "revision");
         sBaseCoreVersion = XMLUtil.getStringAttr(baseElement, "coreVersion");
         sBaseModule = normalizeScope(XMLUtil.getStringAttr(baseElement, "module"));
         sBaseOverride = XMLUtil.getStringAttr(baseElement, "override");
         sBaseDescription = XMLUtil.getStringAttr(baseElement, "description");
         sBaseChecksum = getChecksum(false);
         addMixinElements(mixinMap, baseElement);
         addResourceElements(resourceMap, refNameMap, baseElement);
      }

      if (rootElement != null)
      {
         sRootNamespace = XMLUtil.getReqStringAttr(rootElement, "namespace");
         sRootVersion = XMLUtil.getReqStringAttr(rootElement, "version");
         sRootName = XMLUtil.getReqStringAttr(rootElement, "name");
         sRootRevision = XMLUtil.getReqStringAttr(rootElement, "revision");
         sRootCoreVersion = XMLUtil.getStringAttr(rootElement, "coreVersion");
         sRootModule = normalizeScope(XMLUtil.getStringAttr(rootElement, "module"));
         sRootOverride = XMLUtil.getStringAttr(rootElement, "override");
         sRootDescription = XMLUtil.getStringAttr(rootElement, "description");
         addMixinElements(mixinMap, rootElement);
         addResourceElements(resourceMap, refNameMap, rootElement);

         if (baseElement == null)
         {
            sBaseNamespace = XMLUtil.getStringAttr(rootElement, "baseNamespace");
            sBaseVersion = XMLUtil.getStringAttr(rootElement, "baseVersion");
            sBaseChecksum = XMLUtil.getStringAttr(rootElement, "baseChecksum");
         }
      }
      else
      {
         sRootNamespace = sBaseNamespace;
         sRootVersion = sBaseVersion;
         sRootName = sBaseName;
         sRootRevision = sBaseRevision;
         sRootModule = sBaseModule;
         sRootOverride = sBaseOverride;
         sRootDescription = sBaseDescription;
         sBaseNamespace = null;
         sBaseVersion = null;
         sBaseChecksum = null;
         sBaseModule = null;
         sBaseOverride = null;
         sBaseDescription = null;
      }

      if (sRootCoreVersion == null)
      {
         sRootCoreVersion = sBaseCoreVersion;
      }

      if (sRootNamespace != null)
      {
         descriptorElement.setAttribute("name", sRootName);
         descriptorElement.setAttribute("revision", sRootRevision);
         descriptorElement.setAttribute("namespace", sRootNamespace);
         descriptorElement.setAttribute("version", sRootVersion);

         if (sRootCoreVersion != null)
         {
            descriptorElement.setAttribute("coreVersion", sRootCoreVersion);
         }

         if (sRootModule != null)
         {
            descriptorElement.setAttribute("module", sRootModule);
         }

         if (sRootOverride != null)
         {
            descriptorElement.setAttribute("override", sRootOverride);
         }

         if (sRootDescription != null)
         {
            descriptorElement.setAttribute("description", sRootDescription);
         }
      }

      if (sBaseNamespace != null)
      {
         descriptorElement.setAttribute("baseNamespace", sBaseNamespace);
         descriptorElement.setAttribute("baseVersion", sBaseVersion);
         descriptorElement.setAttribute("baseChecksum", sBaseChecksum);
      }

      // Insert the mixin elements
      Element mixinsElement = doc.createElement("Mixins");

      descriptorElement.appendChild(mixinsElement);

      for (Iterator itr = mixinMap.valueIterator(); itr.hasNext(); )
      {
         Element mixinElement = XMLUtil.addChildElement(mixinsElement, null, "Mixin");
         NamedNodeMap map = ((Element)itr.next()).getAttributes();

         for (int i = 0, n = map.getLength(); i < n; ++i)
View Full Code Here

            ((Field)itr.getValue()).setNext(null);
         }

         Arrays.sort(keyArray, FIELD_KEY_COMPARATOR);

         Lookup fieldMap = new LinkedHashTab(keyArray.length);
         Field firstOutput = null;
         Field lastOutput = null;

         for (i = 0; i < keyArray.length; ++i)
         {
            Object key = keyArray[i];
            Field field = (Field)m_fieldMap.get(key);

            fieldMap.put(key, field);

            if (field.isOutput() && field.getNext() == null && field != lastOutput)
            {
               if (lastOutput == null)
               {
View Full Code Here

    */
   public void generate(Machine machine)
   {
      verifyNotReadOnly();

      Lookup messageMap = new LinkedHashTab();
      List defaultList = new ArrayList(4);

      // Group the branches by message
      for (int i = 0, n = getBranchCount(); i != n; ++i)
      {
         Branch branch = getBranch(i);
         Message message = (branch instanceof Case) ? ((Case)branch).getMessage() : null;

         if (message != null)
         {
            List list = (List)messageMap.get(message.getName());

            if (list == null)
            {
               list = new ArrayList(4);
               messageMap.put(message.getName(), list);
            }
           
            list.add(branch);
         }
         else
         {
            defaultList.add(branch);
         }
      }

      // Generate the grouped branches

      Pair body = Jump.BODY;
      Pair cond = new Pair(Symbol.COND, generate(defaultList));

      if (messageMap.size() == 0)
      {
         body = new Pair(cond, body);
      }
      else
      {
         // (case (this':class) (("msg1") (cond ...)) ... (("msgN") (cond ...)))

         Pair code = new Pair(Pair.list(Symbol.THIS, Pair.quote(Symbol._CLASS)));

         body = new Pair(new Pair(Symbol.CASE, code), body);

         for (Lookup.Iterator itr = messageMap.iterator(); itr.hasNext();)
         {
            itr.next();

            Pair tail = new Pair(Pair.list(Pair.list(itr.getKey()),
               new Pair(Symbol.COND, generate((List)itr.getValue()))));
View Full Code Here

TOP

Related Classes of nexj.core.util.LinkedHashTab

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.