本文整理汇总了Java中com.sun.squawk.util.Arrays.binarySearch方法的典型用法代码示例。如果您正苦于以下问题:Java Arrays.binarySearch方法的具体用法?Java Arrays.binarySearch怎么用?Java Arrays.binarySearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.util.Arrays
的用法示例。
在下文中一共展示了Arrays.binarySearch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getManifestProperty
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Gets the value of an {@link Suite#PROPERTIES_MANIFEST_RESOURCE_NAME} property embedded in the suite.
*
* @param name the name of the property whose value is to be retrieved
* @return the property value
*/
String getManifestProperty(String name) {
int index = Arrays.binarySearch(manifestProperties, name, ManifestProperty.comparer);
if (index < 0) {
// To support dynamic class loading we need to follow the same semantics as Klass.forName
// which is to look to see if we can't dynamically load a property if its not found
if (isClosed() || isPropertiesManifestResourceInstalled) {
return null;
}
// The following should automatically install the properties if there is a manifest
InputStream input = getResourceAsStream(PROPERTIES_MANIFEST_RESOURCE_NAME, null);
if (input != null) {
try {input.close();} catch (IOException e) {/*nothing*/};
}
isPropertiesManifestResourceInstalled = true;
index = Arrays.binarySearch(manifestProperties, name, ManifestProperty.comparer);
if (index < 0) {
return null;
}
}
return manifestProperties [index].value;
}
示例2: installProperty
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Installs a collection of IMlet property values into this suite.
*
* @param property IMlet property to install
*/
public void installProperty(ManifestProperty property) {
checkWrite();
// There could be more than one manifest property for a given key,
// as is the case if JAD properties are added, so take this into account
int index = Arrays.binarySearch(manifestProperties, property.name, ManifestProperty.comparer);
if (index < 0) {
/*if[ENABLE_VERBOSE]*/
if (VM.isVerbose()) {
System.out.println("[Adding property key: |" + property.name + "| value: |" + property.value + "|]");
}
/*end[ENABLE_VERBOSE]*/
System.arraycopy(manifestProperties, 0, manifestProperties = new ManifestProperty[manifestProperties.length + 1], 0, manifestProperties.length - 1);
manifestProperties[manifestProperties.length - 1] = property;
Arrays.sort(manifestProperties, ManifestProperty.comparer);
} else {
/*if[ENABLE_VERBOSE]*/
if (VM.isVerbose()) {
System.out.println("[Overwriting property key: |" + property.name + "| value: |" + property.value + "|]");
}
/*end[ENABLE_VERBOSE]*/
manifestProperties[index] = property;
}
}
示例3: installProperty
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Installs a collection of IMlet property values into this suite.
*
* @param property IMlet property to install
*/
public void installProperty(ManifestProperty property) {
checkWrite();
// There could be more than one manifest property for a given key,
// as is the case if JAD properties are added, so take this into account
int index = Arrays.binarySearch(manifestProperties, property.name, ManifestProperty.comparer);
if (index < 0) {
if (VM.isVerbose()) {
System.out.println("[Adding property key: |" + property.name + "| value: |" + property.value + "|]");
}
System.arraycopy(manifestProperties, 0, manifestProperties = new ManifestProperty[manifestProperties.length + 1], 0, manifestProperties.length - 1);
manifestProperties[manifestProperties.length - 1] = property;
Arrays.sort(manifestProperties, ManifestProperty.comparer);
} else {
if (VM.isVerbose()) {
System.out.println("[Overwriting property key: |" + property.name + "| value: |" + property.value + "|]");
}
manifestProperties[index] = property;
}
}
示例4: getMetadata0
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Gets the <code>KlassMetadata</code> instance from this suite
* corresponding to a specified class.
*
* @param klass a class
* @return the <code>KlassMetadata</code> instance corresponding to
* <code>klass</code> or <code>null</code> if there isn't one
*/
KlassMetadata getMetadata0(Klass klass) {
if (metadatas != null /*&& contains(klass)*/) {
int metaindex = Arrays.binarySearch(metadatas, klass, KlassMetadata.comparer);
if (metaindex >= 0) {
KlassMetadata metadata = metadatas[metaindex];
Assert.that(metadata != null);
Assert.that(metadata.getDefinedClass() == klass, "metadata.getDefinedClass(): " + metadata.getDefinedClass() + " klass: " + klass);
return metadata;
}
}
Assert.that(searchForMetadata(klass) == null);
return null;
}
示例5: getMetadata0
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Gets the <code>KlassMetadata</code> instance from this suite
* corresponding to a specified class.
*
* @param klass a class
* @return the <code>KlassMetadata</code> instance corresponding to
* <code>klass</code> or <code>null</code> if there isn't one
*/
KlassMetadata getMetadata0(Klass klass) {
if (metadatas != null /*&& contains(klass)*/) {
int metaindex = Arrays.binarySearch(metadatas, klass, KlassMetadata.comparer);
if (metaindex >= 0) {
KlassMetadata metadata = metadatas[metaindex];
if (false) Assert.that(metadata != null);
if (false) Assert.that(metadata.getDefinedClass() == klass, "metadata.getDefinedClass(): " + metadata.getDefinedClass() + " klass: " + klass);
return metadata;
}
}
if (false) Assert.that(searchForMetadata(klass) == null);
return null;
}
示例6: getMetadataIndex
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Gets the index of the metadata for this class in this suite.
*
* @param klass a class
* @return the index or a negative number
*/
int getMetadataIndex(Klass klass) {
Assert.that(metadatas != null);
Assert.that(contains(klass) || (type == METADATA && parent.contains(klass)), this + " doesn't contain " + klass);
return Arrays.binarySearch(metadatas, klass, KlassMetadata.comparer);
}
示例7: getMetadataIndex
import com.sun.squawk.util.Arrays; //导入方法依赖的package包/类
/**
* Gets the index of the metadata for this class in this suite.
*
* @param klass a class
* @return the index or a negative number
*/
int getMetadataIndex(Klass klass) {
if (false) Assert.that(metadatas != null);
if (false) Assert.that(contains(klass) || (type == METADATA && parent.contains(klass)), this + " doesn't contain " + klass);
return Arrays.binarySearch(metadatas, klass, KlassMetadata.comparer);
}