// Path: src/main/java/com/hosseini/persian/dt/PersianDT.java
// public enum  PersianDT {
// 
//     /*
// 
//     <p>
//     Enforce the singleton property with a private constructor or an enum type .
//     a single-element enum type is the best way to implement a singleton
//     </p>
//     */
// 
//     INSTANCE;
// 
// 
//     /**
//      * you can't instantiate PersianDT directly
//      * <p>
//      * we use Singleton Pattern to don't allow leak memory
//      * and make sure we have ust one instance out there
//      * <p>
//      **/
// 
//     PersianDT() {}
// 
//     public synchronized static PersianDT Instance() {
// 
//         return INSTANCE;
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method will give you access to all method and api you need to
//      * return current date from device/Server/pc or ...
//      * for you of course persian date and before that make sure you
//      * have sentence or just need date and if you just need date you
//      * can pass {@code ""} as param to it
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accepte Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date.
//      * @return A Current object
//      * @see Current
//      * @param date
//      *              get current date from the system
//      */
//     public synchronized Current Current(final Date date, final Object sentence) {
// 
//         final String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(date);
//         if (sentence instanceof String)
//             return new Current(formatDate, (String) sentence);
// 
//         else
//             return new Current(formatDate, "");
// 
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method will give you access to all method and api you need to
//      * return Given date to persian date from device/Server/pc or ...
//      * for you of course persian date and before that make sure you
//      * have sentence or just need date and if you just need date you
//      * can pass {@code ""} as param to it
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accept Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date.
//      * @param date     accept enlish date as string
//      * @return A Generate object
//      * @see Generate
//      */
// 
//     public synchronized Generate generate(final String date
//             , final Object sentence) {
// 
// 
//         if (sentence instanceof String)
//             return new Generate(date, (String) sentence);
// 
//         else
//             return new Generate(date, "");
//     }
// 
//     public synchronized Generate generate(final Date date
//             , final Object sentence) {
// 
//         final String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(date);
// 
//         if (sentence instanceof String)
//             return new Generate(formatDate, (String) sentence);
// 
//         else
//             return new Generate(formatDate, "");
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method create Ago object and will give you access to all method
//      * and api you need for create date from your given date like <b>1 year ago</b>
//      * return Date with ago fromat from current device/Server/pc or ...
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accept Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date and so if you
//      *                 just need date you can pass {@code ""} as param to it.
//      * @param date     accept enlish date as string
//      * @return A AgoTime object
//      * @see AgoTime
//      */
// 
//     public synchronized AgoTime Ago(final String date, final Object sentence) {
// 
//         if (sentence instanceof String)
//             return new AgoTime(date, (String) sentence);
// 
//         else
//             return new AgoTime(date, "");
//     }
// 
// }
// 
// Path: src/main/java/com/hosseini/persian/dt/PersianDate/CallBack.java
// public interface CallBack {
// 
//     void onReceive(String date);
// }


import com.hosseini.persian.dt.PersianDT;
import com.hosseini.persian.dt.PersianDate.CallBack;
import java.util.Date;
package Example.current;



/**
 * Created by abbas on 3/30/16.
 */
public class useItEasyWayLikeBuilderpattern implements CallBack {

    public static void main(String[] strings) {


        new useItEasyWayLikeBuilderpattern().date();
    }

    public void date() {


        //Today id 1395/1/21
        PersianDT
                .Instance()
                .generate(new Date(), "{DATE}")
                .CallBack(System.out::println)
                .Separator("/")
                .generateWithMonthName();



        System.out.println();

        //if you use java8 you may like this more kind of callbacks

        PersianDT
                .Instance()
                .generate(new Date(),"Wendsday equle to {DATE} in Persian.")
                .Separator("/")
                        //use methiod reference
                        //for example System.out::println
                .CallBack(System.out::println)
                .generateWithMonthName();

// Path: src/main/java/com/hosseini/persian/dt/PersianDT.java
// public enum  PersianDT {
// 
//     /*
// 
//     <p>
//     Enforce the singleton property with a private constructor or an enum type .
//     a single-element enum type is the best way to implement a singleton
//     </p>
//     */
// 
//     INSTANCE;
// 
// 
//     /**
//      * you can't instantiate PersianDT directly
//      * <p>
//      * we use Singleton Pattern to don't allow leak memory
//      * and make sure we have ust one instance out there
//      * <p>
//      **/
// 
//     PersianDT() {}
// 
//     public synchronized static PersianDT Instance() {
// 
//         return INSTANCE;
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method will give you access to all method and api you need to
//      * return current date from device/Server/pc or ...
//      * for you of course persian date and before that make sure you
//      * have sentence or just need date and if you just need date you
//      * can pass {@code ""} as param to it
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accepte Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date.
//      * @return A Current object
//      * @see Current
//      * @param date
//      *              get current date from the system
//      */
//     public synchronized Current Current(final Date date, final Object sentence) {
// 
//         final String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(date);
//         if (sentence instanceof String)
//             return new Current(formatDate, (String) sentence);
// 
//         else
//             return new Current(formatDate, "");
// 
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method will give you access to all method and api you need to
//      * return Given date to persian date from device/Server/pc or ...
//      * for you of course persian date and before that make sure you
//      * have sentence or just need date and if you just need date you
//      * can pass {@code ""} as param to it
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accept Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date.
//      * @param date     accept enlish date as string
//      * @return A Generate object
//      * @see Generate
//      */
// 
//     public synchronized Generate generate(final String date
//             , final Object sentence) {
// 
// 
//         if (sentence instanceof String)
//             return new Generate(date, (String) sentence);
// 
//         else
//             return new Generate(date, "");
//     }
// 
//     public synchronized Generate generate(final Date date
//             , final Object sentence) {
// 
//         final String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).format(date);
// 
//         if (sentence instanceof String)
//             return new Generate(formatDate, (String) sentence);
// 
//         else
//             return new Generate(formatDate, "");
//     }
// 
//     /**
//      * Builder Pattern Style
//      * <p>
//      * this method create Ago object and will give you access to all method
//      * and api you need for create date from your given date like <b>1 year ago</b>
//      * return Date with ago fromat from current device/Server/pc or ...
//      * <p>
//      * we can use this like functional Programming and more fun
//      * use it like Builder pattern make devs have more fun with it
//      *
//      * @param sentence accept Object type because not every time
//      *                 developers need or want use date in some where
//      *                 in sentence mostly just need date and so if you
//      *                 just need date you can pass {@code ""} as param to it.
//      * @param date     accept enlish date as string
//      * @return A AgoTime object
//      * @see AgoTime
//      */
// 
//     public synchronized AgoTime Ago(final String date, final Object sentence) {
// 
//         if (sentence instanceof String)
//             return new AgoTime(date, (String) sentence);
// 
//         else
//             return new AgoTime(date, "");
//     }
// 
// }
// 
// Path: src/main/java/com/hosseini/persian/dt/PersianDate/CallBack.java
// public interface CallBack {
// 
//     void onReceive(String date);
// }


// Path: src/main/java/Example/current/useItEasyWayLikeBuilderpattern.java
import com.hosseini.persian.dt.PersianDT;
import com.hosseini.persian.dt.PersianDate.CallBack;
import java.util.Date;

package Example.current;



/**
 * Created by abbas on 3/30/16.
 */
public class useItEasyWayLikeBuilderpattern implements CallBack {

    public static void main(String[] strings) {


        new useItEasyWayLikeBuilderpattern().date();
    }

    public void date() {


        //Today id 1395/1/21
        PersianDT
                .Instance()
                .generate(new Date(), "{DATE}")
                .CallBack(System.out::println)
                .Separator("/")
                .generateWithMonthName();



        System.out.println();

        //if you use java8 you may like this more kind of callbacks

        PersianDT
                .Instance()
                .generate(new Date(),"Wendsday equle to {DATE} in Persian.")
                .Separator("/")
                        //use methiod reference
                        //for example System.out::println
                .CallBack(System.out::println)
                .generateWithMonthName();

        System.out.println();