org.ogf.saga.namespace
Enum Flags

java.lang.Object
  extended by java.lang.Enum<Flags>
      extended by org.ogf.saga.namespace.Flags
All Implemented Interfaces:
Serializable, Comparable<Flags>

public enum Flags
extends Enum<Flags>

Enumerates some flags for methods in this package. Note: since enumerations cannot be extended, all flags are included here. The SAGA specs gets away with this as it has no real enumeration type. In Java, the values should all be of the same type, or else the file package for instance cannot inherit from the namespace package. These flags are meant to be or-ed together, resulting in an integer. Java does not define arithmetic operators for enumerations, so methods are added here to test for presence and or-ing. For instance,
int flags = Flags.EXCL.or(Flags.READ.or(Flags.WRITE));
if (Flags.READ.isSet(flags)) ...


Enum Constant Summary
ALLFILEFLAGS
          All flags applicable to the file package.
ALLLOGICALFILEFLAGS
          All flags applicable to the logical file package.
ALLNAMESPACEFLAGS
          All flags applicable to the namespace package.
APPEND
          Upon opening, the file pointer is set to the end of the file.
BINARY
          For OS-es that distinguish between binary and non-binary modes.
CREATE
          Allows a namespace entry to be created while opening it, if it does not already exist.
CREATEPARENTS
          Implies that missing path elements are created on the fly.
DEREFERENCE
          Enforces an operation to apply not to the entry pointed to by the target name, but to the link target of that entry.
EXCL
          If the entry already exists, the CREATE flag is not silenty ignored.
LOCK
          Enforces a lock on the namespace entry when it is opened.
NONE
          Indicates the absence of flags.
OVERWRITE
          Enforces an operation which creates a new namespace entry to continue even if the target entry does not already exist.
READ
          The file or directory is opened for reading.
READWRITE
          The file or directory is opened for reading and writing.
RECURSIVE
          Enforces an operation to apply recursively on a directory tree.
TRUNCATE
          Upon opening, the file is truncated to length 0.
WRITE
          The file or directory is opened for writing.
 
Method Summary
 int getValue()
          Returns the integer value of this enumeration literal.
 boolean isSet(int val)
          Tests for the presence of this flag in the specified value.
 int or(Flags val)
          Returns the result of or-ing this flag into another.
 int or(int val)
          Returns the result of or-ing this flag into an integer.
static Flags valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Flags[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final Flags NONE
Indicates the absence of flags.


OVERWRITE

public static final Flags OVERWRITE
Enforces an operation which creates a new namespace entry to continue even if the target entry does not already exist.


RECURSIVE

public static final Flags RECURSIVE
Enforces an operation to apply recursively on a directory tree.


DEREFERENCE

public static final Flags DEREFERENCE
Enforces an operation to apply not to the entry pointed to by the target name, but to the link target of that entry.


CREATE

public static final Flags CREATE
Allows a namespace entry to be created while opening it, if it does not already exist.


EXCL

public static final Flags EXCL
If the entry already exists, the CREATE flag is not silenty ignored. Instead, an AlreadyExistsException is raised.


LOCK

public static final Flags LOCK
Enforces a lock on the namespace entry when it is opened.


CREATEPARENTS

public static final Flags CREATEPARENTS
Implies that missing path elements are created on the fly. Implies CREATE.


TRUNCATE

public static final Flags TRUNCATE
Upon opening, the file is truncated to length 0. Implies WRITE.


APPEND

public static final Flags APPEND
Upon opening, the file pointer is set to the end of the file. IMPLIES WRITE.


READ

public static final Flags READ
The file or directory is opened for reading.


WRITE

public static final Flags WRITE
The file or directory is opened for writing.


READWRITE

public static final Flags READWRITE
The file or directory is opened for reading and writing.


ALLNAMESPACEFLAGS

public static final Flags ALLNAMESPACEFLAGS
All flags applicable to the namespace package.


BINARY

public static final Flags BINARY
For OS-es that distinguish between binary and non-binary modes.


ALLLOGICALFILEFLAGS

public static final Flags ALLLOGICALFILEFLAGS
All flags applicable to the logical file package.


ALLFILEFLAGS

public static final Flags ALLFILEFLAGS
All flags applicable to the file package.

Method Detail

values

public static Flags[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Flags c : Flags.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Flags valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getValue

public int getValue()
Returns the integer value of this enumeration literal.

Returns:
the integer value.

or

public int or(int val)
Returns the result of or-ing this flag into an integer.

Parameters:
val - the value to OR this enumeration value into.
Returns:
the result of or-ing this flag into the integer parameter.

or

public int or(Flags val)
Returns the result of or-ing this flag into another.

Parameters:
val - the value to OR this enumeration value into.
Returns:
the result of or-ing this flag into the integer parameter.

isSet

public boolean isSet(int val)
Tests for the presence of this flag in the specified value.

Parameters:
val - the value.
Returns:
true if this flag is present.


Copyright © 2014 Open Grid Forum. All rights reserved.