新建一个空数组

@param <T> 数组元素类型
@param componentType 元素类型
@param newSize 大小
@return 空数组
186259
@SuppressWarnings("unchecked")
	public static <T> T[] newArray(Class<?> componentType, int newSize) {
		return (T[]) Array.newInstance(componentType, newSize);
	}
190281
public static int getArraySize(final Object object, final Class<?> componentType) {

        ArgUtils.notNull(componentType, "componentType");

        if(object == null) {
            return 0;
        }

        if(!object.getClass().isArray()) {
            throw new IllegalArgumentException(String.format("args0 is not arrays : %s.", object.getClass().getName()));
        }

        if(!componentType.isPrimitive()) {
            return ((Object[])object).length;
        }

        if(componentType.equals(boolean.class)) {
            return ((boolean[]) object).length;

        } else if(componentType.equals(char.class)) {
            return ((char[]) object).length;

        } else if(componentType.equals(byte.class)) {
            return ((byte[]) object).length;

        } else if(componentType.equals(short.class)) {
            return ((short[]) object).length;

        } else if(componentType.equals(int.class)) {
            return ((int[]) object).length;

        } else if(componentType.equals(long.class)) {
            return ((long[]) object).length;

        } else if(componentType.equals(float.class)) {
            return ((byte[]) object).length;

        } else if(componentType.equals(double.class)) {
            return ((byte[]) object).length;

        }

        throw new IllegalArgumentException(String.format("not support primitive type : %s.", componentType.getName()));
    }
995503
@Override
  public void componentResized(ComponentEvent e) {
    if (e.getComponent() == component) {
      double newRatio = getCurrentRatio();
      if (Math.abs(newRatio - activeRatio) > threshold) {
        activeRatio = newRatio;
        executeResize(newRatio);
      }
    }
  }
321204
@SneakyThrows
    public <T extends SOAPObject> T newSoapObject(final Class<T> objectType) {
        val qName = getSamlObjectQName(objectType);
        val builder = (SOAPObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
        if (builder == null) {
            throw new IllegalStateException("No SAML object builder is registered for class " + objectType.getName());
        }
        return objectType.cast(builder.buildObject(qName));
    }
1033560
private String getActualComponentType(String componentType) {

        if (componentType == null) {
            throw new IllegalArgumentException("参数不能为null.");
        }

        int lastIndex = componentType.lastIndexOf(ARRAY_PREFIX);
        if (lastIndex != -1) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < lastIndex + 1; i++) {
                sb.append(ARRAY_PREFIX);
            }
            sb.append("L");
            sb.append(componentType.substring(lastIndex + 1));
            sb.append(";");
            return sb.toString();
        }

        return componentType;
    }
644461
private Optional<PackingPlan.InstancePlan> getAnyInstanceOfComponent(String componentName) {
    for (PackingPlan.InstancePlan instancePlan : this.instances) {
      if (instancePlan.getComponentName().equals(componentName)) {
        return Optional.of(instancePlan);
      }
    }
    return Optional.absent();
  }
1299302
private void resize(int newSize)
  {
    K []newKeys = (K []) new Object[newSize];
    long []newValues = new long[newSize];
    byte []newFlags = new byte[newSize];

    _mask = newKeys.length - 1;

    for (int i = 0; i < _keys.length; i++) {
      if (_keys[i] == null || (_flags[i] & DELETED) != 0)
        continue;

      int hash = _keys[i].hashCode() & _mask;

      while (true) {
        if (newKeys[hash] == null) {
          newKeys[hash] = _keys[i];
          newValues[hash] = _values[i];
          newFlags[hash] = _flags[i];
          break;
        }
        hash = (hash + 1) & _mask;
      }
    }

    _keys = newKeys;
    _values = newValues;
    _flags = newFlags;
  }
1358508
private void increaseSizeTo(int newSize) {
    assert (newSize > pointers.length);
    double[][] pointersBuf = new double[newSize][];
    boolean[] sparseBuf = new boolean[newSize];
    boolean[] copyOnWriteBuf = new boolean[newSize];
    System.arraycopy(pointers, 0, pointersBuf, 0, pointers.length);
    System.arraycopy(sparse, 0, sparseBuf, 0, pointers.length);
    System.arraycopy(copyOnWrite, 0, copyOnWriteBuf, 0, pointers.length);
    pointers = pointersBuf;
    sparse = sparseBuf;
    copyOnWrite = copyOnWriteBuf;
  }
562793
private String getComponentType(String componentType) throws SignatureException {

        String JVMSig = "";

        if(componentType != null){
            switch (componentType) {
                case "void":    JVMSig += SIG_VOID;    break;
                case "boolean": JVMSig += SIG_BOOLEAN; break;
                case "byte":    JVMSig += SIG_BYTE;    break;
                case "char":    JVMSig += SIG_CHAR;    break;
                case "short":   JVMSig += SIG_SHORT;   break;
                case "int":     JVMSig += SIG_INT;     break;
                case "long":    JVMSig += SIG_LONG;    break;
                case "float":   JVMSig += SIG_FLOAT;   break;
                case "double":  JVMSig += SIG_DOUBLE;  break;
                default:
                    if (!componentType.equals("")) {
                        TypeElement classNameDoc = elems.getTypeElement(componentType);

                        if (classNameDoc == null) {
                            throw new SignatureException(componentType);
                        }
                        else {
                            String classname = classNameDoc.getQualifiedName().toString();
                            String newclassname = classname.replace('.', '/');
                            JVMSig += "L";
                            JVMSig += newclassname;
                            JVMSig += ";";
                        }
                    }
                    break;
            }
        }
        return JVMSig;
    }
1046215
public void resize(int newSize) {
    if (newSize > elements.length) {
      reallocate(Math.max(newSize, 2 * elements.length));
    } else {
      for (int i = size; i < newSize; i++) {
        elements[i] = 0;
      }
    }
    size = newSize;
  }
908215
@SuppressWarnings("unchecked")
	protected final void updateComponentType(P newElement) {
		final Class<? extends P> lclazz = (Class<? extends P>) newElement.getClass();
		this.clazz = (Class<? extends P>) ReflectionUtil.getCommonType(this.clazz, lclazz);
	}
125192
@Override
    public void componentResized(ComponentEvent event) {
        final int SIZE = getWidth() <= getHeight() ? getWidth() : getHeight();
        final Container PARENT = getParent();
        if ((PARENT != null) && (PARENT.getLayout() == null)) {
            if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) {
                setSize(getMinimumSize());
            } else {
                setSize(SIZE, SIZE);
            }
        } else {
            if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) {
                setSize(getMinimumSize());
                setPreferredSize(getMinimumSize());
            } else {
                setSize(new Dimension(SIZE, SIZE));
                setPreferredSize(new Dimension(SIZE, SIZE));
            }
        }

        calcInnerBounds();

        recreateLedImages();
        if (isLedOn()) {
            setCurrentLedImage(getLedImageOn());
        } else {
            setCurrentLedImage(getLedImageOff());
        }

        recreateUserLedImages();
        if (isUserLedOn()) {
            setCurrentUserLedImage(getUserLedImageOn());
        } else {
            setCurrentUserLedImage(getUserLedImageOff());
        }

        getModel().setSize(getLocation().x, getLocation().y, SIZE, SIZE);
        init(getInnerBounds().width, getInnerBounds().height);
    }
933419
@SuppressWarnings("unchecked")
	<T extends Component> T getComponent (ComponentType componentType) {
		int componentTypeIndex = componentType.getIndex();

		if (componentTypeIndex < components.getCapacity()) {
			return (T)components.get(componentType.getIndex());
		} else {
			return null;
		}
	}
842057
@SneakyThrows
    public <T extends SAMLObject> T newSamlObject(final Class<T> objectType) {
        val qName = getSamlObjectQName(objectType);
        val builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
        if (builder == null) {
            throw new IllegalStateException("No SAML object builder is registered for class " + objectType.getName());
        }
        return objectType.cast(builder.buildObject(qName));
    }
1193032
int keepLargeNetworks(PrepEdgeFilter filter, List<IntArrayList> components) {
        if (components.size() <= 1)
            return 0;

        int maxCount = -1;
        IntIndexedContainer oldComponent = null;
        int allRemoved = 0;
        BooleanEncodedValue accessEnc = filter.getAccessEnc();
        EdgeExplorer explorer = ghStorage.createEdgeExplorer(filter);
        for (IntArrayList component : components) {
            if (maxCount < 0) {
                maxCount = component.size();
                oldComponent = component;
                continue;
            }

            int removedEdges;
            if (maxCount < component.size()) {
                // new biggest area found. remove old
                removedEdges = removeEdges(explorer, accessEnc, oldComponent, minNetworkSize);

                maxCount = component.size();
                oldComponent = component;
            } else {
                removedEdges = removeEdges(explorer, accessEnc, component, minNetworkSize);
            }

            allRemoved += removedEdges;
        }

        if (allRemoved > ghStorage.getAllEdges().length() / 2)
            throw new IllegalStateException("Too many total edges were removed: " + allRemoved + ", all edges:" + ghStorage.getAllEdges().length());
        return allRemoved;
    }
619612
private void resize(int newSize)
  {
    long []newKeys = new long[newSize];
    Object []newValues = new Object[newSize];
    byte []newFlags = new byte[newSize];

    for (int i = 0; i < newSize; i++)
      newKeys[i] = DEAD_KEY;

    mask = newKeys.length - 1;

    for (int i = 0; i < keys.length; i++) {
      if (keys[i] == DEAD_KEY || (flags[i] & DELETED) != 0)
        continue;

      int hash = (int) keys[i] & mask;

      while (true) {
        if (newKeys[hash] == DEAD_KEY) {
          newKeys[hash] = keys[i];
          newValues[hash] = values[i];
          newFlags[hash] = flags[i];
          break;
        }
        hash = (hash + 1) & mask;
      }
    }

    keys = newKeys;
    values = newValues;
    flags = newFlags;
  }
828677
public synchronized void setSize(int newSize) {

        if (newSize < 0) {
            throw new ArrayIndexOutOfBoundsException(newSize);
        } else if (newSize > buf.length) {
            buf = copyOf(buf, Math.max(buf.length << 1, newSize));
        }

        count = newSize;
    }