|
From: Frank V. C. <fr...@us...> - 2001-04-03 03:00:19
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw
In directory usw-pr-cvs1:/tmp/cvs-serv13149/src/libs/clfw
Modified Files:
Array.cpp Concept.cpp
Log Message:
115287 Enhanced concept type ready for serious testing
Index: Array.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Array.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Array.cpp 2001/03/01 16:34:28 1.6
--- Array.cpp 2001/04/03 03:00:14 1.7
***************
*** 117,121 ****
//
! Count Array::getSize( void ) const
{
return theCount;
--- 117,121 ----
//
! Counter Array::getSize( void ) const
{
return theCount;
***************
*** 131,138 ****
}
//
! // Get indexed entity methods
//
! FrameworkEntityPtr Array::operator []( Index offset ) const
throw (BoundsException)
{
--- 131,138 ----
}
//
! // Get ElementIndexed entity methods
//
! FrameworkEntityPtr Array::operator []( ElementIndex offset ) const
throw (BoundsException)
{
***************
*** 151,158 ****
//
! // Get indexed entity
//
! FrameworkEntityPtr Array::getElementAt( Index offset ) const
throw (BoundsException)
{
--- 151,178 ----
//
! // Return the index of an entity if it matches up with
! // an existing element. Return -1 otherwise
//
! ElementIndex Array::indexOf( FrameworkEntityCptr aPtr ) const
! throw (NullPointerException)
! {
! if( aPtr == NULLPTR )
! {
! throw NullPointerException( LOCATION );
! }
! else
! {
! ; // do nothing
! }
! GUARD;
! return this->getMemberIndex( aPtr );
! }
!
! //
! // Get ElementIndexed entity
! //
!
! FrameworkEntityPtr Array::getElementAt( ElementIndex offset ) const
throw (BoundsException)
{
***************
*** 164,168 ****
//
! MetaClassPtr Array::getElementClassAt( Index offset ) const
throw (BoundsException)
{
--- 184,188 ----
//
! MetaClassPtr Array::getElementClassAt( ElementIndex offset ) const
throw (BoundsException)
{
***************
*** 211,215 ****
GUARD;
! for( Count x = 0; ( x < theCount ) && ( found == false ); ++x )
{
found = *(MetaSpace::getClassForType(theEntities[x]->getType())) ==
--- 231,235 ----
GUARD;
! for( Counter x = 0; ( x < theCount ) && ( found == false ); ++x )
{
found = *(MetaSpace::getClassForType(theEntities[x]->getType())) ==
***************
*** 272,276 ****
//
! void Array::putAt( Index offset, FrameworkEntityPtr anEntity )
throw (NullPointerException,BoundsException)
{
--- 292,296 ----
//
! void Array::putAt( ElementIndex offset, FrameworkEntityPtr anEntity )
throw (NullPointerException,BoundsException)
{
***************
*** 294,301 ****
//
// Index removal of entity
//
! FrameworkEntityPtr Array::removeAt( Index offset )
throw (BoundsException)
{
--- 314,351 ----
//
+ // Remove entity if exist given a test object
+ //
+
+ FrameworkEntityPtr Array::remove( FrameworkEntityPtr aPtr )
+ throw (NullPointerException)
+ {
+ FrameworkEntityPtr aRetPtr( NULLPTR );
+
+ if( aPtr == NULLPTR )
+ {
+ throw NullPointerException( LOCATION );
+ }
+ else
+ {
+ Counter x = this->getMemberIndex( aPtr );
+
+ if( x >= 0 )
+ {
+ aRetPtr = (*this)[x];
+ this->removeAt( x );
+ }
+ else
+ {
+ ; // do nothing
+ }
+ }
+ return aRetPtr;
+ }
+
+ //
// Index removal of entity
//
! FrameworkEntityPtr Array::removeAt( ElementIndex offset )
throw (BoundsException)
{
***************
*** 317,321 ****
}
! /// Remove first entity in array
FrameworkEntityPtr Array::removeAtFront( void )
--- 367,371 ----
}
! // Remove first entity in array
FrameworkEntityPtr Array::removeAtFront( void )
***************
*** 495,499 ****
//
! void Array::addAll( Index offset, CollectionCref aCollection )
throw (BoundsException,IncompatibleClassException)
{
--- 545,549 ----
//
! void Array::addAll( ElementIndex offset, CollectionCref aCollection )
throw (BoundsException,IncompatibleClassException)
{
***************
*** 552,555 ****
--- 602,627 ----
}
+ // Walk the walk and return reasoning information
+
+ ElementIndex Array::getMemberIndex( FrameworkEntityCptr aPtr ) const
+ {
+ ElementIndex index(-1);
+ bool found( false );
+
+ for( Counter x = 0 ; ( x < theCount ) && ( found == false ); ++x )
+ {
+ if( ( found = theEntities[x]->equals( aPtr ) ) == true )
+ {
+ index = x;
+ }
+ else
+ {
+ ; // do nothing
+ }
+ }
+
+ return index;
+ }
+
// Walk the walk looking for match
***************
*** 558,562 ****
bool found( false );
! for( Count x = 0; ( x < theCount ) && ( found == false ); ++x )
{
found = theEntities[x]->equals( aPtr );
--- 630,634 ----
bool found( false );
! for( Counter x = 0; ( x < theCount ) && ( found == false ); ++x )
{
found = theEntities[x]->equals( aPtr );
***************
*** 568,572 ****
// Consume
! void Array::increaseOccupancy( Count additions )
{
theCount += additions;
--- 640,644 ----
// Consume
! void Array::increaseOccupancy( Counter additions )
{
theCount += additions;
***************
*** 576,580 ****
// Relieve
! void Array::decreaseOccupancy( Count removals )
{
theCount -= removals;
--- 648,652 ----
// Relieve
! void Array::decreaseOccupancy( Counter removals )
{
theCount -= removals;
***************
*** 586,590 ****
//
! bool Array::checkBoundsForAdd( Count increment )
{
bool canDo( true );
--- 658,662 ----
//
! bool Array::checkBoundsForAdd( Counter increment )
{
bool canDo( true );
***************
*** 592,596 ****
if( theRemaining == 0 || increment > theRemaining )
{
! UnsignedIntegerCref aR = getSizeRestrictionAsReference();
if( aR.getValue() != 0 &&
--- 664,668 ----
if( theRemaining == 0 || increment > theRemaining )
{
! IntegerCref aR = getSizeRestrictionAsReference();
if( aR.getValue() != 0 &&
***************
*** 618,630 ****
//
! void Array::increaseArraySize( Count increment )
{
if( increment > theRemaining )
{
! Count growth = (theCount+increment)+theCount/2;
FrameworkEntity **newArray =
(FrameworkEntity **) new FrameworkEntityPtr[growth];
! for( Count x=0; x<theCount ; ++x )
{
newArray[x] = theEntities[x];
--- 690,702 ----
//
! void Array::increaseArraySize( Counter increment )
{
if( increment > theRemaining )
{
! Counter growth = (theCount+increment)+theCount/2;
FrameworkEntity **newArray =
(FrameworkEntity **) new FrameworkEntityPtr[growth];
! for( Counter x=0; x<theCount ; ++x )
{
newArray[x] = theEntities[x];
***************
*** 653,657 ****
//
! void Array::shiftForInsert( Index position, Count increment )
{
size_t sizeMove = (theCount - position)*sizeof(FrameworkEntityPtr);
--- 725,729 ----
//
! void Array::shiftForInsert( ElementIndex position, Count increment )
{
size_t sizeMove = (theCount - position)*sizeof(FrameworkEntityPtr);
***************
*** 668,672 ****
//
! void Array::shiftForRemove( Index position, Count increment )
{
size_t sizeMove = (theCount - increment)*sizeof(FrameworkEntityPtr);
--- 740,744 ----
//
! void Array::shiftForRemove( ElementIndex position, Count increment )
{
size_t sizeMove = (theCount - increment)*sizeof(FrameworkEntityPtr);
***************
*** 685,689 ****
void Array::copyOverFromArray
(
! Index startPos,
FrameworkEntity **aSrc,
CountCref maxCount
--- 757,761 ----
void Array::copyOverFromArray
(
! ElementIndex startPos,
FrameworkEntity **aSrc,
CountCref maxCount
***************
*** 738,742 ****
// We define our property data descriptor
! DEFINE_CLASSINSTANCE_DESCRIPTOR(Array, UnsignedInteger,UnsignedInteger, SizeRestriction );
// We construct the values reference
--- 810,814 ----
// We define our property data descriptor
! DEFINE_CLASSINSTANCE_DESCRIPTOR(Array, Integer,Integer, SizeRestriction );
// We construct the values reference
Index: Concept.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Concept.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Concept.cpp 2001/03/31 22:21:45 1.3
--- Concept.cpp 2001/04/03 03:00:14 1.4
***************
*** 39,43 ****
Concept::Concept( void )
:
! Aggregate()
{
}
--- 39,44 ----
Concept::Concept( void )
:
! Aggregate(),
! theProperties( NULLPTR )
{
}
***************
*** 49,53 ****
Concept::Concept( ConceptCref aType )
:
! Aggregate( aType )
{
; // do nothing
--- 50,55 ----
Concept::Concept( ConceptCref aType )
:
! Aggregate( aType ),
! theProperties( NULLPTR )
{
; // do nothing
***************
*** 81,106 ****
}
! AttributePtr Concept::getAttributeFromKey( FrameworkEntityPtr )
{
! return AttributePtr( NULLPTR );
}
SetCollectionPtr Concept::getPropertyKeys( void )
{
return SetCollectionPtr( NULLPTR );
}
! void Concept::addAttribute( AttributePtr )
{
!
! }
! void Concept::removeAttribute( AttributePtr )
! {
!
! }
! void Concept::removeKey( FrameworkEntityPtr )
! {
!
}
--- 83,175 ----
}
! //
! // Retrieve an attribute given a key entity
! //
!
! AttributePtr Concept::getAttributeFromKey( FrameworkEntityPtr aPtr )
! throw ()
{
! AttributePtr aRetPtr( NULLPTR );
!
! if( theProperties == NULLPTR || aPtr == NULLPTR )
! {
! throw NullPointerException(LOCATION);
! }
! else
! {
! ElementIndex aIndx(-1);
! Attribute aFake;
! aFake.setKey( aPtr );
! if( ( aIndx = theProperties->indexOf( &aFake ) ) != -1 )
! {
! FrameworkEntityPtr aBasePtr( theProperties->getElementAt(aIndx) );
! if( aBasePtr->getType()->isTypeOf( Attribute::getTypeDescriptor() ) )
! {
! aRetPtr = Attribute::castDown( aBasePtr );
! }
! else
! {
! throw IncompatibleClassException( LOCATION );
! }
! }
!
! }
! return aRetPtr;
}
SetCollectionPtr Concept::getPropertyKeys( void )
+ throw ()
{
+ if( theProperties == NULLPTR )
+ {
+ throw NullPointerException(LOCATION);
+ }
+ else
+ {
+
+ }
return SetCollectionPtr( NULLPTR );
}
! void Concept::addAttribute( AttributePtr aPtr )
! throw ()
{
! if( theProperties == NULLPTR || aPtr == NULLPTR )
! {
! throw NullPointerException(LOCATION);
! }
! else
! {
! theProperties->put( aPtr );
! }
! }
!
! void Concept::removeAttribute( AttributePtr aPtr )
! throw ()
! {
! if( theProperties == NULLPTR || aPtr == NULLPTR )
! {
! throw NullPointerException(LOCATION);
! }
! else
! {
! theProperties->remove(aPtr);
! }
! }
!
! void Concept::removeKey( FrameworkEntityPtr aPtr )
! throw ()
! {
! if( theProperties == NULLPTR || aPtr == NULLPTR )
! {
! throw NullPointerException(LOCATION);
! }
! else
! {
! Attribute aFake;
! aFake.setKey( aPtr );
! theProperties->remove(&aFake);
! }
}
|