org.eclipse.osgi_3.8.2.v20130124-134944

 normalize().toString());
    }
    return result;
  }
  
  private StringBuffer normalize()
  {
    StringBuffer sb = new StringBuffer();
    sb.append('(');
    Object localObject;
    int j;
    int i;
    switch (op)
    {
    case 7: 
      sb.append('&');
      
      FilterImpl[] filters = (FilterImpl[])value;
      j = (localObject = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = localObject[i];
        sb.append(f.normalize());
      }
      break;
    case 8: 
      sb.append('|');
      
      FilterImpl[] filters = (FilterImpl[])value;
      j = (localObject = filters).length;
      for (i = 0; i < j; i++)
      {
        FilterImpl f = localObject[i];
        sb.append(f.normalize());
      }
      break;
    case 9: 
      sb.append('!');
      FilterImpl filter = (FilterImpl)value;
      sb.append(filter.normalize());
      
      break;
    case 6: 
      sb.append(attr);
      sb.append('=');
      
      String[] substrings = (String[])value;
      
      j = (localObject = substrings).length;
      for (i = 0; i < j; i++)
      {
        String substr = localObject[i];
        if (substr == null) {
          sb.append('*');
        } else {
          sb.append(encodeValue(substr));
        }
      }
      break;
    case 1: 
      sb.append(attr);
      sb.append('=');
      sb.append(encodeValue((String)value));
      
      break;
    case 3: 
      sb.append(attr);
      sb.append(">=");
      sb.append(encodeValue((String)value));
      
      break;
    case 4: 
      sb.append(attr);
      sb.append("<=");
      sb.append(encodeValue((String)value));
      
      break;
    case 2: 
      sb.append(attr);
      sb.append("~=");
      sb.append(encodeValue(approxString((String)value)));
      
      break;
    case 5: 
      sb.append(attr);
      sb.append("=*");
    }
    sb.append(')');
    
    return sb;
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof Filter)) {
      return false;
    }
    return toString().equals(obj.toString());
  }
  
  public int hashCode()
  {
    return toString().hashCode();
  }
  
  FilterImpl(int operation, String attr, Object value)
  {
    op = operation;
    this.attr = attr;
    this.value = value;
  }
  
  private static String encodeValue(String value)
  {
    boolean encoded = false;
    int inlen = value.length();
    int outlen = inlen << 1;
    
    char[] output = new char[outlen];
    value.getChars(0, inlen, output, inlen);
    
    int cursor = 0;
    for (int i = inlen; i < outlen; i++)
    {
      char c = output[i];
      switch (c)
      {
      case '(': 
      case ')': 
      case '*': 
      case '\\': 
        output[cursor] = '\\';
        cursor++;
        encoded = true;
      }
      output[cursor] = c;
      cursor++;
    }
    return encoded ? new String(output, 0, cursor) : value;
  }
  
  private boolean compare(int operation, Object value1, Object value2)
  {
    if (value1 == null)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("compare(" + value1 + "," + value2 + ")");
      }
      return false;
    }
    if ((value1 instanceof String)) {
      return compare_String(operation, (String)value1, value2);
    }
    Class<?> clazz = value1.getClass();
    if (clazz.isArray())
    {
      Class<?> type = clazz.getComponentType();
      if (type.isPrimitive()) {
        return compare_PrimitiveArray(operation, type, value1, value2);
      }
      return compare_ObjectArray(operation, (Object[])value1, value2);
    }
    if ((value1 instanceof Collection)) {
      return compare_Collection(operation, (Collection)value1, value2);
    }
    if ((value1 instanceof Integer)) {
      return compare_Integer(operation, ((Integer)value1).intValue(), value2);
    }
    if ((value1 instanceof Long)) {
      return compare_Long(operation, ((Long)value1).longValue(), value2);
    }
    if ((value1 instanceof Byte)) {
      return compare_Byte(operation, ((Byte)value1).byteValue(), value2);
    }
    if ((value1 instanceof Short)) {
      return compare_Short(operation, ((Short)value1).shortValue(), value2);
    }
    if ((value1 instanceof Character)) {
      return compare_Character(operation, ((Character)value1).charValue(), value2);
    }
    if ((value1 instanceof Float)) {
      return compare_Float(operation, ((Float)value1).floatValue(), value2);
    }
    if ((value1 instanceof Double)) {
      return compare_Double(operation, ((Double)value1).doubleValue(), value2);
    }
    if ((value1 instanceof Boolean)) {
      return compare_Boolean(operation, ((Boolean)value1).booleanValue(), value2);
    }
    if ((value1 instanceof Comparable))
    {
      Comparable<Object> comparable = (Comparable)value1;
      return compare_Comparable(operation, comparable, value2);
    }
    return compare_Unknown(operation, value1, value2);
  }
  
  private boolean compare_Collection(int operation, Collection<?> collection, Object value2)
  {
    for (Iterator localIterator = collection.iterator(); localIterator.hasNext();)
    {
      Object value1 = localIterator.next();
      if (compare(operation, value1, value2)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean compare_ObjectArray(int operation, Object[] array, Object value2)
  {
    Object[] arrayOfObject;
    int j = (arrayOfObject = array).length;
    for (int i = 0; i < j; i++)
    {
      Object value1 = arrayOfObject[i];
      if (compare(operation, value1, value2)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean compare_PrimitiveArray(int operation, Class<?> type, Object primarray, Object value2)
  {
    int j;
    int i;
    if (Integer.TYPE.isAssignableFrom(type))
    {
      int[] array = (int[])primarray;
      int[] arrayOfInt1;
      j = (arrayOfInt1 = array).length;
      for (i = 0; i < j; i++)
      {
        int value1 = arrayOfInt1[i];
        if (compare_Integer(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    Object localObject2;
    if (Long.TYPE.isAssignableFrom(type))
    {
      long[] array = (long[])primarray;
      int k = (localObject2 = array).length;
      for (j = 0; j < k; j++)
      {
        long value1 = localObject2[j];
        if (compare_Long(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    Object localObject1;
    if (Byte.TYPE.isAssignableFrom(type))
    {
      byte[] array = (byte[])primarray;
      j = (localObject1 = array).length;
      for (i = 0; i < j; i++)
      {
        byte value1 = localObject1[i];
        if (compare_Byte(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    if (Short.TYPE.isAssignableFrom(type))
    {
      short[] array = (short[])primarray;
      j = (localObject1 = array).length;
      for (i = 0; i < j; i++)
      {
        short value1 = localObject1[i];
        if (compare_Short(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    if (Character.TYPE.isAssignableFrom(type))
    {
      char[] array = (char[])primarray;
      j = (localObject1 = array).length;
      for (i = 0; i < j; i++)
      {
        char value1 = localObject1[i];
        if (compare_Character(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    if (Float.TYPE.isAssignableFrom(type))
    {
      float[] array = (float[])primarray;
      j = (localObject1 = array).length;
      for (i = 0; i < j; i++)
      {
        float value1 = localObject1[i];
        if (compare_Float(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    if (Double.TYPE.isAssignableFrom(type))
    {
      double[] array = (double[])primarray;
      int m = (localObject2 = array).length;
      for (j = 0; j < m; j++)
      {
        double value1 = localObject2[j];
        if (compare_Double(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    if (Boolean.TYPE.isAssignableFrom(type))
    {
      boolean[] array = (boolean[])primarray;
      boolean[] arrayOfBoolean1;
      j = (arrayOfBoolean1 = array).length;
      for (i = 0; i < j; i++)
      {
        boolean value1 = arrayOfBoolean1[i];
        if (compare_Boolean(operation, value1, value2)) {
          return true;
        }
      }
      return false;
    }
    return false;
  }
  
  private boolean compare_String(int operation, String string, Object value2)
  {
    switch (operation)
    {
    case 6: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + string + "," + value2 + ")");
      }
      String[] substrings = (String[])value2;
      int pos = 0;
      int i = 0;
      for (int size = substrings.length; i < size; i++)
      {
        String substr = substrings[i];
        if (i + 1 < size)
        {
          if (substr == null)
          {
            String substr2 = substrings[(i + 1)];
            if (substr2 != null)
            {
              if (Debug.DEBUG_FILTER) {
                Debug.println("indexOf(\"" + substr2 + "\"," + pos + ")");
              }
              int index = string.indexOf(substr2, pos);
              if (index == -1) {
                return false;
              }
              pos = index + substr2.length();
              if (i + 2 < size) {
                i++;
              }
            }
          }
          else
          {
            int len = substr.length();
            if (Debug.DEBUG_FILTER) {
              Debug.println("regionMatches(" + pos + ",\"" + substr + "\")");
            }
            if (string.regionMatches(pos, substr, 0, len)) {
              pos += len;
            } else {
              return false;
            }
          }
        }
        else
        {
          if (substr == null) {
            return true;
          }
          if (Debug.DEBUG_FILTER) {
            Debug.println("regionMatches(" + pos + "," + substr + ")");
          }
          return string.endsWith(substr);
        }
      }
      return true;
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + string + "," + value2 + ")");
      }
      return string.equals(value2);
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + string + "," + value2 + ")");
      }
      string = approxString(string);
      String string2 = approxString((String)value2);
      
      return string.equalsIgnoreCase(string2);
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + string + "," + value2 + ")");
      }
      return string.compareTo((String)value2) >= 0;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + string + "," + value2 + ")");
      }
      return string.compareTo((String)value2) <= 0;
    }
    return false;
  }
  
  private boolean compare_Integer(int operation, int intval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + intval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      intval2 = Integer.parseInt(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      int intval2;
      return false;
    }
    int intval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + intval + "," + value2 + ")");
      }
      return intval == intval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + intval + "," + value2 + ")");
      }
      return intval == intval2;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + intval + "," + value2 + ")");
      }
      return intval >= intval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + intval + "," + value2 + ")");
      }
      return intval <= intval2;
    }
    return false;
  }
  
  private boolean compare_Long(int operation, long longval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + longval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      longval2 = Long.parseLong(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      long longval2;
      return false;
    }
    long longval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + longval + "," + value2 + ")");
      }
      return longval == longval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + longval + "," + value2 + ")");
      }
      return longval == longval2;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + longval + "," + value2 + ")");
      }
      return longval >= longval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + longval + "," + value2 + ")");
      }
      return longval <= longval2;
    }
    return false;
  }
  
  private boolean compare_Byte(int operation, byte byteval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + byteval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      byteval2 = Byte.parseByte(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      byte byteval2;
      return false;
    }
    byte byteval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + byteval + "," + value2 + ")");
      }
      return byteval == byteval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + byteval + "," + value2 + ")");
      }
      return byteval == byteval2;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + byteval + "," + value2 + ")");
      }
      return byteval >= byteval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + byteval + "," + value2 + ")");
      }
      return byteval <= byteval2;
    }
    return false;
  }
  
  private boolean compare_Short(int operation, short shortval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + shortval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      shortval2 = Short.parseShort(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      short shortval2;
      return false;
    }
    short shortval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + shortval + "," + value2 + ")");
      }
      return shortval == shortval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + shortval + "," + value2 + ")");
      }
      return shortval == shortval2;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + shortval + "," + value2 + ")");
      }
      return shortval >= shortval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + shortval + "," + value2 + ")");
      }
      return shortval <= shortval2;
    }
    return false;
  }
  
  private boolean compare_Character(int operation, char charval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + charval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      charval2 = ((String)value2).charAt(0);
    }
    catch (IndexOutOfBoundsException localIndexOutOfBoundsException)
    {
      char charval2;
      return false;
    }
    char charval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + charval + "," + value2 + ")");
      }
      return charval == charval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + charval + "," + value2 + ")");
      }
      return (charval == charval2) || (Character.toUpperCase(charval) == Character.toUpperCase(charval2)) || (Character.toLowerCase(charval) == Character.toLowerCase(charval2));
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + charval + "," + value2 + ")");
      }
      return charval >= charval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + charval + "," + value2 + ")");
      }
      return charval <= charval2;
    }
    return false;
  }
  
  private boolean compare_Boolean(int operation, boolean boolval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + boolval + "," + value2 + ")");
      }
      return false;
    }
    boolean boolval2 = Boolean.valueOf(((String)value2).trim()).booleanValue();
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + boolval + "," + value2 + ")");
      }
      return boolval == boolval2;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + boolval + "," + value2 + ")");
      }
      return boolval == boolval2;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + boolval + "," + value2 + ")");
      }
      return boolval == boolval2;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + boolval + "," + value2 + ")");
      }
      return boolval == boolval2;
    }
    return false;
  }
  
  private boolean compare_Float(int operation, float floatval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + floatval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      floatval2 = Float.parseFloat(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      float floatval2;
      return false;
    }
    float floatval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + floatval + "," + value2 + ")");
      }
      return Float.compare(floatval, floatval2) == 0;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + floatval + "," + value2 + ")");
      }
      return Float.compare(floatval, floatval2) == 0;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + floatval + "," + value2 + ")");
      }
      return Float.compare(floatval, floatval2) >= 0;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + floatval + "," + value2 + ")");
      }
      return Float.compare(floatval, floatval2) <= 0;
    }
    return false;
  }
  
  private boolean compare_Double(int operation, double doubleval, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + doubleval + "," + value2 + ")");
      }
      return false;
    }
    try
    {
      doubleval2 = Double.parseDouble(((String)value2).trim());
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      double doubleval2;
      return false;
    }
    double doubleval2;
    switch (operation)
    {
    case 1: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("EQUAL(" + doubleval + "," + value2 + ")");
      }
      return Double.compare(doubleval, doubleval2) == 0;
    case 2: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("APPROX(" + doubleval + "," + value2 + ")");
      }
      return Double.compare(doubleval, doubleval2) == 0;
    case 3: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("GREATER(" + doubleval + "," + value2 + ")");
      }
      return Double.compare(doubleval, doubleval2) >= 0;
    case 4: 
      if (Debug.DEBUG_FILTER) {
        Debug.println("LESS(" + doubleval + "," + value2 + ")");
      }
      return Double.compare(doubleval, doubleval2) <= 0;
    }
    return false;
  }
  
  private static Object valueOf(Class<?> target, String value2)
  {
    try
    {
      method = target.getMethod("valueOf", new Class[] { String.class });
    }
    catch (NoSuchMethodException localNoSuchMethodException1)
    {
      Method method;
      break label103;
    }
    Method method;
    if ((Modifier.isStatic(method.getModifiers())) && (target.isAssignableFrom(method.getReturnType())))
    {
      setAccessible(method);
      try
      {
        return method.invoke(null, new Object[] { value2.trim() });
      }
      catch (IllegalAccessException localIllegalAccessException1)
      {
        return null;
      }
      catch (InvocationTargetException localInvocationTargetException1)
      {
        return null;
      }
    }
    try
    {
      label103:
      constructor = target.getConstructor(new Class[] { String.class });
    }
    catch (NoSuchMethodException localNoSuchMethodException2)
    {
      Constructor<?> constructor;
      break label184;
    }
    Constructor<?> constructor;
    setAccessible(constructor);
    try
    {
      return constructor.newInstance(new Object[] { value2.trim() });
    }
    catch (IllegalAccessException localIllegalAccessException2)
    {
      return null;
    }
    catch (InvocationTargetException localInvocationTargetException2)
    {
      return null;
    }
    catch (InstantiationException localInstantiationException)
    {
      return null;
    }
    label184:
    return null;
  }
  
  private static void setAccessible(AccessibleObject accessible)
  {
    if (!accessible.isAccessible()) {
      AccessController.doPrivileged(new SetAccessibleAction(accessible));
    }
  }
  
  private boolean compare_Comparable(int operation, Comparable<Object> value1, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + value1 + "," + value2 + ")");
      }
      return false;
    }
    value2 = valueOf(value1.getClass(), (String)value2);
    if (value2 == null) {
      return false;
    }
    try
    {
      switch (operation)
      {
      case 1: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("EQUAL(" + value1 + "," + value2 + ")");
        }
        return value1.compareTo(value2) == 0;
      case 2: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("APPROX(" + value1 + "," + value2 + ")");
        }
        return value1.compareTo(value2) == 0;
      case 3: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("GREATER(" + value1 + "," + value2 + ")");
        }
        return value1.compareTo(value2) >= 0;
      case 4: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("LESS(" + value1 + "," + value2 + ")");
        }
        return value1.compareTo(value2) <= 0;
      }
    }
    catch (Exception localException)
    {
      return false;
    }
    return false;
  }
  
  private boolean compare_Unknown(int operation, Object value1, Object value2)
  {
    if (operation == 6)
    {
      if (Debug.DEBUG_FILTER) {
        Debug.println("SUBSTRING(" + value1 + "," + value2 + ")");
      }
      return false;
    }
    value2 = valueOf(value1.getClass(), (String)value2);
    if (value2 == null) {
      return false;
    }
    try
    {
      switch (operation)
      {
      case 1: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("EQUAL(" + value1 + "," + value2 + ")");
        }
        return value1.equals(value2);
      case 2: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("APPROX(" + value1 + "," + value2 + ")");
        }
        return value1.equals(value2);
      case 3: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("GREATER(" + value1 + "," + value2 + ")");
        }
        return value1.equals(value2);
      case 4: 
        if (Debug.DEBUG_FILTER) {
          Debug.println("LESS(" + value1 + "," + value2 + ")");
        }
        return value1.equals(value2);
      }
    }
    catch (Exception localException)
    {
      return false;
    }
    return false;
  }
  
  private static String approxString(String input)
  {
    boolean changed = false;
    char[] output = input.toCharArray();
    int cursor = 0;
    char[] arrayOfChar1;
    int j = (arrayOfChar1 = output).length;
    for (int i = 0; i < j; i++)
    {
      char c = arrayOfChar1[i];
      if (Character.isWhitespace(c))
      {
        changed = true;
      }
      else
      {
        output[cursor] = c;
        cursor++;
      }
    }
    return changed ? new String(output, 0, cursor) : input;
  }
  
  public String getRequiredObjectClass()
  {
    return getPrimaryKeyValue("objectClass");
  }
  
  public String getPrimaryKeyValue(String primaryKey)
  {
    switch (op)
    {
    case 1: 
      if ((attr.equalsIgnoreCase(primaryKey)) && ((value instanceof String))) {
        return (String)value;
      }
      break;
    case 7: 
      FilterImpl[] clauses = (FilterImpl[])value;
      FilterImpl[] arrayOfFilterImpl1;
      int j = (arrayOfFilterImpl1 = clauses).length;
      for (int i = 0; i < j; i++)
      {
        FilterImpl clause = arrayOfFilterImpl1[i];
        if (op == 1)
        {
          String result = clause.getPrimaryKeyValue(primaryKey);
          if (result != null) {
            return result;
          }
        }
      }
    }
    return null;
  }
  
  public String[] getAttributes()
  {
    List<String> results = new ArrayList();
    getAttributesInternal(results);
    return (String[])results.toArray(new String[results.size()]);
  }
  
  private void getAttributesInternal(List<String> results)
  {
    if ((value instanceof FilterImpl[]))
    {
      FilterImpl[] children = (FilterImpl[])value;
      FilterImpl[] arrayOfFilterImpl1;
      int j = (arrayOfFilterImpl1 = children).length;
      for (int i = 0; i < j; i++)
      {
        FilterImpl child = arrayOfFilterImpl1[i];
        child.getAttributesInternal(results);
      }
      return;
    }
    if ((value instanceof FilterImpl))
    {
      FilterImpl child = (FilterImpl)value;
      child.getAttributesInternal(results);
      return;
    }
    if (attr != null) {
      results.add(attr);
    }
  }
  
  private static class Parser
  {
    private final String filterstring;
    private final char[] filterChars;
    private int pos;
    
    Parser(String filterstring)
    {
      this.filterstring = filterstring;
      filterChars = filterstring.toCharArray();
      pos = 0;
    }
    
    FilterImpl parse()
      throws InvalidSyntaxException
    {
      try
      {
        filter = parse_filter();
      }
      catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
      {
        FilterImpl filter;
        throw new InvalidSyntaxException(Msg.FILTER_TERMINATED_ABRUBTLY, filterstring);
      }
      FilterImpl filter;
      if (pos != filterChars.length) {
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_TRAILING_CHARACTERS, filterstring.substring(pos)), filterstring);
      }
      return filter;
    }
    
    private FilterImpl parse_filter()
      throws InvalidSyntaxException
    {
      skipWhiteSpace();
      if (filterChars[pos] != '(') {
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_LEFTPAREN, filterstring.substring(pos)), filterstring);
      }
      pos += 1;
      
      FilterImpl filter = parse_filtercomp();
      
      skipWhiteSpace();
      if (filterChars[pos] != ')') {
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_RIGHTPAREN, filterstring.substring(pos)), filterstring);
      }
      pos += 1;
      
      skipWhiteSpace();
      
      return filter;
    }
    
    private FilterImpl parse_filtercomp()
      throws InvalidSyntaxException
    {
      skipWhiteSpace();
      
      char c = filterChars[pos];
      switch (c)
      {
      case '&': 
        pos += 1;
        return parse_and();
      case '|': 
        pos += 1;
        return parse_or();
      case '!': 
        pos += 1;
        return parse_not();
      }
      return parse_item();
    }
    
    private FilterImpl parse_and()
      throws InvalidSyntaxException
    {
      int lookahead = pos;
      skipWhiteSpace();
      if (filterChars[pos] != '(')
      {
        pos = (lookahead - 1);
        return parse_item();
      }
      List<FilterImpl> operands = new ArrayList(10);
      while (filterChars[pos] == '(')
      {
        FilterImpl child = parse_filter();
        operands.add(child);
      }
      return new FilterImpl(7, null, operands.toArray(new FilterImpl[operands.size()]));
    }
    
    private FilterImpl parse_or()
      throws InvalidSyntaxException
    {
      int lookahead = pos;
      skipWhiteSpace();
      if (filterChars[pos] != '(')
      {
        pos = (lookahead - 1);
        return parse_item();
      }
      List<FilterImpl> operands = new ArrayList(10);
      while (filterChars[pos] == '(')
      {
        FilterImpl child = parse_filter();
        operands.add(child);
      }
      return new FilterImpl(8, null, operands.toArray(new FilterImpl[operands.size()]));
    }
    
    private FilterImpl parse_not()
      throws InvalidSyntaxException
    {
      int lookahead = pos;
      skipWhiteSpace();
      if (filterChars[pos] != '(')
      {
        pos = (lookahead - 1);
        return parse_item();
      }
      FilterImpl child = parse_filter();
      
      return new FilterImpl(9, null, child);
    }
    
    private FilterImpl parse_item()
      throws InvalidSyntaxException
    {
      String attr = parse_attr();
      
      skipWhiteSpace();
      switch (filterChars[pos])
      {
      case '~': 
        if (filterChars[(pos + 1)] == '=')
        {
          pos += 2;
          return new FilterImpl(2, attr, parse_value());
        }
        break;
      case '>': 
        if (filterChars[(pos + 1)] == '=')
        {
          pos += 2;
          return new FilterImpl(3, attr, parse_value());
        }
        break;
      case '<': 
        if (filterChars[(pos + 1)] == '=')
        {
          pos += 2;
          return new FilterImpl(4, attr, parse_value());
        }
        break;
      case '=': 
        if (filterChars[(pos + 1)] == '*')
        {
          int oldpos = pos;
          pos += 2;
          skipWhiteSpace();
          if (filterChars[pos] == ')') {
            return new FilterImpl(5, attr, null);
          }
          pos = oldpos;
        }
        pos += 1;
        Object string = parse_substring();
        if ((string instanceof String)) {
          return new FilterImpl(1, attr, string);
        }
        return new FilterImpl(6, attr, string);
      }
      throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_OPERATOR, filterstring.substring(pos)), filterstring);
    }
    
    private String parse_attr()
      throws InvalidSyntaxException
    {
      skipWhiteSpace();
      
      int begin = pos;
      int end = pos;
      
      char c = filterChars[pos];
      while ((c != '~') && (c != '<') && (c != '>') && (c != '=') && (c != '(') && (c != ')'))
      {
        pos += 1;
        if (!Character.isWhitespace(c)) {
          end = pos;
        }
        c = filterChars[pos];
      }
      int length = end - begin;
      if (length == 0) {
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_ATTR, filterstring.substring(pos)), filterstring);
      }
      return new String(filterChars, begin, length);
    }
    
    private String parse_value()
      throws InvalidSyntaxException
    {
      StringBuffer sb = new StringBuffer(filterChars.length - pos);
      for (;;)
      {
        char c = filterChars[pos];
        switch (c)
        {
        case ')': 
          break;
        case '(': 
          throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_VALUE, filterstring.substring(pos)), filterstring);
        case '\\': 
          pos += 1;
          c = filterChars[pos];
        default: 
          sb.append(c);
          pos += 1;
        }
      }
      if (sb.length() == 0) {
        throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_MISSING_VALUE, filterstring.substring(pos)), filterstring);
      }
      return sb.toString();
    }
    
    private Object parse_substring()
      throws InvalidSyntaxException
    {
      StringBuffer sb = new StringBuffer(filterChars.length - pos);
      
      List<String> operands = new ArrayList(10);
      for (;;)
      {
        char c = filterChars[pos];
        switch (c)
        {
        case ')': 
          if (sb.length() <= 0) {
            break label213;
          }
          operands.add(sb.toString());
          
          break;
        case '(': 
          throw new InvalidSyntaxException(NLS.bind(Msg.FILTER_INVALID_VALUE, filterstring.substring(pos)), filterstring);
        case '*': 
          if (sb.length() > 0) {
            operands.add(sb.toString());
          }
          sb.setLength(0);
          
          operands.add(null);
          pos += 1;
          
          break;
        case '\\': 
          pos += 1;
          c = filterChars[pos];
        default: 
          sb.append(c);
          pos += 1;
        }
      }
      label213:
      int size = operands.size();
      if (size == 0) {
        return "";
      }
      if (size == 1)
      {
        Object single = operands.get(0);
        if (single != null) {
          return single;
        }
      }
      return operands.toArray(new String[size]);
    }
    
    private void skipWhiteSpace()
    {
      for (int length = filterChars.length; (pos < length) && (Character.isWhitespace(filterChars[pos]));) {
        pos += 1;
      }
    }
  }
  
  private static class ServiceReferenceDictionary
    extends Dictionary<String, Object>
  {
    private final ServiceReference<?> reference;
    
    ServiceReferenceDictionary(ServiceReference<?> reference)
    {
      this.reference = reference;
    }
    
    public Object get(Object key)
    {
      if (reference == null) {
        return null;
      }
      return reference.getProperty((String)key);
    }
    
    public boolean isEmpty()
    {
      throw new UnsupportedOperationException();
    }
    
    public Enumeration<String> keys()
    {
      throw new UnsupportedOperationException();
    }
    
    public Enumeration<Object> elements()
    {
      throw new UnsupportedOperationException();
    }
    
    public Object put(String key, Object value)
    {
      throw new UnsupportedOperationException();
    }
    
    public Object remove(Object key)
    {
      throw new UnsupportedOperationException();
    }
    
    public int size()
    {
      throw new UnsupportedOperationException();
    }
  }
  
  private static class SetAccessibleAction
    implements PrivilegedAction<Object>
  {
    private final AccessibleObject accessible;
    
    SetAccessibleAction(AccessibleObject accessible)
    {
      this.accessible = accessible;
    }
    
    public Object run()
    {
      accessible.setAccessible(true);
      return null;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.FilterImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.io.InputStream;
import java.net.URLConnection;
import java.security.AccessControlContext;
import java.security.PrivilegedExceptionAction;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.osgi.framework.BundleException;

class Framework$1
  implements PrivilegedExceptionAction<AbstractBundle>
{
  final Framework this$0;
  
  Framework$1(Framework paramFramework, InputStream paramInputStream, String paramString, AccessControlContext paramAccessControlContext, BundleContextImpl paramBundleContextImpl) {}
  
  public AbstractBundle run()
    throws BundleException
  {
    URLConnection source = val$in != null ? new BundleSource(val$in) : this$0.adaptor.mapLocationToURLConnection(val$location);
    
    return this$0.installWorkerPrivileged(val$location, source, val$callerContext, val$origin);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.Framework.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.util.Collection;
import org.eclipse.osgi.internal.serviceregistry.HookContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.bundle.EventHook;

class Framework$10
  implements HookContext
{
  final Framework this$0;
  
  Framework$10(Framework paramFramework, BundleEvent paramBundleEvent, Collection paramCollection) {}
  
  public void call(Object hook, ServiceRegistration<?> hookRegistration)
    throws Exception
  {
    if ((hook instanceof EventHook)) {
      ((EventHook)hook).event(val$event, val$result);
    }
  }
  
  public String getHookClassName()
  {
    return Framework.eventHookName;
  }
  
  public String getHookMethodName()
  {
    return "event";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.Framework.10
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.security.PrivilegedExceptionAction;

class Framework$2
  implements PrivilegedExceptionAction<Object>
{
  final Framework this$0;
  
  Framework$2(Framework paramFramework, AbstractBundle paramAbstractBundle, boolean paramBoolean) {}
  
  public Object run()
    throws Exception
  {
    this$0.checkAdminPermission(val$bundle, "lifecycle");
    if (val$extension) {
      this$0.checkAdminPermission(val$bundle, "extensionLifecycle");
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.Framework.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.security.PrivilegedAction;
import java.util.Collection;

class Framework$3
  implements PrivilegedAction<Object>
{
  final Framework this$0;
  
  Framework$3(Framework paramFramework, BundleContextImpl paramBundleContextImpl, Collection paramCollection) {}
  
  public Object run()
  {
    this$0.notifyFindHooksPriviledged(val$context, val$shrinkable);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.Framework.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.util.Collection;
import org.eclipse.osgi.internal.serviceregistry.HookContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.bundle.FindHook;

class Framework$4
  implements HookContext
{
  final Framework this$0;
  
  Framework$4(Framework paramFramework, BundleContextImpl paramBundleContextImpl, Collection paramCollection) {}
  
  public void call(Object hook, ServiceRegistration<?> hookRegistration)
    throws Exception
  {
    if ((hook instanceof FindHook)) {
      ((FindHook)hook).find(val$context, val$allBundles);
    }
  }
  
  public String getHookClassName()
  {
    return Framework.findHookName;
  }
  
  public String getHookMethodName()
  {
    return "find";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.Framework.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.internal.core;

import java.security.PrivilegedAction;
import java.util.Collection;
import org.osgi.framework.Bundle;

class Framework$5
  implements PrivilegedAction<Object>
{
  final Framework this$0;
  
  Framework$5(Framework paramFramework, int paramInt, Bundle paramBundle, Collection paramCollection) {}
  
  public
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd