List of usage examples for com.google.common.base Preconditions checkState
public static void checkState(boolean expression)
From source file:com.facebook.buck.android.resources.ResourceTable.java
public static ResourceTable get(ByteBuffer buf) { int type = buf.getShort(); int headerSize = buf.getShort(); int chunkSize = buf.getInt(); int packageCount = buf.getInt(); Preconditions.checkState(type == CHUNK_RESOURCE_TABLE); Preconditions.checkState(headerSize == HEADER_SIZE); Preconditions.checkState(packageCount == 1); StringPool strings = StringPool.get(slice(buf, buf.position())); ResTablePackage resPackage = ResTablePackage.get(slice(buf, HEADER_SIZE + strings.getChunkSize())); Preconditions.checkState(chunkSize == HEADER_SIZE + strings.getChunkSize() + resPackage.getChunkSize()); return new ResourceTable(strings, resPackage); }
From source file:com.facebook.buck.rules.ArchiveMemberSourcePath.java
public ArchiveMemberSourcePath(SourcePath archiveSourcePath, Path memberPath) { Preconditions.checkState(!memberPath.isAbsolute()); this.contents = new Pair<>(archiveSourcePath, memberPath); }
From source file:com.facebook.buck.cxx.platform.AbstractNativeLinkTargetMode.java
@Value.Check public void check() { Preconditions.checkState(getType() == Linker.LinkType.SHARED || getType() == Linker.LinkType.EXECUTABLE); Preconditions.checkState(!getLibraryName().isPresent() || getType() == Linker.LinkType.SHARED); }
From source file:org.opendaylight.controller.md.sal.binding.impl.BindingDOMAdapterBuilder.java
@Override protected final T createInstance(final ClassToInstanceMap<DOMService> delegates) { Preconditions.checkState(codec != null); return createInstance(codec, delegates); }
From source file:com.facebook.buck.io.filesystem.RecursiveFileMatcher.java
private RecursiveFileMatcher(Path basePath) { Preconditions.checkState(!basePath.isAbsolute()); this.basePath = basePath; }
From source file:eu.wydler.pub.Talker.java
@Override public void main(NodeConfiguration configuration) { Preconditions.checkState(node == null); Preconditions.checkNotNull(configuration); try {//from w w w . j av a2 s .c o m node = new DefaultNodeFactory().newNode("talker", configuration); publisher = node.newPublisher("rpy", "geometry_msgs/Twist"); } catch (Exception e) { if (node != null) { node.getLog().fatal(e); } else { e.printStackTrace(); } } }
From source file:com.google.javascript.jscomp.RemoveWeakSources.java
@Override public void process(Node externs, Node root) { for (Node script = root.getFirstChild(); script != null; script = script.getNext()) { Preconditions.checkState(script.isScript()); if (script.getStaticSourceFile().isWeak()) { // Keep the file but remove the contents, since some users expect the number of input and // output files to be the same. NodeUtil.deleteChildren(script, compiler); }// w ww .ja v a2 s. com } }
From source file:com.facebook.buck.jvm.java.abi.AnnotationDefaultValueMirror.java
@Override public void visit(String name, Object value) { Preconditions.checkState(defaultValue == null); defaultValue = AnnotationValueMirror.forPrimitive(value); }
From source file:vazkii.botania.api.BotaniaAPIClient.java
/** * Register your model for the given subtile class here. * Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work. * Your model json must specify key "tintindex" in all the faces it wants tint applied. * Tint is applied whenever a player recolors the flower using floral dye * * @param subTileName The String ID of the subtile * @param model A path to a blockstate json and variant to be used for this subtile * @param itemModel A path to a blockstate json and variant to be used for this subtile's item form *//* ww w . j a v a 2s .c o m*/ public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) { Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION)); subtileBlockModels.put(subTileName, model); subtileItemModels.put(subTileName, itemModel); }
From source file:org.apache.hadoop.oncrpc.security.VerifierNone.java
@Override public void read(XDR xdr) { int length = xdr.readInt(); Preconditions.checkState(length == 0); }