Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1821)

Unified Diff: mojo/public/java/system/src/org/chromium/mojo/system/Flags.java

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/java/system/src/org/chromium/mojo/system/Flags.java
diff --git a/mojo/public/java/system/src/org/chromium/mojo/system/Flags.java b/mojo/public/java/system/src/org/chromium/mojo/system/Flags.java
deleted file mode 100644
index 30ff07f7100e37f4c5ad867dbc861ee0daf4cf43..0000000000000000000000000000000000000000
--- a/mojo/public/java/system/src/org/chromium/mojo/system/Flags.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.mojo.system;
-
-/**
- * Base class for bit field used as flags.
- *
- * @param <F> the type of the flags.
- */
-public abstract class Flags<F extends Flags<F>> {
- private int mFlags;
- private boolean mImmutable;
-
- /**
- * Dedicated constructor.
- *
- * @param flags initial value of the flag.
- */
- protected Flags(int flags) {
- mImmutable = false;
- mFlags = flags;
- }
-
- /**
- * @return the computed flag.
- */
- public int getFlags() {
- return mFlags;
- }
-
- /**
- * Change the given bit of this flag.
- *
- * @param value the new value of given bit.
- * @return this.
- */
- protected F setFlag(int flag, boolean value) {
- if (mImmutable) {
- throw new UnsupportedOperationException("Flags is immutable.");
- }
- if (value) {
- mFlags |= flag;
- } else {
- mFlags &= ~flag;
- }
- @SuppressWarnings("unchecked")
- F f = (F) this;
- return f;
- }
-
- /**
- * Makes this flag immutable. This is a non-reversable operation.
- */
- protected F immutable() {
- mImmutable = true;
- @SuppressWarnings("unchecked")
- F f = (F) this;
- return f;
- }
-
- /**
- * @see Object#hashCode()
- */
- @Override
- public int hashCode() {
- return mFlags;
- }
-
- /**
- * @see Object#equals(Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- Flags<?> other = (Flags<?>) obj;
- if (mFlags != other.mFlags) return false;
- return true;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698