Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Cut Class Reference

Inheritance diagram for Cut:

Inheritance graph
[legend]
Collaboration diagram for Cut:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Cut (Integer id)
 Cut (String name, Double value)
int getId ()
Cut setId (Integer id)
String getName ()
Cut setName (String name)
Double getValue ()
Cut setValue (Double value)
boolean store () throws JetWebException
boolean retrieve () throws JetWebException
boolean lt (Cut cut)
boolean gt (Cut cut)
boolean equals (Cut cut)

Private Attributes

Integer id_ = -1
String name_ = ""
Double value_ = null

Constructor & Destructor Documentation

Cut Integer  id  ) 
 

Definition at line 15 of file Cut.java.

References Cut.id_.

00015                           {
00016     id_ = id;
00017     try{
00018         DBJobManager.selectFromDB(this);
00019     }catch(JetWebException err){
00020         System.out.println(err.getMessage());
00021         err.printStackTrace();
00022     }
00023     }

Cut String  name,
Double  value
 

Definition at line 25 of file Cut.java.

References Cut.name_, and Cut.value_.

00025                                          {
00026     name_ = name;
00027     value_ = value;
00028     try{
00029         DBJobManager.selectFromDB(this);
00030     }catch(JetWebException err){
00031         System.out.println(err.getMessage());
00032         err.printStackTrace();
00033     }
00034     }


Member Function Documentation

boolean equals Cut  cut  ) 
 

Definition at line 112 of file Cut.java.

References Cut.getName(), Cut.getValue(), Cut.name_, and Cut.value_.

Referenced by Cut.gt(), and Cut.lt().

00112                                   {
00113     if (!cut.getName().equals(name_))return false;
00114     return Match.compareDouble(value_, cut.getValue());
00115     }

int getId  ) 
 

Get the unique ID of the object

Implements Storeable.

Definition at line 36 of file Cut.java.

Referenced by DBJobManager.updateStatus().

00036                       {
00037     return id_;
00038     }

String getName  ) 
 

Definition at line 45 of file Cut.java.

References Cut.id_, Cut.name_, and Cut.retrieve().

Referenced by CutCollection.addCut(), Cut.equals(), Cut.gt(), Cut.lt(), and DBJobManager.selectNearestCut().

00045                            {
00046     if(id_>0 && name_.equals("")) {
00047         try{
00048         retrieve();
00049         }catch(JetWebException err){
00050         System.out.println("unable to retrieve cut from data base");
00051         err.printStackTrace();
00052         }
00053     }
00054     return name_;
00055     }

Double getValue  ) 
 

Definition at line 62 of file Cut.java.

References Cut.id_, Cut.retrieve(), and Cut.value_.

Referenced by Cut.equals(), Cut.gt(), Cut.lt(), and DBJobManager.selectNearestCut().

00062                             {
00063     if(id_>0 && value_==null) {
00064         try{
00065         retrieve();
00066         }catch(JetWebException err){
00067         System.out.println
00068             ("Cut.getValue(): unable to retrvieve cut from data base");
00069         err.printStackTrace();
00070         }
00071     }
00072 
00073     return value_;
00074     }

boolean gt Cut  cut  ) 
 

Definition at line 106 of file Cut.java.

References Cut.equals(), Cut.getName(), Cut.getValue(), Cut.name_, and Cut.value_.

00106                               {
00107     if (!cut.getName().equals(name_))return false;
00108     return(value_ > cut.getValue());
00109     }

boolean lt Cut  cut  ) 
 

Definition at line 98 of file Cut.java.

References Cut.equals(), Cut.getName(), Cut.getValue(), Cut.name_, and Cut.value_.

Referenced by CutCollection.addCut().

00098                               {
00099     if(cut.getValue()==null ||
00100        value_==null)return false;
00101     if (!cut.getName().equals(name_))return false;
00102     return(value_ < cut.getValue());
00103     }

boolean retrieve  )  throws JetWebException
 

Populate the object in memory from the database. Return true if the information retrieved is up to date.

Implements Storeable.

Definition at line 90 of file Cut.java.

References Cut.id_, Cut.name_, and Cut.value_.

Referenced by Cut.getName(), and Cut.getValue().

00091                           {
00092     if(id_<0 &&(value_==null || name_.equals("")))return false;
00093     return DBJobManager.selectFromDB(this);
00094     }

Cut setId Integer  id  ) 
 

Definition at line 40 of file Cut.java.

References Cut.id_.

00040                                 {
00041     id_ = id;
00042     return this;
00043     }

Cut setName String  name  ) 
 

Definition at line 57 of file Cut.java.

References Cut.name_.

Referenced by DBJobManager.selectFromDB().

00057                                    {
00058     name_ = name;
00059     return this;
00060     }

Cut setValue Double  value  ) 
 

Definition at line 76 of file Cut.java.

References Cut.value_.

00076                                      {
00077     value_ = value;
00078     return this;
00079     }

boolean store  )  throws JetWebException
 

Write the object in memory to the database. If the ID does not exist in the DB the object is inserted as a new entry. If the ID exists, that entry is updated.

Returns:
true if the object was inserted, false otherwise.

Implements Storeable.

Definition at line 81 of file Cut.java.

References Cut.id_, Cut.name_, and Cut.value_.

00082                           {
00083 
00084     //if no id and value/name present then nothing to store
00085     if(id_<0 && (value_==null || name_.equals(""))) return false;
00086     DBJobManager.addToDB(this);
00087     return true;
00088     }


Member Data Documentation

Integer id_ = -1 [private]
 

Definition at line 11 of file Cut.java.

Referenced by Cut.Cut(), Cut.getName(), Cut.getValue(), Cut.retrieve(), Cut.setId(), and Cut.store().

String name_ = "" [private]
 

Definition at line 12 of file Cut.java.

Referenced by Cut.Cut(), Cut.equals(), Cut.getName(), Cut.gt(), Cut.lt(), Cut.retrieve(), Cut.setName(), and Cut.store().

Double value_ = null [private]
 

Definition at line 13 of file Cut.java.

Referenced by Cut.Cut(), Cut.equals(), Cut.getValue(), Cut.gt(), Cut.lt(), Cut.retrieve(), Cut.setValue(), and Cut.store().


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007