while ( strok.hasMoreTokens() )
{
String element = strok.nextToken();
if ( element.indexOf( '*' ) >= 0 )
{
throw new AccessControlException( WrapperManager.getRes().getString( "can't define '*' inside a sequence." ) );
}
int range = element.indexOf( "-" );
if ( range >= 0 )
{
if ( range == 0 )
{
if ( m_eventArr.size() != 0 )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} has to be first element in sequence.", element ) );
}
else
{
lastValue = Integer.parseInt( element.substring( 1 ) );
if ( lastValue <= EVENT_MIN || lastValue > EVENT_MAX )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is out of bounds.", new Integer( lastValue ) ) );
}
m_eventArr.add( new String( EVENT_MIN + "-" + lastValue ) );
}
}
else if ( range == element.length() - 1 )
{
currentValue = Integer.parseInt( element.substring( 0, element.length() - 1 ) );
if ( currentValue <= EVENT_MIN || currentValue > EVENT_MAX )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is out of bounds.", new Integer( lastValue ) ) );
}
if ( currentValue < lastValue )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is not sorted.", new Integer( currentValue ) ) );
}
lastValue = currentValue;
if ( strok.hasMoreTokens() )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} has to be last element in sequence.", element ) );
}
m_eventArr.add( currentValue + "-" + EVENT_MAX );
}
else
{
currentValue = Integer.parseInt( element.substring( 0, range ) );
if ( currentValue <= EVENT_MIN || currentValue > EVENT_MAX )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is out of bounds.", new Integer( lastValue ) ) );
}
if ( currentValue < lastValue )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is not sorted.", new Integer( currentValue ) ) );
}
lastValue = currentValue;
currentValue = Integer.parseInt( element.substring( range + 1 ) );
if ( currentValue <= EVENT_MIN || currentValue > EVENT_MAX )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is out of bounds.", new Integer( lastValue ) ) );
}
if ( currentValue < lastValue )
{
throw new AccessControlException( WrapperManager.getRes().getString( "Value {0} is not sorted.", new Integer( currentValue ) ) );
}
m_eventArr.add( lastValue + "-" + currentValue );
lastValue = currentValue;
}
}