ti.chimera.registry
Interface NodeContract

All Known Implementing Classes:
AndNodeContract, ChoiceNodeContract, ColorNodeContract, FontNodeContract, ImmutableNodeContract, OrNodeContract, TypeNodeContract

public interface NodeContract

A NodeContract establishes what sorts of values can be stored in a node in the registry. The contract is set at node creation time, and does not change during the node's lifecycle. (But, from the consumer's point of view, the node instance at a particular path may change, and bring with it a new contract.)

Also, contracts are comparable, so that the consumer of node data can provide a contract... if the consumer's contract is equal to, or a subset of, the node's contract, then the consumer is happy. In other words, the consumer wants to know that there is no value that will pass the node's contract, but not the consumer's contract.

Version:
0.1
Author:
;Rob Clark;a0873619;San Diego;;

Field Summary
static NodeContract BOOLEAN_CONTRACT
          A contract that checks that the type of the value is a #java.lang.Boolean.
static NodeContract NULL_CONTRACT
          A contract that accepts any change.
static NodeContract NUMBER_CONTRACT
          A contract that checks that the type of the value is a #java.lang.Number.
static NodeContract STRING_CONTRACT
          A contract that checks that the type of the value is a #java.lang.String.
 
Method Summary
 boolean accepts(java.lang.Object value)
          Determine if the specified value meets this contract.
 java.lang.String toString()
          The contract implementation should overload toString so the contract can be displayed to the user in a sane format, for use in error messages, etc.
 

Field Detail

STRING_CONTRACT

static final NodeContract STRING_CONTRACT
A contract that checks that the type of the value is a #java.lang.String.


BOOLEAN_CONTRACT

static final NodeContract BOOLEAN_CONTRACT
A contract that checks that the type of the value is a #java.lang.Boolean.


NUMBER_CONTRACT

static final NodeContract NUMBER_CONTRACT
A contract that checks that the type of the value is a #java.lang.Number.


NULL_CONTRACT

static final NodeContract NULL_CONTRACT
A contract that accepts any change.

Method Detail

accepts

boolean accepts(java.lang.Object value)
Determine if the specified value meets this contract.

Parameters:
value - the value to check
Returns:
true if meets contract

toString

java.lang.String toString()
The contract implementation should overload toString so the contract can be displayed to the user in a sane format, for use in error messages, etc.

Overrides:
toString in class java.lang.Object