classifierLibrary
Class StandardSituation

java.lang.Object
  extended byclassifierLibrary.StandardSituation
All Implemented Interfaces:
java.lang.Cloneable, Situation

public class StandardSituation
extends java.lang.Object
implements Situation, java.lang.Cloneable

Library classifierLibrary, Klasse StandardSituation

Copyright by Klaus Hufschlag 2004, 2005, 2006

This file is part of the Generic Classifier Library. The Generic Classifier Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Generic Classifier Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Generic Classifier Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Version:
1.4
Author:
Klaus Hufschlag

Constructor Summary
StandardSituation(Language l, int Length)
          Constructor, creates a string-like sequence of Symbols, with given language and lenght, initializes all places in sequence with the default symbol of the language
 
Method Summary
 java.lang.Object clone()
          Retuns a copy(clone) of the situation as a new object.
 int compare(Situation sit)
          Compares the Situation with another one.
 int compareSubsumtive(Situation sit)
          Compares the Situation with another one.
 boolean compatibility(Situation sit)
          Method checks compatitbility with another situation, e.g. if Languages match.
 Situation cross(Situation sit, int Position)
          Method for crossover at given position, returns new Situation after crossover.
 void debug_out()
          Output for Debugging.
 Symbol getElement(int position)
          Returns the Symbol at a given position in the Situation/sequence.
 Language getLanguage()
          getLanguageReturns the Language defined for the Situation.
 int getLength()
          Returns the size of the situation, for sets this should be the maximum size / size of the defined basic set.
 boolean isMatched(Situation sit)
          Criterion for a situation to be matched by another situation, should be used for specifying different types of Situations in subclasses.
 boolean isMatchedSubsumtive(Situation sit)
          Criterion for a situation to be matched by another situation, should be used for specifying different types of Situations in subclasses.
 Situation mutation(double Probability)
          Method for mutation with given probability.
 void randomizeSituation()
          Changes the situation to a random situation based on the given language
 void randomizeSituation(double wildprob)
          Changes the situation to a random situation based on the given language, using a given probability for wildcard symbols.
 void setElement(int Position, Symbol Symbol)
          Sets the Element of the Situation/sequence at given position to the given Symbol.
 void setLanguage(Language lang)
          Sets the Language to be used for the Situation.
 int size()
          Returns the size of the situation, can be dynamic if situation is a set.
 int specificMembers()
          Returns the number of elements in the Situation that are not wildcards.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardSituation

public StandardSituation(Language l,
                         int Length)
Constructor, creates a string-like sequence of Symbols, with given language and lenght, initializes all places in sequence with the default symbol of the language

Parameters:
l - Language to use
Length - Length of the sequence
Method Detail

clone

public java.lang.Object clone()
Description copied from interface: Situation
Retuns a copy(clone) of the situation as a new object.

Specified by:
clone in interface Situation

getLength

public int getLength()
Description copied from interface: Situation
Returns the size of the situation, for sets this should be the maximum size / size of the defined basic set.

Specified by:
getLength in interface Situation
Returns:
Length of the situation as int.

size

public int size()
Description copied from interface: Situation
Returns the size of the situation, can be dynamic if situation is a set.

Specified by:
size in interface Situation
Returns:
Size of the situation as int.

getLanguage

public Language getLanguage()
Description copied from interface: Situation
getLanguageReturns the Language defined for the Situation.

Specified by:
getLanguage in interface Situation
Returns:
Language of the Situation

setLanguage

public void setLanguage(Language lang)
Description copied from interface: Situation
Sets the Language to be used for the Situation.

Specified by:
setLanguage in interface Situation
Parameters:
lang - Language to be set

compatibility

public boolean compatibility(Situation sit)
Description copied from interface: Situation
Method checks compatitbility with another situation, e.g. if Languages match.

Specified by:
compatibility in interface Situation
Parameters:
sit - Situation to compare with
Returns:
true, if compatible, else false

cross

public Situation cross(Situation sit,
                       int Position)
Description copied from interface: Situation
Method for crossover at given position, returns new Situation after crossover.

Specified by:
cross in interface Situation
Parameters:
sit - Situation to cross with
Position - Position for crossover
Returns:
new Situation after crossover

mutation

public Situation mutation(double Probability)
Description copied from interface: Situation
Method for mutation with given probability.

Specified by:
mutation in interface Situation
Parameters:
Probability - Probability for mutation
Returns:
new Situation after Mutation

setElement

public void setElement(int Position,
                       Symbol Symbol)
Sets the Element of the Situation/sequence at given position to the given Symbol.

Parameters:
Position - Position at which the Symbol has to be set
Symbol - Symbol to set

getElement

public Symbol getElement(int position)
Returns the Symbol at a given position in the Situation/sequence.

Parameters:
position - Position of wanted Symbol
Returns:
Symbol Symbol at wanted position, null if position does not exist

randomizeSituation

public void randomizeSituation()
Description copied from interface: Situation
Changes the situation to a random situation based on the given language

Specified by:
randomizeSituation in interface Situation

randomizeSituation

public void randomizeSituation(double wildprob)
Description copied from interface: Situation
Changes the situation to a random situation based on the given language, using a given probability for wildcard symbols.

Specified by:
randomizeSituation in interface Situation
Parameters:
wildprob - Probability for wildcards.

debug_out

public void debug_out()
Description copied from interface: Situation
Output for Debugging.

Specified by:
debug_out in interface Situation

compare

public int compare(Situation sit)
Description copied from interface: Situation
Compares the Situation with another one. Returns the number of exact matches, without using wildcards.

Specified by:
compare in interface Situation
Parameters:
sit - Situation to compare with
Returns:
Absolute number of matches

compareSubsumtive

public int compareSubsumtive(Situation sit)
Description copied from interface: Situation
Compares the Situation with another one. Returns the number of matches using wildcards, i.e. counting a symbol that is subsumed by another symbol as a match.

Specified by:
compareSubsumtive in interface Situation
Parameters:
sit - Situation to compare with
Returns:
Absolute number of matches

isMatched

public boolean isMatched(Situation sit)
Description copied from interface: Situation
Criterion for a situation to be matched by another situation, should be used for specifying different types of Situations in subclasses.

Specified by:
isMatched in interface Situation
Parameters:
sit - Situation to compare with
Returns:
true, if Situation is mached, otherwise false.

isMatchedSubsumtive

public boolean isMatchedSubsumtive(Situation sit)
Description copied from interface: Situation
Criterion for a situation to be matched by another situation, should be used for specifying different types of Situations in subclasses.

Specified by:
isMatchedSubsumtive in interface Situation
Parameters:
sit - Situation to compare with
Returns:
true, if Situation is mached, otherwise false.

specificMembers

public int specificMembers()
Description copied from interface: Situation
Returns the number of elements in the Situation that are not wildcards.

Specified by:
specificMembers in interface Situation
Returns:
Number of non-wildcards as int