All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.query.facets.lang.Employee Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */


package com.gemstone.gemfire.cache.query.facets.lang;

import java.util.*;

public class Employee {
  static Random rand = new Random();
  
  public int salary;
  public String name;
  public Date hireDate;
  public Address fieldAddress;
  public float f;
  public double d;
  public Set collect;
  
  public long empId;
  
  public Employee() {
    f = 0.9f;
    d = 0.1;
    salary = (int)(rand.nextFloat()  * 200000);
    name = genName();
    if (rand.nextFloat() < 0.2)
      hireDate = null;
    else
      hireDate = new Date(Math.abs(rand.nextLong()));
    
    if (rand.nextFloat() < 0.2)
      fieldAddress = null;
    else
      fieldAddress = new Address();
    
    collect = new HashSet();
  }
  
  
  
  public String toString() {
    return getClass().getName() + ": " + name + "/" + salary + '/' + fieldAddress;
  }
  
  public int testMethod(double p1, String p2) {
    System.out.println("invoking testMethod: double");
    return salary;
  }
  
  public int testMethod(float p1, String p2) {
    System.out.println("invoking testMethod: float");
    return salary;
  }
  
  public int testMethod(long p1, String p2) {
    System.out.println("invoking testMethod: long");
    return salary;
  }
  
  public int testMethod(int p1, String p2) {
    System.out.println("invoking testMethod: int");
    return salary;
  }
  
  public int testMethod(short p1, String p2) {
    System.out.println("invoking testMethod: short");
    return salary;
  }
  
  public int testMethod(char p1, String p2) {
    System.out.println("invoking testMethod: char");
    return salary;
  }
  
  public int testMethod(byte p1, String p2) {
    System.out.println("invoking testMethod: byte");
    return salary;
  }
  
  public int testMethod(boolean p1, String p2) {
    System.out.println("invoking testMethod: boolean");
    return salary;
  }
  
  public int testMethod(java.sql.Date p1, String p2) {
    System.out.println("invoking testMethod: java.sql.Date: " + p1);
    return salary;
  }
  
  public int testMethod(java.sql.Time p1, String p2) {
    System.out.println("invoking testMethod: Time: " + p1);
    return salary;
  }
  
  public int testMethod(java.sql.Timestamp p1, String p2) {
    System.out.println("invoking testMethod: Timestamp: " + p1);
    return salary;
  }
  
  
  private static String genName() {
    switch ((Math.abs(rand.nextInt()) % 5)) {
      case 0:
        return "Adam";
      case 1:
        return "Bob";
      case 2:
        return "Charles";
      case 3:
        return "David";
      case 4:
        return "Earnest";
    }
    throw new IllegalStateException();
  }
  
  
  public Address address() {
    System.out.println("In address() method");
    return fieldAddress;
  }
  
  
  
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy