nl.lxtreme.ols.api.data
Enum Edge

java.lang.Object
  extended by java.lang.Enum<Edge>
      extended by nl.lxtreme.ols.api.data.Edge
All Implemented Interfaces:
Serializable, Comparable<Edge>

public enum Edge
extends Enum<Edge>

Denotes a rising/falling signal edge.


Enum Constant Summary
FALLING
          A falling edge (high -> low transition).
NONE
          No edge.
RISING
          A rising edge (low -> high transition).
 
Method Summary
 Edge invert()
          Returns the inverse of this edge, so return 'falling' it this is a 'rising' edge, and the other way around.
 boolean isFalling()
          Returns whether this is a falling edge or not.
 boolean isNone()
          Returns whether this is not an edge at all.
 boolean isRising()
          Returns whether this is a rising edge or not.
static Edge toEdge(int aOldValue, int aNewValue)
          Given two (sample) values, determines whether they form a falling, rising or no edge.
static Edge valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Edge[] 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 Edge NONE
No edge.


RISING

public static final Edge RISING
A rising edge (low -> high transition).


FALLING

public static final Edge FALLING
A falling edge (high -> low transition).

Method Detail

values

public static Edge[] 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 (Edge c : Edge.values())
    System.out.println(c);

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

valueOf

public static Edge 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

toEdge

public static Edge toEdge(int aOldValue,
                          int aNewValue)
Given two (sample) values, determines whether they form a falling, rising or no edge.

If the given "old" value is strictly greater than the given "new" value, this will be considered a falling edge. If the "old" value is strictly less than the "new" value, this will be considered a rising edge. If both values are equal, this means no edge.

Parameters:
aOldValue - the "old" value;
aNewValue - the "new" value.
Returns:
the edge corresponding to the given values, never null .

invert

public Edge invert()
Returns the inverse of this edge, so return 'falling' it this is a 'rising' edge, and the other way around. In case this edge is 'none', 'none' will be returned.

Returns:
the inverse of this edge, never null.

isFalling

public boolean isFalling()
Returns whether this is a falling edge or not.

Returns:
true if this is a falling edge, false otherwise.

isNone

public boolean isNone()
Returns whether this is not an edge at all.

Returns:
true if this is "no" edge, false otherwise.

isRising

public boolean isRising()
Returns whether this is a rising edge or not.

Returns:
true if this is a rising edge, false otherwise.


Copyright © 2012 L'Xtreme IT consultancy. All Rights Reserved.