Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.pjsofts.eurobudget.beans
Class CategoryPair  view CategoryPair download CategoryPair.java

java.lang.Object
  extended bycom.pjsofts.eurobudget.beans.CategoryPair
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

public class CategoryPair
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable, java.io.Serializable

Java Bean Pair of Category a pair of category is normally unique per transaction.


Field Summary
static CategoryPair CATEGORY_EQILIBRAGE
           
static CategoryPair CATEGORY_INIT
          try to use this as null value, where u can t use the real 'null' ,
static CategoryPair CATEGORY_RATTRAPAGE
           
static CategoryPair CATEGORY_SPECIAL
           
static CategoryPair CATEGORY_SPLIT
           
static CategoryPair CATEGORY_SYSTEME
           
static CategoryPair CATEGORY_VENTILATION
           
static CategoryPair CATEGORY_VIREMENT
           
private  CategoryGroup group
          not implemented yet serial
private static java.util.ResourceBundle i18n
           
private  Category main
          first one serial
private static long serialVersionUID
           
private  Category sub
          second one serial
private  TaxDetails taxDetails
          not implemented yet, one per CategoryPair ! serial
private  int type
          Holds value of property type.
static int TYPE_COST
          Type of category pair
static int TYPE_REVENUE
           
static int TYPE_SPECIAL
           
 
Constructor Summary
CategoryPair()
          Creates a new instance of CategoryPair all null, type COST
CategoryPair(Category main, Category sub, int type)
          Creates a new instance of CategoryPair
CategoryPair(int type)
          Creates a new of CategoryPair with Category.NULL as main and sub
CategoryPair(java.lang.String main, int type)
          Creates a new instance of CategoryPair with subcategory == null
 
Method Summary
 java.lang.Object clone()
          cloneable interface
 int compareTo(java.lang.Object obj)
          normal order: null before the others main order, then sub order a Pair with same main and sub are equals then do not use hashcode (should not happens but )..
 void copy(CategoryPair cp)
          convenient method to set value of main and sub categories (also copy type and group)
 boolean equals(java.lang.Object obj)
          WARNING: breaking contract: this compares only main and sub cat, not type, tax ...
 CategoryGroup getGroup()
          Getter for property group.
 Category getMain()
          Getter for property main.
 Category getSub()
          Getter for property sub.
 TaxDetails getTaxDetails()
          Getter for property taxDetails.
 int getType()
          Getter for property type.
 boolean isCredit()
          Getter for property type.
 boolean isDebit()
          Getter for property type.
 boolean isNull()
          return true if both Main and sub ctg are null or if both are set to CATEGORY_NULL
 boolean isSpecial()
          Getter for property type.
 void setGroup(CategoryGroup group)
          Setter for property group.
 void setMain(Category main)
          Setter for property main.
 void setSub(Category sub)
          Setter for property sub.
 void setTaxDetails(TaxDetails taxDetails)
          Setter for property taxDetails.
 void setType(int type)
          Setter for property type.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

i18n

private static final transient java.util.ResourceBundle i18n

TYPE_COST

public static final transient int TYPE_COST
Type of category pair

See Also:
Constant Field Values

TYPE_REVENUE

public static final transient int TYPE_REVENUE
See Also:
Constant Field Values

TYPE_SPECIAL

public static final transient int TYPE_SPECIAL
See Also:
Constant Field Values

CATEGORY_INIT

public static final transient CategoryPair CATEGORY_INIT
try to use this as null value, where u can t use the real 'null' ,


CATEGORY_VIREMENT

public static final transient CategoryPair CATEGORY_VIREMENT

CATEGORY_VENTILATION

public static final transient CategoryPair CATEGORY_VENTILATION

CATEGORY_EQILIBRAGE

public static final transient CategoryPair CATEGORY_EQILIBRAGE

CATEGORY_RATTRAPAGE

public static final transient CategoryPair CATEGORY_RATTRAPAGE

CATEGORY_SPECIAL

public static final transient CategoryPair CATEGORY_SPECIAL

CATEGORY_SYSTEME

public static final transient CategoryPair CATEGORY_SYSTEME

CATEGORY_SPLIT

public static final transient CategoryPair CATEGORY_SPLIT

main

private Category main
first one serial


sub

private Category sub
second one serial


type

private int type
Holds value of property type. true means positive (transaction credit the account) eg. Revenues, false means negative (transaction debit the account) eg. Cost serial


group

private transient CategoryGroup group
not implemented yet serial


taxDetails

private transient TaxDetails taxDetails
not implemented yet, one per CategoryPair ! serial

Constructor Detail

CategoryPair

public CategoryPair()
Creates a new instance of CategoryPair all null, type COST


CategoryPair

public CategoryPair(int type)
Creates a new of CategoryPair with Category.NULL as main and sub


CategoryPair

public CategoryPair(java.lang.String main,
                    int type)
Creates a new instance of CategoryPair with subcategory == null


CategoryPair

public CategoryPair(Category main,
                    Category sub,
                    int type)
Creates a new instance of CategoryPair

Method Detail

isCredit

public boolean isCredit()
Getter for property type.


isDebit

public boolean isDebit()
Getter for property type.


isSpecial

public boolean isSpecial()
Getter for property type.


setType

public void setType(int type)
Setter for property type.


getType

public int getType()
Getter for property type.


getMain

public Category getMain()
Getter for property main.


setMain

public void setMain(Category main)
Setter for property main.


getSub

public Category getSub()
Getter for property sub.


setSub

public void setSub(Category sub)
Setter for property sub.


getGroup

public CategoryGroup getGroup()
Getter for property group.


setGroup

public void setGroup(CategoryGroup group)
Setter for property group.


getTaxDetails

public TaxDetails getTaxDetails()
Getter for property taxDetails.


setTaxDetails

public void setTaxDetails(TaxDetails taxDetails)
Setter for property taxDetails.


compareTo

public int compareTo(java.lang.Object obj)
normal order: null before the others main order, then sub order a Pair with same main and sub are equals then do not use hashcode (should not happens but ).. cost before revenues ?? tax details ??

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object obj)
WARNING: breaking contract: this compares only main and sub cat, not type, tax ... Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

  • It is reflexive: for any reference value x, x.equals(x) should return true.
  • It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the object is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.


isNull

public boolean isNull()
return true if both Main and sub ctg are null or if both are set to CATEGORY_NULL


toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.


clone

public java.lang.Object clone()
cloneable interface


copy

public void copy(CategoryPair cp)
convenient method to set value of main and sub categories (also copy type and group)