home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.disi.unige.it
/
2015-02-11.ftp.disi.unige.it.tar
/
ftp.disi.unige.it
/
pub
/
.person
/
GuerriniG
/
dispense
/
corso-oodb
/
progetti-01
/
progetto2
/
telefono.java
< prev
next >
Wrap
Text File
|
2001-03-01
|
2KB
|
87 lines
package progetto2;
import com.odi.*;
import com.odi.util.*;
import java.util.*;
public class Telefono{
//Extents
public static Ext_OSTreeSet Ext = new Ext_OSTreeSet("Telefoni");
public boolean showSlotName=false; // look at toString method ...
// Attributes
public String numero;
public String tipo;
////////////////////////////////////////////////////////
// Constructor
public Telefono()
{
}
public Telefono(String _numero, String _tipo)
{
numero=_numero;
tipo=_tipo;
}
////////////////////////////////////////////////////////
// The Extents
void updateExtents(Database db, boolean add)
{
Ext.update(this, db, add);
}
////////////////////////////////////////////////////////
// Hook the IPersistent method
public void preFlushContents()
{
Segment theSegment= Session.getCurrent().segmentOfpreFlushContentsObject();
Database db = theSegment.getDatabase();
Collection theExtent = (Collection) Ext.getExtents(db);
if (!theExtent.contains(this))
updateExtents(db, true);
}
////////////////////////////////////////////////////////
// Override toString method
public String toString()
{
String ret;
ret = super.toString();
if (showSlotName)
ret = ret + " numero";
ret = ret + " " + numero;
if (showSlotName)
ret = ret + " tipo";
ret = ret + " " + tipo;
return ret;
}
// Operations
}