com.gemstone.gemfire.cache.query.data.Position Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-junit Show documentation
Show all versions of gemfire-junit Show documentation
SnappyData store based off Pivotal GemFireXD
/*
* 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.data;
import java.io.*;
import java.util.HashSet;
import java.util.Set;
import com.gemstone.gemfire.*;
public class Position implements Serializable, DataSerializable, Comparable {
private long avg20DaysVol=0;
private String bondRating;
private double convRatio;
private String country;
private double delta;
private long industry;
private long issuer;
public double mktValue;
private double qty;
public String secId;
public String secIdIndexed;
private String secLinks;
public String secType;
private double sharesOutstanding;
public String underlyer;
private long volatility;
private int pid;
public static int cnt = 0;
public int portfolioId = 0;
/* public no-arg constructor required for DataSerializable */
public Position() {}
public Position(String id, double out) {
secId = id;
secIdIndexed = secId;
sharesOutstanding = out;
secType = "a";
pid = cnt++;
this.mktValue = cnt;
}
public boolean equals(Object o) {
if (!(o instanceof Position)) return false;
return this.secId.equals(((Position)o).secId);
}
public int hashCode() {
return this.secId.hashCode();
}
public static void resetCounter() {
cnt = 0;
}
public double getMktValue() {
return this.mktValue;
}
public String getSecId(){
return secId;
}
public int getId(){
return pid;
}
public double getSharesOutstanding(){
return sharesOutstanding;
}
public String toString(){
return "Position [secId=" + this.secId + " out=" + this.sharesOutstanding
+ " type=" + this.secType + " id=" + this.pid + " mktValue="
+ this.mktValue + "]";
}
public Set getSet(int size){
Set set = new HashSet();
for(int i=0;i