polyglot.types
Class Flags

java.lang.Object
  extended by polyglot.types.Flags
All Implemented Interfaces:
java.io.Serializable

public class Flags
extends java.lang.Object
implements java.io.Serializable

Flags is an immutable set of class, method, or field modifiers. We represent package scope as the absence of private, public and protected scope modifiers.

See Also:
Serialized Form

Field Summary
static Flags ABSTRACT
           
protected static Flags ACCESS_FLAGS
          All access flags.
protected  long bits
          Bit set use to implement a flag set.
static Flags FINAL
           
static Flags INTERFACE
           
static Flags NATIVE
           
static Flags NONE
           
static Flags PRIVATE
           
static Flags PROTECTED
           
static Flags PUBLIC
           
static Flags STATIC
           
static Flags STRICTFP
           
static Flags SYNCHRONIZED
           
static Flags TRANSIENT
           
static Flags VOLATILE
           
 
Constructor Summary
protected Flags(long bits)
          Effects: returns a new accessflags object with no accessflags set.
 
Method Summary
 Flags Abstract()
          Return a copy of this this with the abstract flag set.
 Flags clear(Flags other)
          Create new flags with the flags in other cleared.
 Flags clearAbstract()
          Return a copy of this this with the abstract flag clear.
 Flags clearFinal()
          Return a copy of this this with the final flag clear.
 Flags clearInterface()
          Return a copy of this this with the interface flag clear.
 Flags clearNative()
          Return a copy of this this with the native flag clear.
 Flags clearPrivate()
          Return a copy of this this with the private flag clear.
 Flags clearProtected()
          Return a copy of this this with the protected flag clear.
 Flags clearPublic()
          Return a copy of this this with the public flag clear.
 Flags clearStatic()
          Return a copy of this this with the static flag clear.
 Flags clearStrictFP()
          Return a copy of this this with the strictfp flag clear.
 Flags clearSynchronized()
          Return a copy of this this with the synchronized flag clear.
 Flags clearTransient()
          Return a copy of this this with the transient flag clear.
 Flags clearVolatile()
          Return a copy of this this with the volatile flag clear.
 boolean contains(Flags other)
          Check if all flags in other are set.
static Flags createFlag(java.lang.String name, Flags after)
          Return a new Flags object with a new name.
static Flags createFlag(java.lang.String name, java.lang.String cHeadName, java.lang.String cBodyName, Flags after)
          Return a new Flags object with a new name.
 boolean equals(java.lang.Object o)
           
 Flags Final()
          Return a copy of this this with the final flag set.
 int hashCode()
           
 Flags Interface()
          Return a copy of this this with the interface flag set.
 boolean intersects(Flags other)
          Check if any flags in other are set.
 boolean isAbstract()
          Return true if this has the abstract flag set.
 boolean isFinal()
          Return true if this has the final flag set.
 boolean isInterface()
          Return true if this has the interface flag set.
 boolean isNative()
          Return true if this has the native flag set.
 boolean isPackage()
          Return true if this has the no access flags (public, private, protected) set.
 boolean isPrivate()
          Return true if this has the private flag set.
 boolean isProtected()
          Return true if this has the protected flag set.
 boolean isPublic()
          Return true if this has the public flag set.
 boolean isStatic()
          Return true if this has the static flag set.
 boolean isStrictFP()
          Return true if this has the strictfp flag set.
 boolean isSynchronized()
          Return true if this has the synchronized flag set.
 boolean isTransient()
          Return true if this has the transient flag set.
 boolean isVolatile()
          Return true if this has the volatile flag set.
 boolean moreRestrictiveThan(Flags f)
          Return true if this has more restrictive access flags than f.
 Flags Native()
          Return a copy of this this with the native flag set.
 Flags Package()
          Return a copy of this this with no access flags (public, private, protected) set.
 Flags Private()
          Return a copy of this this with the private flag set.
 Flags Protected()
          Return a copy of this this with the protected flag set.
 Flags Public()
          Return a copy of this this with the public flag set.
 Flags retain(Flags other)
          Create new flags with only flags in other set.
 Flags set(Flags other)
          Create new flags with the flags in other also set.
 Flags Static()
          Return a copy of this this with the static flag set.
 Flags StrictFP()
          Return a copy of this this with the strictfp flag set.
 Flags Synchronized()
          Return a copy of this this with the synchronized flag set.
 java.lang.String toString()
           
 Flags Transient()
          Return a copy of this this with the transient flag set.
 java.lang.String translate()
          Return "" if no flags set, or toString() + " " if some flags are set.
 java.lang.String translateCBody()
          Returns the flag information appropriate for C++ functions
 java.lang.String translateCHead()
          Returns the flag information appropriate for C++ header files
 Flags Volatile()
          Return a copy of this this with the volatile flag set.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Flags NONE

PUBLIC

public static final Flags PUBLIC

PRIVATE

public static final Flags PRIVATE

PROTECTED

public static final Flags PROTECTED

STATIC

public static final Flags STATIC

FINAL

public static final Flags FINAL

SYNCHRONIZED

public static final Flags SYNCHRONIZED

TRANSIENT

public static final Flags TRANSIENT

NATIVE

public static final Flags NATIVE

INTERFACE

public static final Flags INTERFACE

ABSTRACT

public static final Flags ABSTRACT

VOLATILE

public static final Flags VOLATILE

STRICTFP

public static final Flags STRICTFP

ACCESS_FLAGS

protected static final Flags ACCESS_FLAGS
All access flags.


bits

protected long bits
Bit set use to implement a flag set.

Constructor Detail

Flags

protected Flags(long bits)
Effects: returns a new accessflags object with no accessflags set.

Method Detail

createFlag

public static Flags createFlag(java.lang.String name,
                               Flags after)
Return a new Flags object with a new name. Should be called only once per name.

Parameters:
name - the name of the new flag in Java
after - the flags after which this flag should be printed; Flags.NONE to print before all other flags, null if we should print at the end.

createFlag

public static Flags createFlag(java.lang.String name,
                               java.lang.String cHeadName,
                               java.lang.String cBodyName,
                               Flags after)
Return a new Flags object with a new name. Should be called only once per name.

Parameters:
name - the name of the new flag in Java
cHeadName - the name of the flag to print in the C++ header file
cBodyName - the name of the flag to print in the C++ body file
after - the flags after which this flag should be printed; Flags.NONE to print before all other flags, null if we should print at the end.

set

public Flags set(Flags other)
Create new flags with the flags in other also set.


clear

public Flags clear(Flags other)
Create new flags with the flags in other cleared.


retain

public Flags retain(Flags other)
Create new flags with only flags in other set.


intersects

public boolean intersects(Flags other)
Check if any flags in other are set.


contains

public boolean contains(Flags other)
Check if all flags in other are set.


Public

public Flags Public()
Return a copy of this this with the public flag set.


clearPublic

public Flags clearPublic()
Return a copy of this this with the public flag clear.


isPublic

public boolean isPublic()
Return true if this has the public flag set.


Private

public Flags Private()
Return a copy of this this with the private flag set.


clearPrivate

public Flags clearPrivate()
Return a copy of this this with the private flag clear.


isPrivate

public boolean isPrivate()
Return true if this has the private flag set.


Protected

public Flags Protected()
Return a copy of this this with the protected flag set.


clearProtected

public Flags clearProtected()
Return a copy of this this with the protected flag clear.


isProtected

public boolean isProtected()
Return true if this has the protected flag set.


Package

public Flags Package()
Return a copy of this this with no access flags (public, private, protected) set.


isPackage

public boolean isPackage()
Return true if this has the no access flags (public, private, protected) set.


Static

public Flags Static()
Return a copy of this this with the static flag set.


clearStatic

public Flags clearStatic()
Return a copy of this this with the static flag clear.


isStatic

public boolean isStatic()
Return true if this has the static flag set.


Final

public Flags Final()
Return a copy of this this with the final flag set.


clearFinal

public Flags clearFinal()
Return a copy of this this with the final flag clear.


isFinal

public boolean isFinal()
Return true if this has the final flag set.


Synchronized

public Flags Synchronized()
Return a copy of this this with the synchronized flag set.


clearSynchronized

public Flags clearSynchronized()
Return a copy of this this with the synchronized flag clear.


isSynchronized

public boolean isSynchronized()
Return true if this has the synchronized flag set.


Transient

public Flags Transient()
Return a copy of this this with the transient flag set.


clearTransient

public Flags clearTransient()
Return a copy of this this with the transient flag clear.


isTransient

public boolean isTransient()
Return true if this has the transient flag set.


Native

public Flags Native()
Return a copy of this this with the native flag set.


clearNative

public Flags clearNative()
Return a copy of this this with the native flag clear.


isNative

public boolean isNative()
Return true if this has the native flag set.


Interface

public Flags Interface()
Return a copy of this this with the interface flag set.


clearInterface

public Flags clearInterface()
Return a copy of this this with the interface flag clear.


isInterface

public boolean isInterface()
Return true if this has the interface flag set.


Abstract

public Flags Abstract()
Return a copy of this this with the abstract flag set.


clearAbstract

public Flags clearAbstract()
Return a copy of this this with the abstract flag clear.


isAbstract

public boolean isAbstract()
Return true if this has the abstract flag set.


Volatile

public Flags Volatile()
Return a copy of this this with the volatile flag set.


clearVolatile

public Flags clearVolatile()
Return a copy of this this with the volatile flag clear.


isVolatile

public boolean isVolatile()
Return true if this has the volatile flag set.


StrictFP

public Flags StrictFP()
Return a copy of this this with the strictfp flag set.


clearStrictFP

public Flags clearStrictFP()
Return a copy of this this with the strictfp flag clear.


isStrictFP

public boolean isStrictFP()
Return true if this has the strictfp flag set.


moreRestrictiveThan

public boolean moreRestrictiveThan(Flags f)
Return true if this has more restrictive access flags than f.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

translate

public java.lang.String translate()
Return "" if no flags set, or toString() + " " if some flags are set.


translateCBody

public java.lang.String translateCBody()
Returns the flag information appropriate for C++ functions


translateCHead

public java.lang.String translateCHead()
Returns the flag information appropriate for C++ header files


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object