001/****************************************************************************
002 * Copyright/Copyleft:
003 *
004 * For this source the LGPL Lesser General Public License,
005 * published by the Free Software Foundation is valid.
006 * It means:
007 * 1) You can use this source without any restriction for any desired purpose.
008 * 2) You can redistribute copies of this source to everybody.
009 * 3) Every user of this source, also the user of redistribute copies
010 *    with or without payment, must accept this license for further using.
011 * 4) But the LPGL is not appropriate for a whole software product,
012 *    if this source is only a part of them. It means, the user
013 *    must publish this part of source,
014 *    but don't need to publish the whole source of the own product.
015 * 5) You can study and modify (improve) this source
016 *    for own using or for redistribution, but you have to license the
017 *    modified sources likewise under this LGPL Lesser General Public License.
018 *    You mustn't delete this Copyright/Copyleft inscription in this source file.
019 *
020 * @author Hartmut Schorrig: hartmut.schorrig@vishia.de, www.vishia.org
021 * @version 0.93 2011-01-05  (year-month-day)
022 *******************************************************************************/ 
023package org.vishia.java2C.test;
024
025public class AnyClass
026{
027  int x1 = 5;
028  
029  /**The ref is needed to test {@link #returnRefSimle(int)} for concatenations of references.
030   */
031  ImplIfc ref;
032
033  
034  /**Check whether a static instance of this class is translated to C.
035   * 
036   */
037  //final static AnyClass instance1  = new AnyClass(null);
038  
039  AnyClass(ImplIfc ref)
040  { this.ref = ref;
041  }
042  
043  /**Any final method to call. */
044  final int addValue(int value)
045  { x1 += value;
046    return x1;
047  }
048  
049  /**Any override-able method to call. */
050  int addValueOverrideable(int value)
051  { x1 += value;
052    return x1;
053  }
054  
055  /**Returns itself (this)
056   * @java2c=return-this.
057   * @param value
058   * @return
059   */
060  final AnyClass returnThis(int value)
061  { x1 += value;
062    return this;
063  }
064  
065  /**Returns itself (this), but the method is able to override. Therefore a dynamic call should be used.
066   * @java2c=return-this.
067   */
068  AnyClass returnThisOverrideable(int value)
069  { x1 += value;
070    return this;
071  }
072  
073  /**Returns any other instance.
074   * @param value
075   * @return
076   */
077  final ImplIfc returnRef()
078  { return ref;
079  }
080
081  /**Returns any other instance, but this method is able to override, non final.
082   * @param value
083   * @return
084   */
085  ImplIfc returnRefOverrideable()
086  { return ref;
087  }
088
089}