Back to project page PowerGridCompanion.
The source code is released under:
Apache License
If you think the Android project PowerGridCompanion listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mintcode.kris.powergridhelper.Models; //w w w. j av a 2 s .com import android.os.Parcel; import android.os.Parcelable; /** * Created by kris on 6/29/14. */ public class Player implements Parcelable{ public String name; public int color; public int order; public int cities_owned; public int cities_powering; public int largest_power_plant = 0; public int money; public int coal; public int oil; public int garbage; public int uranium; public Player(String n, int c){ name = n; color = c; cities_owned = 0; cities_powering = 0; money = 50; coal = 0; oil = 0; garbage = 0; uranium = 0; order = (int)(Math.random() * 50); largest_power_plant = 0; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(name); dest.writeInt(color); dest.writeInt(order); dest.writeInt(cities_owned); dest.writeInt(cities_powering); dest.writeInt(largest_power_plant); dest.writeInt(money); dest.writeInt(coal); dest.writeInt(oil); dest.writeInt(garbage); dest.writeInt(uranium); } public Player(Parcel in){ name = in.readString(); color = in.readInt(); order = in.readInt(); cities_owned = in.readInt(); cities_powering = in.readInt(); largest_power_plant = in.readInt(); money = in.readInt(); coal = in.readInt(); oil = in.readInt(); garbage = in.readInt(); uranium = in.readInt(); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public Player createFromParcel(Parcel in){ return new Player(in); } public Player[] newArray(int size) { return new Player[size]; } }; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getColor() { return color; } public void setColor(int color) { this.color = color; } public int getOrder() { return order; } public void setOrder(int order) { this.order = order; } public int getCities_owned() { return cities_owned; } public void setCities_owned(int cities_owned) { this.cities_owned = cities_owned; } public int getCities_powering() { return cities_powering; } public void setCities_powering(int cities_powering) { this.cities_powering = cities_powering; } public int getLargest_power_plant() { return largest_power_plant; } public void setLargest_power_plant(int largest_power_plant) { this.largest_power_plant = largest_power_plant; } public int getMoney() { return money; } public void setMoney(int money) { this.money = money; } public int getCoal() { return coal; } public void setCoal(int coal) { this.coal = coal; } public int getOil() { return oil; } public void setOil(int oil) { this.oil = oil; } public int getGarbage() { return garbage; } public void setGarbage(int garbage) { this.garbage = garbage; } public int getUranium() { return uranium; } public void setUranium(int uranium) { this.uranium = uranium; } }