pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.statistics.model
Class AbstractRegexVersioned

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.util.entity.AbstractNamedEntity
          extended by org.torweg.pulse.component.statistics.model.AbstractRegexVersioned
All Implemented Interfaces:
java.io.Serializable, INamed
Direct Known Subclasses:
OperatingSystem, UserAgent

@MappedSuperclass
public abstract class AbstractRegexVersioned
extends AbstractNamedEntity

Abstract base class to derive "versioned" from.

Version:
$Revision: 1573 $
Author:
Daniel Dietz
See Also:
Serialized Form

Field Summary
static java.lang.String UNKNOWN
          The string "unknown" - to be used as category and defaultDisplayName for an "unknown" AbstractVersioned.
 
Constructor Summary
AbstractRegexVersioned()
           
 
Method Summary
 boolean addVersion(RegexVersion version)
          Adds the given Version.
 java.lang.String getCategory()
          Returns the category identifier.
 java.lang.String getRegex()
          Returns the default regular expression.
 RegexVersion getVersion(java.lang.String s)
          Returns a RegexVersion by a value to be used for the version-check.
 java.util.List<RegexVersion> getVersions()
          Returns the Versions.
 boolean isMatch(java.lang.String osString)
          Checks if the given operating system-string matches the regular expression.
 boolean isUnknown()
          Checks if the the current OperatingSystem is the "unknown" operating system.
 void setCategory(java.lang.String cat)
          Sets the category identifier.
 void setName(java.lang.String n)
          Sets the default display name.
 void setRegex(java.lang.String reg)
          Sets the default regular expression.
 java.lang.String toString()
          Returns a string representation of the UserAgent.
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractNamedEntity
getName
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final java.lang.String UNKNOWN
The string "unknown" - to be used as category and defaultDisplayName for an "unknown" AbstractVersioned.

See Also:
Constant Field Values
Constructor Detail

AbstractRegexVersioned

public AbstractRegexVersioned()
Method Detail

getVersions

public final java.util.List<RegexVersion> getVersions()
Returns the Versions.

Returns:
the versions

addVersion

public final boolean addVersion(RegexVersion version)
Adds the given Version.

Parameters:
version - the Version to add
Returns:
true if and only if the given Version has been added to the internal List&lt;Version&gt;, false otherwise

getCategory

public final java.lang.String getCategory()
Returns the category identifier.

Returns:
the category

setCategory

public final void setCategory(java.lang.String cat)
Sets the category identifier.

Parameters:
cat - the category
Throws:
java.lang.IllegalArgumentException - if the given category is null or empty string

setName

public final void setName(java.lang.String n)
Sets the default display name.

Overrides:
setName in class AbstractNamedEntity
Parameters:
n - the name
Throws:
java.lang.IllegalArgumentException - if the given name is null or empty string
See Also:
INameable.setName(java.lang.String)

getRegex

public final java.lang.String getRegex()
Returns the default regular expression.

Returns:
the regex

setRegex

public final void setRegex(java.lang.String reg)
Sets the default regular expression.

Parameters:
reg - the regular expression
Throws:
java.lang.IllegalArgumentException - if the given regular expression is null or empty string

getVersion

public final RegexVersion getVersion(java.lang.String s)
Returns a RegexVersion by a value to be used for the version-check.

Parameters:
s - the string to be used for the check
Returns:
a matching RegexVersion if any matches, null otherwise

isMatch

public final boolean isMatch(java.lang.String osString)
Checks if the given operating system-string matches the regular expression.

Parameters:
osString - the operating system-string
Returns:
true if and only if the string is a match, false otherwise

isUnknown

public final boolean isUnknown()
Checks if the the current OperatingSystem is the "unknown" operating system.

Returns:
true if the OperatingSystem is the "unknown" operating system, false otherwise

toString

public java.lang.String toString()
Returns a string representation of the UserAgent.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the UserAgent