Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
    * JBoss, Home of Professional Open Source
    * Copyright 2005, JBoss Inc., and individual contributors as indicated
    * by the @authors tag. See the copyright.txt in the distribution for a
    * full listing of individual contributors.
    *
    * This is free software; you can redistribute it and/or modify it
    * under the terms of the GNU Lesser General Public License as
    * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public
   * License along with this software; if not, write to the Free
   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
   */
 package org.jboss.xb.binding.group;
 
 import java.util.Map;
 import java.util.List;

Author(s):
Alexey Loubyansky
Version:
$Revision: 2913 $
 
 public class ValueListInitializer
 {
    //private int initializedState;
    private Map attrIndex = .;
    private Map elemIndex = .;
    //private List<?> requiredBindings = Collections.EMPTY_LIST;
 
    public void addRequiredAttribute(QName qNameAttributeBinding binding)
    {
 /*
       Integer index = new Integer(requiredBindings.size());
       switch(attrIndex.size())
       {
          case 0:
             attrIndex = Collections.singletonMap(qName, index);
             break;
          case 1:
             attrIndex = new HashMap(attrIndex);
          default:
             attrIndex.put(qName, index);
       }
       addBinding(binding);
       initializedState += Math.abs(qName.hashCode());
 */
       throw new UnsupportedOperationException();
    }
 
    public void addRequiredElement(QName qNameElementBinding binding)
    {
 /*
       Integer index = new Integer(requiredBindings.size());
       switch(elemIndex.size())
       {
          case 0:
             elemIndex = Collections.singletonMap(qName, index);
             break;
          case 1:
             elemIndex = new HashMap(elemIndex);
          default:
             elemIndex.put(qName, index);
       }
       addBinding(binding);
       initializedState += Math.abs(qName.hashCode());
 */
       throw new UnsupportedOperationException();
    }
 
    public ValueList newValueList(ValueListHandler handlerClass<?> targetClass)
    {
       return new ValueList(thishandlertargetClass);
    }
 
    public void addAttributeValue(QName qNameAttributeBinding bindingValueList valueListObject value)
    {
       Integer index = (Integer).get(qName);
       if(index == null)
       {
          valueList.setAttributeValue(qNamebindingvalue);
       }
       else
       {
          if(isInitialized(valueList))
         {
            throw new JBossXBRuntimeException("The value list has already been initialized!");
         }
         valueList.setRequiredValue(index.intValue(), qName.hashCode(), value);
      }
   }
   public void addTextValue(QName qName,
                            ParticleBinding particle,
                            CharactersHandler handler,
                            ValueList valueList,
                            Object value)
   {
      valueList.addTextValue(qNameparticlehandlervalue);
   }
   public void addTermValue(QName qNameParticleBinding bindingObject handlerValueList valueListObject valueParticleBinding parentParticle)
   {
      Integer index = (Integer).get(qName);
      if(index == null)
      {
         if(binding.isRepeatable())
         {
            valueList.addRepeatableTermValue(qNamebindinghandlervalueparentParticle);
         }
         else
         {
            valueList.addTermValue(qNamebindinghandlervalueparentParticle);
         }
      }
      else
      {
         if(isInitialized(valueList))
         {
            throw new JBossXBRuntimeException("The value list has already been initialized!");
         }
         valueList.setRequiredValue(index.intValue(), qName.hashCode(), value);
      }
   }
   public boolean isInitialized(ValueList valueList)
   {
//      return requiredBindings.size() == 0 || initializedState == valueList.getState();
      throw new UnsupportedOperationException();
   }
   public Object getAttributeValue(QName qNameValueList valueList)
   {
/*
      Object value;
      Integer index = (Integer)attrIndex.get(qName);
      if(index == null)
      {
         value = valueList.getNonRequiredValue(qName);
      }
      else
      {
         value = valueList.getRequiredValue(index.intValue());
      }
      return value;
*/
      throw new UnsupportedOperationException();
   }
   public Object getElementValue(QName qNameValueList valueList)
   {
/*
      Object value;
      Integer index = (Integer)elemIndex.get(qName);
      if(index == null)
      {
         value = valueList.getNonRequiredValue(qName);
      }
      else
      {
         value = valueList.getRequiredValue(index.intValue());
      }
      return value;
*/
      throw new UnsupportedOperationException();
   }
   public List<?> getRequiredBindings()
   {
//      return requiredBindings;
      throw new UnsupportedOperationException();
   }
   // Private
/*   private void addBinding(Object binding)
   {
      if(requiredBindings == Collections.EMPTY_LIST)
      {
         requiredBindings = new ArrayList<Object>();
      }
      requiredBindings.add(binding);
   }
*/}
New to GrepCode? Check out our FAQ X