WPI GDC CMS 0.0.1

org.wpi.gdc.cms.db
Class StringRestriction

java.lang.Object
  |
  +--org.wpi.gdc.cms.db.Restriction
        |
        +--org.wpi.gdc.cms.db.StringRestriction

public class StringRestriction
extends Restriction

This restriction describes how a string should appear.

There are two basic modes: LIKE and EXACT. In LIKE mode, the string checked is a string glob. In EXACT, the string must exactly equal the string in this class.

For example ... FIXME: Finish this :)

Version:
1.2
Author:
dmpotter

Field Summary
static int COMPARE_EXACT
          The EXACT mode
static int COMPARE_LIKE
          The LIKE mode.
protected  int compare_mode
          The comparison mode, either COMPARE_LIKE or COMPARE_EXACT.
protected  java.lang.String string
          The example string.
 
Fields inherited from class org.wpi.gdc.cms.db.Restriction
bool, bool_not, BOOLEAN_AND, BOOLEAN_OR, field, next
 
Constructor Summary
StringRestriction(java.lang.String string, int mode)
          Creates a new StringRestriction.
 
Method Summary
 int getCompareMode()
          Retrieves the string being checked.
 java.lang.String getString()
          Retrieves the string being checked.
 void setCompareMode(int mode)
          Sets the compare mode.
 void setString(java.lang.String string)
          Sets the string.
 boolean validate(java.lang.Object o)
          Validate this restriction against a sample object.
 
Methods inherited from class org.wpi.gdc.cms.db.Restriction
getBoolean, getField, getNot, setBoolean, setField, setNot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPARE_LIKE

public static final int COMPARE_LIKE
The LIKE mode.

COMPARE_EXACT

public static final int COMPARE_EXACT
The EXACT mode

string

protected java.lang.String string
The example string.

compare_mode

protected int compare_mode
The comparison mode, either COMPARE_LIKE or COMPARE_EXACT.
Constructor Detail

StringRestriction

public StringRestriction(java.lang.String string,
                         int mode)
Creates a new StringRestriction.
Parameters:
string - The string to compare against.
mode - The compare mode.
Throws:
java.lang.IllegalArgumentException - If the mode is not COMPARE_LIKE or COMPARE_EXACT.
NullPointerException - if the string is null.
Method Detail

getString

public java.lang.String getString()
Retrieves the string being checked.
Returns:
the string.
See Also:
string, setString(String)

setString

public void setString(java.lang.String string)
Sets the string.
Parameters:
string - The new string value.
Throws:
NullPointerException - if string is null.
See Also:
string, getString()

getCompareMode

public int getCompareMode()
Retrieves the string being checked.
Returns:
The comparison method being used: COMPARE_LIKE or COMPARE_EXACT.
See Also:
compare_mode, setCompareMode(int)

setCompareMode

public void setCompareMode(int mode)
Sets the compare mode.
Parameters:
mode - The new compare mode, either COMPARE_LIKE or COMPARE_EXACT.
Throws:
java.lang.IllegalArgumentException - If the new mode is not COMPARE_LIKE or COMPARE_EXACT.
See Also:
compare_mode, getCompareMode()

validate

public boolean validate(java.lang.Object o)
Validate this restriction against a sample object. (People who write custom extensions should remember it XOR the final result with bool_not to get the proper boolean value.)
Overrides:
validate in class Restriction
Returns:
true if the object matches, false otherwise.

WPI GDC CMS 0.0.1

Copyright © 2001 WPI Game Development Club. All Rights Reserved.