repo_name stringlengths 5 108 | path stringlengths 6 333 | size stringlengths 1 6 | content stringlengths 4 977k | license stringclasses 15 values |
|---|---|---|---|---|
github/codeql | java/ql/test/stubs/apache-commons-collections4-4.4/org/apache/commons/collections4/set/MapBackedSet.java | 1495 | // Generated automatically from org.apache.commons.collections4.set.MapBackedSet for testing purposes
package org.apache.commons.collections4.set;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
public class MapBackedSet<E, V> implements Serializable, Set<E>
{
protected MapBackedSet() {}
public <T> T[] toArray(T[] p0){ return null; }
public Iterator<E> iterator(){ return null; }
public Object[] toArray(){ return null; }
public boolean add(E p0){ return false; }
public boolean addAll(Collection<? extends E> p0){ return false; }
public boolean contains(Object p0){ return false; }
public boolean containsAll(Collection<? extends Object> p0){ return false; }
public boolean equals(Object p0){ return false; }
public boolean isEmpty(){ return false; }
public boolean remove(Object p0){ return false; }
public boolean removeAll(Collection<? extends Object> p0){ return false; }
public boolean removeIf(Predicate<? super E> p0){ return false; }
public boolean retainAll(Collection<? extends Object> p0){ return false; }
public int hashCode(){ return 0; }
public int size(){ return 0; }
public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> p0){ return null; }
public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> p0, V p1){ return null; }
public void clear(){}
}
| mit |
jakobehmsen/dynamake | eclipse/src/dynamake/dragndrop/ViewDragDropPopupBuilder.java | 4731 | package dynamake.dragndrop;
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JPopupMenu;
import dynamake.commands.CommandSequence;
import dynamake.commands.ReversibleCommandPair;
import dynamake.commands.SetPropertyCommandFromScope;
import dynamake.commands.TriStatePURCommand;
import dynamake.menubuilders.ActionRunner;
import dynamake.menubuilders.CompositeMenuBuilder;
import dynamake.models.Model;
import dynamake.models.ModelComponent;
import dynamake.models.LiveModel.LivePanel;
import dynamake.tools.InteractionPresenter;
import dynamake.transcription.Collector;
import dynamake.transcription.Connection;
import dynamake.transcription.Trigger;
public class ViewDragDropPopupBuilder implements DragDropPopupBuilder {
private Connection<Model> connection;
private InteractionPresenter interactionPresenter;
public ViewDragDropPopupBuilder(Connection<Model> connection, InteractionPresenter interactionPresenter) {
this.connection = connection;
this.interactionPresenter = interactionPresenter;
}
@Override
public void buildFromSelectionAndTarget(final ModelComponent livePanel,
JPopupMenu popup, final ModelComponent selection,
final ModelComponent target, final Point dropPointOnTarget, final Rectangle dropBoundsOnTarget) {
ActionRunner runner = new ActionRunner() {
@Override
public void run(final Object action) {
connection.trigger(new Trigger<Model>() {
@SuppressWarnings("unchecked")
@Override
public void run(Collector<Model> collector) {
interactionPresenter.reset(collector);
((Trigger<Model>)action).run(collector);
collector.commitTransaction();
}
});
}
};
CompositeMenuBuilder transactionTargetContentMapBuilder = new CompositeMenuBuilder();
transactionTargetContentMapBuilder.addMenuBuilder("Appliance", new Trigger<Model>() {
@Override
public void run(Collector<Model> collector) {
// Integer currentView = (Integer)selection.getModelBehind().getProperty(Model.PROPERTY_VIEW);
// if(currentView == null)
// currentView = Model.VIEW_APPLIANCE;
// PendingCommandFactory.Util.executeSingle(collector, new PendingCommandState<Model>(
// new SetPropertyCommand(Model.PROPERTY_VIEW, Model.VIEW_APPLIANCE),
// new SetPropertyCommand(Model.PROPERTY_VIEW, currentView)
// ));
collector.execute(new TriStatePURCommand<Model>(
new CommandSequence<Model>(
collector.createProduceCommand(Model.PROPERTY_VIEW),
collector.createProduceCommand(Model.VIEW_APPLIANCE),
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()) // Outputs name of changed property and the previous value
),
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()), // Outputs name of changed property and the previous value
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()) // Outputs name of changed property and the previous value
));
}
});
transactionTargetContentMapBuilder.addMenuBuilder("Engineering", new Trigger<Model>() {
@Override
public void run(Collector<Model> collector) {
// Integer currentView = (Integer)selection.getModelBehind().getProperty(Model.PROPERTY_VIEW);
// if(currentView == null)
// currentView = Model.VIEW_APPLIANCE;
// PendingCommandFactory.Util.executeSingle(collector, new PendingCommandState<Model>(
// new SetPropertyCommand(Model.PROPERTY_VIEW, Model.VIEW_ENGINEERING),
// new SetPropertyCommand(Model.PROPERTY_VIEW, currentView)
// ));
collector.execute(new TriStatePURCommand<Model>(
new CommandSequence<Model>(
collector.createProduceCommand(Model.PROPERTY_VIEW),
collector.createProduceCommand(Model.VIEW_ENGINEERING),
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()) // Outputs name of changed property and the previous value
),
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()), // Outputs name of changed property and the previous value
new ReversibleCommandPair<Model>(new SetPropertyCommandFromScope(), new SetPropertyCommandFromScope()) // Outputs name of changed property and the previous value
));
}
});
transactionTargetContentMapBuilder.appendTo(popup, runner, "Selection to target");
}
@Override
public void cancelPopup(LivePanel livePanel) {
connection.trigger(new Trigger<Model>() {
public void run(Collector<Model> collector) {
interactionPresenter.reset(collector);
collector.rejectTransaction();
}
});
}
}
| mit |
DeckerCHAN/COMP6700_Java_Programming | src/main/java/com/decker/javaProgramming/assignment/ass1/operations/ListingOperation.java | 2093 | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Derek.CHAN
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.decker.javaProgramming.assignment.ass1.operations;
import com.decker.javaProgramming.assignment.ass1.CategoriesManager;
import static java.lang.System.out;
public class ListingOperation implements Operation {
public ListingOperation(CategoriesManager categoriesManager) {
this.categoriesManager = categoriesManager;
}
private CategoriesManager categoriesManager;
public void execute() {
if (categoriesManager.getCategories().keySet().size() > 0) {
out.println("these are available categories:");
categoriesManager.getCategories().keySet().forEach(out::println);
} else {
out.println("no category found.");
}
}
public CategoriesManager getCategoriesManager() {
return categoriesManager;
}
public void setCategoriesManager(CategoriesManager categoriesManager) {
this.categoriesManager = categoriesManager;
}
}
| mit |
jkozlowski/transferoo | src/main/java/io/transferoo/api/HasUniqueId.java | 1322 | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Jakub Dominik Kozlowski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package io.transferoo.api;
import com.fasterxml.jackson.annotation.JsonProperty;
public interface HasUniqueId<T> {
@JsonProperty("id")
UniqueId<T> id();
}
| mit |
mrtowel/routedrawer_android | src/pl/towelrail/locate/receivers/GpsStatusReceiver.java | 1917 | package pl.towelrail.locate.receivers;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.LocationManager;
import android.provider.Settings;
import android.widget.Toast;
import pl.towelrail.locate.R;
public class GpsStatusReceiver extends BroadcastReceiver {
private LocationManager mLocationManager;
public GpsStatusReceiver(LocationManager mLocationManager) {
this.mLocationManager = mLocationManager;
}
@Override
public void onReceive(Context context, Intent intent) {
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
AlertDialog gpsDialog = createGpsSettingsDialog(context);
gpsDialog.show();
}
}
private AlertDialog createGpsSettingsDialog(final Context ctx) {
DialogInterface.OnClickListener mGpsPositiveListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ctx.startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
};
DialogInterface.OnClickListener mGpsNegativeListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(ctx, "Your choice anyway...", Toast.LENGTH_SHORT).show();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(ctx)
.setTitle(R.string.gps_dialog_title)
.setMessage(R.string.turn_on_gps)
.setPositiveButton(R.string.gps_settings, mGpsPositiveListener)
.setNegativeButton(R.string.cancel, mGpsNegativeListener);
return builder.create();
}
}
| mit |
GiovanniSM20/Java | src/Laços/src/Exerciciosequencia/Exercicio17.java | 249 | package Exerciciosequencia;
public class Exercicio17 {
public static void main(String[] args) {
int i,x;
i = 0;
do{
x = i*5;
System.out.println("Multiplos de 5, entre o e 50 são: " + x);
i = i+1;
}while(i<=10);
}
}
| mit |
csongradyp/BadgeR | badger.bdd/src/main/java/net/csongradyp/bdd/steps/DateAchievementUnlockedSteps.java | 852 | package net.csongradyp.bdd.steps;
import javax.inject.Inject;
import net.csongradyp.badger.provider.unlock.provider.DateUnlockedProvider;
import net.csongradyp.bdd.Steps;
import net.csongradyp.bdd.provider.TestDateProvider;
import org.jbehave.core.annotations.Given;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@Steps
public class DateAchievementUnlockedSteps {
@Inject
private DateUnlockedProvider dateUnlockedProvider;
@Inject
private TestDateProvider dateProvider;
@Given("the current date is $date")
public void setCurrentDate(final String date) {
dateProvider.stubDate(date);
assertThat(dateProvider.currentDateString(), is(equalTo(date)));
dateUnlockedProvider.setDateProvider(dateProvider);
}
}
| mit |
PizzaCrust/Roblox4j | src/main/java/online/pizzacrust/roblox/impl/BasicGroup.java | 8071 | package online.pizzacrust.roblox.impl;
import com.google.gson.Gson;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import online.pizzacrust.roblox.Robloxian;
import online.pizzacrust.roblox.group.Group;
import online.pizzacrust.roblox.group.Roleset;
public class BasicGroup implements Group{
private final int groupId;
public BasicGroup(int groupId) {
this.groupId = groupId;
}
public static class RolesetData {
public int Id;
public String Name;
public int Rank;
}
@Override
public List<Roleset> getRolesets() throws Exception {
List<Roleset> rolesets = new ArrayList<>();
String url = "https://www.roblox.com/api/groups/" + groupId + "/RoleSets/";
RolesetData[] data = new Gson().fromJson(Jsoup.connect(url).ignoreContentType(true).get()
.body().text(), RolesetData[].class);
for (RolesetData datum : data) {
rolesets.add(new BasicRoleset(datum.Rank, datum.Id, datum.Name));
}
return rolesets;
}
public static class NameData {
public String Name;
}
@Override
public String getName() throws Exception {
String url = "https://api.roblox.com/groups/" + groupId;
NameData data = new Gson().fromJson(Jsoup.connect(url).ignoreContentType(true).get().body
().text(), NameData.class);
return data.Name;
}
private Robloxian.LightReference[] recursiveRetrieve(Roleset roleset, String cursor) throws IOException {
String url = "https://groups.roblox" +
".com/v1/groups/" + groupId + "/roles/" + roleset.getId() +
"/users?sortOrder=Asc&limit=100&cursor=" + cursor;
PlayersData data = new Gson().fromJson(Jsoup.connect(url).ignoreContentType(true).get()
.body().text(), PlayersData.class);
List<Robloxian.LightReference> references = new ArrayList<>();
for (PlayersData.PlayerData datum : data.data) {
references.add(new BasicReference(datum.userId, datum.username));
}
if (data.nextPageCursor != null) {
Collections.addAll(references, recursiveRetrieve(roleset, data.nextPageCursor));
}
return references.toArray(new Robloxian.LightReference[references.size()]);
}
@Override
public Robloxian.LightReference[] getMembersInRole(Roleset roleset) throws Exception {
String url = "https://groups.roblox" +
".com/v1/groups/" + groupId + "/roles/" + roleset.getId() +
"/users?sortOrder=Asc&limit=100";
PlayersData data = new Gson().fromJson(Jsoup.connect(url).ignoreContentType(true).get()
.body().text(), PlayersData.class);
List<Robloxian.LightReference> references = new ArrayList<>();
for (PlayersData.PlayerData datum : data.data) {
references.add(new BasicReference(datum.userId, datum.username));
}
if (data.nextPageCursor != null) {
Collections.addAll(references, recursiveRetrieve(roleset, data.nextPageCursor));
}
return references.toArray(new Robloxian.LightReference[references.size()]);
}
@Override
public Optional<Roleset> getRole(Robloxian robloxian) throws Exception {
String url = "https://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx" +
"?method=GetGroupRank" +
"&playerid=" + robloxian.getUserId() +
"&groupid=" + this.groupId;
int rankIndex = Integer.parseInt(Jsoup.connect(url).ignoreContentType(true).get().body()
.text());
List<Roleset> rolesets = getRolesets();
for (Roleset roleset : rolesets) {
if (roleset.getRankIndex() == rankIndex) {
return Optional.of(roleset);
}
}
return Optional.empty();
}
@Override
public int getId() {
return groupId;
}
private String index(int i) {
String iS = "" + i;
if (iS.toCharArray().length == 1) {
return "0" + iS;
}
return iS;
}
// __eventtarget, scriptmanager, eventvalidation, viewstate, viewstategenerator
private Map<String, String> getRequiredFormData(int nextIndex,
Document currentPage) {
HashMap<String, String> formDataMap = new HashMap<>();
formDataMap.put("ctl00$ScriptManager",
"ctl00$cphRoblox$rbxGroupAlliesPane$RelationshipsUpdatePanel" +
"|ctl00$cphRoblox$rbxGroupAlliesPane$RelationshipsDataPager$ctl00$ctl" + index
(nextIndex));
formDataMap.put("__EVENTTARGET",
"ctl00$cphRoblox$rbxGroupAlliesPane$RelationshipsDataPager$ctl00$ctl" + index(nextIndex));
formDataMap.put("__EVENTVALIDATION", currentPage.getElementById("__EVENTVALIDATION").attr
("value"));
formDataMap.put("__VIEWSTATEGENERATOR", currentPage.getElementById
("__VIEWSTATEGENERATOR").attr("value"));
formDataMap.put("__VIEWSTATE", currentPage.getElementById("__VIEWSTATE").attr("value"));
return formDataMap;
}
private boolean moreAllyPages(Document document) {
Element root = document.getElementById
("ctl00_cphRoblox_rbxGroupAlliesPane_RelationshipsDataPager");
for (Element a : root.getElementsByTag("a")) {
if (a.text().equalsIgnoreCase("Next")) {
if (!a.hasAttr("disabled")) {
return true;
}
break;
}
}
return false;
}
private List<Group> parsePage(Document document) {
Element root = document.getElementsByClass("grouprelationshipscontainer").first();
List<Group> groups = new ArrayList<>();
for (Element div : root.getElementsByTag("div")) {
if (div.attr("style").equalsIgnoreCase("width:42px;height:42px;padding:8px;" +
"float:left")) {
groups.add(new BasicGroup(Integer.parseInt(div.getElementsByTag("a").first().attr
("href").split
("=")[1])));
}
}
return groups;
}
private List<Group> recursiveGetAllies(int nIndex, Document prevPage) throws IOException {
Map<String, String> form = getRequiredFormData(nIndex, prevPage);
String url = "https://www.roblox.com/Groups/Group.aspx?gid=" + groupId;
Document document = Jsoup.connect(url).data(form).post();
List<Group> groups = new ArrayList<>(parsePage(document));
if (moreAllyPages(document)) {
groups.addAll(recursiveGetAllies(nIndex + 1, document));
}
return groups;
}
@Override
public List<Group> getAllies() throws Exception {
String url = "https://www.roblox.com/Groups/Group.aspx?gid=" + groupId;
Document document = Jsoup.connect(url).get();
List<Group> groups = new ArrayList<>(parsePage(document));
if (moreAllyPages(document)) {
// recursive method
groups.addAll(recursiveGetAllies(1, document));
}
return groups;
}
public static void main(String... args) throws Exception {
BasicGroup basicGroup = new BasicGroup(2900057);
for (Group group : basicGroup.getAllies()) {
System.out.println(group.getName() + "#" + group.getId()
);
}
System.out.println("Total: " + basicGroup.getAllies().size());
}
public static class PlayersData {
public static class PlayerData {
public int userId;
public String username;
}
public String nextPageCursor;
public PlayerData[] data;
}
}
| mit |
Dario95/Proyecto-M-viles | AppDomotica/app/src/main/java/com/example/homero/appdomotica/Habitacion1.java | 3234 | package com.example.homero.appdomotica;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import android.widget.ToggleButton;
import java.util.Random;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link Habitacion1.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link Habitacion1#newInstance} factory method to
* create an instance of this fragment.
*/
public class Habitacion1 extends Fragment {
private ToggleButton luz;
private ToggleButton ventilador;
private ToggleButton tv;
Boolean datosBackend[] = new Boolean[4];
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View vista = inflater.inflate(R.layout.fragment_habitacion1, container, false);
obtenerDatosBackend();
luz = (ToggleButton)vista.findViewById(R.id.tglHab1Luz);
luz.setChecked(datosBackend[0]);
ventilador = (ToggleButton)vista.findViewById(R.id.tglHab1Ventilador);
ventilador.setChecked(datosBackend[1]);
tv = (ToggleButton)vista.findViewById(R.id.tglHab1Tv);
tv.setChecked(datosBackend[2]);
luz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(datosBackend[0]){
Toast.makeText(vista.getContext(),"Luz 1 "+luz.getText(),Toast.LENGTH_LONG).show();
}else{
Toast.makeText(vista.getContext(),"Luz 1 "+luz.getText(),Toast.LENGTH_LONG).show();
}
datosBackend[0]=!datosBackend[0];
}
});
ventilador.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(datosBackend[1]){
Toast.makeText(vista.getContext(),"Ventilador "+ventilador.getText(),Toast.LENGTH_LONG).show();
}else{
Toast.makeText(vista.getContext(),"Ventilador "+ventilador.getText(),Toast.LENGTH_LONG).show();
}
datosBackend[1]=!datosBackend[1];
}
});
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(datosBackend[2]){
Toast.makeText(vista.getContext(),"Tv "+tv.getText(),Toast.LENGTH_LONG).show();
}else{
Toast.makeText(vista.getContext(),"Tv "+tv.getText(),Toast.LENGTH_LONG).show();
}
datosBackend[2]=!datosBackend[2];
}
});
return vista;
}
void obtenerDatosBackend(){
Random rnd = new Random();
datosBackend[0] = rnd.nextBoolean();
datosBackend[1] = rnd.nextBoolean();
datosBackend[2] = rnd.nextBoolean();
}
}
| mit |
arnaudroger/orm-benchmark | src/main/java/org/sfm/beans/GS896.java | 111498 | package org.sfm.beans;
public class GS896 {
private String val0;
private int val1;
private long val2;
private String val3;
private int val4;
private long val5;
private String val6;
private int val7;
private long val8;
private String val9;
private int val10;
private long val11;
private String val12;
private int val13;
private long val14;
private String val15;
private int val16;
private long val17;
private String val18;
private int val19;
private long val20;
private String val21;
private int val22;
private long val23;
private String val24;
private int val25;
private long val26;
private String val27;
private int val28;
private long val29;
private String val30;
private int val31;
private long val32;
private String val33;
private int val34;
private long val35;
private String val36;
private int val37;
private long val38;
private String val39;
private int val40;
private long val41;
private String val42;
private int val43;
private long val44;
private String val45;
private int val46;
private long val47;
private String val48;
private int val49;
private long val50;
private String val51;
private int val52;
private long val53;
private String val54;
private int val55;
private long val56;
private String val57;
private int val58;
private long val59;
private String val60;
private int val61;
private long val62;
private String val63;
private int val64;
private long val65;
private String val66;
private int val67;
private long val68;
private String val69;
private int val70;
private long val71;
private String val72;
private int val73;
private long val74;
private String val75;
private int val76;
private long val77;
private String val78;
private int val79;
private long val80;
private String val81;
private int val82;
private long val83;
private String val84;
private int val85;
private long val86;
private String val87;
private int val88;
private long val89;
private String val90;
private int val91;
private long val92;
private String val93;
private int val94;
private long val95;
private String val96;
private int val97;
private long val98;
private String val99;
private int val100;
private long val101;
private String val102;
private int val103;
private long val104;
private String val105;
private int val106;
private long val107;
private String val108;
private int val109;
private long val110;
private String val111;
private int val112;
private long val113;
private String val114;
private int val115;
private long val116;
private String val117;
private int val118;
private long val119;
private String val120;
private int val121;
private long val122;
private String val123;
private int val124;
private long val125;
private String val126;
private int val127;
private long val128;
private String val129;
private int val130;
private long val131;
private String val132;
private int val133;
private long val134;
private String val135;
private int val136;
private long val137;
private String val138;
private int val139;
private long val140;
private String val141;
private int val142;
private long val143;
private String val144;
private int val145;
private long val146;
private String val147;
private int val148;
private long val149;
private String val150;
private int val151;
private long val152;
private String val153;
private int val154;
private long val155;
private String val156;
private int val157;
private long val158;
private String val159;
private int val160;
private long val161;
private String val162;
private int val163;
private long val164;
private String val165;
private int val166;
private long val167;
private String val168;
private int val169;
private long val170;
private String val171;
private int val172;
private long val173;
private String val174;
private int val175;
private long val176;
private String val177;
private int val178;
private long val179;
private String val180;
private int val181;
private long val182;
private String val183;
private int val184;
private long val185;
private String val186;
private int val187;
private long val188;
private String val189;
private int val190;
private long val191;
private String val192;
private int val193;
private long val194;
private String val195;
private int val196;
private long val197;
private String val198;
private int val199;
private long val200;
private String val201;
private int val202;
private long val203;
private String val204;
private int val205;
private long val206;
private String val207;
private int val208;
private long val209;
private String val210;
private int val211;
private long val212;
private String val213;
private int val214;
private long val215;
private String val216;
private int val217;
private long val218;
private String val219;
private int val220;
private long val221;
private String val222;
private int val223;
private long val224;
private String val225;
private int val226;
private long val227;
private String val228;
private int val229;
private long val230;
private String val231;
private int val232;
private long val233;
private String val234;
private int val235;
private long val236;
private String val237;
private int val238;
private long val239;
private String val240;
private int val241;
private long val242;
private String val243;
private int val244;
private long val245;
private String val246;
private int val247;
private long val248;
private String val249;
private int val250;
private long val251;
private String val252;
private int val253;
private long val254;
private String val255;
private int val256;
private long val257;
private String val258;
private int val259;
private long val260;
private String val261;
private int val262;
private long val263;
private String val264;
private int val265;
private long val266;
private String val267;
private int val268;
private long val269;
private String val270;
private int val271;
private long val272;
private String val273;
private int val274;
private long val275;
private String val276;
private int val277;
private long val278;
private String val279;
private int val280;
private long val281;
private String val282;
private int val283;
private long val284;
private String val285;
private int val286;
private long val287;
private String val288;
private int val289;
private long val290;
private String val291;
private int val292;
private long val293;
private String val294;
private int val295;
private long val296;
private String val297;
private int val298;
private long val299;
private String val300;
private int val301;
private long val302;
private String val303;
private int val304;
private long val305;
private String val306;
private int val307;
private long val308;
private String val309;
private int val310;
private long val311;
private String val312;
private int val313;
private long val314;
private String val315;
private int val316;
private long val317;
private String val318;
private int val319;
private long val320;
private String val321;
private int val322;
private long val323;
private String val324;
private int val325;
private long val326;
private String val327;
private int val328;
private long val329;
private String val330;
private int val331;
private long val332;
private String val333;
private int val334;
private long val335;
private String val336;
private int val337;
private long val338;
private String val339;
private int val340;
private long val341;
private String val342;
private int val343;
private long val344;
private String val345;
private int val346;
private long val347;
private String val348;
private int val349;
private long val350;
private String val351;
private int val352;
private long val353;
private String val354;
private int val355;
private long val356;
private String val357;
private int val358;
private long val359;
private String val360;
private int val361;
private long val362;
private String val363;
private int val364;
private long val365;
private String val366;
private int val367;
private long val368;
private String val369;
private int val370;
private long val371;
private String val372;
private int val373;
private long val374;
private String val375;
private int val376;
private long val377;
private String val378;
private int val379;
private long val380;
private String val381;
private int val382;
private long val383;
private String val384;
private int val385;
private long val386;
private String val387;
private int val388;
private long val389;
private String val390;
private int val391;
private long val392;
private String val393;
private int val394;
private long val395;
private String val396;
private int val397;
private long val398;
private String val399;
private int val400;
private long val401;
private String val402;
private int val403;
private long val404;
private String val405;
private int val406;
private long val407;
private String val408;
private int val409;
private long val410;
private String val411;
private int val412;
private long val413;
private String val414;
private int val415;
private long val416;
private String val417;
private int val418;
private long val419;
private String val420;
private int val421;
private long val422;
private String val423;
private int val424;
private long val425;
private String val426;
private int val427;
private long val428;
private String val429;
private int val430;
private long val431;
private String val432;
private int val433;
private long val434;
private String val435;
private int val436;
private long val437;
private String val438;
private int val439;
private long val440;
private String val441;
private int val442;
private long val443;
private String val444;
private int val445;
private long val446;
private String val447;
private int val448;
private long val449;
private String val450;
private int val451;
private long val452;
private String val453;
private int val454;
private long val455;
private String val456;
private int val457;
private long val458;
private String val459;
private int val460;
private long val461;
private String val462;
private int val463;
private long val464;
private String val465;
private int val466;
private long val467;
private String val468;
private int val469;
private long val470;
private String val471;
private int val472;
private long val473;
private String val474;
private int val475;
private long val476;
private String val477;
private int val478;
private long val479;
private String val480;
private int val481;
private long val482;
private String val483;
private int val484;
private long val485;
private String val486;
private int val487;
private long val488;
private String val489;
private int val490;
private long val491;
private String val492;
private int val493;
private long val494;
private String val495;
private int val496;
private long val497;
private String val498;
private int val499;
private long val500;
private String val501;
private int val502;
private long val503;
private String val504;
private int val505;
private long val506;
private String val507;
private int val508;
private long val509;
private String val510;
private int val511;
private long val512;
private String val513;
private int val514;
private long val515;
private String val516;
private int val517;
private long val518;
private String val519;
private int val520;
private long val521;
private String val522;
private int val523;
private long val524;
private String val525;
private int val526;
private long val527;
private String val528;
private int val529;
private long val530;
private String val531;
private int val532;
private long val533;
private String val534;
private int val535;
private long val536;
private String val537;
private int val538;
private long val539;
private String val540;
private int val541;
private long val542;
private String val543;
private int val544;
private long val545;
private String val546;
private int val547;
private long val548;
private String val549;
private int val550;
private long val551;
private String val552;
private int val553;
private long val554;
private String val555;
private int val556;
private long val557;
private String val558;
private int val559;
private long val560;
private String val561;
private int val562;
private long val563;
private String val564;
private int val565;
private long val566;
private String val567;
private int val568;
private long val569;
private String val570;
private int val571;
private long val572;
private String val573;
private int val574;
private long val575;
private String val576;
private int val577;
private long val578;
private String val579;
private int val580;
private long val581;
private String val582;
private int val583;
private long val584;
private String val585;
private int val586;
private long val587;
private String val588;
private int val589;
private long val590;
private String val591;
private int val592;
private long val593;
private String val594;
private int val595;
private long val596;
private String val597;
private int val598;
private long val599;
private String val600;
private int val601;
private long val602;
private String val603;
private int val604;
private long val605;
private String val606;
private int val607;
private long val608;
private String val609;
private int val610;
private long val611;
private String val612;
private int val613;
private long val614;
private String val615;
private int val616;
private long val617;
private String val618;
private int val619;
private long val620;
private String val621;
private int val622;
private long val623;
private String val624;
private int val625;
private long val626;
private String val627;
private int val628;
private long val629;
private String val630;
private int val631;
private long val632;
private String val633;
private int val634;
private long val635;
private String val636;
private int val637;
private long val638;
private String val639;
private int val640;
private long val641;
private String val642;
private int val643;
private long val644;
private String val645;
private int val646;
private long val647;
private String val648;
private int val649;
private long val650;
private String val651;
private int val652;
private long val653;
private String val654;
private int val655;
private long val656;
private String val657;
private int val658;
private long val659;
private String val660;
private int val661;
private long val662;
private String val663;
private int val664;
private long val665;
private String val666;
private int val667;
private long val668;
private String val669;
private int val670;
private long val671;
private String val672;
private int val673;
private long val674;
private String val675;
private int val676;
private long val677;
private String val678;
private int val679;
private long val680;
private String val681;
private int val682;
private long val683;
private String val684;
private int val685;
private long val686;
private String val687;
private int val688;
private long val689;
private String val690;
private int val691;
private long val692;
private String val693;
private int val694;
private long val695;
private String val696;
private int val697;
private long val698;
private String val699;
private int val700;
private long val701;
private String val702;
private int val703;
private long val704;
private String val705;
private int val706;
private long val707;
private String val708;
private int val709;
private long val710;
private String val711;
private int val712;
private long val713;
private String val714;
private int val715;
private long val716;
private String val717;
private int val718;
private long val719;
private String val720;
private int val721;
private long val722;
private String val723;
private int val724;
private long val725;
private String val726;
private int val727;
private long val728;
private String val729;
private int val730;
private long val731;
private String val732;
private int val733;
private long val734;
private String val735;
private int val736;
private long val737;
private String val738;
private int val739;
private long val740;
private String val741;
private int val742;
private long val743;
private String val744;
private int val745;
private long val746;
private String val747;
private int val748;
private long val749;
private String val750;
private int val751;
private long val752;
private String val753;
private int val754;
private long val755;
private String val756;
private int val757;
private long val758;
private String val759;
private int val760;
private long val761;
private String val762;
private int val763;
private long val764;
private String val765;
private int val766;
private long val767;
private String val768;
private int val769;
private long val770;
private String val771;
private int val772;
private long val773;
private String val774;
private int val775;
private long val776;
private String val777;
private int val778;
private long val779;
private String val780;
private int val781;
private long val782;
private String val783;
private int val784;
private long val785;
private String val786;
private int val787;
private long val788;
private String val789;
private int val790;
private long val791;
private String val792;
private int val793;
private long val794;
private String val795;
private int val796;
private long val797;
private String val798;
private int val799;
private long val800;
private String val801;
private int val802;
private long val803;
private String val804;
private int val805;
private long val806;
private String val807;
private int val808;
private long val809;
private String val810;
private int val811;
private long val812;
private String val813;
private int val814;
private long val815;
private String val816;
private int val817;
private long val818;
private String val819;
private int val820;
private long val821;
private String val822;
private int val823;
private long val824;
private String val825;
private int val826;
private long val827;
private String val828;
private int val829;
private long val830;
private String val831;
private int val832;
private long val833;
private String val834;
private int val835;
private long val836;
private String val837;
private int val838;
private long val839;
private String val840;
private int val841;
private long val842;
private String val843;
private int val844;
private long val845;
private String val846;
private int val847;
private long val848;
private String val849;
private int val850;
private long val851;
private String val852;
private int val853;
private long val854;
private String val855;
private int val856;
private long val857;
private String val858;
private int val859;
private long val860;
private String val861;
private int val862;
private long val863;
private String val864;
private int val865;
private long val866;
private String val867;
private int val868;
private long val869;
private String val870;
private int val871;
private long val872;
private String val873;
private int val874;
private long val875;
private String val876;
private int val877;
private long val878;
private String val879;
private int val880;
private long val881;
private String val882;
private int val883;
private long val884;
private String val885;
private int val886;
private long val887;
private String val888;
private int val889;
private long val890;
private String val891;
private int val892;
private long val893;
private String val894;
private int val895;
public String getVal0() {
return val0;
}
public void setVal0(String v) {
this.val0 = v;
}
public int getVal1() {
return val1;
}
public void setVal1(int v) {
this.val1 = v;
}
public long getVal2() {
return val2;
}
public void setVal2(long v) {
this.val2 = v;
}
public String getVal3() {
return val3;
}
public void setVal3(String v) {
this.val3 = v;
}
public int getVal4() {
return val4;
}
public void setVal4(int v) {
this.val4 = v;
}
public long getVal5() {
return val5;
}
public void setVal5(long v) {
this.val5 = v;
}
public String getVal6() {
return val6;
}
public void setVal6(String v) {
this.val6 = v;
}
public int getVal7() {
return val7;
}
public void setVal7(int v) {
this.val7 = v;
}
public long getVal8() {
return val8;
}
public void setVal8(long v) {
this.val8 = v;
}
public String getVal9() {
return val9;
}
public void setVal9(String v) {
this.val9 = v;
}
public int getVal10() {
return val10;
}
public void setVal10(int v) {
this.val10 = v;
}
public long getVal11() {
return val11;
}
public void setVal11(long v) {
this.val11 = v;
}
public String getVal12() {
return val12;
}
public void setVal12(String v) {
this.val12 = v;
}
public int getVal13() {
return val13;
}
public void setVal13(int v) {
this.val13 = v;
}
public long getVal14() {
return val14;
}
public void setVal14(long v) {
this.val14 = v;
}
public String getVal15() {
return val15;
}
public void setVal15(String v) {
this.val15 = v;
}
public int getVal16() {
return val16;
}
public void setVal16(int v) {
this.val16 = v;
}
public long getVal17() {
return val17;
}
public void setVal17(long v) {
this.val17 = v;
}
public String getVal18() {
return val18;
}
public void setVal18(String v) {
this.val18 = v;
}
public int getVal19() {
return val19;
}
public void setVal19(int v) {
this.val19 = v;
}
public long getVal20() {
return val20;
}
public void setVal20(long v) {
this.val20 = v;
}
public String getVal21() {
return val21;
}
public void setVal21(String v) {
this.val21 = v;
}
public int getVal22() {
return val22;
}
public void setVal22(int v) {
this.val22 = v;
}
public long getVal23() {
return val23;
}
public void setVal23(long v) {
this.val23 = v;
}
public String getVal24() {
return val24;
}
public void setVal24(String v) {
this.val24 = v;
}
public int getVal25() {
return val25;
}
public void setVal25(int v) {
this.val25 = v;
}
public long getVal26() {
return val26;
}
public void setVal26(long v) {
this.val26 = v;
}
public String getVal27() {
return val27;
}
public void setVal27(String v) {
this.val27 = v;
}
public int getVal28() {
return val28;
}
public void setVal28(int v) {
this.val28 = v;
}
public long getVal29() {
return val29;
}
public void setVal29(long v) {
this.val29 = v;
}
public String getVal30() {
return val30;
}
public void setVal30(String v) {
this.val30 = v;
}
public int getVal31() {
return val31;
}
public void setVal31(int v) {
this.val31 = v;
}
public long getVal32() {
return val32;
}
public void setVal32(long v) {
this.val32 = v;
}
public String getVal33() {
return val33;
}
public void setVal33(String v) {
this.val33 = v;
}
public int getVal34() {
return val34;
}
public void setVal34(int v) {
this.val34 = v;
}
public long getVal35() {
return val35;
}
public void setVal35(long v) {
this.val35 = v;
}
public String getVal36() {
return val36;
}
public void setVal36(String v) {
this.val36 = v;
}
public int getVal37() {
return val37;
}
public void setVal37(int v) {
this.val37 = v;
}
public long getVal38() {
return val38;
}
public void setVal38(long v) {
this.val38 = v;
}
public String getVal39() {
return val39;
}
public void setVal39(String v) {
this.val39 = v;
}
public int getVal40() {
return val40;
}
public void setVal40(int v) {
this.val40 = v;
}
public long getVal41() {
return val41;
}
public void setVal41(long v) {
this.val41 = v;
}
public String getVal42() {
return val42;
}
public void setVal42(String v) {
this.val42 = v;
}
public int getVal43() {
return val43;
}
public void setVal43(int v) {
this.val43 = v;
}
public long getVal44() {
return val44;
}
public void setVal44(long v) {
this.val44 = v;
}
public String getVal45() {
return val45;
}
public void setVal45(String v) {
this.val45 = v;
}
public int getVal46() {
return val46;
}
public void setVal46(int v) {
this.val46 = v;
}
public long getVal47() {
return val47;
}
public void setVal47(long v) {
this.val47 = v;
}
public String getVal48() {
return val48;
}
public void setVal48(String v) {
this.val48 = v;
}
public int getVal49() {
return val49;
}
public void setVal49(int v) {
this.val49 = v;
}
public long getVal50() {
return val50;
}
public void setVal50(long v) {
this.val50 = v;
}
public String getVal51() {
return val51;
}
public void setVal51(String v) {
this.val51 = v;
}
public int getVal52() {
return val52;
}
public void setVal52(int v) {
this.val52 = v;
}
public long getVal53() {
return val53;
}
public void setVal53(long v) {
this.val53 = v;
}
public String getVal54() {
return val54;
}
public void setVal54(String v) {
this.val54 = v;
}
public int getVal55() {
return val55;
}
public void setVal55(int v) {
this.val55 = v;
}
public long getVal56() {
return val56;
}
public void setVal56(long v) {
this.val56 = v;
}
public String getVal57() {
return val57;
}
public void setVal57(String v) {
this.val57 = v;
}
public int getVal58() {
return val58;
}
public void setVal58(int v) {
this.val58 = v;
}
public long getVal59() {
return val59;
}
public void setVal59(long v) {
this.val59 = v;
}
public String getVal60() {
return val60;
}
public void setVal60(String v) {
this.val60 = v;
}
public int getVal61() {
return val61;
}
public void setVal61(int v) {
this.val61 = v;
}
public long getVal62() {
return val62;
}
public void setVal62(long v) {
this.val62 = v;
}
public String getVal63() {
return val63;
}
public void setVal63(String v) {
this.val63 = v;
}
public int getVal64() {
return val64;
}
public void setVal64(int v) {
this.val64 = v;
}
public long getVal65() {
return val65;
}
public void setVal65(long v) {
this.val65 = v;
}
public String getVal66() {
return val66;
}
public void setVal66(String v) {
this.val66 = v;
}
public int getVal67() {
return val67;
}
public void setVal67(int v) {
this.val67 = v;
}
public long getVal68() {
return val68;
}
public void setVal68(long v) {
this.val68 = v;
}
public String getVal69() {
return val69;
}
public void setVal69(String v) {
this.val69 = v;
}
public int getVal70() {
return val70;
}
public void setVal70(int v) {
this.val70 = v;
}
public long getVal71() {
return val71;
}
public void setVal71(long v) {
this.val71 = v;
}
public String getVal72() {
return val72;
}
public void setVal72(String v) {
this.val72 = v;
}
public int getVal73() {
return val73;
}
public void setVal73(int v) {
this.val73 = v;
}
public long getVal74() {
return val74;
}
public void setVal74(long v) {
this.val74 = v;
}
public String getVal75() {
return val75;
}
public void setVal75(String v) {
this.val75 = v;
}
public int getVal76() {
return val76;
}
public void setVal76(int v) {
this.val76 = v;
}
public long getVal77() {
return val77;
}
public void setVal77(long v) {
this.val77 = v;
}
public String getVal78() {
return val78;
}
public void setVal78(String v) {
this.val78 = v;
}
public int getVal79() {
return val79;
}
public void setVal79(int v) {
this.val79 = v;
}
public long getVal80() {
return val80;
}
public void setVal80(long v) {
this.val80 = v;
}
public String getVal81() {
return val81;
}
public void setVal81(String v) {
this.val81 = v;
}
public int getVal82() {
return val82;
}
public void setVal82(int v) {
this.val82 = v;
}
public long getVal83() {
return val83;
}
public void setVal83(long v) {
this.val83 = v;
}
public String getVal84() {
return val84;
}
public void setVal84(String v) {
this.val84 = v;
}
public int getVal85() {
return val85;
}
public void setVal85(int v) {
this.val85 = v;
}
public long getVal86() {
return val86;
}
public void setVal86(long v) {
this.val86 = v;
}
public String getVal87() {
return val87;
}
public void setVal87(String v) {
this.val87 = v;
}
public int getVal88() {
return val88;
}
public void setVal88(int v) {
this.val88 = v;
}
public long getVal89() {
return val89;
}
public void setVal89(long v) {
this.val89 = v;
}
public String getVal90() {
return val90;
}
public void setVal90(String v) {
this.val90 = v;
}
public int getVal91() {
return val91;
}
public void setVal91(int v) {
this.val91 = v;
}
public long getVal92() {
return val92;
}
public void setVal92(long v) {
this.val92 = v;
}
public String getVal93() {
return val93;
}
public void setVal93(String v) {
this.val93 = v;
}
public int getVal94() {
return val94;
}
public void setVal94(int v) {
this.val94 = v;
}
public long getVal95() {
return val95;
}
public void setVal95(long v) {
this.val95 = v;
}
public String getVal96() {
return val96;
}
public void setVal96(String v) {
this.val96 = v;
}
public int getVal97() {
return val97;
}
public void setVal97(int v) {
this.val97 = v;
}
public long getVal98() {
return val98;
}
public void setVal98(long v) {
this.val98 = v;
}
public String getVal99() {
return val99;
}
public void setVal99(String v) {
this.val99 = v;
}
public int getVal100() {
return val100;
}
public void setVal100(int v) {
this.val100 = v;
}
public long getVal101() {
return val101;
}
public void setVal101(long v) {
this.val101 = v;
}
public String getVal102() {
return val102;
}
public void setVal102(String v) {
this.val102 = v;
}
public int getVal103() {
return val103;
}
public void setVal103(int v) {
this.val103 = v;
}
public long getVal104() {
return val104;
}
public void setVal104(long v) {
this.val104 = v;
}
public String getVal105() {
return val105;
}
public void setVal105(String v) {
this.val105 = v;
}
public int getVal106() {
return val106;
}
public void setVal106(int v) {
this.val106 = v;
}
public long getVal107() {
return val107;
}
public void setVal107(long v) {
this.val107 = v;
}
public String getVal108() {
return val108;
}
public void setVal108(String v) {
this.val108 = v;
}
public int getVal109() {
return val109;
}
public void setVal109(int v) {
this.val109 = v;
}
public long getVal110() {
return val110;
}
public void setVal110(long v) {
this.val110 = v;
}
public String getVal111() {
return val111;
}
public void setVal111(String v) {
this.val111 = v;
}
public int getVal112() {
return val112;
}
public void setVal112(int v) {
this.val112 = v;
}
public long getVal113() {
return val113;
}
public void setVal113(long v) {
this.val113 = v;
}
public String getVal114() {
return val114;
}
public void setVal114(String v) {
this.val114 = v;
}
public int getVal115() {
return val115;
}
public void setVal115(int v) {
this.val115 = v;
}
public long getVal116() {
return val116;
}
public void setVal116(long v) {
this.val116 = v;
}
public String getVal117() {
return val117;
}
public void setVal117(String v) {
this.val117 = v;
}
public int getVal118() {
return val118;
}
public void setVal118(int v) {
this.val118 = v;
}
public long getVal119() {
return val119;
}
public void setVal119(long v) {
this.val119 = v;
}
public String getVal120() {
return val120;
}
public void setVal120(String v) {
this.val120 = v;
}
public int getVal121() {
return val121;
}
public void setVal121(int v) {
this.val121 = v;
}
public long getVal122() {
return val122;
}
public void setVal122(long v) {
this.val122 = v;
}
public String getVal123() {
return val123;
}
public void setVal123(String v) {
this.val123 = v;
}
public int getVal124() {
return val124;
}
public void setVal124(int v) {
this.val124 = v;
}
public long getVal125() {
return val125;
}
public void setVal125(long v) {
this.val125 = v;
}
public String getVal126() {
return val126;
}
public void setVal126(String v) {
this.val126 = v;
}
public int getVal127() {
return val127;
}
public void setVal127(int v) {
this.val127 = v;
}
public long getVal128() {
return val128;
}
public void setVal128(long v) {
this.val128 = v;
}
public String getVal129() {
return val129;
}
public void setVal129(String v) {
this.val129 = v;
}
public int getVal130() {
return val130;
}
public void setVal130(int v) {
this.val130 = v;
}
public long getVal131() {
return val131;
}
public void setVal131(long v) {
this.val131 = v;
}
public String getVal132() {
return val132;
}
public void setVal132(String v) {
this.val132 = v;
}
public int getVal133() {
return val133;
}
public void setVal133(int v) {
this.val133 = v;
}
public long getVal134() {
return val134;
}
public void setVal134(long v) {
this.val134 = v;
}
public String getVal135() {
return val135;
}
public void setVal135(String v) {
this.val135 = v;
}
public int getVal136() {
return val136;
}
public void setVal136(int v) {
this.val136 = v;
}
public long getVal137() {
return val137;
}
public void setVal137(long v) {
this.val137 = v;
}
public String getVal138() {
return val138;
}
public void setVal138(String v) {
this.val138 = v;
}
public int getVal139() {
return val139;
}
public void setVal139(int v) {
this.val139 = v;
}
public long getVal140() {
return val140;
}
public void setVal140(long v) {
this.val140 = v;
}
public String getVal141() {
return val141;
}
public void setVal141(String v) {
this.val141 = v;
}
public int getVal142() {
return val142;
}
public void setVal142(int v) {
this.val142 = v;
}
public long getVal143() {
return val143;
}
public void setVal143(long v) {
this.val143 = v;
}
public String getVal144() {
return val144;
}
public void setVal144(String v) {
this.val144 = v;
}
public int getVal145() {
return val145;
}
public void setVal145(int v) {
this.val145 = v;
}
public long getVal146() {
return val146;
}
public void setVal146(long v) {
this.val146 = v;
}
public String getVal147() {
return val147;
}
public void setVal147(String v) {
this.val147 = v;
}
public int getVal148() {
return val148;
}
public void setVal148(int v) {
this.val148 = v;
}
public long getVal149() {
return val149;
}
public void setVal149(long v) {
this.val149 = v;
}
public String getVal150() {
return val150;
}
public void setVal150(String v) {
this.val150 = v;
}
public int getVal151() {
return val151;
}
public void setVal151(int v) {
this.val151 = v;
}
public long getVal152() {
return val152;
}
public void setVal152(long v) {
this.val152 = v;
}
public String getVal153() {
return val153;
}
public void setVal153(String v) {
this.val153 = v;
}
public int getVal154() {
return val154;
}
public void setVal154(int v) {
this.val154 = v;
}
public long getVal155() {
return val155;
}
public void setVal155(long v) {
this.val155 = v;
}
public String getVal156() {
return val156;
}
public void setVal156(String v) {
this.val156 = v;
}
public int getVal157() {
return val157;
}
public void setVal157(int v) {
this.val157 = v;
}
public long getVal158() {
return val158;
}
public void setVal158(long v) {
this.val158 = v;
}
public String getVal159() {
return val159;
}
public void setVal159(String v) {
this.val159 = v;
}
public int getVal160() {
return val160;
}
public void setVal160(int v) {
this.val160 = v;
}
public long getVal161() {
return val161;
}
public void setVal161(long v) {
this.val161 = v;
}
public String getVal162() {
return val162;
}
public void setVal162(String v) {
this.val162 = v;
}
public int getVal163() {
return val163;
}
public void setVal163(int v) {
this.val163 = v;
}
public long getVal164() {
return val164;
}
public void setVal164(long v) {
this.val164 = v;
}
public String getVal165() {
return val165;
}
public void setVal165(String v) {
this.val165 = v;
}
public int getVal166() {
return val166;
}
public void setVal166(int v) {
this.val166 = v;
}
public long getVal167() {
return val167;
}
public void setVal167(long v) {
this.val167 = v;
}
public String getVal168() {
return val168;
}
public void setVal168(String v) {
this.val168 = v;
}
public int getVal169() {
return val169;
}
public void setVal169(int v) {
this.val169 = v;
}
public long getVal170() {
return val170;
}
public void setVal170(long v) {
this.val170 = v;
}
public String getVal171() {
return val171;
}
public void setVal171(String v) {
this.val171 = v;
}
public int getVal172() {
return val172;
}
public void setVal172(int v) {
this.val172 = v;
}
public long getVal173() {
return val173;
}
public void setVal173(long v) {
this.val173 = v;
}
public String getVal174() {
return val174;
}
public void setVal174(String v) {
this.val174 = v;
}
public int getVal175() {
return val175;
}
public void setVal175(int v) {
this.val175 = v;
}
public long getVal176() {
return val176;
}
public void setVal176(long v) {
this.val176 = v;
}
public String getVal177() {
return val177;
}
public void setVal177(String v) {
this.val177 = v;
}
public int getVal178() {
return val178;
}
public void setVal178(int v) {
this.val178 = v;
}
public long getVal179() {
return val179;
}
public void setVal179(long v) {
this.val179 = v;
}
public String getVal180() {
return val180;
}
public void setVal180(String v) {
this.val180 = v;
}
public int getVal181() {
return val181;
}
public void setVal181(int v) {
this.val181 = v;
}
public long getVal182() {
return val182;
}
public void setVal182(long v) {
this.val182 = v;
}
public String getVal183() {
return val183;
}
public void setVal183(String v) {
this.val183 = v;
}
public int getVal184() {
return val184;
}
public void setVal184(int v) {
this.val184 = v;
}
public long getVal185() {
return val185;
}
public void setVal185(long v) {
this.val185 = v;
}
public String getVal186() {
return val186;
}
public void setVal186(String v) {
this.val186 = v;
}
public int getVal187() {
return val187;
}
public void setVal187(int v) {
this.val187 = v;
}
public long getVal188() {
return val188;
}
public void setVal188(long v) {
this.val188 = v;
}
public String getVal189() {
return val189;
}
public void setVal189(String v) {
this.val189 = v;
}
public int getVal190() {
return val190;
}
public void setVal190(int v) {
this.val190 = v;
}
public long getVal191() {
return val191;
}
public void setVal191(long v) {
this.val191 = v;
}
public String getVal192() {
return val192;
}
public void setVal192(String v) {
this.val192 = v;
}
public int getVal193() {
return val193;
}
public void setVal193(int v) {
this.val193 = v;
}
public long getVal194() {
return val194;
}
public void setVal194(long v) {
this.val194 = v;
}
public String getVal195() {
return val195;
}
public void setVal195(String v) {
this.val195 = v;
}
public int getVal196() {
return val196;
}
public void setVal196(int v) {
this.val196 = v;
}
public long getVal197() {
return val197;
}
public void setVal197(long v) {
this.val197 = v;
}
public String getVal198() {
return val198;
}
public void setVal198(String v) {
this.val198 = v;
}
public int getVal199() {
return val199;
}
public void setVal199(int v) {
this.val199 = v;
}
public long getVal200() {
return val200;
}
public void setVal200(long v) {
this.val200 = v;
}
public String getVal201() {
return val201;
}
public void setVal201(String v) {
this.val201 = v;
}
public int getVal202() {
return val202;
}
public void setVal202(int v) {
this.val202 = v;
}
public long getVal203() {
return val203;
}
public void setVal203(long v) {
this.val203 = v;
}
public String getVal204() {
return val204;
}
public void setVal204(String v) {
this.val204 = v;
}
public int getVal205() {
return val205;
}
public void setVal205(int v) {
this.val205 = v;
}
public long getVal206() {
return val206;
}
public void setVal206(long v) {
this.val206 = v;
}
public String getVal207() {
return val207;
}
public void setVal207(String v) {
this.val207 = v;
}
public int getVal208() {
return val208;
}
public void setVal208(int v) {
this.val208 = v;
}
public long getVal209() {
return val209;
}
public void setVal209(long v) {
this.val209 = v;
}
public String getVal210() {
return val210;
}
public void setVal210(String v) {
this.val210 = v;
}
public int getVal211() {
return val211;
}
public void setVal211(int v) {
this.val211 = v;
}
public long getVal212() {
return val212;
}
public void setVal212(long v) {
this.val212 = v;
}
public String getVal213() {
return val213;
}
public void setVal213(String v) {
this.val213 = v;
}
public int getVal214() {
return val214;
}
public void setVal214(int v) {
this.val214 = v;
}
public long getVal215() {
return val215;
}
public void setVal215(long v) {
this.val215 = v;
}
public String getVal216() {
return val216;
}
public void setVal216(String v) {
this.val216 = v;
}
public int getVal217() {
return val217;
}
public void setVal217(int v) {
this.val217 = v;
}
public long getVal218() {
return val218;
}
public void setVal218(long v) {
this.val218 = v;
}
public String getVal219() {
return val219;
}
public void setVal219(String v) {
this.val219 = v;
}
public int getVal220() {
return val220;
}
public void setVal220(int v) {
this.val220 = v;
}
public long getVal221() {
return val221;
}
public void setVal221(long v) {
this.val221 = v;
}
public String getVal222() {
return val222;
}
public void setVal222(String v) {
this.val222 = v;
}
public int getVal223() {
return val223;
}
public void setVal223(int v) {
this.val223 = v;
}
public long getVal224() {
return val224;
}
public void setVal224(long v) {
this.val224 = v;
}
public String getVal225() {
return val225;
}
public void setVal225(String v) {
this.val225 = v;
}
public int getVal226() {
return val226;
}
public void setVal226(int v) {
this.val226 = v;
}
public long getVal227() {
return val227;
}
public void setVal227(long v) {
this.val227 = v;
}
public String getVal228() {
return val228;
}
public void setVal228(String v) {
this.val228 = v;
}
public int getVal229() {
return val229;
}
public void setVal229(int v) {
this.val229 = v;
}
public long getVal230() {
return val230;
}
public void setVal230(long v) {
this.val230 = v;
}
public String getVal231() {
return val231;
}
public void setVal231(String v) {
this.val231 = v;
}
public int getVal232() {
return val232;
}
public void setVal232(int v) {
this.val232 = v;
}
public long getVal233() {
return val233;
}
public void setVal233(long v) {
this.val233 = v;
}
public String getVal234() {
return val234;
}
public void setVal234(String v) {
this.val234 = v;
}
public int getVal235() {
return val235;
}
public void setVal235(int v) {
this.val235 = v;
}
public long getVal236() {
return val236;
}
public void setVal236(long v) {
this.val236 = v;
}
public String getVal237() {
return val237;
}
public void setVal237(String v) {
this.val237 = v;
}
public int getVal238() {
return val238;
}
public void setVal238(int v) {
this.val238 = v;
}
public long getVal239() {
return val239;
}
public void setVal239(long v) {
this.val239 = v;
}
public String getVal240() {
return val240;
}
public void setVal240(String v) {
this.val240 = v;
}
public int getVal241() {
return val241;
}
public void setVal241(int v) {
this.val241 = v;
}
public long getVal242() {
return val242;
}
public void setVal242(long v) {
this.val242 = v;
}
public String getVal243() {
return val243;
}
public void setVal243(String v) {
this.val243 = v;
}
public int getVal244() {
return val244;
}
public void setVal244(int v) {
this.val244 = v;
}
public long getVal245() {
return val245;
}
public void setVal245(long v) {
this.val245 = v;
}
public String getVal246() {
return val246;
}
public void setVal246(String v) {
this.val246 = v;
}
public int getVal247() {
return val247;
}
public void setVal247(int v) {
this.val247 = v;
}
public long getVal248() {
return val248;
}
public void setVal248(long v) {
this.val248 = v;
}
public String getVal249() {
return val249;
}
public void setVal249(String v) {
this.val249 = v;
}
public int getVal250() {
return val250;
}
public void setVal250(int v) {
this.val250 = v;
}
public long getVal251() {
return val251;
}
public void setVal251(long v) {
this.val251 = v;
}
public String getVal252() {
return val252;
}
public void setVal252(String v) {
this.val252 = v;
}
public int getVal253() {
return val253;
}
public void setVal253(int v) {
this.val253 = v;
}
public long getVal254() {
return val254;
}
public void setVal254(long v) {
this.val254 = v;
}
public String getVal255() {
return val255;
}
public void setVal255(String v) {
this.val255 = v;
}
public int getVal256() {
return val256;
}
public void setVal256(int v) {
this.val256 = v;
}
public long getVal257() {
return val257;
}
public void setVal257(long v) {
this.val257 = v;
}
public String getVal258() {
return val258;
}
public void setVal258(String v) {
this.val258 = v;
}
public int getVal259() {
return val259;
}
public void setVal259(int v) {
this.val259 = v;
}
public long getVal260() {
return val260;
}
public void setVal260(long v) {
this.val260 = v;
}
public String getVal261() {
return val261;
}
public void setVal261(String v) {
this.val261 = v;
}
public int getVal262() {
return val262;
}
public void setVal262(int v) {
this.val262 = v;
}
public long getVal263() {
return val263;
}
public void setVal263(long v) {
this.val263 = v;
}
public String getVal264() {
return val264;
}
public void setVal264(String v) {
this.val264 = v;
}
public int getVal265() {
return val265;
}
public void setVal265(int v) {
this.val265 = v;
}
public long getVal266() {
return val266;
}
public void setVal266(long v) {
this.val266 = v;
}
public String getVal267() {
return val267;
}
public void setVal267(String v) {
this.val267 = v;
}
public int getVal268() {
return val268;
}
public void setVal268(int v) {
this.val268 = v;
}
public long getVal269() {
return val269;
}
public void setVal269(long v) {
this.val269 = v;
}
public String getVal270() {
return val270;
}
public void setVal270(String v) {
this.val270 = v;
}
public int getVal271() {
return val271;
}
public void setVal271(int v) {
this.val271 = v;
}
public long getVal272() {
return val272;
}
public void setVal272(long v) {
this.val272 = v;
}
public String getVal273() {
return val273;
}
public void setVal273(String v) {
this.val273 = v;
}
public int getVal274() {
return val274;
}
public void setVal274(int v) {
this.val274 = v;
}
public long getVal275() {
return val275;
}
public void setVal275(long v) {
this.val275 = v;
}
public String getVal276() {
return val276;
}
public void setVal276(String v) {
this.val276 = v;
}
public int getVal277() {
return val277;
}
public void setVal277(int v) {
this.val277 = v;
}
public long getVal278() {
return val278;
}
public void setVal278(long v) {
this.val278 = v;
}
public String getVal279() {
return val279;
}
public void setVal279(String v) {
this.val279 = v;
}
public int getVal280() {
return val280;
}
public void setVal280(int v) {
this.val280 = v;
}
public long getVal281() {
return val281;
}
public void setVal281(long v) {
this.val281 = v;
}
public String getVal282() {
return val282;
}
public void setVal282(String v) {
this.val282 = v;
}
public int getVal283() {
return val283;
}
public void setVal283(int v) {
this.val283 = v;
}
public long getVal284() {
return val284;
}
public void setVal284(long v) {
this.val284 = v;
}
public String getVal285() {
return val285;
}
public void setVal285(String v) {
this.val285 = v;
}
public int getVal286() {
return val286;
}
public void setVal286(int v) {
this.val286 = v;
}
public long getVal287() {
return val287;
}
public void setVal287(long v) {
this.val287 = v;
}
public String getVal288() {
return val288;
}
public void setVal288(String v) {
this.val288 = v;
}
public int getVal289() {
return val289;
}
public void setVal289(int v) {
this.val289 = v;
}
public long getVal290() {
return val290;
}
public void setVal290(long v) {
this.val290 = v;
}
public String getVal291() {
return val291;
}
public void setVal291(String v) {
this.val291 = v;
}
public int getVal292() {
return val292;
}
public void setVal292(int v) {
this.val292 = v;
}
public long getVal293() {
return val293;
}
public void setVal293(long v) {
this.val293 = v;
}
public String getVal294() {
return val294;
}
public void setVal294(String v) {
this.val294 = v;
}
public int getVal295() {
return val295;
}
public void setVal295(int v) {
this.val295 = v;
}
public long getVal296() {
return val296;
}
public void setVal296(long v) {
this.val296 = v;
}
public String getVal297() {
return val297;
}
public void setVal297(String v) {
this.val297 = v;
}
public int getVal298() {
return val298;
}
public void setVal298(int v) {
this.val298 = v;
}
public long getVal299() {
return val299;
}
public void setVal299(long v) {
this.val299 = v;
}
public String getVal300() {
return val300;
}
public void setVal300(String v) {
this.val300 = v;
}
public int getVal301() {
return val301;
}
public void setVal301(int v) {
this.val301 = v;
}
public long getVal302() {
return val302;
}
public void setVal302(long v) {
this.val302 = v;
}
public String getVal303() {
return val303;
}
public void setVal303(String v) {
this.val303 = v;
}
public int getVal304() {
return val304;
}
public void setVal304(int v) {
this.val304 = v;
}
public long getVal305() {
return val305;
}
public void setVal305(long v) {
this.val305 = v;
}
public String getVal306() {
return val306;
}
public void setVal306(String v) {
this.val306 = v;
}
public int getVal307() {
return val307;
}
public void setVal307(int v) {
this.val307 = v;
}
public long getVal308() {
return val308;
}
public void setVal308(long v) {
this.val308 = v;
}
public String getVal309() {
return val309;
}
public void setVal309(String v) {
this.val309 = v;
}
public int getVal310() {
return val310;
}
public void setVal310(int v) {
this.val310 = v;
}
public long getVal311() {
return val311;
}
public void setVal311(long v) {
this.val311 = v;
}
public String getVal312() {
return val312;
}
public void setVal312(String v) {
this.val312 = v;
}
public int getVal313() {
return val313;
}
public void setVal313(int v) {
this.val313 = v;
}
public long getVal314() {
return val314;
}
public void setVal314(long v) {
this.val314 = v;
}
public String getVal315() {
return val315;
}
public void setVal315(String v) {
this.val315 = v;
}
public int getVal316() {
return val316;
}
public void setVal316(int v) {
this.val316 = v;
}
public long getVal317() {
return val317;
}
public void setVal317(long v) {
this.val317 = v;
}
public String getVal318() {
return val318;
}
public void setVal318(String v) {
this.val318 = v;
}
public int getVal319() {
return val319;
}
public void setVal319(int v) {
this.val319 = v;
}
public long getVal320() {
return val320;
}
public void setVal320(long v) {
this.val320 = v;
}
public String getVal321() {
return val321;
}
public void setVal321(String v) {
this.val321 = v;
}
public int getVal322() {
return val322;
}
public void setVal322(int v) {
this.val322 = v;
}
public long getVal323() {
return val323;
}
public void setVal323(long v) {
this.val323 = v;
}
public String getVal324() {
return val324;
}
public void setVal324(String v) {
this.val324 = v;
}
public int getVal325() {
return val325;
}
public void setVal325(int v) {
this.val325 = v;
}
public long getVal326() {
return val326;
}
public void setVal326(long v) {
this.val326 = v;
}
public String getVal327() {
return val327;
}
public void setVal327(String v) {
this.val327 = v;
}
public int getVal328() {
return val328;
}
public void setVal328(int v) {
this.val328 = v;
}
public long getVal329() {
return val329;
}
public void setVal329(long v) {
this.val329 = v;
}
public String getVal330() {
return val330;
}
public void setVal330(String v) {
this.val330 = v;
}
public int getVal331() {
return val331;
}
public void setVal331(int v) {
this.val331 = v;
}
public long getVal332() {
return val332;
}
public void setVal332(long v) {
this.val332 = v;
}
public String getVal333() {
return val333;
}
public void setVal333(String v) {
this.val333 = v;
}
public int getVal334() {
return val334;
}
public void setVal334(int v) {
this.val334 = v;
}
public long getVal335() {
return val335;
}
public void setVal335(long v) {
this.val335 = v;
}
public String getVal336() {
return val336;
}
public void setVal336(String v) {
this.val336 = v;
}
public int getVal337() {
return val337;
}
public void setVal337(int v) {
this.val337 = v;
}
public long getVal338() {
return val338;
}
public void setVal338(long v) {
this.val338 = v;
}
public String getVal339() {
return val339;
}
public void setVal339(String v) {
this.val339 = v;
}
public int getVal340() {
return val340;
}
public void setVal340(int v) {
this.val340 = v;
}
public long getVal341() {
return val341;
}
public void setVal341(long v) {
this.val341 = v;
}
public String getVal342() {
return val342;
}
public void setVal342(String v) {
this.val342 = v;
}
public int getVal343() {
return val343;
}
public void setVal343(int v) {
this.val343 = v;
}
public long getVal344() {
return val344;
}
public void setVal344(long v) {
this.val344 = v;
}
public String getVal345() {
return val345;
}
public void setVal345(String v) {
this.val345 = v;
}
public int getVal346() {
return val346;
}
public void setVal346(int v) {
this.val346 = v;
}
public long getVal347() {
return val347;
}
public void setVal347(long v) {
this.val347 = v;
}
public String getVal348() {
return val348;
}
public void setVal348(String v) {
this.val348 = v;
}
public int getVal349() {
return val349;
}
public void setVal349(int v) {
this.val349 = v;
}
public long getVal350() {
return val350;
}
public void setVal350(long v) {
this.val350 = v;
}
public String getVal351() {
return val351;
}
public void setVal351(String v) {
this.val351 = v;
}
public int getVal352() {
return val352;
}
public void setVal352(int v) {
this.val352 = v;
}
public long getVal353() {
return val353;
}
public void setVal353(long v) {
this.val353 = v;
}
public String getVal354() {
return val354;
}
public void setVal354(String v) {
this.val354 = v;
}
public int getVal355() {
return val355;
}
public void setVal355(int v) {
this.val355 = v;
}
public long getVal356() {
return val356;
}
public void setVal356(long v) {
this.val356 = v;
}
public String getVal357() {
return val357;
}
public void setVal357(String v) {
this.val357 = v;
}
public int getVal358() {
return val358;
}
public void setVal358(int v) {
this.val358 = v;
}
public long getVal359() {
return val359;
}
public void setVal359(long v) {
this.val359 = v;
}
public String getVal360() {
return val360;
}
public void setVal360(String v) {
this.val360 = v;
}
public int getVal361() {
return val361;
}
public void setVal361(int v) {
this.val361 = v;
}
public long getVal362() {
return val362;
}
public void setVal362(long v) {
this.val362 = v;
}
public String getVal363() {
return val363;
}
public void setVal363(String v) {
this.val363 = v;
}
public int getVal364() {
return val364;
}
public void setVal364(int v) {
this.val364 = v;
}
public long getVal365() {
return val365;
}
public void setVal365(long v) {
this.val365 = v;
}
public String getVal366() {
return val366;
}
public void setVal366(String v) {
this.val366 = v;
}
public int getVal367() {
return val367;
}
public void setVal367(int v) {
this.val367 = v;
}
public long getVal368() {
return val368;
}
public void setVal368(long v) {
this.val368 = v;
}
public String getVal369() {
return val369;
}
public void setVal369(String v) {
this.val369 = v;
}
public int getVal370() {
return val370;
}
public void setVal370(int v) {
this.val370 = v;
}
public long getVal371() {
return val371;
}
public void setVal371(long v) {
this.val371 = v;
}
public String getVal372() {
return val372;
}
public void setVal372(String v) {
this.val372 = v;
}
public int getVal373() {
return val373;
}
public void setVal373(int v) {
this.val373 = v;
}
public long getVal374() {
return val374;
}
public void setVal374(long v) {
this.val374 = v;
}
public String getVal375() {
return val375;
}
public void setVal375(String v) {
this.val375 = v;
}
public int getVal376() {
return val376;
}
public void setVal376(int v) {
this.val376 = v;
}
public long getVal377() {
return val377;
}
public void setVal377(long v) {
this.val377 = v;
}
public String getVal378() {
return val378;
}
public void setVal378(String v) {
this.val378 = v;
}
public int getVal379() {
return val379;
}
public void setVal379(int v) {
this.val379 = v;
}
public long getVal380() {
return val380;
}
public void setVal380(long v) {
this.val380 = v;
}
public String getVal381() {
return val381;
}
public void setVal381(String v) {
this.val381 = v;
}
public int getVal382() {
return val382;
}
public void setVal382(int v) {
this.val382 = v;
}
public long getVal383() {
return val383;
}
public void setVal383(long v) {
this.val383 = v;
}
public String getVal384() {
return val384;
}
public void setVal384(String v) {
this.val384 = v;
}
public int getVal385() {
return val385;
}
public void setVal385(int v) {
this.val385 = v;
}
public long getVal386() {
return val386;
}
public void setVal386(long v) {
this.val386 = v;
}
public String getVal387() {
return val387;
}
public void setVal387(String v) {
this.val387 = v;
}
public int getVal388() {
return val388;
}
public void setVal388(int v) {
this.val388 = v;
}
public long getVal389() {
return val389;
}
public void setVal389(long v) {
this.val389 = v;
}
public String getVal390() {
return val390;
}
public void setVal390(String v) {
this.val390 = v;
}
public int getVal391() {
return val391;
}
public void setVal391(int v) {
this.val391 = v;
}
public long getVal392() {
return val392;
}
public void setVal392(long v) {
this.val392 = v;
}
public String getVal393() {
return val393;
}
public void setVal393(String v) {
this.val393 = v;
}
public int getVal394() {
return val394;
}
public void setVal394(int v) {
this.val394 = v;
}
public long getVal395() {
return val395;
}
public void setVal395(long v) {
this.val395 = v;
}
public String getVal396() {
return val396;
}
public void setVal396(String v) {
this.val396 = v;
}
public int getVal397() {
return val397;
}
public void setVal397(int v) {
this.val397 = v;
}
public long getVal398() {
return val398;
}
public void setVal398(long v) {
this.val398 = v;
}
public String getVal399() {
return val399;
}
public void setVal399(String v) {
this.val399 = v;
}
public int getVal400() {
return val400;
}
public void setVal400(int v) {
this.val400 = v;
}
public long getVal401() {
return val401;
}
public void setVal401(long v) {
this.val401 = v;
}
public String getVal402() {
return val402;
}
public void setVal402(String v) {
this.val402 = v;
}
public int getVal403() {
return val403;
}
public void setVal403(int v) {
this.val403 = v;
}
public long getVal404() {
return val404;
}
public void setVal404(long v) {
this.val404 = v;
}
public String getVal405() {
return val405;
}
public void setVal405(String v) {
this.val405 = v;
}
public int getVal406() {
return val406;
}
public void setVal406(int v) {
this.val406 = v;
}
public long getVal407() {
return val407;
}
public void setVal407(long v) {
this.val407 = v;
}
public String getVal408() {
return val408;
}
public void setVal408(String v) {
this.val408 = v;
}
public int getVal409() {
return val409;
}
public void setVal409(int v) {
this.val409 = v;
}
public long getVal410() {
return val410;
}
public void setVal410(long v) {
this.val410 = v;
}
public String getVal411() {
return val411;
}
public void setVal411(String v) {
this.val411 = v;
}
public int getVal412() {
return val412;
}
public void setVal412(int v) {
this.val412 = v;
}
public long getVal413() {
return val413;
}
public void setVal413(long v) {
this.val413 = v;
}
public String getVal414() {
return val414;
}
public void setVal414(String v) {
this.val414 = v;
}
public int getVal415() {
return val415;
}
public void setVal415(int v) {
this.val415 = v;
}
public long getVal416() {
return val416;
}
public void setVal416(long v) {
this.val416 = v;
}
public String getVal417() {
return val417;
}
public void setVal417(String v) {
this.val417 = v;
}
public int getVal418() {
return val418;
}
public void setVal418(int v) {
this.val418 = v;
}
public long getVal419() {
return val419;
}
public void setVal419(long v) {
this.val419 = v;
}
public String getVal420() {
return val420;
}
public void setVal420(String v) {
this.val420 = v;
}
public int getVal421() {
return val421;
}
public void setVal421(int v) {
this.val421 = v;
}
public long getVal422() {
return val422;
}
public void setVal422(long v) {
this.val422 = v;
}
public String getVal423() {
return val423;
}
public void setVal423(String v) {
this.val423 = v;
}
public int getVal424() {
return val424;
}
public void setVal424(int v) {
this.val424 = v;
}
public long getVal425() {
return val425;
}
public void setVal425(long v) {
this.val425 = v;
}
public String getVal426() {
return val426;
}
public void setVal426(String v) {
this.val426 = v;
}
public int getVal427() {
return val427;
}
public void setVal427(int v) {
this.val427 = v;
}
public long getVal428() {
return val428;
}
public void setVal428(long v) {
this.val428 = v;
}
public String getVal429() {
return val429;
}
public void setVal429(String v) {
this.val429 = v;
}
public int getVal430() {
return val430;
}
public void setVal430(int v) {
this.val430 = v;
}
public long getVal431() {
return val431;
}
public void setVal431(long v) {
this.val431 = v;
}
public String getVal432() {
return val432;
}
public void setVal432(String v) {
this.val432 = v;
}
public int getVal433() {
return val433;
}
public void setVal433(int v) {
this.val433 = v;
}
public long getVal434() {
return val434;
}
public void setVal434(long v) {
this.val434 = v;
}
public String getVal435() {
return val435;
}
public void setVal435(String v) {
this.val435 = v;
}
public int getVal436() {
return val436;
}
public void setVal436(int v) {
this.val436 = v;
}
public long getVal437() {
return val437;
}
public void setVal437(long v) {
this.val437 = v;
}
public String getVal438() {
return val438;
}
public void setVal438(String v) {
this.val438 = v;
}
public int getVal439() {
return val439;
}
public void setVal439(int v) {
this.val439 = v;
}
public long getVal440() {
return val440;
}
public void setVal440(long v) {
this.val440 = v;
}
public String getVal441() {
return val441;
}
public void setVal441(String v) {
this.val441 = v;
}
public int getVal442() {
return val442;
}
public void setVal442(int v) {
this.val442 = v;
}
public long getVal443() {
return val443;
}
public void setVal443(long v) {
this.val443 = v;
}
public String getVal444() {
return val444;
}
public void setVal444(String v) {
this.val444 = v;
}
public int getVal445() {
return val445;
}
public void setVal445(int v) {
this.val445 = v;
}
public long getVal446() {
return val446;
}
public void setVal446(long v) {
this.val446 = v;
}
public String getVal447() {
return val447;
}
public void setVal447(String v) {
this.val447 = v;
}
public int getVal448() {
return val448;
}
public void setVal448(int v) {
this.val448 = v;
}
public long getVal449() {
return val449;
}
public void setVal449(long v) {
this.val449 = v;
}
public String getVal450() {
return val450;
}
public void setVal450(String v) {
this.val450 = v;
}
public int getVal451() {
return val451;
}
public void setVal451(int v) {
this.val451 = v;
}
public long getVal452() {
return val452;
}
public void setVal452(long v) {
this.val452 = v;
}
public String getVal453() {
return val453;
}
public void setVal453(String v) {
this.val453 = v;
}
public int getVal454() {
return val454;
}
public void setVal454(int v) {
this.val454 = v;
}
public long getVal455() {
return val455;
}
public void setVal455(long v) {
this.val455 = v;
}
public String getVal456() {
return val456;
}
public void setVal456(String v) {
this.val456 = v;
}
public int getVal457() {
return val457;
}
public void setVal457(int v) {
this.val457 = v;
}
public long getVal458() {
return val458;
}
public void setVal458(long v) {
this.val458 = v;
}
public String getVal459() {
return val459;
}
public void setVal459(String v) {
this.val459 = v;
}
public int getVal460() {
return val460;
}
public void setVal460(int v) {
this.val460 = v;
}
public long getVal461() {
return val461;
}
public void setVal461(long v) {
this.val461 = v;
}
public String getVal462() {
return val462;
}
public void setVal462(String v) {
this.val462 = v;
}
public int getVal463() {
return val463;
}
public void setVal463(int v) {
this.val463 = v;
}
public long getVal464() {
return val464;
}
public void setVal464(long v) {
this.val464 = v;
}
public String getVal465() {
return val465;
}
public void setVal465(String v) {
this.val465 = v;
}
public int getVal466() {
return val466;
}
public void setVal466(int v) {
this.val466 = v;
}
public long getVal467() {
return val467;
}
public void setVal467(long v) {
this.val467 = v;
}
public String getVal468() {
return val468;
}
public void setVal468(String v) {
this.val468 = v;
}
public int getVal469() {
return val469;
}
public void setVal469(int v) {
this.val469 = v;
}
public long getVal470() {
return val470;
}
public void setVal470(long v) {
this.val470 = v;
}
public String getVal471() {
return val471;
}
public void setVal471(String v) {
this.val471 = v;
}
public int getVal472() {
return val472;
}
public void setVal472(int v) {
this.val472 = v;
}
public long getVal473() {
return val473;
}
public void setVal473(long v) {
this.val473 = v;
}
public String getVal474() {
return val474;
}
public void setVal474(String v) {
this.val474 = v;
}
public int getVal475() {
return val475;
}
public void setVal475(int v) {
this.val475 = v;
}
public long getVal476() {
return val476;
}
public void setVal476(long v) {
this.val476 = v;
}
public String getVal477() {
return val477;
}
public void setVal477(String v) {
this.val477 = v;
}
public int getVal478() {
return val478;
}
public void setVal478(int v) {
this.val478 = v;
}
public long getVal479() {
return val479;
}
public void setVal479(long v) {
this.val479 = v;
}
public String getVal480() {
return val480;
}
public void setVal480(String v) {
this.val480 = v;
}
public int getVal481() {
return val481;
}
public void setVal481(int v) {
this.val481 = v;
}
public long getVal482() {
return val482;
}
public void setVal482(long v) {
this.val482 = v;
}
public String getVal483() {
return val483;
}
public void setVal483(String v) {
this.val483 = v;
}
public int getVal484() {
return val484;
}
public void setVal484(int v) {
this.val484 = v;
}
public long getVal485() {
return val485;
}
public void setVal485(long v) {
this.val485 = v;
}
public String getVal486() {
return val486;
}
public void setVal486(String v) {
this.val486 = v;
}
public int getVal487() {
return val487;
}
public void setVal487(int v) {
this.val487 = v;
}
public long getVal488() {
return val488;
}
public void setVal488(long v) {
this.val488 = v;
}
public String getVal489() {
return val489;
}
public void setVal489(String v) {
this.val489 = v;
}
public int getVal490() {
return val490;
}
public void setVal490(int v) {
this.val490 = v;
}
public long getVal491() {
return val491;
}
public void setVal491(long v) {
this.val491 = v;
}
public String getVal492() {
return val492;
}
public void setVal492(String v) {
this.val492 = v;
}
public int getVal493() {
return val493;
}
public void setVal493(int v) {
this.val493 = v;
}
public long getVal494() {
return val494;
}
public void setVal494(long v) {
this.val494 = v;
}
public String getVal495() {
return val495;
}
public void setVal495(String v) {
this.val495 = v;
}
public int getVal496() {
return val496;
}
public void setVal496(int v) {
this.val496 = v;
}
public long getVal497() {
return val497;
}
public void setVal497(long v) {
this.val497 = v;
}
public String getVal498() {
return val498;
}
public void setVal498(String v) {
this.val498 = v;
}
public int getVal499() {
return val499;
}
public void setVal499(int v) {
this.val499 = v;
}
public long getVal500() {
return val500;
}
public void setVal500(long v) {
this.val500 = v;
}
public String getVal501() {
return val501;
}
public void setVal501(String v) {
this.val501 = v;
}
public int getVal502() {
return val502;
}
public void setVal502(int v) {
this.val502 = v;
}
public long getVal503() {
return val503;
}
public void setVal503(long v) {
this.val503 = v;
}
public String getVal504() {
return val504;
}
public void setVal504(String v) {
this.val504 = v;
}
public int getVal505() {
return val505;
}
public void setVal505(int v) {
this.val505 = v;
}
public long getVal506() {
return val506;
}
public void setVal506(long v) {
this.val506 = v;
}
public String getVal507() {
return val507;
}
public void setVal507(String v) {
this.val507 = v;
}
public int getVal508() {
return val508;
}
public void setVal508(int v) {
this.val508 = v;
}
public long getVal509() {
return val509;
}
public void setVal509(long v) {
this.val509 = v;
}
public String getVal510() {
return val510;
}
public void setVal510(String v) {
this.val510 = v;
}
public int getVal511() {
return val511;
}
public void setVal511(int v) {
this.val511 = v;
}
public long getVal512() {
return val512;
}
public void setVal512(long v) {
this.val512 = v;
}
public String getVal513() {
return val513;
}
public void setVal513(String v) {
this.val513 = v;
}
public int getVal514() {
return val514;
}
public void setVal514(int v) {
this.val514 = v;
}
public long getVal515() {
return val515;
}
public void setVal515(long v) {
this.val515 = v;
}
public String getVal516() {
return val516;
}
public void setVal516(String v) {
this.val516 = v;
}
public int getVal517() {
return val517;
}
public void setVal517(int v) {
this.val517 = v;
}
public long getVal518() {
return val518;
}
public void setVal518(long v) {
this.val518 = v;
}
public String getVal519() {
return val519;
}
public void setVal519(String v) {
this.val519 = v;
}
public int getVal520() {
return val520;
}
public void setVal520(int v) {
this.val520 = v;
}
public long getVal521() {
return val521;
}
public void setVal521(long v) {
this.val521 = v;
}
public String getVal522() {
return val522;
}
public void setVal522(String v) {
this.val522 = v;
}
public int getVal523() {
return val523;
}
public void setVal523(int v) {
this.val523 = v;
}
public long getVal524() {
return val524;
}
public void setVal524(long v) {
this.val524 = v;
}
public String getVal525() {
return val525;
}
public void setVal525(String v) {
this.val525 = v;
}
public int getVal526() {
return val526;
}
public void setVal526(int v) {
this.val526 = v;
}
public long getVal527() {
return val527;
}
public void setVal527(long v) {
this.val527 = v;
}
public String getVal528() {
return val528;
}
public void setVal528(String v) {
this.val528 = v;
}
public int getVal529() {
return val529;
}
public void setVal529(int v) {
this.val529 = v;
}
public long getVal530() {
return val530;
}
public void setVal530(long v) {
this.val530 = v;
}
public String getVal531() {
return val531;
}
public void setVal531(String v) {
this.val531 = v;
}
public int getVal532() {
return val532;
}
public void setVal532(int v) {
this.val532 = v;
}
public long getVal533() {
return val533;
}
public void setVal533(long v) {
this.val533 = v;
}
public String getVal534() {
return val534;
}
public void setVal534(String v) {
this.val534 = v;
}
public int getVal535() {
return val535;
}
public void setVal535(int v) {
this.val535 = v;
}
public long getVal536() {
return val536;
}
public void setVal536(long v) {
this.val536 = v;
}
public String getVal537() {
return val537;
}
public void setVal537(String v) {
this.val537 = v;
}
public int getVal538() {
return val538;
}
public void setVal538(int v) {
this.val538 = v;
}
public long getVal539() {
return val539;
}
public void setVal539(long v) {
this.val539 = v;
}
public String getVal540() {
return val540;
}
public void setVal540(String v) {
this.val540 = v;
}
public int getVal541() {
return val541;
}
public void setVal541(int v) {
this.val541 = v;
}
public long getVal542() {
return val542;
}
public void setVal542(long v) {
this.val542 = v;
}
public String getVal543() {
return val543;
}
public void setVal543(String v) {
this.val543 = v;
}
public int getVal544() {
return val544;
}
public void setVal544(int v) {
this.val544 = v;
}
public long getVal545() {
return val545;
}
public void setVal545(long v) {
this.val545 = v;
}
public String getVal546() {
return val546;
}
public void setVal546(String v) {
this.val546 = v;
}
public int getVal547() {
return val547;
}
public void setVal547(int v) {
this.val547 = v;
}
public long getVal548() {
return val548;
}
public void setVal548(long v) {
this.val548 = v;
}
public String getVal549() {
return val549;
}
public void setVal549(String v) {
this.val549 = v;
}
public int getVal550() {
return val550;
}
public void setVal550(int v) {
this.val550 = v;
}
public long getVal551() {
return val551;
}
public void setVal551(long v) {
this.val551 = v;
}
public String getVal552() {
return val552;
}
public void setVal552(String v) {
this.val552 = v;
}
public int getVal553() {
return val553;
}
public void setVal553(int v) {
this.val553 = v;
}
public long getVal554() {
return val554;
}
public void setVal554(long v) {
this.val554 = v;
}
public String getVal555() {
return val555;
}
public void setVal555(String v) {
this.val555 = v;
}
public int getVal556() {
return val556;
}
public void setVal556(int v) {
this.val556 = v;
}
public long getVal557() {
return val557;
}
public void setVal557(long v) {
this.val557 = v;
}
public String getVal558() {
return val558;
}
public void setVal558(String v) {
this.val558 = v;
}
public int getVal559() {
return val559;
}
public void setVal559(int v) {
this.val559 = v;
}
public long getVal560() {
return val560;
}
public void setVal560(long v) {
this.val560 = v;
}
public String getVal561() {
return val561;
}
public void setVal561(String v) {
this.val561 = v;
}
public int getVal562() {
return val562;
}
public void setVal562(int v) {
this.val562 = v;
}
public long getVal563() {
return val563;
}
public void setVal563(long v) {
this.val563 = v;
}
public String getVal564() {
return val564;
}
public void setVal564(String v) {
this.val564 = v;
}
public int getVal565() {
return val565;
}
public void setVal565(int v) {
this.val565 = v;
}
public long getVal566() {
return val566;
}
public void setVal566(long v) {
this.val566 = v;
}
public String getVal567() {
return val567;
}
public void setVal567(String v) {
this.val567 = v;
}
public int getVal568() {
return val568;
}
public void setVal568(int v) {
this.val568 = v;
}
public long getVal569() {
return val569;
}
public void setVal569(long v) {
this.val569 = v;
}
public String getVal570() {
return val570;
}
public void setVal570(String v) {
this.val570 = v;
}
public int getVal571() {
return val571;
}
public void setVal571(int v) {
this.val571 = v;
}
public long getVal572() {
return val572;
}
public void setVal572(long v) {
this.val572 = v;
}
public String getVal573() {
return val573;
}
public void setVal573(String v) {
this.val573 = v;
}
public int getVal574() {
return val574;
}
public void setVal574(int v) {
this.val574 = v;
}
public long getVal575() {
return val575;
}
public void setVal575(long v) {
this.val575 = v;
}
public String getVal576() {
return val576;
}
public void setVal576(String v) {
this.val576 = v;
}
public int getVal577() {
return val577;
}
public void setVal577(int v) {
this.val577 = v;
}
public long getVal578() {
return val578;
}
public void setVal578(long v) {
this.val578 = v;
}
public String getVal579() {
return val579;
}
public void setVal579(String v) {
this.val579 = v;
}
public int getVal580() {
return val580;
}
public void setVal580(int v) {
this.val580 = v;
}
public long getVal581() {
return val581;
}
public void setVal581(long v) {
this.val581 = v;
}
public String getVal582() {
return val582;
}
public void setVal582(String v) {
this.val582 = v;
}
public int getVal583() {
return val583;
}
public void setVal583(int v) {
this.val583 = v;
}
public long getVal584() {
return val584;
}
public void setVal584(long v) {
this.val584 = v;
}
public String getVal585() {
return val585;
}
public void setVal585(String v) {
this.val585 = v;
}
public int getVal586() {
return val586;
}
public void setVal586(int v) {
this.val586 = v;
}
public long getVal587() {
return val587;
}
public void setVal587(long v) {
this.val587 = v;
}
public String getVal588() {
return val588;
}
public void setVal588(String v) {
this.val588 = v;
}
public int getVal589() {
return val589;
}
public void setVal589(int v) {
this.val589 = v;
}
public long getVal590() {
return val590;
}
public void setVal590(long v) {
this.val590 = v;
}
public String getVal591() {
return val591;
}
public void setVal591(String v) {
this.val591 = v;
}
public int getVal592() {
return val592;
}
public void setVal592(int v) {
this.val592 = v;
}
public long getVal593() {
return val593;
}
public void setVal593(long v) {
this.val593 = v;
}
public String getVal594() {
return val594;
}
public void setVal594(String v) {
this.val594 = v;
}
public int getVal595() {
return val595;
}
public void setVal595(int v) {
this.val595 = v;
}
public long getVal596() {
return val596;
}
public void setVal596(long v) {
this.val596 = v;
}
public String getVal597() {
return val597;
}
public void setVal597(String v) {
this.val597 = v;
}
public int getVal598() {
return val598;
}
public void setVal598(int v) {
this.val598 = v;
}
public long getVal599() {
return val599;
}
public void setVal599(long v) {
this.val599 = v;
}
public String getVal600() {
return val600;
}
public void setVal600(String v) {
this.val600 = v;
}
public int getVal601() {
return val601;
}
public void setVal601(int v) {
this.val601 = v;
}
public long getVal602() {
return val602;
}
public void setVal602(long v) {
this.val602 = v;
}
public String getVal603() {
return val603;
}
public void setVal603(String v) {
this.val603 = v;
}
public int getVal604() {
return val604;
}
public void setVal604(int v) {
this.val604 = v;
}
public long getVal605() {
return val605;
}
public void setVal605(long v) {
this.val605 = v;
}
public String getVal606() {
return val606;
}
public void setVal606(String v) {
this.val606 = v;
}
public int getVal607() {
return val607;
}
public void setVal607(int v) {
this.val607 = v;
}
public long getVal608() {
return val608;
}
public void setVal608(long v) {
this.val608 = v;
}
public String getVal609() {
return val609;
}
public void setVal609(String v) {
this.val609 = v;
}
public int getVal610() {
return val610;
}
public void setVal610(int v) {
this.val610 = v;
}
public long getVal611() {
return val611;
}
public void setVal611(long v) {
this.val611 = v;
}
public String getVal612() {
return val612;
}
public void setVal612(String v) {
this.val612 = v;
}
public int getVal613() {
return val613;
}
public void setVal613(int v) {
this.val613 = v;
}
public long getVal614() {
return val614;
}
public void setVal614(long v) {
this.val614 = v;
}
public String getVal615() {
return val615;
}
public void setVal615(String v) {
this.val615 = v;
}
public int getVal616() {
return val616;
}
public void setVal616(int v) {
this.val616 = v;
}
public long getVal617() {
return val617;
}
public void setVal617(long v) {
this.val617 = v;
}
public String getVal618() {
return val618;
}
public void setVal618(String v) {
this.val618 = v;
}
public int getVal619() {
return val619;
}
public void setVal619(int v) {
this.val619 = v;
}
public long getVal620() {
return val620;
}
public void setVal620(long v) {
this.val620 = v;
}
public String getVal621() {
return val621;
}
public void setVal621(String v) {
this.val621 = v;
}
public int getVal622() {
return val622;
}
public void setVal622(int v) {
this.val622 = v;
}
public long getVal623() {
return val623;
}
public void setVal623(long v) {
this.val623 = v;
}
public String getVal624() {
return val624;
}
public void setVal624(String v) {
this.val624 = v;
}
public int getVal625() {
return val625;
}
public void setVal625(int v) {
this.val625 = v;
}
public long getVal626() {
return val626;
}
public void setVal626(long v) {
this.val626 = v;
}
public String getVal627() {
return val627;
}
public void setVal627(String v) {
this.val627 = v;
}
public int getVal628() {
return val628;
}
public void setVal628(int v) {
this.val628 = v;
}
public long getVal629() {
return val629;
}
public void setVal629(long v) {
this.val629 = v;
}
public String getVal630() {
return val630;
}
public void setVal630(String v) {
this.val630 = v;
}
public int getVal631() {
return val631;
}
public void setVal631(int v) {
this.val631 = v;
}
public long getVal632() {
return val632;
}
public void setVal632(long v) {
this.val632 = v;
}
public String getVal633() {
return val633;
}
public void setVal633(String v) {
this.val633 = v;
}
public int getVal634() {
return val634;
}
public void setVal634(int v) {
this.val634 = v;
}
public long getVal635() {
return val635;
}
public void setVal635(long v) {
this.val635 = v;
}
public String getVal636() {
return val636;
}
public void setVal636(String v) {
this.val636 = v;
}
public int getVal637() {
return val637;
}
public void setVal637(int v) {
this.val637 = v;
}
public long getVal638() {
return val638;
}
public void setVal638(long v) {
this.val638 = v;
}
public String getVal639() {
return val639;
}
public void setVal639(String v) {
this.val639 = v;
}
public int getVal640() {
return val640;
}
public void setVal640(int v) {
this.val640 = v;
}
public long getVal641() {
return val641;
}
public void setVal641(long v) {
this.val641 = v;
}
public String getVal642() {
return val642;
}
public void setVal642(String v) {
this.val642 = v;
}
public int getVal643() {
return val643;
}
public void setVal643(int v) {
this.val643 = v;
}
public long getVal644() {
return val644;
}
public void setVal644(long v) {
this.val644 = v;
}
public String getVal645() {
return val645;
}
public void setVal645(String v) {
this.val645 = v;
}
public int getVal646() {
return val646;
}
public void setVal646(int v) {
this.val646 = v;
}
public long getVal647() {
return val647;
}
public void setVal647(long v) {
this.val647 = v;
}
public String getVal648() {
return val648;
}
public void setVal648(String v) {
this.val648 = v;
}
public int getVal649() {
return val649;
}
public void setVal649(int v) {
this.val649 = v;
}
public long getVal650() {
return val650;
}
public void setVal650(long v) {
this.val650 = v;
}
public String getVal651() {
return val651;
}
public void setVal651(String v) {
this.val651 = v;
}
public int getVal652() {
return val652;
}
public void setVal652(int v) {
this.val652 = v;
}
public long getVal653() {
return val653;
}
public void setVal653(long v) {
this.val653 = v;
}
public String getVal654() {
return val654;
}
public void setVal654(String v) {
this.val654 = v;
}
public int getVal655() {
return val655;
}
public void setVal655(int v) {
this.val655 = v;
}
public long getVal656() {
return val656;
}
public void setVal656(long v) {
this.val656 = v;
}
public String getVal657() {
return val657;
}
public void setVal657(String v) {
this.val657 = v;
}
public int getVal658() {
return val658;
}
public void setVal658(int v) {
this.val658 = v;
}
public long getVal659() {
return val659;
}
public void setVal659(long v) {
this.val659 = v;
}
public String getVal660() {
return val660;
}
public void setVal660(String v) {
this.val660 = v;
}
public int getVal661() {
return val661;
}
public void setVal661(int v) {
this.val661 = v;
}
public long getVal662() {
return val662;
}
public void setVal662(long v) {
this.val662 = v;
}
public String getVal663() {
return val663;
}
public void setVal663(String v) {
this.val663 = v;
}
public int getVal664() {
return val664;
}
public void setVal664(int v) {
this.val664 = v;
}
public long getVal665() {
return val665;
}
public void setVal665(long v) {
this.val665 = v;
}
public String getVal666() {
return val666;
}
public void setVal666(String v) {
this.val666 = v;
}
public int getVal667() {
return val667;
}
public void setVal667(int v) {
this.val667 = v;
}
public long getVal668() {
return val668;
}
public void setVal668(long v) {
this.val668 = v;
}
public String getVal669() {
return val669;
}
public void setVal669(String v) {
this.val669 = v;
}
public int getVal670() {
return val670;
}
public void setVal670(int v) {
this.val670 = v;
}
public long getVal671() {
return val671;
}
public void setVal671(long v) {
this.val671 = v;
}
public String getVal672() {
return val672;
}
public void setVal672(String v) {
this.val672 = v;
}
public int getVal673() {
return val673;
}
public void setVal673(int v) {
this.val673 = v;
}
public long getVal674() {
return val674;
}
public void setVal674(long v) {
this.val674 = v;
}
public String getVal675() {
return val675;
}
public void setVal675(String v) {
this.val675 = v;
}
public int getVal676() {
return val676;
}
public void setVal676(int v) {
this.val676 = v;
}
public long getVal677() {
return val677;
}
public void setVal677(long v) {
this.val677 = v;
}
public String getVal678() {
return val678;
}
public void setVal678(String v) {
this.val678 = v;
}
public int getVal679() {
return val679;
}
public void setVal679(int v) {
this.val679 = v;
}
public long getVal680() {
return val680;
}
public void setVal680(long v) {
this.val680 = v;
}
public String getVal681() {
return val681;
}
public void setVal681(String v) {
this.val681 = v;
}
public int getVal682() {
return val682;
}
public void setVal682(int v) {
this.val682 = v;
}
public long getVal683() {
return val683;
}
public void setVal683(long v) {
this.val683 = v;
}
public String getVal684() {
return val684;
}
public void setVal684(String v) {
this.val684 = v;
}
public int getVal685() {
return val685;
}
public void setVal685(int v) {
this.val685 = v;
}
public long getVal686() {
return val686;
}
public void setVal686(long v) {
this.val686 = v;
}
public String getVal687() {
return val687;
}
public void setVal687(String v) {
this.val687 = v;
}
public int getVal688() {
return val688;
}
public void setVal688(int v) {
this.val688 = v;
}
public long getVal689() {
return val689;
}
public void setVal689(long v) {
this.val689 = v;
}
public String getVal690() {
return val690;
}
public void setVal690(String v) {
this.val690 = v;
}
public int getVal691() {
return val691;
}
public void setVal691(int v) {
this.val691 = v;
}
public long getVal692() {
return val692;
}
public void setVal692(long v) {
this.val692 = v;
}
public String getVal693() {
return val693;
}
public void setVal693(String v) {
this.val693 = v;
}
public int getVal694() {
return val694;
}
public void setVal694(int v) {
this.val694 = v;
}
public long getVal695() {
return val695;
}
public void setVal695(long v) {
this.val695 = v;
}
public String getVal696() {
return val696;
}
public void setVal696(String v) {
this.val696 = v;
}
public int getVal697() {
return val697;
}
public void setVal697(int v) {
this.val697 = v;
}
public long getVal698() {
return val698;
}
public void setVal698(long v) {
this.val698 = v;
}
public String getVal699() {
return val699;
}
public void setVal699(String v) {
this.val699 = v;
}
public int getVal700() {
return val700;
}
public void setVal700(int v) {
this.val700 = v;
}
public long getVal701() {
return val701;
}
public void setVal701(long v) {
this.val701 = v;
}
public String getVal702() {
return val702;
}
public void setVal702(String v) {
this.val702 = v;
}
public int getVal703() {
return val703;
}
public void setVal703(int v) {
this.val703 = v;
}
public long getVal704() {
return val704;
}
public void setVal704(long v) {
this.val704 = v;
}
public String getVal705() {
return val705;
}
public void setVal705(String v) {
this.val705 = v;
}
public int getVal706() {
return val706;
}
public void setVal706(int v) {
this.val706 = v;
}
public long getVal707() {
return val707;
}
public void setVal707(long v) {
this.val707 = v;
}
public String getVal708() {
return val708;
}
public void setVal708(String v) {
this.val708 = v;
}
public int getVal709() {
return val709;
}
public void setVal709(int v) {
this.val709 = v;
}
public long getVal710() {
return val710;
}
public void setVal710(long v) {
this.val710 = v;
}
public String getVal711() {
return val711;
}
public void setVal711(String v) {
this.val711 = v;
}
public int getVal712() {
return val712;
}
public void setVal712(int v) {
this.val712 = v;
}
public long getVal713() {
return val713;
}
public void setVal713(long v) {
this.val713 = v;
}
public String getVal714() {
return val714;
}
public void setVal714(String v) {
this.val714 = v;
}
public int getVal715() {
return val715;
}
public void setVal715(int v) {
this.val715 = v;
}
public long getVal716() {
return val716;
}
public void setVal716(long v) {
this.val716 = v;
}
public String getVal717() {
return val717;
}
public void setVal717(String v) {
this.val717 = v;
}
public int getVal718() {
return val718;
}
public void setVal718(int v) {
this.val718 = v;
}
public long getVal719() {
return val719;
}
public void setVal719(long v) {
this.val719 = v;
}
public String getVal720() {
return val720;
}
public void setVal720(String v) {
this.val720 = v;
}
public int getVal721() {
return val721;
}
public void setVal721(int v) {
this.val721 = v;
}
public long getVal722() {
return val722;
}
public void setVal722(long v) {
this.val722 = v;
}
public String getVal723() {
return val723;
}
public void setVal723(String v) {
this.val723 = v;
}
public int getVal724() {
return val724;
}
public void setVal724(int v) {
this.val724 = v;
}
public long getVal725() {
return val725;
}
public void setVal725(long v) {
this.val725 = v;
}
public String getVal726() {
return val726;
}
public void setVal726(String v) {
this.val726 = v;
}
public int getVal727() {
return val727;
}
public void setVal727(int v) {
this.val727 = v;
}
public long getVal728() {
return val728;
}
public void setVal728(long v) {
this.val728 = v;
}
public String getVal729() {
return val729;
}
public void setVal729(String v) {
this.val729 = v;
}
public int getVal730() {
return val730;
}
public void setVal730(int v) {
this.val730 = v;
}
public long getVal731() {
return val731;
}
public void setVal731(long v) {
this.val731 = v;
}
public String getVal732() {
return val732;
}
public void setVal732(String v) {
this.val732 = v;
}
public int getVal733() {
return val733;
}
public void setVal733(int v) {
this.val733 = v;
}
public long getVal734() {
return val734;
}
public void setVal734(long v) {
this.val734 = v;
}
public String getVal735() {
return val735;
}
public void setVal735(String v) {
this.val735 = v;
}
public int getVal736() {
return val736;
}
public void setVal736(int v) {
this.val736 = v;
}
public long getVal737() {
return val737;
}
public void setVal737(long v) {
this.val737 = v;
}
public String getVal738() {
return val738;
}
public void setVal738(String v) {
this.val738 = v;
}
public int getVal739() {
return val739;
}
public void setVal739(int v) {
this.val739 = v;
}
public long getVal740() {
return val740;
}
public void setVal740(long v) {
this.val740 = v;
}
public String getVal741() {
return val741;
}
public void setVal741(String v) {
this.val741 = v;
}
public int getVal742() {
return val742;
}
public void setVal742(int v) {
this.val742 = v;
}
public long getVal743() {
return val743;
}
public void setVal743(long v) {
this.val743 = v;
}
public String getVal744() {
return val744;
}
public void setVal744(String v) {
this.val744 = v;
}
public int getVal745() {
return val745;
}
public void setVal745(int v) {
this.val745 = v;
}
public long getVal746() {
return val746;
}
public void setVal746(long v) {
this.val746 = v;
}
public String getVal747() {
return val747;
}
public void setVal747(String v) {
this.val747 = v;
}
public int getVal748() {
return val748;
}
public void setVal748(int v) {
this.val748 = v;
}
public long getVal749() {
return val749;
}
public void setVal749(long v) {
this.val749 = v;
}
public String getVal750() {
return val750;
}
public void setVal750(String v) {
this.val750 = v;
}
public int getVal751() {
return val751;
}
public void setVal751(int v) {
this.val751 = v;
}
public long getVal752() {
return val752;
}
public void setVal752(long v) {
this.val752 = v;
}
public String getVal753() {
return val753;
}
public void setVal753(String v) {
this.val753 = v;
}
public int getVal754() {
return val754;
}
public void setVal754(int v) {
this.val754 = v;
}
public long getVal755() {
return val755;
}
public void setVal755(long v) {
this.val755 = v;
}
public String getVal756() {
return val756;
}
public void setVal756(String v) {
this.val756 = v;
}
public int getVal757() {
return val757;
}
public void setVal757(int v) {
this.val757 = v;
}
public long getVal758() {
return val758;
}
public void setVal758(long v) {
this.val758 = v;
}
public String getVal759() {
return val759;
}
public void setVal759(String v) {
this.val759 = v;
}
public int getVal760() {
return val760;
}
public void setVal760(int v) {
this.val760 = v;
}
public long getVal761() {
return val761;
}
public void setVal761(long v) {
this.val761 = v;
}
public String getVal762() {
return val762;
}
public void setVal762(String v) {
this.val762 = v;
}
public int getVal763() {
return val763;
}
public void setVal763(int v) {
this.val763 = v;
}
public long getVal764() {
return val764;
}
public void setVal764(long v) {
this.val764 = v;
}
public String getVal765() {
return val765;
}
public void setVal765(String v) {
this.val765 = v;
}
public int getVal766() {
return val766;
}
public void setVal766(int v) {
this.val766 = v;
}
public long getVal767() {
return val767;
}
public void setVal767(long v) {
this.val767 = v;
}
public String getVal768() {
return val768;
}
public void setVal768(String v) {
this.val768 = v;
}
public int getVal769() {
return val769;
}
public void setVal769(int v) {
this.val769 = v;
}
public long getVal770() {
return val770;
}
public void setVal770(long v) {
this.val770 = v;
}
public String getVal771() {
return val771;
}
public void setVal771(String v) {
this.val771 = v;
}
public int getVal772() {
return val772;
}
public void setVal772(int v) {
this.val772 = v;
}
public long getVal773() {
return val773;
}
public void setVal773(long v) {
this.val773 = v;
}
public String getVal774() {
return val774;
}
public void setVal774(String v) {
this.val774 = v;
}
public int getVal775() {
return val775;
}
public void setVal775(int v) {
this.val775 = v;
}
public long getVal776() {
return val776;
}
public void setVal776(long v) {
this.val776 = v;
}
public String getVal777() {
return val777;
}
public void setVal777(String v) {
this.val777 = v;
}
public int getVal778() {
return val778;
}
public void setVal778(int v) {
this.val778 = v;
}
public long getVal779() {
return val779;
}
public void setVal779(long v) {
this.val779 = v;
}
public String getVal780() {
return val780;
}
public void setVal780(String v) {
this.val780 = v;
}
public int getVal781() {
return val781;
}
public void setVal781(int v) {
this.val781 = v;
}
public long getVal782() {
return val782;
}
public void setVal782(long v) {
this.val782 = v;
}
public String getVal783() {
return val783;
}
public void setVal783(String v) {
this.val783 = v;
}
public int getVal784() {
return val784;
}
public void setVal784(int v) {
this.val784 = v;
}
public long getVal785() {
return val785;
}
public void setVal785(long v) {
this.val785 = v;
}
public String getVal786() {
return val786;
}
public void setVal786(String v) {
this.val786 = v;
}
public int getVal787() {
return val787;
}
public void setVal787(int v) {
this.val787 = v;
}
public long getVal788() {
return val788;
}
public void setVal788(long v) {
this.val788 = v;
}
public String getVal789() {
return val789;
}
public void setVal789(String v) {
this.val789 = v;
}
public int getVal790() {
return val790;
}
public void setVal790(int v) {
this.val790 = v;
}
public long getVal791() {
return val791;
}
public void setVal791(long v) {
this.val791 = v;
}
public String getVal792() {
return val792;
}
public void setVal792(String v) {
this.val792 = v;
}
public int getVal793() {
return val793;
}
public void setVal793(int v) {
this.val793 = v;
}
public long getVal794() {
return val794;
}
public void setVal794(long v) {
this.val794 = v;
}
public String getVal795() {
return val795;
}
public void setVal795(String v) {
this.val795 = v;
}
public int getVal796() {
return val796;
}
public void setVal796(int v) {
this.val796 = v;
}
public long getVal797() {
return val797;
}
public void setVal797(long v) {
this.val797 = v;
}
public String getVal798() {
return val798;
}
public void setVal798(String v) {
this.val798 = v;
}
public int getVal799() {
return val799;
}
public void setVal799(int v) {
this.val799 = v;
}
public long getVal800() {
return val800;
}
public void setVal800(long v) {
this.val800 = v;
}
public String getVal801() {
return val801;
}
public void setVal801(String v) {
this.val801 = v;
}
public int getVal802() {
return val802;
}
public void setVal802(int v) {
this.val802 = v;
}
public long getVal803() {
return val803;
}
public void setVal803(long v) {
this.val803 = v;
}
public String getVal804() {
return val804;
}
public void setVal804(String v) {
this.val804 = v;
}
public int getVal805() {
return val805;
}
public void setVal805(int v) {
this.val805 = v;
}
public long getVal806() {
return val806;
}
public void setVal806(long v) {
this.val806 = v;
}
public String getVal807() {
return val807;
}
public void setVal807(String v) {
this.val807 = v;
}
public int getVal808() {
return val808;
}
public void setVal808(int v) {
this.val808 = v;
}
public long getVal809() {
return val809;
}
public void setVal809(long v) {
this.val809 = v;
}
public String getVal810() {
return val810;
}
public void setVal810(String v) {
this.val810 = v;
}
public int getVal811() {
return val811;
}
public void setVal811(int v) {
this.val811 = v;
}
public long getVal812() {
return val812;
}
public void setVal812(long v) {
this.val812 = v;
}
public String getVal813() {
return val813;
}
public void setVal813(String v) {
this.val813 = v;
}
public int getVal814() {
return val814;
}
public void setVal814(int v) {
this.val814 = v;
}
public long getVal815() {
return val815;
}
public void setVal815(long v) {
this.val815 = v;
}
public String getVal816() {
return val816;
}
public void setVal816(String v) {
this.val816 = v;
}
public int getVal817() {
return val817;
}
public void setVal817(int v) {
this.val817 = v;
}
public long getVal818() {
return val818;
}
public void setVal818(long v) {
this.val818 = v;
}
public String getVal819() {
return val819;
}
public void setVal819(String v) {
this.val819 = v;
}
public int getVal820() {
return val820;
}
public void setVal820(int v) {
this.val820 = v;
}
public long getVal821() {
return val821;
}
public void setVal821(long v) {
this.val821 = v;
}
public String getVal822() {
return val822;
}
public void setVal822(String v) {
this.val822 = v;
}
public int getVal823() {
return val823;
}
public void setVal823(int v) {
this.val823 = v;
}
public long getVal824() {
return val824;
}
public void setVal824(long v) {
this.val824 = v;
}
public String getVal825() {
return val825;
}
public void setVal825(String v) {
this.val825 = v;
}
public int getVal826() {
return val826;
}
public void setVal826(int v) {
this.val826 = v;
}
public long getVal827() {
return val827;
}
public void setVal827(long v) {
this.val827 = v;
}
public String getVal828() {
return val828;
}
public void setVal828(String v) {
this.val828 = v;
}
public int getVal829() {
return val829;
}
public void setVal829(int v) {
this.val829 = v;
}
public long getVal830() {
return val830;
}
public void setVal830(long v) {
this.val830 = v;
}
public String getVal831() {
return val831;
}
public void setVal831(String v) {
this.val831 = v;
}
public int getVal832() {
return val832;
}
public void setVal832(int v) {
this.val832 = v;
}
public long getVal833() {
return val833;
}
public void setVal833(long v) {
this.val833 = v;
}
public String getVal834() {
return val834;
}
public void setVal834(String v) {
this.val834 = v;
}
public int getVal835() {
return val835;
}
public void setVal835(int v) {
this.val835 = v;
}
public long getVal836() {
return val836;
}
public void setVal836(long v) {
this.val836 = v;
}
public String getVal837() {
return val837;
}
public void setVal837(String v) {
this.val837 = v;
}
public int getVal838() {
return val838;
}
public void setVal838(int v) {
this.val838 = v;
}
public long getVal839() {
return val839;
}
public void setVal839(long v) {
this.val839 = v;
}
public String getVal840() {
return val840;
}
public void setVal840(String v) {
this.val840 = v;
}
public int getVal841() {
return val841;
}
public void setVal841(int v) {
this.val841 = v;
}
public long getVal842() {
return val842;
}
public void setVal842(long v) {
this.val842 = v;
}
public String getVal843() {
return val843;
}
public void setVal843(String v) {
this.val843 = v;
}
public int getVal844() {
return val844;
}
public void setVal844(int v) {
this.val844 = v;
}
public long getVal845() {
return val845;
}
public void setVal845(long v) {
this.val845 = v;
}
public String getVal846() {
return val846;
}
public void setVal846(String v) {
this.val846 = v;
}
public int getVal847() {
return val847;
}
public void setVal847(int v) {
this.val847 = v;
}
public long getVal848() {
return val848;
}
public void setVal848(long v) {
this.val848 = v;
}
public String getVal849() {
return val849;
}
public void setVal849(String v) {
this.val849 = v;
}
public int getVal850() {
return val850;
}
public void setVal850(int v) {
this.val850 = v;
}
public long getVal851() {
return val851;
}
public void setVal851(long v) {
this.val851 = v;
}
public String getVal852() {
return val852;
}
public void setVal852(String v) {
this.val852 = v;
}
public int getVal853() {
return val853;
}
public void setVal853(int v) {
this.val853 = v;
}
public long getVal854() {
return val854;
}
public void setVal854(long v) {
this.val854 = v;
}
public String getVal855() {
return val855;
}
public void setVal855(String v) {
this.val855 = v;
}
public int getVal856() {
return val856;
}
public void setVal856(int v) {
this.val856 = v;
}
public long getVal857() {
return val857;
}
public void setVal857(long v) {
this.val857 = v;
}
public String getVal858() {
return val858;
}
public void setVal858(String v) {
this.val858 = v;
}
public int getVal859() {
return val859;
}
public void setVal859(int v) {
this.val859 = v;
}
public long getVal860() {
return val860;
}
public void setVal860(long v) {
this.val860 = v;
}
public String getVal861() {
return val861;
}
public void setVal861(String v) {
this.val861 = v;
}
public int getVal862() {
return val862;
}
public void setVal862(int v) {
this.val862 = v;
}
public long getVal863() {
return val863;
}
public void setVal863(long v) {
this.val863 = v;
}
public String getVal864() {
return val864;
}
public void setVal864(String v) {
this.val864 = v;
}
public int getVal865() {
return val865;
}
public void setVal865(int v) {
this.val865 = v;
}
public long getVal866() {
return val866;
}
public void setVal866(long v) {
this.val866 = v;
}
public String getVal867() {
return val867;
}
public void setVal867(String v) {
this.val867 = v;
}
public int getVal868() {
return val868;
}
public void setVal868(int v) {
this.val868 = v;
}
public long getVal869() {
return val869;
}
public void setVal869(long v) {
this.val869 = v;
}
public String getVal870() {
return val870;
}
public void setVal870(String v) {
this.val870 = v;
}
public int getVal871() {
return val871;
}
public void setVal871(int v) {
this.val871 = v;
}
public long getVal872() {
return val872;
}
public void setVal872(long v) {
this.val872 = v;
}
public String getVal873() {
return val873;
}
public void setVal873(String v) {
this.val873 = v;
}
public int getVal874() {
return val874;
}
public void setVal874(int v) {
this.val874 = v;
}
public long getVal875() {
return val875;
}
public void setVal875(long v) {
this.val875 = v;
}
public String getVal876() {
return val876;
}
public void setVal876(String v) {
this.val876 = v;
}
public int getVal877() {
return val877;
}
public void setVal877(int v) {
this.val877 = v;
}
public long getVal878() {
return val878;
}
public void setVal878(long v) {
this.val878 = v;
}
public String getVal879() {
return val879;
}
public void setVal879(String v) {
this.val879 = v;
}
public int getVal880() {
return val880;
}
public void setVal880(int v) {
this.val880 = v;
}
public long getVal881() {
return val881;
}
public void setVal881(long v) {
this.val881 = v;
}
public String getVal882() {
return val882;
}
public void setVal882(String v) {
this.val882 = v;
}
public int getVal883() {
return val883;
}
public void setVal883(int v) {
this.val883 = v;
}
public long getVal884() {
return val884;
}
public void setVal884(long v) {
this.val884 = v;
}
public String getVal885() {
return val885;
}
public void setVal885(String v) {
this.val885 = v;
}
public int getVal886() {
return val886;
}
public void setVal886(int v) {
this.val886 = v;
}
public long getVal887() {
return val887;
}
public void setVal887(long v) {
this.val887 = v;
}
public String getVal888() {
return val888;
}
public void setVal888(String v) {
this.val888 = v;
}
public int getVal889() {
return val889;
}
public void setVal889(int v) {
this.val889 = v;
}
public long getVal890() {
return val890;
}
public void setVal890(long v) {
this.val890 = v;
}
public String getVal891() {
return val891;
}
public void setVal891(String v) {
this.val891 = v;
}
public int getVal892() {
return val892;
}
public void setVal892(int v) {
this.val892 = v;
}
public long getVal893() {
return val893;
}
public void setVal893(long v) {
this.val893 = v;
}
public String getVal894() {
return val894;
}
public void setVal894(String v) {
this.val894 = v;
}
public int getVal895() {
return val895;
}
public void setVal895(int v) {
this.val895 = v;
}
}
| mit |
delahiri/TamuHACK | CodeRunner/src/main/java/backend/CodeTester.java | 1463 | package backend;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
enum CompileResult {
COMPILE_ERROR, COMPILE_SUCCESS
}
enum ExecutorResult {
RUN_ERROR, RUN_SUCCESS, TLE
}
public class CodeTester {
public String codeString;
public void testCode() throws IOException {
StringBuilder javaFileString = new StringBuilder(codeString);
List<String> mainMethodList = new ArrayList<String>();
mainMethodList.add(
"public static void main(String[] args) {Solution s = new Solution();System.out.println(s.giveSum(1,2));}");
mainMethodList.add(
"public static void main(String[] args) {Solution s = new Solution();System.out.println(s.giveSum(2,3));}");
for (String mainMethod : mainMethodList) {
String javaFilePath = CompAndExecHelper.createJavaFile(javaFileString, mainMethod).getCanonicalPath();
Compiler compiler = new Compiler();
CompileResult cr = compiler.compile("java", javaFilePath);
if (CompileResult.valueOf("COMPILE_ERROR").equals(cr)) {
System.out.println("Compilation failed!");
System.exit(1);
}
if (CompileResult.valueOf("COMPILE_SUCCESS").equals(cr)) {
System.out.println("Compilation Completed Successfully!");
}
ExecutorResult execResult = Executor.execute("java", 500);
if (ExecutorResult.valueOf("TLE").equals(execResult)) {
System.out.println("Time Limit Exceeded");
System.exit(1);
}
}
}
}
| mit |
egore/dri-log-client | src/main/java/de/egore911/drilog/StartActivity.java | 1704 | /* StartActivity.java
*
* Copyright (c) 2015 Christoph Brill <egore911@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package de.egore911.drilog;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import de.egore911.drilog.tasks.LoadChannelsTask;
import de.egore911.drilog.util.Constants;
public class StartActivity extends AppCompatActivity {
private void loadData() {
String url = Constants.BASE_URL + "channels.php";
new LoadChannelsTask(this).execute(url);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadData();
}
}
| mit |
RobertTheNerd/sc2geeks | web-api/app/replayUtility/src/main/java/com/sc2geeks/replayUtility/crawler/Crawler_GosugamersNet.java | 3180 | package com.sc2geeks.replayUtility.crawler;
import com.sc2geeks.replay.model.GameEntity;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: robert
* Date: 10/21/12
* Time: 8:21 AM
* To change this template use File | Settings | File Templates.
*/
public class Crawler_GosugamersNet extends CrawlerBase
{
private int start = 0;
private static final String BASE_URL_REPLAY_LIST = "http://www.gosugamers.net/starcraft2/replays.php?&start=";
private static final String BASE_URL_REPLAY_DETAIL = "http://www.gosugamers.net/starcraft2";
@Override
protected void getReplayFromUrl(String gameUrl, GameEntity game) throws Exception
{
XPath xpath = createXPath();
String source = GetHtml(gameUrl, "UTF-8");
Node node = standardizeXml(source);
game.setExternalId(getReplayId(gameUrl));
game.setEvent(getGameEvent(node, xpath));
game.setExternalRepFile(getDownloadUrl(node, xpath));
}
private static String getReplayId(String gameUrl)
{
return gameUrl.toLowerCase().replace(BASE_URL_REPLAY_DETAIL + "/replays/", "");
}
private static String getGameEvent(Node node, XPath xpath)
{
try
{
NodeList trList = (NodeList) xpath.evaluate("//div[@id='cont']//td[@class='cont_middle']//tr", node, XPathConstants.NODESET);
for (int i = 0; i < trList.getLength(); i ++)
{
Node trNode = trList.item(i);
Node firstTd = (Node) xpath.evaluate(".//td", trNode, XPathConstants.NODE);
if (firstTd == null || firstTd.getTextContent() == null)
continue;
if (firstTd.getTextContent().trim().compareToIgnoreCase("event") == 0)
{
return trNode.getChildNodes().item(1).getTextContent().trim();
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
private static String getDownloadUrl(Node node, XPath xpath) throws XPathExpressionException
{
Node downloadNode = (Node) xpath.evaluate("//div[@id='cont']//td[@class='cont_middle']//p//a", node, XPathConstants.NODE);
return BASE_URL_REPLAY_DETAIL + "/replays/" + downloadNode.getAttributes().getNamedItem("href").getNodeValue();
}
@Override
protected List<String> getReplayUrls()
{
String listUrl = BASE_URL_REPLAY_LIST + Integer.toString(start);
start += 100;
try
{
String source = GetHtml(listUrl, "UTF-8");
Node node = standardizeXml(source);
XPath xpath = createXPath();
NodeList nodes = (NodeList) xpath.evaluate("//table[@class='multitable']//tr[@class='wide_middle']", node, XPathConstants.NODESET);
LinkedHashSet<String> linkSet = new LinkedHashSet<String>();
for (int i = 0; i < nodes.getLength(); i++)
{
String link = nodes.item(i).getAttributes().getNamedItem("id").getNodeValue();
linkSet.add(BASE_URL_REPLAY_DETAIL + link);
}
return Arrays.asList(linkSet.toArray(new String[0]));
} catch (Exception e)
{
e.printStackTrace();
return null;
}
}
@Override
protected String getSourceName()
{
return "gosugamers.net";
}
}
| mit |
highj/highj | src/main/java/org/highj/data/instance/list/ListOrd1.java | 963 | package org.highj.data.instance.list;
import org.derive4j.hkt.__;
import org.highj.Hkt;
import org.highj.data.List;
import org.highj.data.ord.Ord;
import org.highj.data.ord.Ord1;
import org.highj.data.ord.Ordering;
import static org.highj.data.List.µ;
public interface ListOrd1 extends Ord1<µ> {
@Override
default <A> Ord<__<List.µ, A>> cmp(Ord<? super A> ord) {
return (x,y) -> {
List<A> xs = Hkt.asList(x);
List<A> ys = Hkt.asList(y);
while(! xs.isEmpty() && ! ys.isEmpty()) {
Ordering ordering = ord.cmp(xs.head(), ys.head());
if (ordering != Ordering.EQ) {
return ordering;
}
xs = xs.tail();
ys = ys.tail();
}
if (xs.isEmpty() && ys.isEmpty()) {
return Ordering.EQ;
}
return xs.isEmpty() ? Ordering.LT : Ordering.GT;
};
}
}
| mit |
Forec/learn | 2015.7-8/8.17/date_8_17/TestFile.java | 798 | package date_8_17;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TestFile {
public static void main(String[] args) {
try {
FileReader fr = new FileReader("test.txt");
BufferedReader br = new BufferedReader(fr);
FileWriter fw =new FileWriter("testnew.txt");
BufferedWriter bw =new BufferedWriter(fw);
String line;
while ((line = br.readLine()) !=null){
bw.write(line+"\n");
}
bw.flush();
bw.close();
br.close();
fr.close();
fw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| mit |
sriharshachilakapati/SilenceEngine | silenceengine/src/main/java/com/shc/silenceengine/collision/broadphase/package-info.java | 1296 | /*
* The MIT License (MIT)
*
* Copyright (c) 2014-2017 Sri Harsha Chilakapati
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* <p>A package for the broad-phase collision detector implementations.</p>
*/
package com.shc.silenceengine.collision.broadphase; | mit |
bhanuc/Imprezy | hacku4/gen/com/example/hacku4/R.java | 3916 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.hacku4;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final int raghavbb=0x7f020001;
}
public static final class id {
public static final int RelativeLayout1=0x7f080006;
public static final int action_settings=0x7f080014;
public static final int btn_create_se=0x7f08000d;
public static final int button1=0x7f080004;
public static final int button2=0x7f080001;
public static final int button3=0x7f080002;
public static final int editText1=0x7f080011;
public static final int editText2=0x7f080012;
public static final int editText3=0x7f080013;
public static final int exi_ser_code=0x7f08000f;
public static final int exi_ser_id=0x7f080010;
public static final int exi_ser_name=0x7f08000e;
public static final int imager=0x7f080003;
public static final int lv_ser=0x7f080000;
public static final int ser_key=0x7f08000a;
public static final int ser_name=0x7f080007;
public static final int ser_type=0x7f08000c;
public static final int ser_url=0x7f080009;
public static final int ser_values=0x7f080008;
public static final int ser_wantedv=0x7f08000b;
public static final int textView1=0x7f080005;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int exist_ser=0x7f030001;
public static final int initial=0x7f030002;
public static final int m1=0x7f030003;
public static final int ser_splaser=0x7f030004;
public static final int yaho_ser=0x7f030005;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int hello_world=0x7f050002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| mit |
MGautier/Programacion | Android/M4ListImageView/app/src/main/java/ugr/sc/m4listimageview/MainActivity.java | 794 | package ugr.sc.m4listimageview;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
public class MainActivity extends ActionBarActivity {
ListView list;
ImageListAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
list = (ListView) findViewById(R.id.lista);
adapter = new ImageListAdapter<Partido>(this,ListadoPartidos.partidos);
list.setAdapter(adapter);
}
}
| mit |
Studentoflife/CalQ | main/java/awqatty/b/FunctionDictionary/FunctionType.java | 2077 | package awqatty.b.FunctionDictionary;
public enum FunctionType {
SOURCE, // denotes ListTree container (remove?)
BLANK,
RAW_TEXT,
NUMBER,
CONST_E,
CONST_PI,
ADD,
SUBTRACT,
MULTIPLY,
DIVIDE,
NEGATIVE,
ABS,
SQUARE,
MULT_INVERSE,
POWER,
SQRT,
EXP_E,
EXP_10,
LN,
LOG10,
SINE,
COSINE,
TANGENT,
ARCSINE,
ARCCOSINE,
ARCTANGENT,
HYPSINE,
HYPCOSINE,
HYPTANGENT,
ARHYPSINE,
ARHYPCOSINE,
ARHYPTANGENT,
FACTORIAL,
NCK,
NPK,
REMAINDER,
GCD,
LCM,
;
// Property-Check Methods
public boolean isFunction() {
switch (this) {
case SOURCE:
case BLANK:
case NUMBER:
case CONST_PI:
case CONST_E:
return false;
default:
return true;
}
}
public boolean isCommutative() {
switch (this) {
case ADD:
case MULTIPLY:
case GCD:
case LCM:
return true;
default:
return false;
}
}
public boolean isCoreType() {
switch (this) {
case SQUARE:
case MULT_INVERSE:
case EXP_E:
case EXP_10:
return false;
default:
return true;
}
}
/*
public int defaultArgCount() {
switch(this) {
case BLANK:
case NUMBER:
case CONST_PI:
case CONST_E:
return 0;
case SQUARE:
case SQRT:
case NEGATIVE:
case ABS:
case MULT_INVERSE:
case EXP_E:
case EXP_10:
case LN:
case LOG10:
case SINE:
case COSINE:
case TANGENT:
case ARCSINE:
case ARCCOSINE:
case ARCTANGENT:
case HYPSINE:
case HYPCOSINE:
case HYPTANGENT:
case ARHYPSINE:
case ARHYPCOSINE:
case ARHYPTANGENT:
case FACTORIAL:
case SOURCE:
return 1;
case ADD:
case SUBTRACT:
case MULTIPLY:
case DIVIDE:
case POWER:
case NCK:
case NPK:
return 2;
default:
throw new RuntimeException();
}
}
public boolean doesEncapsulateBranches() {
switch (this) {
case DIVIDE:
case SQRT:
return true;
default:
return false;
}
}
public boolean isEncapsulated() {
switch(this) {
case BLANK:
case NUMBER:
case DIVIDE:
case SQRT:
case POWER:
return true;
default:
return false;
}
}
//*/
}
| mit |
playlyfe/playlyfe-java-sdk | src/main/java/com/playlyfe/sdk/PlaylyfeGraphQL.java | 3498 | package com.playlyfe.sdk;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.concurrent.TimeUnit;
import com.auth0.jwt.Algorithm;
import com.auth0.jwt.JWTSigner;
import com.google.gson.Gson;
import com.playlyfe.sdk.Playlyfe.PlaylyfeException;
import com.squareup.okhttp.HttpUrl;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
public class PlaylyfeGraphQL {
class GraphQLRequest {
String query;
Object variables;
GraphQLRequest(String query, Object variables) {
this.query= query;
this.variables = variables;
}
}
public String secret;
public String endPoint;
private static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
private final OkHttpClient client = new OkHttpClient();
private final Gson gson = new Gson();
/* Creates a new PlaylyfeGraphQL SDK client
* @params String secret Your user secret
* @params String endPoint The GraphQL API server endPoint
*/
public PlaylyfeGraphQL(String secret, String endPoint) {
this.secret = secret;
this.endPoint = endPoint;
client.setConnectTimeout(10, TimeUnit.SECONDS);
client.setWriteTimeout(10, TimeUnit.SECONDS);
client.setReadTimeout(30, TimeUnit.SECONDS);
}
/* Creates a jwt token
* @params String user_id the id of the user who is going to make the requests
* @params int expires the expiration time for the token in seconds
*/
public String createJWT(String user_id, int expires) {
JWTSigner signer = new JWTSigner(this.secret);
HashMap<String, Object> claims = new HashMap<String, Object>();
String token = signer.sign(claims, new JWTSigner.Options().setExpirySeconds(expires).setAlgorithm(Algorithm.HS256));
token = user_id + ':' + token;
return token;
}
/* Makes a graphql request to the given endpoint
* @params String query the query you would like to make
* @params Object variables the input parameters for use by the query
*/
public Object graphql(String token, String query, Object variables) throws IOException, PlaylyfeException {
HttpUrl url = HttpUrl.parse(this.endPoint + "?access_token="+token);
System.out.println(url);
String req_body = gson.toJson(new GraphQLRequest(query, variables));
Request request = new Request.Builder()
.url(url)
.post(RequestBody.create(MEDIA_TYPE_JSON, req_body))
.build();
Response response = client.newCall(request).execute();
return parseJson(response.body().string());
}
private Object parseJson(String content) throws PlaylyfeException {
if(content.contains("error") && content.contains("error_description")) {
Map<String, String> errors = (Map<String, String>) gson.fromJson(content, Object.class);
throw new PlaylyfeException(errors.get("error"), errors.get("error_description"));
}
else if (content.contains("errors")) {
Map<String, Object> response = (Map<String, Object>) gson.fromJson(content, Object.class);
List<Object> errors = (List<Object>)response.get("errors");
Map<String, Object> err = (Map<String, Object>) errors.get(0);
throw new PlaylyfeException((String)err.get("code"), (String)err.get("message"));
}
else {
return gson.fromJson(content, Object.class);
}
}
} | mit |
renes/meister-eder | skill/src/main/java/at/rs/alexa/me/ResponseHelper.java | 1544 | package at.rs.alexa.me;
import com.amazon.speech.speechlet.SpeechletResponse;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.Reprompt;
import com.amazon.speech.ui.SimpleCard;
public class ResponseHelper {
private static final String DEFAULT_CARD_TITLE = "Meister Eder";
public static SpeechletResponse createSpeechletResponse(String speechText, String repromptText,
boolean waitForMore) {
SimpleCard card = createDefaultCard(speechText);
return createPlainTextOutput(speechText, repromptText, waitForMore, card);
}
private static SpeechletResponse createPlainTextOutput(String speechText, String repromptText, boolean waitForMore, SimpleCard card) {
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
if (waitForMore) {
PlainTextOutputSpeech repromptSpeech = new PlainTextOutputSpeech();
repromptSpeech.setText(repromptText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(repromptSpeech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
} else {
return SpeechletResponse.newTellResponse(speech, card);
}
}
private static SimpleCard createDefaultCard(String speechText) {
SimpleCard card = new SimpleCard();
card.setTitle(DEFAULT_CARD_TITLE);
card.setContent(speechText);
return card;
}
}
| mit |
afcrowther/algorithms | src/main/java/com/afcrowther/algorithms/library/Edge.java | 4866 | /******************************************************************************
* Compilation: javac Edge.java
* Execution: java Edge
* Dependencies: StdOut.java
*
* Immutable weighted edge.
*
******************************************************************************/
package com.afcrowther.algorithms.library;
/**
* The {@code Edge} class represents a weighted edge in an
* {@link EdgeWeightedGraph}. Each edge consists of two integers
* (naming the two vertices) and a real-value weight. The data type
* provides methods for accessing the two endpoints of the edge and
* the weight. The natural order for this data type is by
* ascending order of weight.
* <p>
* For additional documentation, see <a href="http://algs4.cs.princeton.edu/43mst">Section 4.3</a> of
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public class Edge implements Comparable<Edge> {
private final int v;
private final int w;
private final double weight;
/**
* Initializes an edge between vertices {@code v} and {@code w} of
* the given {@code weight}.
*
* @param v one vertex
* @param w the other vertex
* @param weight the weight of this edge
* @throws IndexOutOfBoundsException if either {@code v} or {@code w}
* is a negative integer
* @throws IllegalArgumentException if {@code weight} is {@code NaN}
*/
public Edge(int v, int w, double weight) {
if (v < 0) throw new IndexOutOfBoundsException("Vertex name must be a nonnegative integer");
if (w < 0) throw new IndexOutOfBoundsException("Vertex name must be a nonnegative integer");
if (Double.isNaN(weight)) throw new IllegalArgumentException("Weight is NaN");
this.v = v;
this.w = w;
this.weight = weight;
}
/**
* Returns the weight of this edge.
*
* @return the weight of this edge
*/
public double weight() {
return weight;
}
/**
* Returns either endpoint of this edge.
*
* @return either endpoint of this edge
*/
public int either() {
return v;
}
/**
* Returns the endpoint of this edge that is different from the given vertex.
*
* @param vertex one endpoint of this edge
* @return the other endpoint of this edge
* @throws IllegalArgumentException if the vertex is not one of the
* endpoints of this edge
*/
public int other(int vertex) {
if (vertex == v) return w;
else if (vertex == w) return v;
else throw new IllegalArgumentException("Illegal endpoint");
}
/**
* Compares two edges by weight.
* Note that {@code compareTo()} is not consistent with {@code equals()},
* which uses the reference equality implementation inherited from {@code Object}.
*
* @param that the other edge
* @return a negative integer, zero, or positive integer depending on whether
* the weight of this is less than, equal to, or greater than the
* argument edge
*/
@Override
public int compareTo(Edge that) {
return Double.compare(this.weight, that.weight);
}
/**
* Returns a string representation of this edge.
*
* @return a string representation of this edge
*/
public String toString() {
return String.format("%d-%d %.5f", v, w, weight);
}
/**
* Unit tests the {@code Edge} data type.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
Edge e = new Edge(12, 34, 5.67);
StdOut.println(e);
}
}
/******************************************************************************
* Copyright 2002-2016, Robert Sedgewick and Kevin Wayne.
*
* This file is part of algs4.jar, which accompanies the textbook
*
* Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne,
* Addison-Wesley Professional, 2011, ISBN 0-321-57351-X.
* http://algs4.cs.princeton.edu
*
*
* algs4.jar is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* algs4.jar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with algs4.jar. If not, see http://www.gnu.org/licenses.
******************************************************************************/
| mit |
chrisco210/CryspScript | src/cf/rachlinski/cryspscript/runtime/dataStructs/stack/ExecutionStack.java | 2346 | package cf.rachlinski.cryspscript.runtime.dataStructs.stack;
import cf.rachlinski.cryspscript.prerun.parsing.line.Line;
import cf.rachlinski.cryspscript.runtime.codeAccessors.Registers;
import cf.rachlinski.cryspscript.runtime.dataStructs.variable.InstructionPointer;
import cf.rachlinski.cryspscript.runtime.dataStructs.variable.Register;
import cf.rachlinski.cryspscript.runtime.exec.keyword.UnmatchedNestException;
public class ExecutionStack extends Stack<Line>
{
/**
* Construct a new Stack object given contents
*
* @param contents the array of {@code Variable<?>}s to initialize
*/
public ExecutionStack(Line[] contents)
{
super(contents);
}
/**
* Return an instruction pointer to the next occurrence of the specified value, accounting for nested statements
* @param instruction the {@code Class} object corresponding to the next instruction
* @return an InstructionPointer to the next occurrence of the specified instruction
*/
public InstructionPointer getNextOccNest(String instruction)
{
int occurrence = -1;
int nesting = 0; //Represents how deep in a region we are
String start = contents[Registers.r1.getValue()].getKeywordText();
for(int i = Registers.r1.getValue() + 1; i < contents.length; i++)
{
if((nesting == 0) && contents[i].getKeywordText().equals(instruction))
{
occurrence = i;
break;
}
if(contents[i].getKeywordText().equals(start)) //Increase nesting level if another statement is added
{
nesting++;
}
else if(contents[i].getKeywordText().equals(instruction)) //Decrease nesting level if a closing statement is added
{
nesting--;
}
}
if(occurrence != -1)
{
return new InstructionPointer(occurrence);
}
throw new UnmatchedNestException(start, instruction);
}
public boolean finished()
{
return Registers.r1.getValue() >= contents.length;
}
/**
* Execute the instruction at the current instruction pointer, specified by {@code Registers.r1}, and increment
* the instruction pointer by 1
*/
public void exec()
{
if(Registers.r1.getValue() >= contents.length)
return;
System.out.println("Contents:" + contents[Registers.r1.getValue()]);
System.out.println("Contents:" + contents[Registers.r1.getValue()].parse());
contents[Registers.r1.getValue()].parse().run();
Registers.r1.inc();
}
}
| mit |
ISKU/Algorithm | BOJ/1162/Main.java | 2342 | /*
* Author: Minho Kim (ISKU)
* Date: September 21, 2018
* E-mail: minho.kim093@gmail.com
*
* https://github.com/ISKU/Algorithm
* https://www.acmicpc.net/problem/1162
*/
import java.util.*;
import java.io.*;
public class Main {
private static ArrayList<Edge>[] graph;
private static int N, K;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
int M = Integer.parseInt(st.nextToken());
K = Integer.parseInt(st.nextToken());
graph = new ArrayList[N + 1];
for (int i = 1; i <= N; i++)
graph[i] = new ArrayList<Edge>();
while (M-- > 0) {
st = new StringTokenizer(br.readLine());
int u = Integer.parseInt(st.nextToken());
int v = Integer.parseInt(st.nextToken());
long w = Long.parseLong(st.nextToken());
graph[u].add(new Edge(v, w));
graph[v].add(new Edge(u, w));
}
long[][] cost = dijkstra();
long min = Long.MAX_VALUE;
for (int i = 0; i <= K; i++)
min = Math.min(min, cost[i][N]);
System.out.print(min);
}
private static long[][] dijkstra() {
Queue<Edge> pq = new PriorityQueue<>(new Comparator<Edge>() {
@Override
public int compare(Edge o1, Edge o2) {
return Long.compare(o1.weight, o2.weight);
}
});
long[][] dist = new long[K + 1][N + 1];
for (int i = 0; i <= K; i++)
Arrays.fill(dist[i], Long.MAX_VALUE);
pq.add(new Edge(1, 0, 0));
dist[0][1] = 0;
while (!pq.isEmpty()) {
Edge u = pq.poll();
if (u.weight > dist[u.k][u.vertex])
continue;
for (Edge v : graph[u.vertex]) {
if (u.k + 1 <= K) {
long cost = u.weight;
if (cost < dist[u.k + 1][v.vertex]) {
dist[u.k + 1][v.vertex] = cost;
pq.add(new Edge(v.vertex, cost, u.k + 1));
}
}
long cost = u.weight + v.weight;
if (cost < dist[u.k][v.vertex]) {
dist[u.k][v.vertex] = cost;
pq.add(new Edge(v.vertex, cost, u.k));
}
}
}
return dist;
}
private static class Edge {
public int vertex, k;
public long weight;
public Edge(int vertex, long weight) {
this.vertex = vertex;
this.weight = weight;
}
public Edge(int vertex, long weight, int k) {
this.vertex = vertex;
this.weight = weight;
this.k = k;
}
}
} | mit |
ykcilborw/Euterpe | src/main/java/wroblicky/andrew/euterpe/charts/HistoricalChartDAOImpl.java | 1002 | package wroblicky.andrew.euterpe.charts;
public class HistoricalChartDAOImpl implements HistoricalChartDAO {
@Override
public void createHistoricalChartTable(TimeInterval timeInterval,
TimeScope timeScope, ChartCategory chartCategory) {
// TODO Auto-generated method stub
// columns: object_id, num_plays, last_interval_plays
// future projections and heating up calculated in business logic layer
}
@Override
public void insertHistoricalChart(HistoricalChart historicalChart) {
// TODO Auto-generated method stub
}
@Override
public HistoricalChart getHistoricalChart(TimeInterval timeInterval,
TimeScope timeScope, ChartCategory chartCategory) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deleteHistoricalChart(TimeInterval timeInterval,
TimeScope timeScope, ChartCategory chartCategory) {
// TODO Auto-generated method stub
}
@Override
public void dropHistoricalCharts() {
// TODO Auto-generated method stub
}
}
| mit |
OguzhanAydin61/SpotifyApi | spotify-api/src/main/java/oguzhan/spotify/webapi/android/models/TracksPager.java | 869 | package oguzhan.spotify.webapi.android.models;
import android.os.Parcel;
import android.os.Parcelable;
public class TracksPager implements Parcelable {
public Pager<Track> tracks;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(this.tracks, 0);
}
public TracksPager() {
}
protected TracksPager(Parcel in) {
this.tracks = in.readParcelable(Pager.class.getClassLoader());
}
public static final Parcelable.Creator<TracksPager> CREATOR = new Parcelable.Creator<TracksPager>() {
public TracksPager createFromParcel(Parcel source) {
return new TracksPager(source);
}
public TracksPager[] newArray(int size) {
return new TracksPager[size];
}
};
}
| mit |
bcvsolutions/CzechIdMng | Realization/backend/rpt/rpt-impl/src/test/java/eu/bcvsolutions/idm/rpt/service/TestReportExecutor.java | 1543 | package eu.bcvsolutions.idm.rpt.service;
import java.io.FileNotFoundException;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.springframework.context.annotation.Description;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.collect.Lists;
import eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto;
import eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto;
import eu.bcvsolutions.idm.rpt.api.dto.RptReportDto;
import eu.bcvsolutions.idm.rpt.api.exception.ReportGenerateException;
import eu.bcvsolutions.idm.rpt.api.executor.AbstractReportExecutor;
/**
* Test identity reports.
*
* @author Radek Tomiška
*
*/
@Component
@Description("Test identieties report")
public class TestReportExecutor extends AbstractReportExecutor {
protected static final String REPORT_NAME = "test-report";
protected static final List<IdmIdentityDto> identities;
static {
IdmIdentityDto identityOne = new IdmIdentityDto("one");
IdmIdentityDto identityTwo = new IdmIdentityDto("two");
identities = Lists.newArrayList(identityOne, identityTwo);
}
@Override
public String getName() {
return REPORT_NAME;
}
@Override
protected IdmAttachmentDto generateData(RptReportDto report) {
try {
return createAttachment(report, IOUtils.toInputStream(getMapper().writeValueAsString(identities)));
} catch (FileNotFoundException | JsonProcessingException ex) {
throw new ReportGenerateException(report.getName(), ex);
}
}
}
| mit |
KorneevVV/otus-java-2017-10-korneev | hmw15/src/main/java/ru/otus/korneev/hmw15/app/MsgToDB.java | 538 | package ru.otus.korneev.hmw15.app;
import ru.otus.korneev.hmw15.messageSystem.Address;
import ru.otus.korneev.hmw15.messageSystem.Addressee;
import ru.otus.korneev.hmw15.messageSystem.Message;
public abstract class MsgToDB extends Message {
public MsgToDB(Address from, Address to) {
super(from, to);
}
@Override
public void exec(Addressee addressee) {
if (addressee instanceof DBService) {
exec((DBService) addressee);
}
}
public abstract void exec(DBService dbService);
}
| mit |
TheBrazillianForgersTeam/ArchitectFriend | src/main/java/cf/brforgers/mods/ArchitectFriend/blocks/RedstonerBlock.java | 1712 | package cf.brforgers.mods.ArchitectFriend.blocks;
import cf.brforgers.mods.ArchitectFriend.ArchitectFriend;
import cf.brforgers.mods.ArchitectFriend.Lib;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class RedstonerBlock extends Block {
@SideOnly(Side.CLIENT)
protected IIcon[] icons = new IIcon[16];
public RedstonerBlock() {
super(Material.rock);
this.setBlockName("RedstonerBlock");
this.setBlockTextureName(Lib.TEXTURE_PATH + "Redstoner");
this.setCreativeTab(ArchitectFriend.tabArchitect);
this.setHardness(2.0F);
this.setResistance(6.0F);
this.setStepSound(soundTypeStone);
}
/* Metadata Override */
@Override
public int damageDropped(int meta) {
return meta;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 16; i++) {
list.add(new ItemStack(item, 1, i));
}
}
/* Texture Override */
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return this.icons[meta];
}
@Override
public void registerBlockIcons(IIconRegister reg) {
for (int i = 0; i < 16; i++) {
this.icons[i] = reg.registerIcon(this.textureName + "_" + i);
}
}
}
| mit |
TSavo/apiomatic | src/main/java/com/github/tsavo/apiomatic/rest/RestCommand.java | 4788 | package com.github.tsavo.apiomatic.rest;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
public class RestCommand<Request, Response> {
private RestTemplate restTemplate;// = new RestTemplate();
private String url;
private Request requestModel;
private ResponseEntity<Response> responseEntity;
private Class<Response> responseModel;
private HttpHeaderDelegate headerDelegate = new NoAuthHeaderDelegate();
private static SchemeRegistry schemeRegistry = new SchemeRegistry();
private static PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
static{
schemeRegistry.register(
new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
schemeRegistry.register(
new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
// Increase max total connection to 200
cm.setMaxTotal(100);
// Increase default max connection per route to 20
cm.setDefaultMaxPerRoute(20);
}
public RestCommand() {
restTemplate=new RestTemplate(new HttpComponentsClientHttpRequestFactory(new DefaultHttpClient(cm)));
}
public RestCommand(final String aUserName, final String aPassword, final String anAuthDomain, int aPort) {
DefaultHttpClient client = new DefaultHttpClient(cm);
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(aUserName, aPassword);
client.getCredentialsProvider().setCredentials(new AuthScope(anAuthDomain, aPort, AuthScope.ANY_REALM), credentials);
HttpComponentsClientHttpRequestFactory commons = new HttpComponentsClientHttpRequestFactory(client);
restTemplate = new RestTemplate(commons);
}
public RestCommand(final String aUrl, Request aRequest, Class<Response> aResponse) {
this();
url = aUrl;
requestModel = aRequest;
responseModel = aResponse;
}
public RestCommand(final String aUrl, Class<Response> aResponse) {
this();
url = aUrl;
responseModel = aResponse;
}
public RestCommand(final String aUrl, Class<Response> aResponse, HttpHeaderDelegate aHeaderDelegate) {
this(aUrl, aResponse);
headerDelegate = aHeaderDelegate;
}
public RestCommand(final String aUrl, Request aRequest, Class<Response> aResponse, HttpHeaderDelegate aHeaderDelegate) {
this(aUrl, aRequest, aResponse);
headerDelegate = aHeaderDelegate;
}
public void delete() {
if (getRequestModel() == null) {
responseEntity=restTemplate.exchange(getUrl(), HttpMethod.DELETE, new HttpEntity<String>(getHttpHeaders()),responseModel);
} else {
responseEntity=restTemplate.exchange(getUrl(), HttpMethod.DELETE, new HttpEntity<Request>(getRequestModel(), getHttpHeaders()), responseModel);
}
}
public Response get() {
responseEntity=restTemplate.exchange(getUrl(), HttpMethod.GET, new HttpEntity<String>(getHttpHeaders()), getResponseModel());
return responseEntity.getBody();
}
public HttpHeaders getHttpHeaders() {
return headerDelegate.getHttpHeaders();
}
public String getUrl() {
return url;
}
public Request getRequestModel() {
return requestModel;
}
public Class<Response> getResponseModel() {
return responseModel;
}
public Response post() {
responseEntity=restTemplate.exchange(getUrl(), HttpMethod.POST, new HttpEntity<Request>(getRequestModel(), getHttpHeaders()), getResponseModel());
return responseEntity.getBody();
}
public Response put() {
responseEntity=restTemplate.exchange(getUrl(), HttpMethod.PUT, new HttpEntity<Request>(getRequestModel(), getHttpHeaders()), getResponseModel());
return responseEntity.getBody();
}
public void setUrl(final String path) {
this.url = path;
}
public void setRequestModel(final Request requestModel) {
this.requestModel = requestModel;
}
public void setResponseModel(final Class<Response> responseModel) {
this.responseModel = responseModel;
}
public HttpHeaderDelegate getHeaderDelegate() {
return headerDelegate;
}
public void setHeaderDelegate(HttpHeaderDelegate headerDelegate) {
this.headerDelegate = headerDelegate;
}
public HttpStatus getHttpStatus(){
return responseEntity.getStatusCode();
}
}
| mit |
TheBlackChamber/commons-encryption | src/main/java/net/theblackchamber/crypto/util/KeystoreUtils.java | 6679 | /**
* The MIT License (MIT)
*
* Copyright (c) 2014 Seamus Minogue
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.theblackchamber.crypto.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import net.theblackchamber.crypto.model.KeyConfig;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
/**
* Utility used for managing a keystore. Generate keys etc.
*
* @author sminogue
* @deprecated Use KeystoreUtils2
*/
public class KeystoreUtils {
/**
* Method which will generate a random Secret key and add it to a keystore
* with the entry name provided.
*
* @param config
* Configuration for generation of key.
* @throws NoSuchAlgorithmException
* @throws KeyStoreException
* @throws CertificateException
* @throws IOException
*/
public static void generateSecretKey(KeyConfig config)
throws NoSuchAlgorithmException, KeyStoreException,
CertificateException, IOException {
if (config == null || config.getKeyStoreFile() == null
|| StringUtils.isEmpty(config.getKeyEntryName())
|| config.getAlgorithm() == null) {
throw new KeyStoreException(
"Missing parameters, unable to create keystore.");
}
SecureRandom random = new SecureRandom();
KeyGenerator keygen = KeyGenerator.getInstance(config.getAlgorithm()
.getName(), new BouncyCastleProvider());
keygen.init(config.getKeySize(), random);
SecretKey key = keygen.generateKey();
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream fis = null;
if (config.getKeyStoreFile().exists()
&& FileUtils.sizeOf(config.getKeyStoreFile()) > 0) {
fis = new FileInputStream(config.getKeyStoreFile());
}
keyStore.load(fis, config.getKeyStorePassword().toCharArray());
KeyStore.ProtectionParameter protectionParameter = new KeyStore.PasswordProtection(
config.getKeyStorePassword().toCharArray());
KeyStore.SecretKeyEntry secretKeyEntry = new KeyStore.SecretKeyEntry(
key);
keyStore.setEntry(config.getKeyEntryName(), secretKeyEntry,
protectionParameter);
if (fis != null) {
fis.close();
}
FileOutputStream fos = new FileOutputStream(config.getKeyStoreFile());
keyStore.store(fos, config.getKeyStorePassword().toCharArray());
fos.close();
}
/**
* Method which will load a secret key from disk with the specified entry
* name.
*
* @param keystore
* {@link KeyStore} file to read.
* @param entryName
* Entry name of the key to be retrieved
* @param keyStorePassword
* Password used to open the {@link KeyStore}
* @return
* @throws KeyStoreException
* @throws NoSuchAlgorithmException
* @throws CertificateException
* @throws FileNotFoundException
* @throws IOException
* @throws UnrecoverableEntryException
*/
public static SecretKey getSecretKey(File keystore, String entryName,
String keyStorePassword) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, UnrecoverableEntryException {
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream fis = null;
if (keystore == null || !keystore.exists()
|| FileUtils.sizeOf(keystore) == 0) {
throw new FileNotFoundException();
}
if (StringUtils.isEmpty(keyStorePassword)) {
throw new KeyStoreException("No Keystore password provided.");
}
if (StringUtils.isEmpty(entryName)) {
throw new KeyStoreException("No Keystore entry name provided.");
}
fis = new FileInputStream(keystore);
return getSecretKey(fis, entryName, keyStorePassword);
}
/**
* Method which will load a secret key from an input stream with the
* specified entry name.
*
* @param keystore
* {@link KeyStore} file to read.
* @param entryName
* Entry name of the key to be retrieved
* @param keyStorePassword
* Password used to open the {@link KeyStore}
* @return
* @throws KeyStoreException
* @throws NoSuchAlgorithmException
* @throws CertificateException
* @throws IOException
* @throws UnrecoverableEntryException
*/
public static SecretKey getSecretKey(InputStream keyInputStream,
String entryName, String keyStorePassword)
throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException, UnrecoverableEntryException {
KeyStore keyStore = KeyStore.getInstance("JCEKS");
if (keyInputStream == null) {
throw new KeyStoreException("No Keystore stream provided.");
}
if (StringUtils.isEmpty(keyStorePassword)) {
throw new KeyStoreException("No Keystore password provided.");
}
if (StringUtils.isEmpty(entryName)) {
throw new KeyStoreException("No Keystore entry name provided.");
}
keyStore.load(keyInputStream, keyStorePassword.toCharArray());
KeyStore.ProtectionParameter protectionParameter = new KeyStore.PasswordProtection(
keyStorePassword.toCharArray());
KeyStore.SecretKeyEntry pkEntry = (KeyStore.SecretKeyEntry) keyStore
.getEntry(entryName, protectionParameter);
try {
return pkEntry.getSecretKey();
} finally {
keyInputStream.close();
}
}
}
| mit |
tuyendothanh/baohiendai | app/src/main/java/com/manuelmaly/hn/task/HNFeedTaskBase.java | 2670 | package com.manuelmaly.hn.task;
import android.util.Log;
import com.manuelmaly.hn.App;
import com.manuelmaly.hn.model.HNFeed;
import com.manuelmaly.hn.parser.HNFeedParser;
import com.manuelmaly.hn.reuse.CancelableRunnable;
import com.manuelmaly.hn.server.HNCredentials;
import com.manuelmaly.hn.server.IAPICommand;
import com.manuelmaly.hn.server.IAPICommand.RequestType;
import com.manuelmaly.hn.server.StringDownloadCommand;
import com.manuelmaly.hn.util.Const;
import com.manuelmaly.hn.util.ExceptionUtil;
import com.manuelmaly.hn.util.FileUtil;
import com.manuelmaly.hn.util.Run;
import java.util.HashMap;
public abstract class HNFeedTaskBase extends BaseTask<HNFeed> {
public HNFeedTaskBase(String notificationBroadcastIntentID, int taskCode) {
super(notificationBroadcastIntentID, taskCode);
}
@Override
public CancelableRunnable getTask() {
return new HNFeedTaskRunnable();
}
protected abstract String getFeedURL();
protected abstract int getCurrentPage();
class HNFeedTaskRunnable extends CancelableRunnable {
StringDownloadCommand mFeedDownload;
@Override
public void run() {
mFeedDownload = new StringDownloadCommand(getFeedURL(), getCurrentPage(), new HashMap<String, String>(), RequestType.GET, false, null,
App.getInstance(), HNCredentials.getCookieStore(App.getInstance()));
mFeedDownload.run();
if (mCancelled)
mErrorCode = IAPICommand.ERROR_CANCELLED_BY_USER;
else
mErrorCode = mFeedDownload.getErrorCode();
if (!mCancelled && mErrorCode == IAPICommand.ERROR_NONE) {
HNFeedParser feedParser = new HNFeedParser();
try {
mResult = feedParser.parseHNPost(mFeedDownload.getListResponseContent());
mResult.setNextPageURL(getFeedURL());
mResult.setNextPage(getCurrentPage()+mResult.getPosts().size());
Run.inBackground(new Runnable() {
public void run() {
FileUtil.setLastHNFeed(mResult);
}
});
} catch (Exception e) {
mResult = null;
ExceptionUtil.sendToGoogleAnalytics(e, Const.GAN_ACTION_PARSING);
Log.e("HNFeedTask", "HNFeed Parser Error :(", e);
}
}
if (mResult == null)
mResult = new HNFeed();
}
@Override
public void onCancelled() {
mFeedDownload.cancel();
}
}
}
| mit |
liupangzi/codekata | leetcode/Algorithms/849.MaximizeDistanceToClosestPerson/Solution.java | 501 | class Solution {
public int maxDistToClosest(int[] seats) {
int start = 0, end = seats.length - 1;
while (seats[start] == 0) start++;
while (seats[end] == 0) end--;
int result = Math.max(start, seats.length - 1 - end);
while (start < end) {
int cursor = start + 1;
while (seats[cursor] == 0) cursor++;
result = Math.max(result, (cursor - start) / 2);
start = cursor;
}
return result;
}
}
| mit |
jcamposanok/introsde-2017-project | external/src/main/java/external/resource/misfit/MisfitActivityGoalsResource.java | 1417 | package external.resource.misfit;
import external.entity.misfit.MisfitActivityGoalList;
import external.oauth.MisfitAuthService;
import external.resource.MisfitResource;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.*;
import java.util.HashMap;
import java.util.Map;
public class MisfitActivityGoalsResource {
@Context
UriInfo uriInfo;
@Context
Request request;
private static String RESOURCE_NAME = "activity/goals";
private static String API_ENDPOINT = "/move/resource/v1/user/me/activity/goals";
public MisfitActivityGoalsResource(UriInfo uriInfo, Request request) {
MisfitAuthService.setResourceName(RESOURCE_NAME);
this.uriInfo = uriInfo;
this.request = request;
}
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response get(@QueryParam("start") String start, @QueryParam("end") String end) {
Map<String, String> params = new HashMap<>();
params.put("start_date", start);
params.put("end_date", end);
Response response = MisfitResource.getResponse(uriInfo, API_ENDPOINT, params);
if (response.getStatus() == 200) {
MisfitActivityGoalList entity = response.readEntity(MisfitActivityGoalList.class);
return Response.ok(entity).build();
}
return response;
}
}
| mit |
paine1690/cdp4j | src/main/java/io/webfolder/cdp/event/network/EventSourceMessageReceived.java | 2788 | /**
* The MIT License
* Copyright © 2017 WebFolder OÜ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package io.webfolder.cdp.event.network;
import io.webfolder.cdp.annotation.Domain;
import io.webfolder.cdp.annotation.EventName;
import io.webfolder.cdp.annotation.Experimental;
/**
* Fired when EventSource message is received
*/
@Experimental
@Domain("Network")
@EventName("eventSourceMessageReceived")
public class EventSourceMessageReceived {
private String requestId;
private Double timestamp;
private String eventName;
private String eventId;
private String data;
/**
* Request identifier.
*/
public String getRequestId() {
return requestId;
}
/**
* Request identifier.
*/
public void setRequestId(String requestId) {
this.requestId = requestId;
}
/**
* Timestamp.
*/
public Double getTimestamp() {
return timestamp;
}
/**
* Timestamp.
*/
public void setTimestamp(Double timestamp) {
this.timestamp = timestamp;
}
/**
* Message type.
*/
public String getEventName() {
return eventName;
}
/**
* Message type.
*/
public void setEventName(String eventName) {
this.eventName = eventName;
}
/**
* Message identifier.
*/
public String getEventId() {
return eventId;
}
/**
* Message identifier.
*/
public void setEventId(String eventId) {
this.eventId = eventId;
}
/**
* Message content.
*/
public String getData() {
return data;
}
/**
* Message content.
*/
public void setData(String data) {
this.data = data;
}
}
| mit |
InnovateUKGitHub/innovation-funding-service | common/ifs-resources/src/main/java/org/innovateuk/ifs/finance/builder/AssociateDevelopmentCostBuilder.java | 2053 | package org.innovateuk.ifs.finance.builder;
import org.innovateuk.ifs.BaseBuilder;
import org.innovateuk.ifs.finance.resource.cost.AssociateDevelopmentCost;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import java.util.function.BiConsumer;
import static java.util.Collections.emptyList;
import static org.innovateuk.ifs.base.amend.BaseBuilderAmendFunctions.uniqueIds;
public class AssociateDevelopmentCostBuilder extends BaseBuilder<AssociateDevelopmentCost, AssociateDevelopmentCostBuilder> {
public AssociateDevelopmentCostBuilder withId(Long... id) {
return withArraySetFieldByReflection("id", id);
}
public AssociateDevelopmentCostBuilder withDuration(Integer... value) {
return withArraySetFieldByReflection("duration", value);
}
public AssociateDevelopmentCostBuilder withCost(BigInteger... value) {
return withArraySetFieldByReflection("cost", value);
}
public AssociateDevelopmentCostBuilder withRole(String... value) {
return withArraySetFieldByReflection("role", value);
}
public AssociateDevelopmentCostBuilder withName(String... value) {
return withArraySetFieldByReflection("name", value);
}
public AssociateDevelopmentCostBuilder withTargetId(Long... value) {
return withArraySetFieldByReflection("targetId", value);
}
public static AssociateDevelopmentCostBuilder newAssociateDevelopmentCost() {
return new AssociateDevelopmentCostBuilder(emptyList()).with(uniqueIds());
}
private AssociateDevelopmentCostBuilder(List<BiConsumer<Integer, AssociateDevelopmentCost>> multiActions) {
super(multiActions);
}
@Override
protected AssociateDevelopmentCostBuilder createNewBuilderWithActions(List<BiConsumer<Integer, AssociateDevelopmentCost>> actions) {
return new AssociateDevelopmentCostBuilder(actions);
}
@Override
protected AssociateDevelopmentCost createInitial() {
return newInstance(AssociateDevelopmentCost.class);
}
} | mit |
dunkfordyce/cordova-ios-storekit | src/android/com/kuya/cordova/plugin/KuyaShop.java | 14633 | package com.kuya.cordova.plugin;
import android.content.Intent;
import android.content.res.Configuration;
import android.text.SpanWatcher;
import android.util.Log;
import android.util.SparseArray;
import com.kuya.cordova.plugin.util.*;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
/**
* Created by dunk on 04/09/15.
*/
public class KuyaShop extends CordovaPlugin {
private final String TAG = "KuyaShop";
// The helper object
IabHelper mHelper;
private SparseArray<CallbackContext> purchases = new SparseArray<CallbackContext>();
private int purchase_id = 1000;
private String getPublicKey() {
int billingKeyFromParam = cordova.getActivity().getResources().getIdentifier("billing_key_param", "string", cordova.getActivity().getPackageName());
if(billingKeyFromParam > 0) {
return cordova.getActivity().getString(billingKeyFromParam);
}
int billingKey = cordova.getActivity().getResources().getIdentifier("billing_key", "string", cordova.getActivity().getPackageName());
return cordova.getActivity().getString(billingKey);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
// Pass on the activity result to the helper for handling
if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
// not handled, so handle it ourselves (here's where you'd
// perform any handling of activity results not related to in-app
// billing...
super.onActivityResult(requestCode, resultCode, data);
}
else {
Log.d(TAG, "onActivityResult handled by IABUtil.");
}
}
public boolean execute(String action, JSONArray data, final CallbackContext callbackContext) {
try {
return executeSafe(action, data, callbackContext);
} catch( JSONException e ) {
callbackContext.error("unhandled json fail");
}
return true;
}
public boolean executeSafe(String action, JSONArray data, final CallbackContext callbackContext) throws JSONException {
if( "init".equals(action) ) {
init(data, callbackContext);
} else if( "details".equals(action) ) {
details(data, callbackContext);
} else if( "purchase".equals(action) ) {
purchase(data, callbackContext);
} else if( "subscribe".equals(action) ) {
subscribe(data, callbackContext);
} else if( "query".equals(action) ) {
query(data, callbackContext);
} else if( "consume".equals(action) ) {
consume(data, callbackContext);
} else {
return false;
}
return true;
}
private void init(JSONArray data, final CallbackContext callbackContext) {
String base64EncodedPublicKey = getPublicKey();
if (base64EncodedPublicKey.isEmpty()) {
callbackContext.error("no key found");
}
// Create the helper, passing it our context and the public key to verify signatures with
Log.d(TAG, "Creating IAB helper.");
mHelper = new IabHelper(cordova.getActivity().getApplicationContext(), base64EncodedPublicKey);
JSONObject options;
try {
options = data.getJSONObject(0);
} catch( JSONException e ) {
options = new JSONObject();
}
// enable debug logging (for a production application, you should set this to false).
mHelper.enableDebugLogging(options.optBoolean("debug"));
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
Log.d(TAG, "Setup finished.");
if (!result.isSuccess()) {
// Oh no, there was a problem.
callbackContext.error("Problem setting up in-app billing: " + result);
return;
}
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) {
callbackContext.error("The billing helper has been disposed");
}
callbackContext.success();
}
});
}
private void details(JSONArray data, final CallbackContext callbackContext) {
final List<String> skus = new ArrayList<String>();
JSONArray in_skus;
try {
in_skus = data.getJSONArray(0);
} catch( JSONException e ) {
callbackContext.error("no skus found");
return;
}
try {
for (int i = 0; i != in_skus.length(); i++) {
skus.add(in_skus.getString(i));
}
} catch( JSONException e ) {
callbackContext.error("error reading skus");
}
mHelper.queryInventoryAsync(true, skus, new IabHelper.QueryInventoryFinishedListener() {
@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv) {
if (result.isFailure()) {
callbackContext.error(result.getMessage());
return;
}
JSONObject js_result = new JSONObject();
for (String sku : skus) {
SkuDetails details = inv.getSkuDetails(sku);
try {
if (details == null) {
js_result.put(sku, null);
continue;
}
JSONObject out_details = new JSONObject();
out_details.put("price", details.getPrice());
out_details.put("description", details.getDescription());
out_details.put("title", details.getTitle());
out_details.put("type", details.getType());
js_result.put(sku, out_details);
} catch (JSONException e) {
callbackContext.error("error converting sku to json");
return;
}
}
callbackContext.success(js_result);
}
});
}
private void purchase(JSONArray data, final CallbackContext callbackContext) {
String sku;
try {
sku = data.getString(0);
} catch (JSONException e) {
callbackContext.error("no/bad sku");
return;
}
Log.d(TAG, "purchasing " + sku);
IabHelper.OnIabPurchaseFinishedListener iabPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
JSONObject ret = new JSONObject();
if (result.isFailure()) {
try {
ret.put("message", result.getMessage());
ret.put("response", result.getResponse());
} catch( JSONException e ) {
e.printStackTrace();
callbackContext.error("total fail");
return;
}
Log.d(TAG, "Error purchasing: " + result);
callbackContext.error(ret);
return;
}
try {
ret.put("developer_payload", info.getDeveloperPayload());
ret.put("item_type", info.getItemType());
ret.put("order_id", info.getOrderId());
ret.put("package_name", info.getPackageName());
ret.put("purchase_state", info.getPurchaseState());
ret.put("purchase_time", info.getPurchaseTime());
ret.put("signature", info.getSignature());
ret.put("sku", info.getSku());
ret.put("token", info.getToken());
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("error returning purchase");
return;
}
callbackContext.success(ret);
}
};
Log.d(TAG, "doing purchase request_id " + purchase_id);
cordova.setActivityResultCallback(this);
mHelper.launchPurchaseFlow(cordova.getActivity(), sku, purchase_id, iabPurchaseFinishedListener, "");
purchase_id ++;
}
private JSONObject jsonifyPurchase(Purchase purchase) throws JSONException {
JSONObject ret = new JSONObject();
ret.put("developer_payload", purchase.getDeveloperPayload());
ret.put("item_type", purchase.getItemType());
ret.put("order_id", purchase.getOrderId());
ret.put("package_name", purchase.getPackageName());
ret.put("purchase_state", purchase.getPurchaseState());
ret.put("purchase_time", purchase.getPurchaseTime());
ret.put("signature", purchase.getSignature());
ret.put("sku", purchase.getSku());
ret.put("token", purchase.getToken());
return ret;
}
private void subscribe(JSONArray data, final CallbackContext callbackContext) {
String sku;
String payload;
try {
sku = data.getString(0);
} catch (JSONException e) {
callbackContext.error("no/bad sku");
return;
}
if( data.length() < 2 ) {
payload = "";
} else {
try {
payload = data.getString(1);
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("bad payload");
return;
}
}
Log.d(TAG, "subscribe " + sku+" payload "+payload);
cordova.setActivityResultCallback(this);
mHelper.launchSubscriptionPurchaseFlow(
cordova.getActivity(),
sku,
purchase_id++,
new IabHelper.OnIabPurchaseFinishedListener() {
@Override
public void onIabPurchaseFinished(IabResult result, Purchase info) {
JSONObject ret = new JSONObject();
if (result.isFailure()) {
try {
ret.put("message", result.getMessage());
ret.put("response", result.getResponse());
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("total fail");
return;
}
Log.d(TAG, "Error purchasing: " + result);
callbackContext.error(ret);
return;
}
try {
ret = jsonifyPurchase(info);
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("error returning purchase");
return;
}
callbackContext.success(ret);
}
},
payload
);
}
private void query(JSONArray data, final CallbackContext callbackContext) {
final JSONArray skus;
try {
skus= data.getJSONArray(0);
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("bad arguments");
return;
}
mHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv) {
if (result.isFailure()) {
callbackContext.error(result.getMessage());
return;
}
JSONObject ret = new JSONObject();
String sku;
for( int i=0; i!= skus.length(); i++ ) {
try {
sku = skus.getString(i);
Log.d(TAG, "testing sku " + sku);
if( inv.hasPurchase(sku) ) {
ret.put(sku, jsonifyPurchase(inv.getPurchase(sku)));
} else {
ret.put(sku, false);
}
//ret.put(sku, inv.hasPurchase(sku));
} catch (JSONException e) {
e.printStackTrace();
continue;
}
}
callbackContext.success(ret);
}
});
}
private void consume(JSONArray data, final CallbackContext callbackContext) {
final String sku;
try {
sku = data.getString(0);
} catch (JSONException e) {
e.printStackTrace();
callbackContext.error("bad argument");
return;
}
mHelper.queryInventoryAsync(new IabHelper.QueryInventoryFinishedListener() {
@Override
public void onQueryInventoryFinished(IabResult result, Inventory inv) {
if (result.isFailure()) {
callbackContext.error(result.getMessage());
return;
}
if( !inv.hasPurchase(sku) ) {
callbackContext.error("not purchased");
return;
}
mHelper.consumeAsync(inv.getPurchase(sku), new IabHelper.OnConsumeFinishedListener() {
@Override
public void onConsumeFinished(Purchase purchase, IabResult result) {
if (result.isFailure()) {
callbackContext.error(result.getMessage());
return;
}
callbackContext.success();
}
});
}
});
}
}
| mit |
druzy/chromecast | druzy/chromecast/Global.java | 162 | package druzy.chromecast;
import druzy.version.Version;
public class Global {
public static final Version version=new Version("1");
private Global() {}
}
| mit |
NoYouShutup/CryptMeme | CryptMeme/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java | 3327 | /*
* Created on Sep 02, 2005
*
* This file is part of susidns project, see http://susi.i2p/
*
* Copyright (C) 2005 <susi23@mail.i2p>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Revision: 1.3 $
*/
package i2p.susi.dns;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.OrderedProperties;
public class ConfigBean extends BaseBean implements Serializable {
private String config;
private boolean saved;
public String getfileName() {
return configFile().toString();
}
public boolean isSaved() {
return saved;
}
public String getConfig()
{
if( config != null )
return config;
reload();
return config;
}
@Override
protected void reload()
{
super.reload();
StringBuilder buf = new StringBuilder(256);
for (Map.Entry<Object, Object> e : properties.entrySet()) {
buf.append((String) e.getKey()).append('=')
.append((String) e.getValue()).append('\n');
}
config = buf.toString();
saved = true;
}
private void save()
{
try {
// use loadProps to trim, use storeProps to sort and get line endings right
Properties props = new OrderedProperties();
DataHelper.loadProps(props, new ByteArrayInputStream(config.getBytes("UTF-8")));
synchronized (BaseBean.class) {
DataHelper.storeProps(props, configFile());
}
saved = true;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void setConfig(String config) {
// will come from form with \r\n line endings
this.config = config;
this.saved = false;
}
public String getMessages() {
String message = "";
if( action != null ) {
if (I2PAppContext.getGlobalContext().getBooleanProperty(BaseBean.PROP_PW_ENABLE) ||
(serial != null && serial.equals(lastSerial))) {
if(action.equals(_("Save"))) {
save();
message = _("Configuration saved.");
} else if (action.equals(_("Reload"))) {
reload();
message = _("Configuration reloaded.");
}
}
else {
message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit.")
+ ' ' +
_("If the problem persists, verify that you have cookies enabled in your browser.");
}
}
if( message.length() > 0 )
message = "<p class=\"messages\">" + message + "</p>";
return message;
}
}
| mit |
mrunde/Bachelor-Thesis | src/de/mrunde/bachelorthesis/basics/Route.java | 6751 | package de.mrunde.bachelorthesis.basics;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;
import com.mapquest.android.maps.GeoPoint;
/**
* The Route class stores all information about route segments, maneuvers,
* locations etc.
*
* @author Marius Runde
*/
public class Route {
/**
* Value to check if the JSON import succeeded
*/
private boolean importSuccessful;
/**
* These are the route segments between each turn action
*/
private List<RouteSegment> segments;
/**
* Store the currently used segment
*/
private int currentSegment;
/**
* All shape points that create the route
*/
private GeoPoint[] shapePoints;
/**
* Constructor of the Route class
*
* @param json
* Guidance object returned by the MapQuest API
*/
public Route(JSONObject json) {
// Some temporal variables
int[] maneuvers;
int[] linkIndexes;
GeoPoint[] decisionPoints;
double[] distances;
int[] shapePointIndexes;
// Extract the guidance information out of the raw JSON file
try {
JSONObject guidance = json.getJSONObject("guidance");
// --- Get the maneuver types and link indexes ---
// First store them in a temporal List
List<Integer> tempManeuverList = new ArrayList<Integer>();
List<Integer> tempLinkList = new ArrayList<Integer>();
JSONArray guidanceNodeCollection = guidance
.getJSONArray("GuidanceNodeCollection");
for (int i = 0; i < guidanceNodeCollection.length(); i++) {
if ((guidanceNodeCollection.getJSONObject(i))
.has("maneuverType")) {
tempManeuverList.add(guidanceNodeCollection
.getJSONObject(i).getInt("maneuverType"));
tempLinkList.add(guidanceNodeCollection.getJSONObject(i)
.getJSONArray("linkIds").getInt(0));
}
}
// Then store them in an array
maneuvers = new int[tempManeuverList.size()];
linkIndexes = new int[tempLinkList.size()];
for (int i = 0; i < maneuvers.length; i++) {
maneuvers[i] = tempManeuverList.get(i);
linkIndexes[i] = tempLinkList.get(i);
}
// --- Get the decision points ---
JSONArray shapePoints = guidance.getJSONArray("shapePoints");
decisionPoints = new GeoPoint[shapePoints.length() / 2];
int j = 0;
for (int i = 0; i < shapePoints.length() - 1; i += 2) {
decisionPoints[j] = new GeoPoint(shapePoints.getDouble(i),
(Double) shapePoints.get(i + 1));
j++;
}
// --- Get the distances and shape point indexes ---
JSONArray guidanceLinkCollection = guidance
.getJSONArray("GuidanceLinkCollection");
distances = new double[guidanceLinkCollection.length()];
shapePointIndexes = new int[guidanceLinkCollection.length()];
for (int i = 0; i < guidanceLinkCollection.length(); i++) {
distances[i] = guidanceLinkCollection.getJSONObject(i)
.getDouble("length");
shapePointIndexes[i] = guidanceLinkCollection.getJSONObject(i)
.getInt("shapeIndex");
}
// Create the route segments
createRouteSegments(maneuvers, linkIndexes, decisionPoints,
distances, shapePointIndexes);
// Set current route segment to first segment
this.currentSegment = 0;
// Initialize the shapePoints
this.shapePoints = decisionPoints;
// Import has been successful
this.importSuccessful = true;
} catch (JSONException e) {
// Import has not been successful
Log.e("InstructionManager",
"Could not extract the guidance JSONObject. This is the error message: "
+ e.getMessage());
this.importSuccessful = false;
}
}
/**
* Create the route segments out of the complete route information
*
* @param maneuvers
* The maneuver types
* @param linkIndexes
* All indexes of required entries in the
* <code>GuidanceLinkCollection</code>
* @param decisionPoints
* All shape points returned by the MapQuest API
* @param distances
* The distances of all street segments
* @param shapePointIndexes
* All indexes of "real" decision points" stored in
* <code>decisionPoints</code>
*/
private void createRouteSegments(int[] maneuvers, int[] linkIndexes,
GeoPoint[] decisionPoints, double[] distances,
int[] shapePointIndexes) {
this.segments = new ArrayList<RouteSegment>();
// Create the first route segment (starting position = null)
GeoPoint firstDecisionPoint = decisionPoints[shapePointIndexes[linkIndexes[0]]];
double firstDistance = 0;
for (int i = 0; i < linkIndexes[0]; i++) {
firstDistance += distances[i];
}
RouteSegment firstSegment = new RouteSegment(null, firstDecisionPoint,
maneuvers[0], (int) firstDistance);
this.segments.add(firstSegment);
// Create the rest of the route segments analog to the first segment
for (int i = 1; i < maneuvers.length; i++) {
GeoPoint lastDecisionPoint = decisionPoints[shapePointIndexes[linkIndexes[i - 1]]];
GeoPoint nextDecisionPoint = decisionPoints[shapePointIndexes[linkIndexes[i]]];
double nextDistance = 0;
for (int j = (i == 0) ? 0 : linkIndexes[i - 1]; j < linkIndexes[i]; j++) {
nextDistance += distances[j];
}
// Round the distance depending on its value and convert it from
// kilometers into meters
if (nextDistance >= 1) {
nextDistance = Math.round(nextDistance * 10) * 100;
} else {
nextDistance = Math.round(nextDistance * 100) * 10;
}
// Create the route segment
RouteSegment nextSegment = new RouteSegment(lastDecisionPoint,
nextDecisionPoint, maneuvers[i], (int) nextDistance);
this.segments.add(nextSegment);
}
}
/**
* @return Check if the JSON import has been successful
*/
public boolean isImportSuccessful() {
return this.importSuccessful;
}
/**
* Get the next route segment
*
* @return The next route segment.<br/>
* Null when the end of route segments has been reached.
*/
public RouteSegment getNextSegment() {
if (currentSegment < this.segments.size()) {
RouteSegment nextSegment = this.segments.get(this.currentSegment);
this.currentSegment++;
return nextSegment;
} else {
return null;
}
}
/**
* Get the number of route segments
*
* @return The number of route segments
*/
public int getNumberOfSegments() {
return this.segments.size();
}
/**
* Get all shape points that create the route
*
* @return All shape points
*/
public GeoPoint[] getShapePoints() {
return this.shapePoints;
}
}
| mit |
Azure/azure-sdk-for-java | sdk/videoanalyzer/azure-resourcemanager-videoanalyzer/src/samples/java/com/azure/resourcemanager/videoanalyzer/generated/VideoAnalyzerOperationStatusesGetSamples.java | 2428 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.videoanalyzer.generated;
import com.azure.core.util.Context;
/** Samples for VideoAnalyzerOperationStatuses Get. */
public final class VideoAnalyzerOperationStatusesGetSamples {
/*
* x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-status-by-id-non-terminal-state-failed.json
*/
/**
* Sample code: Get status of asynchronous operation when it is completed with error.
*
* @param manager Entry point to VideoAnalyzerManager.
*/
public static void getStatusOfAsynchronousOperationWhenItIsCompletedWithError(
com.azure.resourcemanager.videoanalyzer.VideoAnalyzerManager manager) {
manager
.videoAnalyzerOperationStatuses()
.getWithResponse("westus", "D612C429-2526-49D5-961B-885AE11406FD", Context.NONE);
}
/*
* x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-status-by-id-terminal-state.json
*/
/**
* Sample code: Get status of asynchronous operation when it is completed.
*
* @param manager Entry point to VideoAnalyzerManager.
*/
public static void getStatusOfAsynchronousOperationWhenItIsCompleted(
com.azure.resourcemanager.videoanalyzer.VideoAnalyzerManager manager) {
manager
.videoAnalyzerOperationStatuses()
.getWithResponse("westus", "D612C429-2526-49D5-961B-885AE11406FD", Context.NONE);
}
/*
* x-ms-original-file: specification/videoanalyzer/resource-manager/Microsoft.Media/preview/2021-11-01-preview/examples/video-analyzer-operation-status-by-id-non-terminal-state.json
*/
/**
* Sample code: Get status of asynchronous operation when it is ongoing.
*
* @param manager Entry point to VideoAnalyzerManager.
*/
public static void getStatusOfAsynchronousOperationWhenItIsOngoing(
com.azure.resourcemanager.videoanalyzer.VideoAnalyzerManager manager) {
manager
.videoAnalyzerOperationStatuses()
.getWithResponse("westus", "D612C429-2526-49D5-961B-885AE11406FD", Context.NONE);
}
}
| mit |
belatrix/AndroidAllStars | app/src/main/java/com/belatrixsf/connect/ui/settings/SettingsActivity.java | 1997 | /* The MIT License (MIT)
* Copyright (c) 2016 BELATRIX
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.belatrixsf.connect.ui.settings;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import com.belatrixsf.connect.R;
import com.belatrixsf.connect.ui.common.BelatrixConnectActivity;
/**
* Created by echuquilin on 6/07/16.
*/
public class SettingsActivity extends BelatrixConnectActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
setNavigationToolbar();
//set default settings
PreferenceManager.setDefaultValues(this, R.xml.fragment_settings, false);
//display the fragment of settings
getFragmentManager().beginTransaction()
.replace(R.id.main_content, new SettingsFragment())
.commit();
}
}
| mit |
Featherblade/VoxelGunsmith | src/main/java/com/voxelplugineering/voxelsniper/service/persistence/DirectoryDataSourceProvider.java | 5133 | /*
* The MIT License (MIT)
*
* Copyright (c) 2014 The Voxel Plugineering Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.voxelplugineering.voxelsniper.service.persistence;
import static com.google.common.base.Preconditions.checkArgument;
import java.io.File;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
/**
* A {@link DataSourceProvider} for files within a directory.
*/
public class DirectoryDataSourceProvider implements DataSourceProvider
{
private final DataSourceFactory factory;
private final File directory;
// Decided to use a cache due to how often has and read will be called close
// together looking for the same file.
private final LoadingCache<String, File> cache;
private Class<? extends DataSourceReader> reader;
private DataContainer readerArgs;
/**
* Creates a new {@link DirectoryDataSourceProvider}.
*
* @param dir The directory
*/
public DirectoryDataSourceProvider(File dir, DataSourceFactory factory)
{
checkArgument(dir.isDirectory(), "File passed to DirectoryDataSource was not a directory.");
this.directory = dir;
this.factory = factory;
this.cache = CacheBuilder.newBuilder().expireAfterAccess(60, TimeUnit.SECONDS).build(new CacheLoader<String, File>()
{
@Override
public File load(String ident) throws Exception
{
return new File(DirectoryDataSourceProvider.this.directory, ident);
}
});
}
@Override
public boolean has(String identifier)
{
try
{
return this.cache.get(identifier).isFile();
} catch (ExecutionException e)
{
e.printStackTrace();
return false;
}
}
@Override
public Optional<DataSource> get(String identifier)
{
File file;
try
{
file = this.cache.get(identifier);
} catch (ExecutionException e)
{
e.printStackTrace();
return Optional.absent();
}
if (file.isFile())
{
return Optional.<DataSource>of(new FileDataSource(file));
}
return Optional.absent();
}
@Override
public void setReaderType(Class<? extends DataSourceReader> reader, DataContainer args)
{
this.reader = reader;
this.readerArgs = args;
}
@SuppressWarnings("unchecked")
@Override
public Optional<DataSourceReader> getWithReader(String identifier)
{
if (this.reader == null || this.readerArgs == null)
{
return Optional.absent();
}
return (Optional<DataSourceReader>) getWithReader(identifier, this.reader, this.readerArgs);
}
@Override
public <T extends DataSourceReader> Optional<T> getWithReader(String identifier, Class<T> reader)
{
return getWithReader(identifier, reader, new MemoryContainer());
}
@Override
public <T extends DataSourceReader> Optional<T> getWithReader(String identifier, Class<T> reader, DataContainer args)
{
File file;
try
{
file = this.cache.get(identifier);
} catch (ExecutionException e)
{
e.printStackTrace();
return Optional.absent();
}
if (file.isFile() || !file.exists())
{
DataContainer sourceArgs = new MemoryContainer("");
sourceArgs.setString("path", file.getAbsolutePath());
args.setString("source", "file");
args.setContainer("sourceArgs", sourceArgs);
return this.factory.build(reader, args);
}
return Optional.absent();
}
@Override
public Optional<? extends DataSourceProvider> getInternalProvider(String identifier)
{
//TODO
return null;
}
}
| mit |
EricHyh/FileDownloader | sample/src/main/java/com/hyh/filedownloader/sample/image/Stats.java | 4864 | /*
* Copyright (C) 2013 Square, Inc.
*
* 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.
*/
package com.hyh.filedownloader.sample.image;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
class Stats {
private static final int CACHE_HIT = 0;
private static final int CACHE_MISS = 1;
private static final int BITMAP_DECODE_FINISHED = 2;
private static final int BITMAP_TRANSFORMED_FINISHED = 3;
private static final int DOWNLOAD_FINISHED = 4;
private static final String STATS_THREAD_NAME = Utils.THREAD_PREFIX + "Stats";
final HandlerThread statsThread;
final Cache cache;
final Handler handler;
long cacheHits;
long cacheMisses;
long totalDownloadSize;
long totalOriginalBitmapSize;
long totalTransformedBitmapSize;
long averageDownloadSize;
long averageOriginalBitmapSize;
long averageTransformedBitmapSize;
int downloadCount;
int originalBitmapCount;
int transformedBitmapCount;
Stats(Cache cache) {
this.cache = cache;
this.statsThread = new HandlerThread(STATS_THREAD_NAME, THREAD_PRIORITY_BACKGROUND);
this.statsThread.start();
Utils.flushStackLocalLeaks(statsThread.getLooper());
this.handler = new StatsHandler(statsThread.getLooper(), this);
}
void dispatchBitmapDecoded(Bitmap bitmap) {
processBitmap(bitmap, BITMAP_DECODE_FINISHED);
}
void dispatchBitmapTransformed(Bitmap bitmap) {
processBitmap(bitmap, BITMAP_TRANSFORMED_FINISHED);
}
void dispatchDownloadFinished(long size) {
handler.sendMessage(handler.obtainMessage(DOWNLOAD_FINISHED, size));
}
void dispatchCacheHit() {
handler.sendEmptyMessage(CACHE_HIT);
}
void dispatchCacheMiss() {
handler.sendEmptyMessage(CACHE_MISS);
}
void shutdown() {
statsThread.quit();
}
void performCacheHit() {
cacheHits++;
}
void performCacheMiss() {
cacheMisses++;
}
void performDownloadFinished(Long size) {
downloadCount++;
totalDownloadSize += size;
averageDownloadSize = getAverage(downloadCount, totalDownloadSize);
}
void performBitmapDecoded(long size) {
originalBitmapCount++;
totalOriginalBitmapSize += size;
averageOriginalBitmapSize = getAverage(originalBitmapCount, totalOriginalBitmapSize);
}
void performBitmapTransformed(long size) {
transformedBitmapCount++;
totalTransformedBitmapSize += size;
averageTransformedBitmapSize = getAverage(originalBitmapCount, totalTransformedBitmapSize);
}
StatsSnapshot createSnapshot() {
return new StatsSnapshot(cache.maxSize(), cache.size(), cacheHits, cacheMisses,
totalDownloadSize, totalOriginalBitmapSize, totalTransformedBitmapSize, averageDownloadSize,
averageOriginalBitmapSize, averageTransformedBitmapSize, downloadCount, originalBitmapCount,
transformedBitmapCount, System.currentTimeMillis());
}
private void processBitmap(Bitmap bitmap, int what) {
// Never send bitmaps to the handler as they could be recycled before we process them.
int bitmapSize = Utils.getBitmapBytes(bitmap);
handler.sendMessage(handler.obtainMessage(what, bitmapSize, 0));
}
private static long getAverage(int count, long totalSize) {
return totalSize / count;
}
private static class StatsHandler extends Handler {
private final Stats stats;
public StatsHandler(Looper looper, Stats stats) {
super(looper);
this.stats = stats;
}
@Override public void handleMessage(final Message msg) {
switch (msg.what) {
case CACHE_HIT:
stats.performCacheHit();
break;
case CACHE_MISS:
stats.performCacheMiss();
break;
case BITMAP_DECODE_FINISHED:
stats.performBitmapDecoded(msg.arg1);
break;
case BITMAP_TRANSFORMED_FINISHED:
stats.performBitmapTransformed(msg.arg1);
break;
case DOWNLOAD_FINISHED:
stats.performDownloadFinished((Long) msg.obj);
break;
default:
NativePicasso.HANDLER.post(new Runnable() {
@Override public void run() {
throw new AssertionError("Unhandled stats message." + msg.what);
}
});
}
}
}
} | mit |
kevincheng99/personal-budget-assistant | Plutus/gen/android/support/v7/appcompat/R.java | 41086 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package android.support.v7.appcompat;
public final class R {
public static final class anim {
public static final int abc_fade_in = 0x7f040000;
public static final int abc_fade_out = 0x7f040001;
public static final int abc_slide_in_bottom = 0x7f040002;
public static final int abc_slide_in_top = 0x7f040003;
public static final int abc_slide_out_bottom = 0x7f040004;
public static final int abc_slide_out_top = 0x7f040005;
}
public static final class attr {
public static final int actionBarDivider = 0x7f01000f;
public static final int actionBarItemBackground = 0x7f010010;
public static final int actionBarSize = 0x7f01000e;
public static final int actionBarSplitStyle = 0x7f01000c;
public static final int actionBarStyle = 0x7f01000b;
public static final int actionBarTabBarStyle = 0x7f010008;
public static final int actionBarTabStyle = 0x7f010007;
public static final int actionBarTabTextStyle = 0x7f010009;
public static final int actionBarWidgetTheme = 0x7f01000d;
public static final int actionButtonStyle = 0x7f010016;
public static final int actionDropDownStyle = 0x7f010047;
public static final int actionLayout = 0x7f01004e;
public static final int actionMenuTextAppearance = 0x7f010011;
public static final int actionMenuTextColor = 0x7f010012;
public static final int actionModeBackground = 0x7f01003c;
public static final int actionModeCloseButtonStyle = 0x7f01003b;
public static final int actionModeCloseDrawable = 0x7f01003e;
public static final int actionModeCopyDrawable = 0x7f010040;
public static final int actionModeCutDrawable = 0x7f01003f;
public static final int actionModeFindDrawable = 0x7f010044;
public static final int actionModePasteDrawable = 0x7f010041;
public static final int actionModePopupWindowStyle = 0x7f010046;
public static final int actionModeSelectAllDrawable = 0x7f010042;
public static final int actionModeShareDrawable = 0x7f010043;
public static final int actionModeSplitBackground = 0x7f01003d;
public static final int actionModeStyle = 0x7f01003a;
public static final int actionModeWebSearchDrawable = 0x7f010045;
public static final int actionOverflowButtonStyle = 0x7f01000a;
public static final int actionProviderClass = 0x7f010050;
public static final int actionViewClass = 0x7f01004f;
public static final int activityChooserViewStyle = 0x7f01006c;
public static final int background = 0x7f01002f;
public static final int backgroundSplit = 0x7f010031;
public static final int backgroundStacked = 0x7f010030;
public static final int buttonBarButtonStyle = 0x7f010018;
public static final int buttonBarStyle = 0x7f010017;
public static final int customNavigationLayout = 0x7f010032;
public static final int disableChildrenWhenDisabled = 0x7f010054;
public static final int displayOptions = 0x7f010028;
public static final int divider = 0x7f01002e;
public static final int dividerHorizontal = 0x7f01001b;
public static final int dividerPadding = 0x7f010056;
public static final int dividerVertical = 0x7f01001a;
public static final int dropDownListViewStyle = 0x7f010021;
public static final int dropdownListPreferredItemHeight = 0x7f010048;
public static final int expandActivityOverflowButtonDrawable = 0x7f01006b;
public static final int height = 0x7f010026;
public static final int homeAsUpIndicator = 0x7f010013;
public static final int homeLayout = 0x7f010033;
public static final int icon = 0x7f01002c;
public static final int iconifiedByDefault = 0x7f01005a;
public static final int indeterminateProgressStyle = 0x7f010035;
public static final int initialActivityCount = 0x7f01006a;
public static final int isLightTheme = 0x7f010059;
public static final int itemPadding = 0x7f010037;
public static final int listChoiceBackgroundIndicator = 0x7f01004c;
public static final int listPopupWindowStyle = 0x7f010022;
public static final int listPreferredItemHeight = 0x7f01001c;
public static final int listPreferredItemHeightLarge = 0x7f01001e;
public static final int listPreferredItemHeightSmall = 0x7f01001d;
public static final int listPreferredItemPaddingLeft = 0x7f01001f;
public static final int listPreferredItemPaddingRight = 0x7f010020;
public static final int logo = 0x7f01002d;
public static final int navigationMode = 0x7f010027;
public static final int paddingEnd = 0x7f010039;
public static final int paddingStart = 0x7f010038;
public static final int panelMenuListTheme = 0x7f01004b;
public static final int panelMenuListWidth = 0x7f01004a;
public static final int popupMenuStyle = 0x7f010049;
public static final int popupPromptView = 0x7f010053;
public static final int progressBarPadding = 0x7f010036;
public static final int progressBarStyle = 0x7f010034;
public static final int prompt = 0x7f010051;
public static final int queryHint = 0x7f01005b;
public static final int searchDropdownBackground = 0x7f01005c;
public static final int searchResultListItemHeight = 0x7f010065;
public static final int searchViewAutoCompleteTextView = 0x7f010069;
public static final int searchViewCloseIcon = 0x7f01005d;
public static final int searchViewEditQuery = 0x7f010061;
public static final int searchViewEditQueryBackground = 0x7f010062;
public static final int searchViewGoIcon = 0x7f01005e;
public static final int searchViewSearchIcon = 0x7f01005f;
public static final int searchViewTextField = 0x7f010063;
public static final int searchViewTextFieldRight = 0x7f010064;
public static final int searchViewVoiceIcon = 0x7f010060;
public static final int selectableItemBackground = 0x7f010019;
public static final int showAsAction = 0x7f01004d;
public static final int showDividers = 0x7f010055;
public static final int spinnerDropDownItemStyle = 0x7f010058;
public static final int spinnerMode = 0x7f010052;
public static final int spinnerStyle = 0x7f010057;
public static final int subtitle = 0x7f010029;
public static final int subtitleTextStyle = 0x7f01002b;
public static final int textAllCaps = 0x7f01006d;
public static final int textAppearanceLargePopupMenu = 0x7f010014;
public static final int textAppearanceListItem = 0x7f010023;
public static final int textAppearanceListItemSmall = 0x7f010024;
public static final int textAppearanceSearchResultSubtitle = 0x7f010067;
public static final int textAppearanceSearchResultTitle = 0x7f010066;
public static final int textAppearanceSmallPopupMenu = 0x7f010015;
public static final int textColorSearchUrl = 0x7f010068;
public static final int title = 0x7f010025;
public static final int titleTextStyle = 0x7f01002a;
public static final int windowActionBar = 0x7f010000;
public static final int windowActionBarOverlay = 0x7f010001;
public static final int windowFixedHeightMajor = 0x7f010006;
public static final int windowFixedHeightMinor = 0x7f010004;
public static final int windowFixedWidthMajor = 0x7f010003;
public static final int windowFixedWidthMinor = 0x7f010005;
public static final int windowSplitActionBar = 0x7f010002;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs_pre_jb = 0x7f060000;
public static final int abc_action_bar_expanded_action_views_exclusive = 0x7f060001;
public static final int abc_config_actionMenuItemAllCaps = 0x7f060005;
public static final int abc_config_allowActionMenuItemTextWithIcon = 0x7f060004;
public static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f060003;
public static final int abc_split_action_bar_is_narrow = 0x7f060002;
}
public static final class color {
public static final int abc_search_url_text_holo = 0x7f070009;
public static final int abc_search_url_text_normal = 0x7f070000;
public static final int abc_search_url_text_pressed = 0x7f070002;
public static final int abc_search_url_text_selected = 0x7f070001;
}
public static final class dimen {
public static final int abc_action_bar_default_height = 0x7f080002;
public static final int abc_action_bar_icon_vertical_padding = 0x7f080003;
public static final int abc_action_bar_progress_bar_size = 0x7f08000a;
public static final int abc_action_bar_stacked_max_height = 0x7f080009;
public static final int abc_action_bar_stacked_tab_max_width = 0x7f080001;
public static final int abc_action_bar_subtitle_bottom_margin = 0x7f080007;
public static final int abc_action_bar_subtitle_text_size = 0x7f080005;
public static final int abc_action_bar_subtitle_top_margin = 0x7f080006;
public static final int abc_action_bar_title_text_size = 0x7f080004;
public static final int abc_action_button_min_width = 0x7f080008;
public static final int abc_config_prefDialogWidth = 0x7f080000;
public static final int abc_dropdownitem_icon_width = 0x7f080010;
public static final int abc_dropdownitem_text_padding_left = 0x7f08000e;
public static final int abc_dropdownitem_text_padding_right = 0x7f08000f;
public static final int abc_panel_menu_list_width = 0x7f08000b;
public static final int abc_search_view_preferred_width = 0x7f08000d;
public static final int abc_search_view_text_min_width = 0x7f08000c;
public static final int dialog_fixed_height_major = 0x7f080013;
public static final int dialog_fixed_height_minor = 0x7f080014;
public static final int dialog_fixed_width_major = 0x7f080011;
public static final int dialog_fixed_width_minor = 0x7f080012;
}
public static final class drawable {
public static final int abc_ab_bottom_solid_dark_holo = 0x7f020000;
public static final int abc_ab_bottom_solid_light_holo = 0x7f020001;
public static final int abc_ab_bottom_transparent_dark_holo = 0x7f020002;
public static final int abc_ab_bottom_transparent_light_holo = 0x7f020003;
public static final int abc_ab_share_pack_holo_dark = 0x7f020004;
public static final int abc_ab_share_pack_holo_light = 0x7f020005;
public static final int abc_ab_solid_dark_holo = 0x7f020006;
public static final int abc_ab_solid_light_holo = 0x7f020007;
public static final int abc_ab_stacked_solid_dark_holo = 0x7f020008;
public static final int abc_ab_stacked_solid_light_holo = 0x7f020009;
public static final int abc_ab_stacked_transparent_dark_holo = 0x7f02000a;
public static final int abc_ab_stacked_transparent_light_holo = 0x7f02000b;
public static final int abc_ab_transparent_dark_holo = 0x7f02000c;
public static final int abc_ab_transparent_light_holo = 0x7f02000d;
public static final int abc_cab_background_bottom_holo_dark = 0x7f02000e;
public static final int abc_cab_background_bottom_holo_light = 0x7f02000f;
public static final int abc_cab_background_top_holo_dark = 0x7f020010;
public static final int abc_cab_background_top_holo_light = 0x7f020011;
public static final int abc_ic_ab_back_holo_dark = 0x7f020012;
public static final int abc_ic_ab_back_holo_light = 0x7f020013;
public static final int abc_ic_cab_done_holo_dark = 0x7f020014;
public static final int abc_ic_cab_done_holo_light = 0x7f020015;
public static final int abc_ic_clear = 0x7f020016;
public static final int abc_ic_clear_disabled = 0x7f020017;
public static final int abc_ic_clear_holo_light = 0x7f020018;
public static final int abc_ic_clear_normal = 0x7f020019;
public static final int abc_ic_clear_search_api_disabled_holo_light = 0x7f02001a;
public static final int abc_ic_clear_search_api_holo_light = 0x7f02001b;
public static final int abc_ic_commit_search_api_holo_dark = 0x7f02001c;
public static final int abc_ic_commit_search_api_holo_light = 0x7f02001d;
public static final int abc_ic_go = 0x7f02001e;
public static final int abc_ic_go_search_api_holo_light = 0x7f02001f;
public static final int abc_ic_menu_moreoverflow_normal_holo_dark = 0x7f020020;
public static final int abc_ic_menu_moreoverflow_normal_holo_light = 0x7f020021;
public static final int abc_ic_menu_share_holo_dark = 0x7f020022;
public static final int abc_ic_menu_share_holo_light = 0x7f020023;
public static final int abc_ic_search = 0x7f020024;
public static final int abc_ic_search_api_holo_light = 0x7f020025;
public static final int abc_ic_voice_search = 0x7f020026;
public static final int abc_ic_voice_search_api_holo_light = 0x7f020027;
public static final int abc_item_background_holo_dark = 0x7f020028;
public static final int abc_item_background_holo_light = 0x7f020029;
public static final int abc_list_divider_holo_dark = 0x7f02002a;
public static final int abc_list_divider_holo_light = 0x7f02002b;
public static final int abc_list_focused_holo = 0x7f02002c;
public static final int abc_list_longpressed_holo = 0x7f02002d;
public static final int abc_list_pressed_holo_dark = 0x7f02002e;
public static final int abc_list_pressed_holo_light = 0x7f02002f;
public static final int abc_list_selector_background_transition_holo_dark = 0x7f020030;
public static final int abc_list_selector_background_transition_holo_light = 0x7f020031;
public static final int abc_list_selector_disabled_holo_dark = 0x7f020032;
public static final int abc_list_selector_disabled_holo_light = 0x7f020033;
public static final int abc_list_selector_holo_dark = 0x7f020034;
public static final int abc_list_selector_holo_light = 0x7f020035;
public static final int abc_menu_dropdown_panel_holo_dark = 0x7f020036;
public static final int abc_menu_dropdown_panel_holo_light = 0x7f020037;
public static final int abc_menu_hardkey_panel_holo_dark = 0x7f020038;
public static final int abc_menu_hardkey_panel_holo_light = 0x7f020039;
public static final int abc_search_dropdown_dark = 0x7f02003a;
public static final int abc_search_dropdown_light = 0x7f02003b;
public static final int abc_spinner_ab_default_holo_dark = 0x7f02003c;
public static final int abc_spinner_ab_default_holo_light = 0x7f02003d;
public static final int abc_spinner_ab_disabled_holo_dark = 0x7f02003e;
public static final int abc_spinner_ab_disabled_holo_light = 0x7f02003f;
public static final int abc_spinner_ab_focused_holo_dark = 0x7f020040;
public static final int abc_spinner_ab_focused_holo_light = 0x7f020041;
public static final int abc_spinner_ab_holo_dark = 0x7f020042;
public static final int abc_spinner_ab_holo_light = 0x7f020043;
public static final int abc_spinner_ab_pressed_holo_dark = 0x7f020044;
public static final int abc_spinner_ab_pressed_holo_light = 0x7f020045;
public static final int abc_tab_indicator_ab_holo = 0x7f020046;
public static final int abc_tab_selected_focused_holo = 0x7f020047;
public static final int abc_tab_selected_holo = 0x7f020048;
public static final int abc_tab_selected_pressed_holo = 0x7f020049;
public static final int abc_tab_unselected_pressed_holo = 0x7f02004a;
public static final int abc_textfield_search_default_holo_dark = 0x7f02004b;
public static final int abc_textfield_search_default_holo_light = 0x7f02004c;
public static final int abc_textfield_search_right_default_holo_dark = 0x7f02004d;
public static final int abc_textfield_search_right_default_holo_light = 0x7f02004e;
public static final int abc_textfield_search_right_selected_holo_dark = 0x7f02004f;
public static final int abc_textfield_search_right_selected_holo_light = 0x7f020050;
public static final int abc_textfield_search_selected_holo_dark = 0x7f020051;
public static final int abc_textfield_search_selected_holo_light = 0x7f020052;
public static final int abc_textfield_searchview_holo_dark = 0x7f020053;
public static final int abc_textfield_searchview_holo_light = 0x7f020054;
public static final int abc_textfield_searchview_right_holo_dark = 0x7f020055;
public static final int abc_textfield_searchview_right_holo_light = 0x7f020056;
}
public static final class id {
public static final int action_bar = 0x7f05001c;
public static final int action_bar_activity_content = 0x7f050015;
public static final int action_bar_container = 0x7f05001b;
public static final int action_bar_overlay_layout = 0x7f05001f;
public static final int action_bar_root = 0x7f05001a;
public static final int action_bar_subtitle = 0x7f050023;
public static final int action_bar_title = 0x7f050022;
public static final int action_context_bar = 0x7f05001d;
public static final int action_menu_divider = 0x7f050016;
public static final int action_menu_presenter = 0x7f050017;
public static final int action_mode_close_button = 0x7f050024;
public static final int activity_chooser_view_content = 0x7f050025;
public static final int always = 0x7f05000b;
public static final int beginning = 0x7f050011;
public static final int checkbox = 0x7f05002d;
public static final int collapseActionView = 0x7f05000d;
public static final int default_activity_button = 0x7f050028;
public static final int dialog = 0x7f05000e;
public static final int disableHome = 0x7f050008;
public static final int dropdown = 0x7f05000f;
public static final int edit_query = 0x7f050030;
public static final int end = 0x7f050013;
public static final int expand_activities_button = 0x7f050026;
public static final int expanded_menu = 0x7f05002c;
public static final int home = 0x7f050014;
public static final int homeAsUp = 0x7f050005;
public static final int icon = 0x7f05002a;
public static final int ifRoom = 0x7f05000a;
public static final int image = 0x7f050027;
public static final int listMode = 0x7f050001;
public static final int list_item = 0x7f050029;
public static final int middle = 0x7f050012;
public static final int never = 0x7f050009;
public static final int none = 0x7f050010;
public static final int normal = 0x7f050000;
public static final int progress_circular = 0x7f050018;
public static final int progress_horizontal = 0x7f050019;
public static final int radio = 0x7f05002f;
public static final int search_badge = 0x7f050032;
public static final int search_bar = 0x7f050031;
public static final int search_button = 0x7f050033;
public static final int search_close_btn = 0x7f050038;
public static final int search_edit_frame = 0x7f050034;
public static final int search_go_btn = 0x7f05003a;
public static final int search_mag_icon = 0x7f050035;
public static final int search_plate = 0x7f050036;
public static final int search_src_text = 0x7f050037;
public static final int search_voice_btn = 0x7f05003b;
public static final int shortcut = 0x7f05002e;
public static final int showCustom = 0x7f050007;
public static final int showHome = 0x7f050004;
public static final int showTitle = 0x7f050006;
public static final int split_action_bar = 0x7f05001e;
public static final int submit_area = 0x7f050039;
public static final int tabMode = 0x7f050002;
public static final int title = 0x7f05002b;
public static final int top_action_bar = 0x7f050020;
public static final int up = 0x7f050021;
public static final int useLogo = 0x7f050003;
public static final int withText = 0x7f05000c;
}
public static final class integer {
public static final int abc_max_action_buttons = 0x7f090000;
}
public static final class layout {
public static final int abc_action_bar_decor = 0x7f030000;
public static final int abc_action_bar_decor_include = 0x7f030001;
public static final int abc_action_bar_decor_overlay = 0x7f030002;
public static final int abc_action_bar_home = 0x7f030003;
public static final int abc_action_bar_tab = 0x7f030004;
public static final int abc_action_bar_tabbar = 0x7f030005;
public static final int abc_action_bar_title_item = 0x7f030006;
public static final int abc_action_bar_view_list_nav_layout = 0x7f030007;
public static final int abc_action_menu_item_layout = 0x7f030008;
public static final int abc_action_menu_layout = 0x7f030009;
public static final int abc_action_mode_bar = 0x7f03000a;
public static final int abc_action_mode_close_item = 0x7f03000b;
public static final int abc_activity_chooser_view = 0x7f03000c;
public static final int abc_activity_chooser_view_include = 0x7f03000d;
public static final int abc_activity_chooser_view_list_item = 0x7f03000e;
public static final int abc_expanded_menu_layout = 0x7f03000f;
public static final int abc_list_menu_item_checkbox = 0x7f030010;
public static final int abc_list_menu_item_icon = 0x7f030011;
public static final int abc_list_menu_item_layout = 0x7f030012;
public static final int abc_list_menu_item_radio = 0x7f030013;
public static final int abc_popup_menu_item_layout = 0x7f030014;
public static final int abc_search_dropdown_item_icons_2line = 0x7f030015;
public static final int abc_search_view = 0x7f030016;
public static final int abc_simple_decor = 0x7f030017;
public static final int support_simple_spinner_dropdown_item = 0x7f030023;
}
public static final class string {
public static final int abc_action_bar_home_description = 0x7f0a0001;
public static final int abc_action_bar_up_description = 0x7f0a0002;
public static final int abc_action_menu_overflow_description = 0x7f0a0003;
public static final int abc_action_mode_done = 0x7f0a0000;
public static final int abc_activity_chooser_view_see_all = 0x7f0a000a;
public static final int abc_activitychooserview_choose_application = 0x7f0a0009;
public static final int abc_searchview_description_clear = 0x7f0a0006;
public static final int abc_searchview_description_query = 0x7f0a0005;
public static final int abc_searchview_description_search = 0x7f0a0004;
public static final int abc_searchview_description_submit = 0x7f0a0007;
public static final int abc_searchview_description_voice = 0x7f0a0008;
public static final int abc_shareactionprovider_share_with = 0x7f0a000c;
public static final int abc_shareactionprovider_share_with_application = 0x7f0a000b;
}
public static final class style {
public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0063;
public static final int TextAppearance_AppCompat_Base_SearchResult = 0x7f0b006d;
public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle = 0x7f0b006f;
public static final int TextAppearance_AppCompat_Base_SearchResult_Title = 0x7f0b006e;
public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large = 0x7f0b0069;
public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small = 0x7f0b006a;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult = 0x7f0b0070;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle = 0x7f0b0072;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title = 0x7f0b0071;
public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large = 0x7f0b006b;
public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small = 0x7f0b006c;
public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0b0035;
public static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0b0034;
public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0030;
public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0031;
public static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0033;
public static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0032;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b001a;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b0006;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b0008;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b0005;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b0007;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b001e;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0b0020;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b001d;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0b001f;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu = 0x7f0b0054;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle = 0x7f0b0056;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse = 0x7f0b0058;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title = 0x7f0b0055;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse = 0x7f0b0057;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle = 0x7f0b0051;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse = 0x7f0b0053;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title = 0x7f0b0050;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse = 0x7f0b0052;
public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem = 0x7f0b0061;
public static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b0021;
public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b002e;
public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b002f;
public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item = 0x7f0b0062;
public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b0028;
public static final int Theme_AppCompat = 0x7f0b0077;
public static final int Theme_AppCompat_Base_CompactMenu = 0x7f0b0083;
public static final int Theme_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0084;
public static final int Theme_AppCompat_CompactMenu = 0x7f0b007c;
public static final int Theme_AppCompat_CompactMenu_Dialog = 0x7f0b007d;
public static final int Theme_AppCompat_DialogWhenLarge = 0x7f0b007a;
public static final int Theme_AppCompat_Light = 0x7f0b0078;
public static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0b0079;
public static final int Theme_AppCompat_Light_DialogWhenLarge = 0x7f0b007b;
public static final int Theme_Base = 0x7f0b007e;
public static final int Theme_Base_AppCompat = 0x7f0b0080;
public static final int Theme_Base_AppCompat_DialogWhenLarge = 0x7f0b0085;
public static final int Theme_Base_AppCompat_DialogWhenLarge_Base = 0x7f0b0089;
public static final int Theme_Base_AppCompat_Dialog_FixedSize = 0x7f0b0087;
public static final int Theme_Base_AppCompat_Dialog_Light_FixedSize = 0x7f0b0088;
public static final int Theme_Base_AppCompat_Light = 0x7f0b0081;
public static final int Theme_Base_AppCompat_Light_DarkActionBar = 0x7f0b0082;
public static final int Theme_Base_AppCompat_Light_DialogWhenLarge = 0x7f0b0086;
public static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base = 0x7f0b008a;
public static final int Theme_Base_Light = 0x7f0b007f;
public static final int Widget_AppCompat_ActionBar = 0x7f0b0000;
public static final int Widget_AppCompat_ActionBar_Solid = 0x7f0b0002;
public static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0b0011;
public static final int Widget_AppCompat_ActionBar_TabText = 0x7f0b0017;
public static final int Widget_AppCompat_ActionBar_TabView = 0x7f0b0014;
public static final int Widget_AppCompat_ActionButton = 0x7f0b000b;
public static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0b000d;
public static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0b000f;
public static final int Widget_AppCompat_ActionMode = 0x7f0b001b;
public static final int Widget_AppCompat_ActivityChooserView = 0x7f0b0038;
public static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0b0036;
public static final int Widget_AppCompat_Base_ActionBar = 0x7f0b003a;
public static final int Widget_AppCompat_Base_ActionBar_Solid = 0x7f0b003c;
public static final int Widget_AppCompat_Base_ActionBar_TabBar = 0x7f0b0045;
public static final int Widget_AppCompat_Base_ActionBar_TabText = 0x7f0b004b;
public static final int Widget_AppCompat_Base_ActionBar_TabView = 0x7f0b0048;
public static final int Widget_AppCompat_Base_ActionButton = 0x7f0b003f;
public static final int Widget_AppCompat_Base_ActionButton_CloseMode = 0x7f0b0041;
public static final int Widget_AppCompat_Base_ActionButton_Overflow = 0x7f0b0043;
public static final int Widget_AppCompat_Base_ActionMode = 0x7f0b004e;
public static final int Widget_AppCompat_Base_ActivityChooserView = 0x7f0b0075;
public static final int Widget_AppCompat_Base_AutoCompleteTextView = 0x7f0b0073;
public static final int Widget_AppCompat_Base_DropDownItem_Spinner = 0x7f0b005d;
public static final int Widget_AppCompat_Base_ListPopupWindow = 0x7f0b0065;
public static final int Widget_AppCompat_Base_ListView_DropDown = 0x7f0b005f;
public static final int Widget_AppCompat_Base_ListView_Menu = 0x7f0b0064;
public static final int Widget_AppCompat_Base_PopupMenu = 0x7f0b0067;
public static final int Widget_AppCompat_Base_ProgressBar = 0x7f0b005a;
public static final int Widget_AppCompat_Base_ProgressBar_Horizontal = 0x7f0b0059;
public static final int Widget_AppCompat_Base_Spinner = 0x7f0b005b;
public static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0b0024;
public static final int Widget_AppCompat_Light_ActionBar = 0x7f0b0001;
public static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b0003;
public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0b0004;
public static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b0012;
public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0b0013;
public static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b0018;
public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b0019;
public static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b0015;
public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0b0016;
public static final int Widget_AppCompat_Light_ActionButton = 0x7f0b000c;
public static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0b000e;
public static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0b0010;
public static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0b001c;
public static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0b0039;
public static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b0037;
public static final int Widget_AppCompat_Light_Base_ActionBar = 0x7f0b003b;
public static final int Widget_AppCompat_Light_Base_ActionBar_Solid = 0x7f0b003d;
public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse = 0x7f0b003e;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar = 0x7f0b0046;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse = 0x7f0b0047;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabText = 0x7f0b004c;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse = 0x7f0b004d;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabView = 0x7f0b0049;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse = 0x7f0b004a;
public static final int Widget_AppCompat_Light_Base_ActionButton = 0x7f0b0040;
public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode = 0x7f0b0042;
public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow = 0x7f0b0044;
public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse = 0x7f0b004f;
public static final int Widget_AppCompat_Light_Base_ActivityChooserView = 0x7f0b0076;
public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView = 0x7f0b0074;
public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner = 0x7f0b005e;
public static final int Widget_AppCompat_Light_Base_ListPopupWindow = 0x7f0b0066;
public static final int Widget_AppCompat_Light_Base_ListView_DropDown = 0x7f0b0060;
public static final int Widget_AppCompat_Light_Base_PopupMenu = 0x7f0b0068;
public static final int Widget_AppCompat_Light_Base_Spinner = 0x7f0b005c;
public static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0b0025;
public static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0b002a;
public static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0b0027;
public static final int Widget_AppCompat_Light_PopupMenu = 0x7f0b002c;
public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0b0023;
public static final int Widget_AppCompat_ListPopupWindow = 0x7f0b0029;
public static final int Widget_AppCompat_ListView_DropDown = 0x7f0b0026;
public static final int Widget_AppCompat_ListView_Menu = 0x7f0b002d;
public static final int Widget_AppCompat_PopupMenu = 0x7f0b002b;
public static final int Widget_AppCompat_ProgressBar = 0x7f0b000a;
public static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b0009;
public static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b0022;
}
public static final class styleable {
public static final int[] ActionBar = { 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037 };
public static final int[] ActionBarLayout = { 0x010100b3 };
public static final int ActionBarLayout_android_layout_gravity = 0;
public static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 };
public static final int ActionBarWindow_windowActionBar = 0;
public static final int ActionBarWindow_windowActionBarOverlay = 1;
public static final int ActionBarWindow_windowFixedHeightMajor = 6;
public static final int ActionBarWindow_windowFixedHeightMinor = 4;
public static final int ActionBarWindow_windowFixedWidthMajor = 3;
public static final int ActionBarWindow_windowFixedWidthMinor = 5;
public static final int ActionBarWindow_windowSplitActionBar = 2;
public static final int ActionBar_background = 10;
public static final int ActionBar_backgroundSplit = 12;
public static final int ActionBar_backgroundStacked = 11;
public static final int ActionBar_customNavigationLayout = 13;
public static final int ActionBar_displayOptions = 3;
public static final int ActionBar_divider = 9;
public static final int ActionBar_height = 1;
public static final int ActionBar_homeLayout = 14;
public static final int ActionBar_icon = 7;
public static final int ActionBar_indeterminateProgressStyle = 16;
public static final int ActionBar_itemPadding = 18;
public static final int ActionBar_logo = 8;
public static final int ActionBar_navigationMode = 2;
public static final int ActionBar_progressBarPadding = 17;
public static final int ActionBar_progressBarStyle = 15;
public static final int ActionBar_subtitle = 4;
public static final int ActionBar_subtitleTextStyle = 6;
public static final int ActionBar_title = 0;
public static final int ActionBar_titleTextStyle = 5;
public static final int[] ActionMenuItemView = { 0x0101013f };
public static final int ActionMenuItemView_android_minWidth = 0;
public static final int[] ActionMenuView = { };
public static final int[] ActionMode = { 0x7f010026, 0x7f01002a, 0x7f01002b, 0x7f01002f, 0x7f010031 };
public static final int ActionMode_background = 3;
public static final int ActionMode_backgroundSplit = 4;
public static final int ActionMode_height = 0;
public static final int ActionMode_subtitleTextStyle = 2;
public static final int ActionMode_titleTextStyle = 1;
public static final int[] ActivityChooserView = { 0x7f01006a, 0x7f01006b };
public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1;
public static final int ActivityChooserView_initialActivityCount = 0;
public static final int[] CompatTextView = { 0x7f01006d };
public static final int CompatTextView_textAllCaps = 0;
public static final int[] LinearLayoutICS = { 0x7f01002e, 0x7f010055, 0x7f010056 };
public static final int LinearLayoutICS_divider = 0;
public static final int LinearLayoutICS_dividerPadding = 2;
public static final int LinearLayoutICS_showDividers = 1;
public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 };
public static final int MenuGroup_android_checkableBehavior = 5;
public static final int MenuGroup_android_enabled = 0;
public static final int MenuGroup_android_id = 1;
public static final int MenuGroup_android_menuCategory = 3;
public static final int MenuGroup_android_orderInCategory = 4;
public static final int MenuGroup_android_visible = 2;
public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 };
public static final int MenuItem_actionLayout = 14;
public static final int MenuItem_actionProviderClass = 16;
public static final int MenuItem_actionViewClass = 15;
public static final int MenuItem_android_alphabeticShortcut = 9;
public static final int MenuItem_android_checkable = 11;
public static final int MenuItem_android_checked = 3;
public static final int MenuItem_android_enabled = 1;
public static final int MenuItem_android_icon = 0;
public static final int MenuItem_android_id = 2;
public static final int MenuItem_android_menuCategory = 5;
public static final int MenuItem_android_numericShortcut = 10;
public static final int MenuItem_android_onClick = 12;
public static final int MenuItem_android_orderInCategory = 6;
public static final int MenuItem_android_title = 7;
public static final int MenuItem_android_titleCondensed = 8;
public static final int MenuItem_android_visible = 4;
public static final int MenuItem_showAsAction = 13;
public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x01010438 };
public static final int MenuView_android_headerBackground = 4;
public static final int MenuView_android_horizontalDivider = 2;
public static final int MenuView_android_itemBackground = 5;
public static final int MenuView_android_itemIconDisabledAlpha = 6;
public static final int MenuView_android_itemTextAppearance = 1;
public static final int MenuView_android_preserveIconSpacing = 7;
public static final int MenuView_android_verticalDivider = 3;
public static final int MenuView_android_windowAnimationStyle = 0;
public static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005a, 0x7f01005b };
public static final int SearchView_android_imeOptions = 2;
public static final int SearchView_android_inputType = 1;
public static final int SearchView_android_maxWidth = 0;
public static final int SearchView_iconifiedByDefault = 3;
public static final int SearchView_queryHint = 4;
public static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 };
public static final int Spinner_android_dropDownHorizontalOffset = 4;
public static final int Spinner_android_dropDownSelector = 1;
public static final int Spinner_android_dropDownVerticalOffset = 5;
public static final int Spinner_android_dropDownWidth = 3;
public static final int Spinner_android_gravity = 0;
public static final int Spinner_android_popupBackground = 2;
public static final int Spinner_disableChildrenWhenDisabled = 9;
public static final int Spinner_popupPromptView = 8;
public static final int Spinner_prompt = 6;
public static final int Spinner_spinnerMode = 7;
public static final int[] Theme = { 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c };
public static final int Theme_actionDropDownStyle = 0;
public static final int Theme_dropdownListPreferredItemHeight = 1;
public static final int Theme_listChoiceBackgroundIndicator = 5;
public static final int Theme_panelMenuListTheme = 4;
public static final int Theme_panelMenuListWidth = 3;
public static final int Theme_popupMenuStyle = 2;
public static final int[] View = { 0x010100da, 0x7f010038, 0x7f010039 };
public static final int View_android_focusable = 0;
public static final int View_paddingEnd = 2;
public static final int View_paddingStart = 1;
}
}
| mit |
yi-juchung/codingPractice | src/LengthOfLastWord.java | 906 | public class LengthOfLastWord {
static public int lengthOfLastWord(String s) {
if (s == null || s.length() < 1)
return 0;
int beginWord = -1;
int endWord = 0;
int curIdx = 0;
boolean word = false;
while (curIdx < s.length()) {
if (word) {
if (s.charAt(curIdx) == ' ') {
endWord = curIdx;
word = !word;
}
} else {
if (s.charAt(curIdx) != ' ') {
beginWord = curIdx;
word = !word;
}
}
curIdx++;
}
if (word) {
endWord = curIdx;
}
return (beginWord != -1)?endWord-beginWord:0;
}
public static void main(String [ ] args) {
System.out.print(lengthOfLastWord(" abc kkkk ka k w"));
}
}
| mit |
vrampal/codingame-public | java/src/test/java/training/hard/skynetRevolutionEpisode2/PlayerTest.java | 736 | package training.hard.skynetRevolutionEpisode2;
import static org.junit.Assert.*;
import java.io.*;
import java.util.*;
import org.junit.*;
public class PlayerTest {
@Test(expected = NoSuchElementException.class)
public void testData04() throws IOException {
testFile("skynet2-04.txt");
}
@Test(expected = NoSuchElementException.class)
public void testData05() throws IOException {
testFile("skynet2-05.txt");
}
@Test(expected = NoSuchElementException.class)
public void testData06() throws IOException {
testFile("skynet2-06.txt");
}
private void testFile(String filename) throws IOException {
Player player = new Player();
player.in = new Scanner(new File("../data/" + filename));
player.run();
}
}
| mit |
Col-E/Recaf | src/main/java/me/coley/recaf/config/FieldWrapper.java | 1987 | package me.coley.recaf.config;
import me.coley.recaf.util.LangUtil;
import java.lang.reflect.Field;
import static me.coley.recaf.util.Log.*;
/**
* Config field wrapper.
*
* @author Matt
*/
public class FieldWrapper {
private final Configurable instance;
private final Field field;
private final Conf conf;
/**
* @param instance
* Configurable object instance.
* @param field
* Field of configurable value.
* @param conf
* Annotation on field.
*/
public FieldWrapper(Configurable instance, Field field, Conf conf) {
this.instance = instance;
this.field = field;
this.conf = conf;
}
/**
* @return Translation key.
*/
public final String key() {
return conf.value();
}
/**
* @return {@code true} when the config key is translatable.
*/
public final boolean isTranslatable() {
return !conf.noTranslate();
}
/**
* @return Translated name.
*/
public final String name() {
return LangUtil.translate(key() + ".name");
}
/**
* @return Translated description.
*/
public final String description() {
return LangUtil.translate(key() + ".desc");
}
/**
* @return {@code true} if the field is not intended to be shown.
*/
public final boolean hidden() {
return conf.hide();
}
/**
* @param <T>
* Generic type of class.
*
* @return Declared type of the field.
*/
@SuppressWarnings("unchecked")
public final <T> Class<T> type() {
return (Class<T>) field.getType();
}
/**
* @param <T>
* Field value type.
*
* @return Field value.
*/
@SuppressWarnings("unchecked")
public final <T> T get() {
try {
return (T) field.get(instance);
} catch(IllegalAccessException ex) {
error(ex, "Failed to fetch field value: {}", key());
return null;
}
}
/**
* @param value
* Value to set.
*/
public final void set(Object value) {
try {
field.set(instance, value);
} catch(IllegalAccessException ex) {
error(ex, "Failed to set field value: {}", key());
}
}
}
| mit |
zhangyuezhong/SpringBootExample | SpringPagination/src/main/java/com/telstra/springboot/util/RandomNameGenerator.java | 796 | package com.telstra.springboot.util;
/**
* Generates pseudo random unique names that combines one adjective and one noun,
* like "friendly tiger" or "good apple".
*
* There's about 1.5 million unique combinations, and if you keep requesting a new word
* it will start to loop (but this code will generate all unique combinations before it starts
* to loop.)
*
* @author Kohsuke Kawaguchi
*/
public class RandomNameGenerator {
private int pos;
public RandomNameGenerator(int seed) {
this.pos = seed;
}
public RandomNameGenerator() {
this((int) System.currentTimeMillis());
}
public synchronized String next() {
Dictionary d = Dictionary.INSTANCE;
pos = Math.abs(pos+d.getPrime()) % d.size();
return d.word(pos);
}
}
| mit |
danielbitenco/UFSC | Programas/Java/Data Base - Banco de Dados/Copy of Trabalho BDI/src/ufsc/bd1/org/model/Solicitacao.java | 1301 | package ufsc.bd1.org.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "Solicitacao")
public class Solicitacao {
@Id
@SequenceGenerator(name="pk_sequence",sequenceName="seq_Solicitacao_pk", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
@Column(name="ID_solicitacao", unique=true, nullable=false)
private Integer id;
@Column(name = "item")
private char item;
@Column(name = "descricao")
private char descricao;
public Solicitacao(){}
public Solicitacao(int id, char item, char descricao)
{
this.setId(id);
this.setItem(item);
this.setDescricao(descricao);
}
public Solicitacao(char item, char descricao)
{
this.setItem(item);
this.setDescricao(descricao);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public char getItem() {
return item;
}
public void setItem(char item) {
this.item = item;
}
public char getDescricao() {
return descricao;
}
public void setDescricao(char descricao) {
this.descricao = descricao;
}
}
| mit |
cacheflowe/haxademic | src/com/haxademic/demo/draw/shapes/Demo_VoxelSphere2.java | 19777 | package com.haxademic.demo.draw.shapes;
import java.util.HashMap;
import java.util.Set;
import com.haxademic.core.app.P;
import com.haxademic.core.app.PAppletHax;
import com.haxademic.core.app.config.AppSettings;
import com.haxademic.core.app.config.Config;
import com.haxademic.core.data.constants.PTextAlign;
import com.haxademic.core.debug.DebugView;
import com.haxademic.core.draw.color.EasingColor;
import com.haxademic.core.draw.context.PG;
import com.haxademic.core.draw.filters.pshader.BloomFilter;
import com.haxademic.core.draw.filters.pshader.BrightnessStepFilter;
import com.haxademic.core.draw.text.FontCacher;
import com.haxademic.core.math.MathUtil;
import com.haxademic.core.math.SphericalCoord;
import com.haxademic.core.media.DemoAssets;
import com.haxademic.core.net.JsonUtil;
import com.haxademic.core.render.FrameLoop;
import com.haxademic.core.ui.UI;
import processing.core.PFont;
public class Demo_VoxelSphere2
extends PAppletHax {
public static void main(String args[]) { arguments = args; PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); }
// cube layout
protected String LIGHT_SPACING = "LIGHT_SPACING";
protected String LIGHT_SIZE = "LIGHT_SIZE";
protected String NUM_LIGHTS = "NUM_LIGHTS";
protected String BOUNDING_SPHERE = "BOUNDING_SPHERE";
protected String ROT_X = "ROT_X";
protected String ROT_Y = "ROT_Y";
// pattern controls
protected String NUM_SEGMENTS_VERT = "PATTERN_NUM_SEGMENTS_VERT";
protected String START_RADS_VERT = "PATTERN_START_RADS_VERT";
protected String GAP_THRESH_VERT = "PATTERN_GAP_THRESH_VERT";
protected String NUM_SEGMENTS_HORIZ = "PATTERN_NUM_SEGMENTS_HORIZ";
protected String START_RADS_HORIZ = "PATTERN_START_RADS_HORIZ";
protected String GAP_THRESH_HORIZ = "PATTERN_GAP_THRESH_HORIZ";
// animation helpers
protected String ANIMATE_MODE = "ANIMATE_MODE";
// sphere math helpers
protected SphericalCoord sphereCoord = new SphericalCoord();
// configs
protected static HashMap<String, String> configs;
static {
configs = new HashMap<String, String>();
configs.put("a", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 14.0, \"PATTERN_GAP_THRESH_VERT\": -0.5843284, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.46324384 } ");
configs.put("b", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 22.0, \"PATTERN_GAP_THRESH_VERT\": 0.7173357, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.96176517 } ");
configs.put("c", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 4.0, \"PATTERN_GAP_THRESH_VERT\": 0.45192134, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 22.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.5585952 } ");
configs.put("d", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": 0.029999735, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": -1.0 } ");
configs.put("e", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": -0.91326684, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 16.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.061478257 } ");
configs.put("f", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 22.0, \"PATTERN_GAP_THRESH_VERT\": -0.14026618, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.4583429 } ");
configs.put("g", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": -0.7391555, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 18.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.14310849 } ");
configs.put("h", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 8.0, \"PATTERN_GAP_THRESH_VERT\": 0.5923357, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 16.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.5397266 } ");
configs.put("i", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 18.0, \"PATTERN_GAP_THRESH_VERT\": -0.39235595, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.26771063 } ");
configs.put("j", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": -0.2991562, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.36995012 } ");
configs.put("k", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": -0.70216703, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.61245894 } ");
configs.put("l", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 8.0, \"PATTERN_GAP_THRESH_VERT\": -0.02406156, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.17982471 } ");
configs.put("m", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 22.0, \"PATTERN_GAP_THRESH_VERT\": -0.8154269, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.036954403 } ");
configs.put("n", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": 0.6526089, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 12.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.8325277 } ");
configs.put("o", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 12.0, \"PATTERN_GAP_THRESH_VERT\": 0.7170665, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 16.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.102694035 } ");
configs.put("p", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": 0.22329724, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 4.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.7296017 } ");
configs.put("q", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 14.0, \"PATTERN_GAP_THRESH_VERT\": 0.13128905, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 18.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.63811255 } ");
configs.put("r", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 12.0, \"PATTERN_GAP_THRESH_VERT\": 0.46750873, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 12.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.5228157 } ");
configs.put("s", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 14.0, \"PATTERN_GAP_THRESH_VERT\": -0.8393265, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 22.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.8369159 } ");
configs.put("t", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 4.0, \"PATTERN_GAP_THRESH_VERT\": 0.2787292, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 8.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.54687464 } ");
configs.put("u", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 12.0, \"PATTERN_GAP_THRESH_VERT\": -0.19053984, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 22.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.6054472 } ");
configs.put("v", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": 0.85479033, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.6111987 } ");
configs.put("w", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": 0.80701435, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 12.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.54716444 } ");
configs.put("x", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 4.0, \"PATTERN_GAP_THRESH_VERT\": 0.49174082, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 4.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.07977557 } ");
configs.put("y", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 10.0, \"PATTERN_GAP_THRESH_VERT\": -0.31146777, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 12.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.8188895 } ");
configs.put("z", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 14.0, \"PATTERN_GAP_THRESH_VERT\": 0.25727415, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.9009448 } ");
configs.put(" ", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": 1.0, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": 1.0 } ");
// configs = new HashMap<String, String>();
// configs.put("w", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": 0.80701435, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 12.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.54716444 } ");
// configs.put("a", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 14.0, \"PATTERN_GAP_THRESH_VERT\": -0.5843284, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 20.0, \"PATTERN_GAP_THRESH_HORIZ\": 0.46324384 } ");
// configs.put("t", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 4.0, \"PATTERN_GAP_THRESH_VERT\": 0.2787292, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 8.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.54687464 } ");
// configs.put("e", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": -0.91326684, \"PATTERN_START_RADS_HORIZ\": -4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 16.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.061478257 } ");
// configs.put("r", "{ \"PATTERN_START_RADS_VERT\": -4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 6.0, \"PATTERN_GAP_THRESH_VERT\": -0.86276597, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 18.0, \"PATTERN_GAP_THRESH_HORIZ\": -0.803981 } ");
// configs.put(" ", "{ \"PATTERN_START_RADS_VERT\": 4.712389, \"PATTERN_NUM_SEGMENTS_VERT\": 16.0, \"PATTERN_GAP_THRESH_VERT\": 1.0, \"PATTERN_START_RADS_HORIZ\": 4.712389, \"PATTERN_NUM_SEGMENTS_HORIZ\": 14.0, \"PATTERN_GAP_THRESH_HORIZ\": 1.0 } ");
}
protected String[] letterKeys;
protected String curLetter = "";
protected int numLetters = configs.keySet().size();
protected static HashMap<String, String> vowelColors;
static {
vowelColors = new HashMap<String, String>();
vowelColors.put("a", "#C724B1");
vowelColors.put("e", "#FF7F41");
vowelColors.put("i", "#B5BD00");
vowelColors.put("o", "#59CBE8");
vowelColors.put("u", "#8B84D7");
}
protected String[] otherColors = new String[] {
"#C5B4E3",
"#E2ACD7",
"#046A38",
"#86C8BC",
};
protected EasingColor globalColor = new EasingColor(0xffffffff);
protected int FRAMES = numLetters * 3 * 60; // 3 configs (plus default sphere at 2 sizes, for 3 seconds @ 60fps
// protected int FRAMES = numLetters * 45; // 3 configs (plus default sphere at 2 sizes, for 3 seconds @ 60fps
protected void config() {
Config.setProperty( AppSettings.WIDTH, 960 );
Config.setProperty( AppSettings.HEIGHT, 960 );
Config.setProperty( AppSettings.LOOP_FRAMES, FRAMES );
Config.setProperty( AppSettings.LOOP_TICKS, numLetters );
Config.setProperty( AppSettings.SHOW_UI, false );
Config.setProperty(AppSettings.RENDERING_MOVIE, false);
Config.setProperty(AppSettings.RENDERING_MOVIE_START_FRAME, 1 + FRAMES);
Config.setProperty(AppSettings.RENDERING_MOVIE_STOP_FRAME, 1 + FRAMES * 2);
}
protected void firstFrame() {
UI.addTitle("LED Grid");
UI.addSlider(LIGHT_SPACING, 80, 1, 100f, 1, false);
UI.addSlider(LIGHT_SIZE, 18, 1, 100f, 1, false);
UI.addSlider(NUM_LIGHTS, 14, 5, 40, 1, false);
UI.addSlider(BOUNDING_SPHERE, 0.97f, 0.1f, 3f, 0.01f, false);
UI.addSlider(ROT_X, 0, -P.TWO_PI, P.TWO_PI, 0.01f, false);
UI.addSlider(ROT_Y, 0, -P.TWO_PI, P.TWO_PI, 0.01f, false);
UI.addTitle("Patterns");
UI.addSlider(START_RADS_VERT, -3f * P.HALF_PI, -3f * P.HALF_PI, 3f * P.HALF_PI, 6f * P.HALF_PI, false);
UI.addSlider(NUM_SEGMENTS_VERT, 4, 2, 24, 1, false);
UI.addSlider(GAP_THRESH_VERT, 0.3f, -1f, 1f, 0.01f, false);
UI.addSlider(START_RADS_HORIZ, -3f * P.HALF_PI, -3f * P.HALF_PI, 3f * P.HALF_PI, 6f * P.HALF_PI, false);
UI.addSlider(NUM_SEGMENTS_HORIZ, 4, 2, 24, 1, false);
UI.addSlider(GAP_THRESH_HORIZ, 0.3f, -1f, 1f, 0.01f, false);
UI.addSlider(ANIMATE_MODE, 1, 0, 1, 1, false);
// build alphabet keys array
Set<String> keys = configs.keySet();
letterKeys = new String[keys.size()];
int index = 0;
for(String element : keys) letterKeys[index++] = element;
// speicifc word animation-only
// letterKeys[0] = "w";
// letterKeys[1] = "a";
// letterKeys[2] = "t";
// letterKeys[3] = "e";
// letterKeys[4] = "r";
// letterKeys[5] = " ";
}
protected void drawApp() {
// set context
p.background(0);
p.noStroke();
p.noFill();
p.push();
PG.setDrawCenter(p);
PG.setCenterScreen(p);
PG.setBasicLights(p);
p.translate(0, 0, -1000);
// PG.basicCameraFromMouse(p.g);
p.rotateX(UI.valueEased(ROT_X));
p.rotateY(UI.valueEased(ROT_Y));
p.rotateX(-0.2f + 0.15f * P.sin(2f * FrameLoop.progressRads() * numLetters)); // auto-rotate for rendering
p.rotateY(0.7f * P.sin(FrameLoop.progressRads() * numLetters)); // auto-rotate for rendering
// p.rotateX(-0.2f + 0.15f * P.sin(2f * FrameLoop.progressRads())); // auto-rotate for rendering
// p.rotateY(0.7f * P.sin(FrameLoop.progressRads())); // auto-rotate for rendering
// set animation stops
if(FrameLoop.isTick() && UI.valueInt(ANIMATE_MODE) == 1) {
// get sphere config
curLetter = letterKeys[FrameLoop.curTick()];
if(configs.containsKey(curLetter)) {
UI.loadValuesFromJSON(configs.get(curLetter));
}
// setColorForLetter(curLetter);
}
// update color
globalColor.update();
// set sizes
float lightSize = UI.valueEased(LIGHT_SIZE);
float lightSpacing = UI.valueEased(LIGHT_SPACING);
int numLights = UI.valueInt(NUM_LIGHTS);
float cubeSize = UI.valueEased(LIGHT_SPACING) * UI.valueEased(NUM_LIGHTS);
float cubeSizeHalf = cubeSize / 2f;
int numLightsShown = 0;
// show center sphere
// noFill();
// stroke(255, 50);
p.sphereDetail(4);
// p.sphere(cubeSizeHalf * UI.value(BOUNDING_SPHERE));
// For every x,y coordinate in a 3D space, calculate a noise value and produce a brightness value
for (float x=0; x < numLights; x++) {
for (float y=0; y < numLights; y++) {
// for (float z=numLights/2; z < numLights; z++) { // only half a sphere
for (float z=0; z < numLights; z++) { // only half a sphere
// position
float curX = -cubeSizeHalf + x * lightSpacing;
float curY = -cubeSizeHalf + y * lightSpacing;
float curZ = -cubeSizeHalf + z * lightSpacing;
if(numLights % 2 == 1) { // offset if odd number of lights
curX += lightSpacing/2f;
curY += lightSpacing/2f;
curZ += lightSpacing/2f;
}
sphereCoord.setCartesian(curX, curY, curZ);
// distance to constrain to sphere
float distFromCenter = distance(0,0,0,curX,curY,curZ);
if(distFromCenter < cubeSizeHalf * UI.valueEased(BOUNDING_SPHERE)) { // + halfWidth * 0.75f * P.sin(progressRads)
// oscillate active lights in a spherical pulse
// float distOscToggle = P.sin(FrameLoop.count(-0.1f) + distFromCenter * 0.01f);
// do some polar calcs
float radsToCenterVert = MathUtil.getRadiansToTarget(curX, curZ, 0, 0);
float radsCircleProgress = radsToCenterVert / P.TWO_PI;
float radialOscVert = P.sin(UI.valueEased(START_RADS_VERT) + radsToCenterVert * UI.valueEased(NUM_SEGMENTS_VERT));
// float radialOscVert = P.sin(UI.valueEased(START_RADS_VERT) + sphereCoord.theta * UI.valueEased(NUM_SEGMENTS_VERT));
float radsToCenterHoriz = MathUtil.getRadiansToTarget(curX, curY, 0, 0);
float radsCircleProgressH = radsToCenterHoriz / P.TWO_PI;
// float radialOscHoriz = P.sin(UI.valueEased(START_RADS_HORIZ) + radsToCenterHoriz * UI.valueEased(NUM_SEGMENTS_HORIZ));
float radialOscHoriz = P.sin(UI.valueEased(START_RADS_HORIZ) + sphereCoord.phi * UI.valueEased(NUM_SEGMENTS_HORIZ));
// color from dist
float r = P.sin(curX*0.01f) * 255f + 60f;
float g = P.sin(curY*0.01f) * 255f + 70f;
float b = P.sin(curZ*0.01f) * 255f + 100f;
p.fill(r, g, b);
p.pushMatrix();
p.translate(curX, curY, curZ);
// if(distOscToggle < 0f) {
if(radialOscVert < UI.valueEased(GAP_THRESH_VERT) || radialOscHoriz < UI.valueEased(GAP_THRESH_HORIZ)) {
p.fill(100, 50);
// p.box(lightSize/3);
} else {
// p.fill(P.map(distOscToggle, 0f, 1f, 0, 255));
p.fill(globalColor.colorInt());
p.box(lightSize);
}
p.popMatrix();
numLightsShown++;
} else {
// inactive lights
p.pushMatrix();
p.translate(curX, curY, curZ);
p.fill(100, 50);
// p.box(lightSize / 3);
p.popMatrix();
}
}
}
}
DebugView.setValue("numLightsShown", numLightsShown);
// post process
BrightnessStepFilter.instance(p).setBrightnessStep(-1f/255f);
BrightnessStepFilter.instance(p).applyTo(p.g);
BloomFilter.instance(p).setStrength(1.5f);
BloomFilter.instance(p).setBlurIterations(3);
BloomFilter.instance(p).setBlendMode(BloomFilter.BLEND_SCREEN);
BloomFilter.instance(p).applyTo(p.g);
// draw current letter
p.pop();
PG.setDrawCorner(p.g);
PFont font = FontCacher.getFont(DemoAssets.fontInterPath, 78);
FontCacher.setFontOnContext(p.g, font, p.color(255), 1, PTextAlign.LEFT, PTextAlign.TOP);
p.text(curLetter.toUpperCase(), 50, 50);
}
protected void setColorForLetter(String curLetter) {
// set color
if(vowelColors.containsKey(curLetter)) {
globalColor.setTargetHex(vowelColors.get(curLetter));
P.out(curLetter, vowelColors.get(curLetter));
} else {
globalColor.setTargetInt(0xffffffff);
}
}
protected float distance( float x1, float y1, float z1, float x2, float y2, float z2 ) {
float dx = x1 - x2;
float dy = y1 - y2;
float dz = z1 - z2;
return P.sqrt( dx * dx + dy * dy + dz * dz );
}
public void randomValues() {
// rads start
UI.setValue(START_RADS_VERT, MathUtil.randBoolean() ? -3f * P.HALF_PI : 3f * P.HALF_PI);
UI.setValue(START_RADS_HORIZ, MathUtil.randBoolean() ? -3f * P.HALF_PI : 3f * P.HALF_PI);
// num segments
UI.setValue(NUM_SEGMENTS_VERT, 2 + 2 * MathUtil.randRange(0, 10));
UI.setValue(NUM_SEGMENTS_HORIZ, 2 + 2 * MathUtil.randRange(0, 10));
// density
UI.setRandomValue(GAP_THRESH_VERT);
UI.setRandomValue(GAP_THRESH_HORIZ);
}
public void keyPressed() {
super.keyPressed();
if(p.key == ' ') {
String jsonOutput = UI.valuesToJSON(new String[] {"PATTERN_"});
// jsonOutput = UI.valuesToJSON();
P.out(JsonUtil.jsonToSingleLine(jsonOutput));
}
// random params
if(p.key == '1') randomValues();
// load letter
String keyStr = key+"";
if(configs.containsKey(keyStr) && key != ' ') {
UI.loadValuesFromJSON(configs.get(keyStr));
setColorForLetter(keyStr);
}
}
}
| mit |
jordantdavis/CourseOopAndDataStructures | Lab4PolymorphismAndFileIo/src/CostSortClient.java | 5444 |
//Jordan Davis
//10.14.11
//Lab 4: Polymorphism and File I/O
import Chocolate.*;
import Chocolate.Comparable;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class CostSortClient
{
//name of the file to read from
final static String FILENAME = "Monkey.txt";
final static String FILENAME2 = "Monkey2.txt";
//finds out how many lines of data the file contains
public static int fileLength(String filename)
{
int c = 0; //counter
Scanner length = null;
//try to instantiate a Scanner object to scan the File object
try
{
length = new Scanner(new File(filename));
}
//if the String given in the File constructor is not a valid filename or path then exit the program
catch (FileNotFoundException fnfe)
{
System.out.println(FILENAME + " does not exist.");
System.exit(0);
}
//while there are still more data lines of data
while (length.hasNext())
{
//increment the counter
c++;
//advance to the next line of data
length.nextLine();
}
//return the number of lines data
return c;
}
//takes all data from the text file and puts it in an array
public static Comparable[] populateDataArray(Comparable c[], String filename)
{
//constants for the words in the text file that denote the type of Chocolate
final String SQUARE = "SQUARE";
final String ROUND = "ROUND";
Scanner read = null; //Scanner to read the data in the text file
String chocoType; //String to hold the name of a type of Chocolate read from the text file (square or round)
int i = 0; //counter
//try to instantiate the Scanner to read from the File
try
{
read = new Scanner(new File(filename));
}
//if the String given in the File constructor is not a valid filename or path then exit the program
catch (FileNotFoundException fnfe)
{
System.out.println(FILENAME + " does not exist.");
System.exit(0);
}
//while the text file has more lines of info
while (read.hasNext())
{
//the first token read on a given line is the type of Chocolate
chocoType = read.next();
//if the type of Chocolate is square then create a new SquareChocolate object at index i of c
if (chocoType.equals(SQUARE))
{
//read the next three tokens as doubles and use them as constructors for a new SquareChocolate object
c[i] = new SquareChocolate(read.nextDouble(), read.nextDouble(), read.nextDouble());
//increment counter
i++;
}
//if the type of Chocolate is round then create a new RoundChocolate object at index i of c
else
{
//read the next two tokens as doubles and use them as constructors for the new RoundChocolate object
c[i] = new RoundChocolate(read.nextDouble(), read.nextDouble());
//increment counter
i++;
}
}
//return the array populated with the text file data
return c;
}
//takes in an array of Comparables and sorts them in ascending order according to cost
public static void insertionSort(Comparable c[])
{
//current Comparable (which is a type of Chocolate object) to insert in the array
Comparable chocolateToInsert;
//for each element in the array, except for the first element
for (int i = 1; i < c.length; i++)
{
//the element at index i becomes the current Chocolate to place
chocolateToInsert = c[i];
//index used for going back through the Comparable array to insert the current Chocolate to place
int j = i - 1;
//while the index is not less than 0 and
//the "cost" of the Chocolate you are trying to place is less than the "cost" Chocolate at index j
while (j >= 0 && chocolateToInsert.compareTo(c[j]) == -1)
{
//move c at just up one index
c[j + 1] = c[j];
//decrement j
j--;
}
//finally place the Chocolate to insert into the old index of the previously moved Chocolate in c
c[j + 1] = chocolateToInsert;
}
}
//print out each Chocolate object in a given Comparable array
public static void printData(Comparable c[])
{
for (int i = 0; i < c.length; i++)
{
System.out.println(c[i]);
System.out.println("-------------------------");
}
System.out.println("END OF OUTPUT");
System.out.println("-------------------------");
}
public static void main(String args[])
{
//create a new Comparable array w/ a length that is the same as the count of lines of data in the file
Comparable chocolate[] = new Comparable[fileLength(FILENAME)];
//place values from Monkey.txt into chocolate
populateDataArray(chocolate, FILENAME);
//sort the elements of chocolate by cost
insertionSort(chocolate);
//print the sorted array
printData(chocolate);
System.out.println("\n\n******************************************************************************\n\n");
//another test
Comparable c2[] = new Comparable[fileLength(FILENAME2)];
populateDataArray(c2, FILENAME2);
insertionSort(c2);
printData(c2);
System.out.println("\n\n******************************************************************************\n\n");
SquareChocolate sc = new SquareChocolate(1.4, 1.7, 2.5);
RoundChocolate rc = new RoundChocolate(1.6, 1.9);
System.out.println(sc + "\n\ncompared to\n\n" + rc);
System.out.println("\n" + sc.compareTo(rc));
}
}
| mit |
JonathanxD/CodeAPI | src/test/java/com/github/jonathanxd/kores/test/RecursiveTypeResolution.java | 632 | package com.github.jonathanxd.kores.test;
import com.github.jonathanxd.iutils.object.Either;
import com.github.jonathanxd.kores.base.FieldDeclaration;
import com.github.jonathanxd.kores.type.KoresTypes;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class RecursiveTypeResolution {
@Test
public void comparableRecursion() {
Class<?> map = Map.class;
// Could cause StackOverflowError if not treated correctly.
Either<Exception, List<FieldDeclaration>> fieldResolution =
KoresTypes.getKoresType(map).getBindedDefaultResolver().resolveFields();
}
}
| mit |
schillermann/SpigotSurvivalKit | src/de/schillermann/spigotsurvivalkit/menu/item/HelpersMenuItem.java | 896 | package de.schillermann.spigotsurvivalkit.menu.item;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
/**
*
* @author Mario Schillermann
*/
final public class HelpersMenuItem extends MenuItem {
final private List<String> description;
public HelpersMenuItem(Material type, String name, List<String> description) {
super(type, name, description);
this.description = description;
}
public ItemStack getItem(List<String> helperNameList) {
ItemStack item = super.getItem();
ItemMeta meta = item.getItemMeta();
if(helperNameList.isEmpty())
meta.setLore(this.description);
else
meta.setLore(helperNameList);
item.setItemMeta(meta);
return item;
}
}
| mit |
zxh0/jvmgo-book | v1/code/java/jvmgo_java/ch05/src/main/java/com/github/jvmgo/instructions/control/lookupswitch.java | 1279 | package com.github.jvmgo.instructions.control;
import com.github.jvmgo.instructions.base.BranchInstruction;
import com.github.jvmgo.instructions.base.BytecodeReader;
import lombok.Getter;
import lombok.Setter;
import com.github.jvmgo.rtda.Frame;
import com.github.jvmgo.rtda.OperandStack;
import com.github.jvmgo.rtda.Thread;
@Setter
@Getter
public class lookupswitch extends BranchInstruction {
private int defaultOffset;
private int npairs;
private int[] matchOffsets;
@Override
public int getOpCode() {
return 0xab;
}
@Override
public void fetchOperands(BytecodeReader reader) {
reader.skipPadding();
defaultOffset = reader.read32();
npairs = reader.read32();
matchOffsets = reader.readInt32s(npairs * 2);
}
@Override
public void execute(Frame frame) throws Exception {
OperandStack operandStack = frame.getOperandStack();
Thread thread = frame.getThread();
int key = operandStack.popInt();
for (int i = 0; i < npairs * 2; i += 2) {
if (matchOffsets[i] == key) {
offset = matchOffsets[i + 1];
thread.setPc(offset);
return;
}
}
thread.setPc(defaultOffset);
}
}
| mit |
ysrbdlgn/AudioConverter | ac-frontend/src/main/java/com/ysrbdlgn/audioconverter/frontend/ui/ribbon/Ribbon.java | 3407 | package com.ysrbdlgn.audioconverter.frontend.ui.ribbon;
import com.ysrbdlgn.audioconverter.frontend.ui.ribbon.skin.RibbonSkin;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.scene.control.Control;
import javafx.scene.control.Skin;
import java.util.Collection;
import java.util.HashMap;
public class Ribbon extends Control {
public final static String DEFAULT_STYLE_CLASS = "ribbon";
private ObservableList<String> tabTitles;
private ObservableList<RibbonTab> tabs;
private HashMap<String, RibbonTab> titleToRibbonTab;
private QuickAccessBar quickAccessBar;
public Ribbon() {
quickAccessBar = new QuickAccessBar();
tabTitles = FXCollections.observableArrayList();
tabs = FXCollections.observableArrayList();
titleToRibbonTab = new HashMap<>();
tabTitles.addListener(new ListChangeListener<String>() {
@Override
public void onChanged(Change<? extends String> changed) {
tabTitlesChanged(changed);
}
});
getStyleClass().setAll(DEFAULT_STYLE_CLASS);
}
private void tabTitlesChanged(ListChangeListener.Change<? extends String> changed) {
while (changed.next()) {
if (changed.wasAdded()) {
updateAddedRibbonTabs(changed.getAddedSubList());
}
if (changed.wasRemoved()) {
for (String title : changed.getRemoved())
titleToRibbonTab.remove(title);
}
}
}
private void updateAddedRibbonTabs(Collection<? extends String> ribbonTabTitles) {
for (String title : ribbonTabTitles) {
RibbonTab ribbonTab = new RibbonTab(title);
titleToRibbonTab.put(title, ribbonTab);
tabs.add(ribbonTab);
}
}
public ObservableList<String> getTabTitles() {
return tabTitles;
}
public ObservableList<RibbonTab> getTabs() {
return tabs;
}
public QuickAccessBar getQuickAccessBar() {
return quickAccessBar;
}
public void setQuickAccessBar(QuickAccessBar qAccessBar) {
quickAccessBar = qAccessBar;
}
@Override
protected Skin<?> createDefaultSkin() {
return new RibbonSkin(this);
}
/***************************************************************************
* *
* Properties *
* *
**************************************************************************/
/**
* Selected Ribbon Tab
**/
private SimpleObjectProperty<RibbonTab> selectedRibbonTab = new SimpleObjectProperty<>();
public SimpleObjectProperty selectedRibbonTabProperty() {
return selectedRibbonTab;
}
public RibbonTab getSelectedRibbonTab() {
return selectedRibbonTab.get();
}
public void setSelectedRibbonTab(RibbonTab ribbonTab) {
selectedRibbonTab.set(ribbonTab);
}
@Override
public String getUserAgentStylesheet() {
return getClass().getResource("/css/fxribbon.css").toExternalForm();
}
}
| mit |
uncleashi/find-client-android | app/src/main/java/com/find/wifitool/wifi/WifiIntentReceiver.java | 6179 | package com.find.wifitool.wifi;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.find.wifitool.httpCalls.FindWiFi;
import com.find.wifitool.httpCalls.FindWiFiImpl;
import com.find.wifitool.internal.Constants;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by akshay on 30/12/16.
*/
public class WifiIntentReceiver extends IntentService {
private static final String TAG = WifiIntentReceiver.class.getSimpleName();
// private variables
private WifiManager mWifiManager;
private WifiData mWifiData;
private FindWiFi client;
private String eventName, userName, groupName, serverName, locationName;
private JSONObject wifiFingerprint;
private String currLocation;
private static final Set<Character> AD_HOC_HEX_VALUES =
new HashSet<Character>(Arrays.asList('2','6', 'a', 'e', 'A', 'E'));
/**
* Creates an IntentService. Invoked by your subclass's constructor.
*/
public WifiIntentReceiver() {
super(TAG);
}
@Override
protected void onHandleIntent(Intent intent) {
client = new FindWiFiImpl(getApplicationContext());
// Getting all the value passed from previous Fragment
eventName = intent.getStringExtra("event");
userName = intent.getStringExtra("userName");
groupName = intent.getStringExtra("groupName");
serverName = intent.getStringExtra("serverName");
locationName = intent.getStringExtra("locationName");
Long timeStamp = System.currentTimeMillis()/1000;
// getting all wifi APs and forming data payload
try {
mWifiData = new WifiData();
mWifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
JSONArray wifiResultsArray = new JSONArray();
List<ScanResult> mResults = mWifiManager.getScanResults();
for (ScanResult result : mResults) {
JSONObject wifiResults = new JSONObject();
if (shouldLog(result)) {
wifiResults.put("mac", result.BSSID);
wifiResults.put("rssi", result.level);
wifiResultsArray.put(wifiResults);
}
}
wifiFingerprint = new JSONObject();
wifiFingerprint.put("group", groupName);
wifiFingerprint.put("username", userName);
wifiFingerprint.put("location", locationName);
wifiFingerprint.put("time", timeStamp);
wifiFingerprint.put("wifi-fingerprint", wifiResultsArray);
Log.d(TAG, String.valueOf(wifiFingerprint));
} catch (Exception ex) {
ex.printStackTrace();
}
// Send the packet to server
sendPayload(eventName, serverName, wifiFingerprint);
}
// Function to check to check the route(learn or track) and send data to server
private void sendPayload(String event, String serverName, JSONObject json) {
if(event.equalsIgnoreCase("track")) {
Callback postTrackEvent = new Callback() {
@Override
public void onFailure(Request request, IOException e) {
Log.e(TAG, "Failed request: " + request, e);
}
@Override
public void onResponse(Response response) throws IOException {
String body = response.body().string();
if (response.isSuccessful()) {
Log.d(TAG, body);
try {
JSONObject json = new JSONObject(body);
currLocation = json.getString("location");
} catch (JSONException e) {
Log.e(TAG, "Failed to extract location from response: " + body, e);
}
sendCurrentLocation(currLocation);
} else {
Log.e(TAG, "Unsuccessful request: " + body);
}
}
};
client.findTrack(postTrackEvent, serverName, json);
} else {
Callback postLearnEvent = new Callback() {
@Override
public void onFailure(Request request, IOException e) {
Log.e(TAG, "Failed request: " + request, e);
}
@Override
public void onResponse(Response response) throws IOException {
String body = response.body().string();
Log.d(TAG, body);
}
};
client.findLearn(postLearnEvent, serverName, json);
}
}
// Broadcasting current location extracted from Response
private void sendCurrentLocation(String location) {
if (location != null && !location.isEmpty()) {
Intent intent = new Intent(Constants.TRACK_BCAST);
intent.putExtra("location", location);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
}
}
/**
* Returns true if the given scan should be logged, or false if it is an
* ad-hoc AP or if it is an AP that has opted out of Google's collection
* practices.
*/
private static boolean shouldLog(final ScanResult sr) {
// Only apply this test if we have exactly 17 character long BSSID which should
// be the case.
final char secondNybble = sr.BSSID.length() == 17 ? sr.BSSID.charAt(1) : ' ';
if(AD_HOC_HEX_VALUES.contains(secondNybble)) {
return false;
}
else {
return true;
}
}
}
| mit |
d2fn/passage | src/main/java/com/bbn/openmap/tools/symbology/milStd2525/CodePosition.java | 12521 | // **********************************************************************
//
// <copyright>
//
// BBN Technologies
// 10 Moulton Street
// Cambridge, MA 02138
// (617) 873-8000
//
// Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
//
// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/tools/symbology/milStd2525/CodePosition.java,v $
// $RCSfile: CodePosition.java,v $
// $Revision: 1.12 $
// $Date: 2005/08/11 20:39:17 $
// $Author: dietrick $
//
// **********************************************************************
package com.bbn.openmap.tools.symbology.milStd2525;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import com.bbn.openmap.util.ComponentFactory;
import com.bbn.openmap.util.Debug;
import com.bbn.openmap.util.PropUtils;
/**
* The CodePosition class is a base class used to interpret and
* organize role settings for a symbol. The SymbolCode describes a
* symbol and its role, with different characters having defined
* meanings and optional values, depending on the symbol. The
* CodePosition object defines a character and meaning for a character
* in a certain place. A SymbolPart refers to a particlar CodePosition
* that uniquely defines it, giving it some organizational meaning.
* SymbolParts that share a parent can get to the parent's CodePositin
* to see that meaning as well.
* <P>
*
* CodePositions have some intelligence for parsing position
* properties and hierarchy properties, which allow the whole symbol
* tree to be defined.
* <P>
*
* CodePositions server a couple of different roles. Some CodePosition
* objects organize the kinds of set values that may be applicable for
* a certain character position, and can offer those choices. These
* organizational CodePositions won't have a SymbolPart to represent
* itself. Other CodePositions, including the choices and those tied
* directly to SymbolParts in the SymbolPart tree, don't offer choices
* but can provide SymbolParts to represent themselves in the symbol.
*/
public class CodePosition {
public final static char NO_CHAR = ' ';
public final static int NO_NUMBER = -1;
protected int hierarchyNumber;
protected String id;
protected String prettyName;
protected int startIndex;
protected int endIndex;
protected CodePosition nextPosition = null;
protected SymbolPart symbolPart = null;
public boolean DEBUG = false;
/** Property file property for pretty name 'name' */
public final static String NameProperty = "name";
/**
* Property file property for a classname representing the next
* position in the position tree 'next'.
*/
public final static String NextProperty = "next";
/**
* A list of CodePosition choices for this position. This is only
* used for a single instance of the CodePosition that in turn
* holds this list of possible versions.
*/
protected List choices;
public CodePosition() {
DEBUG = Debug.debugging("codeposition");
}
public CodePosition(String name, int start, int end) {
this();
startIndex = start - 1;
endIndex = end;
prettyName = name;
}
/**
* A query method that answers of the given 15 digit code applies
* to this symbol part.
*
* @param queryCode
* @return true if the code applies to this position.
*/
public boolean codeMatches(String queryCode) {
int length = id.length();
if (Debug.debugging("symbology.detail")) {
Debug.output("Checking " + queryCode + " against |" + id
+ "| starting at " + startIndex + " for " + length);
}
return queryCode.regionMatches(true, startIndex, id, 0, length);
}
/**
* Get the current list of CodePosition possibilities. Only returns
* a list for the CodePositions used to parse the position
* properties.
*/
public List getPositionChoices() {
return choices;
}
/**
* Get a CodePosition from this list of available possibilities
* given the hierarchy number for the position. Not all positions
* have a hierarchy number, but the number given in the positions
* properties will probably suffice.
*/
public CodePosition getFromChoices(int hierarchyNumber) {
List aList = getPositionChoices();
if (aList != null) {
for (Iterator it = aList.iterator(); it.hasNext();) {
CodePosition cp = (CodePosition) it.next();
if (hierarchyNumber == cp.getHierarchyNumber()) {
return cp;
}
}
}
return null;
}
/**
* Method to add a position to the choices for this particular
* code position.
*
* @param index the hierarchical index for this position choice.
* This really only becomes important for those
* CodePositions which are used for interpreting the
* hierarchy properties. Other positions can use them for
* convenience, and this value will probably be just an
* ordering number for this choice out of all the other
* choices for the position.
* @param entry this should be character or characters used in the
* symbol code for this particular position choice.
* @param prefix the scoping property prefix used for all the
* properties. The entry is discovered by looking in the
* properties for this 'prefix.index'. Then other
* properties are discovered by looking for
* 'prefix.entry.propertyKey' properties.
* @param props the position properties.
*/
protected CodePosition addPositionChoice(int index, String entry,
String prefix, Properties props) {
String className = this.getClass().getName();
CodePosition cp = (CodePosition) ComponentFactory.create(className);
if (cp != null) {
if (DEBUG) {
Debug.output("CodePosition: created position (" + className
+ ")");
}
// Before prefix is modified
cp.symbolPart = getSymbolPart(prefix + entry, prefix, props);
prefix = PropUtils.getScopedPropertyPrefix(prefix) + entry + ".";
// Might not mean anything for option-type positions
cp.hierarchyNumber = index;
//cp.id = entry.charAt(0); // ASSUMED, but breaks
// multi-character codes
cp.id = entry;
cp.prettyName = props.getProperty(prefix + NameProperty);
addPositionChoice(cp);
} else {
if (DEBUG) {
Debug.output("CodePosition: couldn't create position ("
+ className + ")");
}
}
return cp;
}
/**
* Add the CodePosition to the choices, creating the choices List
* if needed.
*/
public void addPositionChoice(CodePosition cp) {
if (choices == null) {
choices = new LinkedList();
}
choices.add(cp);
}
/**
* This method reads Properties to add choices to this class as
* options for what values are valid in this position.
*/
protected void parsePositions(String prefix, Properties props) {
int index = 1;
prefix = PropUtils.getScopedPropertyPrefix(prefix);
String entry = props.getProperty(prefix + Integer.toString(index));
while (entry != null) {
addPositionChoice(index, entry, prefix, props);
entry = props.getProperty(prefix + Integer.toString(++index));
}
}
/**
* A method called when parsing position properties.
*
* @param entry should be prefix of the overall position class
* along with the symbol representation for that position.
* @param prefix should just be the prefix for the overall
* position class, including the period before the symbol
* representation for that position.
* @param props the position properties.
*/
protected SymbolPart getSymbolPart(String entry, String prefix,
Properties props) {
int offset = prefix.length();
return new SymbolPart(this, entry, props, null, offset, offset
+ endIndex - startIndex, false);
}
protected void parseHierarchy(String hCode, Properties props,
SymbolPart parent) {
List parentList = null;
int levelCounter = 1;
while (levelCounter > 0) {
String hierarchyCode = hCode + "." + levelCounter;
if (DEBUG) {
Debug.output("CodePosition.parse: " + hierarchyCode + " with "
+ getPrettyName());
}
String entry = props.getProperty(hierarchyCode);
if (entry != null) {
CodeFunctionID cp = new CodeFunctionID();
SymbolPart sp = new SymbolPart(cp, entry, props, parent);
if (parentList == null) {
parentList = parent.getSubs();
if (parentList == null) {
parentList = new LinkedList();
parent.setSubs(parentList);
}
}
if (DEBUG) {
Debug.output("CodePosition.parse: adding "
+ sp.getPrettyName() + " to "
+ parent.getPrettyName());
}
parentList.add(sp);
if (DEBUG) {
Debug.output("CodePosition.parse: looking for children of "
+ sp.getPrettyName());
}
cp.parseHierarchy(hierarchyCode, props, sp);
levelCounter++;
} else {
levelCounter = -1; // Flag to punch out of loop
}
}
}
/**
* The SymbolPart tree can be represented by a hierarchy number
* system, and this system is what is used in the hierarchy
* properties file to build the symbol tree.
*/
public int getHierarchyNumber() {
return hierarchyNumber;
}
/**
* Return a string version of the hierarchy number.
*/
public String getHierarchyNumberString() {
return Integer.toString(hierarchyNumber);
}
/**
* Get the character, in the symbol code, that this position
* represents.
*/
public String getID() {
return id;
}
/**
* Get the pretty name that states what this position and
* character represents.
*/
public String getPrettyName() {
return prettyName;
}
/**
* Get the starting index of the span that this position
* represents. This value is a java index value starting at 0.
*/
public int getStartIndex() {
return startIndex;
}
/**
* Get the ending index of the span that this position represents.
* This value is a java index value starting at 0.
*/
public int getEndIndex() {
return endIndex;
}
/**
* Return the next CodePosition. An organizational tool to help
* build the SymbolPart tree when parsing the hierarchy
* properties.
*/
public CodePosition getNextPosition() {
return nextPosition;
}
public String toString() {
// return getPrettyName() + " [" + getID() + "] at " +
// getStartIndex() + ", " + getEndIndex();
return getPrettyName();
}
protected CodePosition getNULLCodePosition() {
String className = this.getClass().getName();
CodePosition cp = (CodePosition) ComponentFactory.create(className);
StringBuffer idbuf = new StringBuffer();
for (int i = startIndex; i < endIndex; i++) {
idbuf.append("*");
}
cp.id = idbuf.toString();
cp.prettyName = "- Unspecified -";
if (Debug.debugging("symbology")) {
Debug.output("CodePosition: creating *unspecified* version of (" + className + ") with "
+ cp.id + ", " + cp.prettyName);
}
return cp;
}
} | mit |
joshuaspence/StealthNet | src/StealthNet/Chat.java | 8429 | /* @formatter:off */
/******************************************************************************
* ELEC5616
* Computer and Network Security, The University of Sydney
*
* PACKAGE: StealthNet
* FILENAME: Chat.java
* AUTHORS: Matt Barrie and Joshua Spence
* DESCRIPTION: Implementation of StealthNet Client Chat for ELEC5616
* programming assignment. Debug code has also been added to
* this class.
*
*****************************************************************************/
/* @formatter:on */
package StealthNet;
/* Import Libraries ******************************************************** */
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
/* StealthNet.Chat Class Definition **************************************** */
/**
* The chat window used to allow two StealthNet {@link Client}s to communicate
* in a graphical chat window.
*
* @author Matt Barrie
* @author Joshua Spence
*/
public class Chat extends Thread {
/* Debug options. */
private static final boolean DEBUG_GENERAL = Debug.isDebug("StealthNet.Chat.General");
private static final boolean DEBUG_ERROR_TRACE = Debug.isDebug("StealthNet.Chat.ErrorTrace") || Debug.isDebug("ErrorTrace");
/* GUI elements. */
private JFrame chatFrame;
private JTextArea chatTextBox;
private JTextField msgText;
/**
* The StealthNet {@link Comms} instance used to allow the {@link Client}s
* to communicate.
*/
private Comms stealthComms = null;
/** The ID of the user owning the chat session. */
private final String userID;
/**
* Constructor.
*
* @param id The ID of the user owning the chat session.
* @param snComms The Comms class used to allow the clients to communicate.
*/
public Chat(final String id, final Comms snComms) {
userID = id;
stealthComms = snComms;
}
/**
* Cleans up before destroying the class.
*
* @throws IOException
*/
@Override
protected void finalize() throws IOException {
if (stealthComms != null)
stealthComms.terminateSession();
}
/**
* Creates the GUI for the Chat instance.
*
* @return An AWT component containing the chat elements.
*/
public Component createGUI() {
/* Create text window. */
chatTextBox = new JTextArea();
chatTextBox.setLineWrap(true);
chatTextBox.setWrapStyleWord(true);
chatTextBox.setEditable(false);
chatTextBox.setBackground(Color.lightGray);
final JScrollPane chatScrollPane = new JScrollPane(chatTextBox);
chatScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
chatScrollPane.setPreferredSize(new Dimension(280, 100));
chatScrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Chat"), BorderFactory.createEmptyBorder(0, 0, 0, 0)), chatScrollPane.getBorder()));
/* Create text input field (and quit button). */
msgText = new JTextField(25);
msgText.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
sendChat();
}
});
final JButton quitBtn = new JButton("X");
quitBtn.setVerticalTextPosition(SwingConstants.BOTTOM);
quitBtn.setHorizontalTextPosition(SwingConstants.CENTER);
quitBtn.setMnemonic(KeyEvent.VK_Q);
quitBtn.setToolTipText("Quit");
quitBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (stealthComms != null) {
if (DEBUG_GENERAL)
System.out.println("Terminating chat session.");
stealthComms.sendPacket(DecryptedPacket.CMD_LOGOUT);
stealthComms.terminateSession();
}
stealthComms = null;
}
});
final JPanel btnPane = new JPanel();
btnPane.setLayout(new BorderLayout());
btnPane.add(msgText);
btnPane.add(quitBtn, BorderLayout.EAST);
/* Create top-level panel and add components. */
final JPanel pane = new JPanel();
pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 5, 10));
pane.setLayout(new BorderLayout());
pane.add(chatScrollPane);
pane.add(btnPane, BorderLayout.SOUTH);
return pane;
}
/** Send a chat message using StealthNet. */
private synchronized void sendChat() {
final String msg = "[" + userID + "] " + msgText.getText();
chatTextBox.append(msg + "\n");
if (stealthComms != null) {
if (DEBUG_GENERAL)
System.out.println("Sending chat message: \"" + msg + "\".");
stealthComms.sendPacket(DecryptedPacket.CMD_MSG, msg);
}
msgText.setText("");
}
/** Receive a chat message using StealthNet. */
private synchronized void recvChat() {
try {
if (stealthComms == null || !stealthComms.recvReady())
return;
} catch (final IOException e) {
if (stealthComms != null) {
stealthComms.sendPacket(DecryptedPacket.CMD_LOGOUT);
stealthComms.terminateSession();
}
stealthComms = null;
return;
}
DecryptedPacket pckt = new DecryptedPacket();
try {
while (pckt.command != DecryptedPacket.CMD_LOGOUT && stealthComms.recvReady()) {
pckt = stealthComms.recvPacket();
if (pckt == null)
break;
switch (pckt.command) {
/* @formatter:off */
/***********************************************************
* Message command
**********************************************************/
/* @formatter:on */
case DecryptedPacket.CMD_MSG: {
/* Chat message received. */
final String msg = new String(pckt.data);
if (DEBUG_GENERAL)
System.out.println("Received chat message: \"" + msg + "\".");
chatTextBox.append(msg + "\n");
break;
}
/***********************************************************
* Logout command
**********************************************************/
case DecryptedPacket.CMD_LOGOUT: {
/* Terminate chat session. */
if (DEBUG_GENERAL)
System.out.println("Terminating chat session.");
JOptionPane.showMessageDialog(chatFrame, "Chat session terminated at other side.", "StealthNet", JOptionPane.INFORMATION_MESSAGE);
stealthComms.terminateSession();
stealthComms = null;
break;
}
/***********************************************************
* Unknown command
**********************************************************/
default:
System.err.println("Unrecognised command.");
}
}
} catch (final Exception e) {
System.err.println("Error running chat thread.");
if (DEBUG_ERROR_TRACE)
e.printStackTrace();
}
}
/** The main function for Chat. */
@Override
public void run() {
final Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
/* Set up chat window. */
chatFrame = new JFrame("stealthnet chat [" + userID + "]");
chatFrame.getContentPane().add(createGUI(), BorderLayout.CENTER);
chatFrame.pack();
msgText.requestFocus();
chatFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
if (stealthComms != null) {
stealthComms.sendPacket(DecryptedPacket.CMD_LOGOUT);
stealthComms.terminateSession();
}
stealthComms = null;
}
});
/* Centre the window. */
final int x = (screenDim.width - chatFrame.getSize().width) / 2;
final int y = (screenDim.height - chatFrame.getSize().height) / 2;
chatFrame.setLocation(x, y);
chatFrame.setVisible(true);
/* Wait for chat messages. */
while (stealthComms != null) {
recvChat();
try {
sleep(100);
} catch (final Exception e) {}
}
chatTextBox = null;
msgText = null;
chatFrame.setVisible(false);
}
}
/******************************************************************************
* END OF FILE: Chat.java
*****************************************************************************/
| mit |
sukmin/cavecat | src/main/java/com/cavecat/bo/UserBO.java | 943 | package com.cavecat.bo;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cavecat.dao.UserDAO;
import com.cavecat.model.User;
@Service
public class UserBO {
@Autowired
private UserDAO userDAO;
@PostConstruct
public void init() {
List<User> users = userDAO.findByIdAndPasswd("test", "123");
if (users.size() > 0) {
return;
}
User user1 = new User();
user1.setId("test");
user1.setPasswd("123");
user1.setEmail("test@test.com");
user1.setRegisteredDate(new Date());
userDAO.save(user1);
}
public boolean isMember(User user) {
List<User> users = userDAO.findByIdAndPasswd(user.getId(), user.getPasswd());
return (users.size() == 1);
}
public boolean isNotMember(User user) {
return !isMember(user);
}
}
| mit |
OblivionNW/Nucleus | src/main/java/io/github/nucleuspowered/nucleus/modules/core/config/WarmupConfig.java | 772 | /*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.modules.core.config;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class WarmupConfig {
@Setting(value = "cancel-on-move", comment = "config.core.warmup.move")
private boolean onMove = true;
@Setting(value = "cancel-on-command", comment = "config.core.warmup.command")
private boolean onCommand = true;
public boolean isOnMove() {
return this.onMove;
}
public boolean isOnCommand() {
return this.onCommand;
}
}
| mit |
avshabanov/spring-camel-demo | listener-web-app/src/main/java/com/alexshabanov/cameldemo/listener/route/handler/GreetingHandler.java | 1137 | package com.alexshabanov.cameldemo.listener.route.handler;
import com.alexshabanov.cameldemo.domain.Greeting;
import com.alexshabanov.cameldemo.listener.service.GreetingSinkService;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.jms.StreamMessage;
/**
* Processor that fetches Greeting message from the JMS channel.
*
* @author Alexander Shabanov
*/
public final class GreetingHandler implements Processor {
private final Logger log = LoggerFactory.getLogger(GreetingHandler.class);
@Autowired
private GreetingSinkService greetingSinkService;
@Override
public void process(Exchange exchange) throws Exception {
log.info("Got exchange id={}", exchange.getExchangeId());
final StreamMessage message = exchange.getIn().getBody(StreamMessage.class);
final Greeting greeting = new Greeting(message.readString(), message.readInt());
log.info("- Parsed {}", greeting);
greetingSinkService.putGreeting(greeting);
}
}
| mit |
eeveorg/GMSI | script/LRterminals/WordContinue.java | 196 | /*
* Decompiled with CFR 0_119.
*/
package script.LRterminals;
import script.Token;
public class WordContinue
extends Token {
public WordContinue(Token old) {
super(old);
}
}
| mit |
zhangqiang110/my4j | pms/src/main/java/com/swfarm/biz/chain/dao/SkuDevKpiSheetDao.java | 218 | package com.swfarm.biz.chain.dao;
import com.swfarm.biz.chain.bo.SkuDevKpiSheet;
import com.swfarm.pub.framework.dao.GenericDao;
public interface SkuDevKpiSheetDao extends GenericDao<SkuDevKpiSheet, Long> {
}
| mit |
MarconeAugusto/Aula09_ex01 | ex01/src/main/java/Principal.java | 869 | public class Principal {
public static void main(String[] args){
Complexo c1 = new Complexo();
Complexo c2 = new Complexo(3,5);
Complexo c3 = new Complexo(4,52);
Complexo c4 = new Complexo(2,33);
System.out.println("Complexo c1: " +c1);
System.out.println("Complexo c2: " +c2);
System.out.println("Complexo c3: " +c3);
System.out.println("Complexo c4: " +c4);
c1.soma(c4);
System.out.println("Complexo c1: "+c1);
c2.soma(c1);
System.out.println("Complexo c2: "+c2);
c3.soma(c2);
System.out.println("Complexo c3: "+c3);
c1.subtrai(c2);
System.out.println("Complexo c1: "+c1);
c3.subtrai(c1);
System.out.println("Complexo c3: "+c3);
c4.subtrai(c3);
System.out.println("Complexo c4: "+c4);
}
}
| mit |
bhewett/mozu-java | mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductVariationFactory.java | 25425 | /**
* This code was auto-generated by a tool.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
*/
package com.mozu.test.framework.datafactory;
import java.util.List;
import java.util.ArrayList;
import org.apache.http.HttpStatus;
import com.mozu.api.ApiException;
import com.mozu.api.ApiContext;
import com.mozu.test.framework.core.TestFailException;
import com.mozu.api.resources.commerce.catalog.admin.products.ProductVariationResource;
/** <summary>
* Use the product variations sub-resource to manage the variations of a product based on its attributes. For example, a t-shirt product could be offered in six variations: Small Black, Medium Black, Large Black, Small White, Medium White, and Large White.
* </summary>
*/
public class ProductVariationFactory
{
public static List<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice> getProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception
{
List<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice> returnObj = new ArrayList<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice>();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariationLocalizedDeltaPrices( productCode, variationKey);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
return getProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, productCode, variationKey, currencyCode, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariationLocalizedDeltaPrice( productCode, variationKey, currencyCode, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static List<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice> getProductVariationLocalizedPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception
{
List<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice> returnObj = new ArrayList<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice>();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariationLocalizedPrices( productCode, variationKey);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice getProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
return getProductVariationLocalizedPrice(apiContext, dataViewMode, productCode, variationKey, currencyCode, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice getProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationFixedPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationFixedPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariationLocalizedPrice( productCode, variationKey, currencyCode, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception
{
return getProductVariation(apiContext, dataViewMode, productCode, variationKey, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariation returnObj = new com.mozu.api.contracts.productadmin.ProductVariation();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariation( productCode, variationKey, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception
{
return getProductVariations(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationPagedCollection returnObj = new com.mozu.api.contracts.productadmin.ProductVariationPagedCollection();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.getProductVariations( productCode, startIndex, pageSize, sortBy, filter, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, int expectedCode) throws Exception
{
return addProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.addProductVariationLocalizedDeltaPrice( localizedDeltaPrice, productCode, variationKey, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice addProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationFixedPrice localizedPrice, String productCode, String variationKey, int expectedCode) throws Exception
{
return addProductVariationLocalizedPrice(apiContext, dataViewMode, localizedPrice, productCode, variationKey, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice addProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationFixedPrice localizedPrice, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationFixedPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationFixedPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.addProductVariationLocalizedPrice( localizedPrice, productCode, variationKey, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static List<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice> updateProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice> localizedDeltaPrice, String productCode, String variationKey, int expectedCode) throws Exception
{
List<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice> returnObj = new ArrayList<com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice>();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariationLocalizedDeltaPrices( localizedDeltaPrice, productCode, variationKey);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
return updateProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, currencyCode, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariationLocalizedDeltaPrice( localizedDeltaPrice, productCode, variationKey, currencyCode, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static List<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice> updateProductVariationLocalizedPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice> localizedPrice, String productCode, String variationKey, int expectedCode) throws Exception
{
List<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice> returnObj = new ArrayList<com.mozu.api.contracts.productadmin.ProductVariationFixedPrice>();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariationLocalizedPrices( localizedPrice, productCode, variationKey);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice updateProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationFixedPrice localizedPrice, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
return updateProductVariationLocalizedPrice(apiContext, dataViewMode, localizedPrice, productCode, variationKey, currencyCode, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationFixedPrice updateProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationFixedPrice localizedPrice, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationFixedPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationFixedPrice();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariationLocalizedPrice( localizedPrice, productCode, variationKey, currencyCode, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, int expectedCode) throws Exception
{
return updateProductVariation(apiContext, dataViewMode, productVariation, productCode, variationKey, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariation returnObj = new com.mozu.api.contracts.productadmin.ProductVariation();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariation( productVariation, productCode, variationKey, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static com.mozu.api.contracts.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, int expectedCode) throws Exception
{
return updateProductVariations(apiContext, dataViewMode, productVariations, productCode, null, expectedCode);
}
public static com.mozu.api.contracts.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, String responseFields, int expectedCode) throws Exception
{
com.mozu.api.contracts.productadmin.ProductVariationCollection returnObj = new com.mozu.api.contracts.productadmin.ProductVariationCollection();
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
returnObj = resource.updateProductVariations( productVariations, productCode, responseFields);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return null;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
return returnObj;
}
public static void deleteProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception
{
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
resource.deleteProductVariation( productCode, variationKey);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
}
public static void deleteProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
resource.deleteProductVariationLocalizedDeltaPrice( productCode, variationKey, currencyCode);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
}
public static void deleteProductVariationLocalizedPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception
{
ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode);
try
{
resource.deleteProductVariationLocalizedPrice( productCode, variationKey, currencyCode);
}
catch (ApiException e)
{
if(e.getHttpStatusCode() != expectedCode)
throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
else
return;
}
if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300))
throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, "");
}
}
| mit |
980f/ezjava | src/pers/hal42/lang/ReflectX.java | 27349 | package pers.hal42.lang;
import pers.hal42.logging.ErrorLogStream;
import pers.hal42.text.TextList;
import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.Iterator;
import java.util.function.Predicate;
/**
* Utilities to ease use of reflection.
* <p>
* todo:2 get rid of debug class use by create an exception object with all of the messages that are currently debug messages placed inside of it.
*/
public class ReflectX {
/**
* poorly tested as to scope, this gives the types of a map when given a field that is or is derived from a Map.
*/
// It will most likely hang your program if used with any other type.
public static Type[] getInterfaceTypes(Field field, int numTypes) {
Class<?> aClass = field.getType();
Type[] genericInterfaces = aClass.getGenericInterfaces();
for (Type type = field.getGenericType(); type != Object.class; type = aClass.getGenericSuperclass()) {
if (type instanceof ParameterizedType) {
Type[] types = ((ParameterizedType) type).getActualTypeArguments();
if (types.length == numTypes) {//then we hopefully have the desired interface
return types;
}
}
}
return new Type[0];
}
/**
* marker annotation for use by applyTo and apply()
* if class is annotated with @Stored then process all fields except those marked with this.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.TYPE})
public @interface Ignore {
/**
* if nontrivial AND child is not found by the field name then it is sought by this name.
*/
String legacy() default "";
}
/**
* @deprecated NYI
*/
public static Field findGlobalField(String key) {
for (int searchSplit = key.lastIndexOf('.'); searchSplit >= 0; ) {
String classname = key.substring(0, searchSplit);
try {
final Class<?> parent = Class.forName(classname);
//todo: drill through remaining fields to get child. parent.getField()
} catch (ClassNotFoundException e) {
//dbg.Caught(e);
searchSplit = classname.lastIndexOf('.');
}
}
return null;
}
/**
* @returns whether method was invoked
*/
public static boolean doMethodNamed(Object o, String methodName, Object... args) {
try {
Class[] arglist = new Class[args.length];
for (int i = args.length; i-- > 0; ) {
arglist[i] = args[i].getClass();
}
Method method = o.getClass().getMethod(methodName, arglist);
method.invoke(o, args);
return true;
} catch (NoSuchMethodException | NullPointerException | InvocationTargetException | IllegalAccessException e) {
return false;
}
}
/**
* run a method, @returns null if the method invocation faulted, which can't be distinguished from a method which might return a null.
*/
@SuppressWarnings("unchecked")
public static <R> R doMethodWithReturn(Object obj, Method method, Object... args) {
if (method != null) {
try {
return (R) method.invoke(obj, args);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
return null;
}
/**
* @returns whether method @param parser was invoked.
*/
public static boolean doMethod(Object obj, Method method, Object... args) {
if (method != null) {
try {
method.invoke(obj, args);
return true;
} catch (IllegalAccessException | InvocationTargetException e) {
return false;
}
}
return false;
}
public static int Choices(Class<? extends Enum> eClass) {
return eClass.getEnumConstants().length;
}
/**
* if Object o has a String field named 'name' then set that field's value to the name of o in parent
*/
public static void eponomize(Object o, Object parent) {
Class claz = o.getClass();
final Field[] fields = claz.getFields();
for (Field field : fields) {
if (field.getName().equals("name")) { //object has a 'name' field
Field wrapper = fieldForChild(o, parent);
if (wrapper != null) {
try {
field.set(o, wrapper.getName());
} catch (IllegalAccessException e) {
// dbg.Caught(e);
}
}
break;
}
}
}
public static Field fieldForChild(Object child, Object parent) {
final Field[] fields = parent.getClass().getFields();
for (final Field field : fields) {
try {
final Object o = field.get(parent);
if (o == child) {
return field;
}
} catch (IllegalAccessException e) {
// dbg.Caught(e);
}
}
return null;
}
public static String nameOfChild(Object child, Object parent) {
Field field = fieldForChild(child, parent);
if (field != null) {
return field.getName();
}
return null;
}
public static boolean isImplementorOf(Field probate, Class claz) {
return isImplementorOf(probate.getClass(), claz);
}
/**
* @returns name of @param child within object @param parent, null if not an accessible child
*/
public static String fieldName(Object parent, Object child) {
Class<?> parentClass = parent.getClass();
while (parentClass != Object.class) { //are there classLoader issues here? is Object ever allowed to be classLoader specific?
final Field[] declaredFields = parentClass.getDeclaredFields();
for (Field field : declaredFields) {
try {
Object probate = field.get(parent);
if (probate == child) {
field.setAccessible(true);//maybe gratuitous but is fast.
return field.getName();
}
} catch (IllegalAccessException ignored) {
//noinspection UnnecessaryContinue
continue;//keep for breakpoint
}
}
parentClass = parentClass.getSuperclass();
}
return null;
}
public static TextList preloadClassErrors;
private static final String packageRoot = "pers.hal42.";//todo:1 better means of default package root.
// not a good idea to have a dbg in here --- see preLoadClass
private ReflectX() {
// I exist for static reasons only.
}
@SuppressWarnings("unchecked")
public static <T> T CopyConstruct(T prefill) {
Constructor<T> maker = constructorFor((Class<? extends T>) prefill.getClass(), prefill.getClass());
try {
return maker != null ? maker.newInstance(prefill) : null;
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
return null;
}
}
/**
* @returns @param ordinal th enum constant, or null if ordinal out of range or there are no such constants
*/
public static Object enumByOrdinal(Class fclaz, int ordinal) {
Object[] set = fclaz.getEnumConstants();
if (ordinal < 0 || ordinal >= set.length) {
return null;
} else {
return set[ordinal];
}
}
/**
* @returns in essence (negative of) whether field's class has fields.
*/
public static boolean isScalar(Field field) {
//can't figure out a default for when field is null, so NPE.
Class type = field.getType();
return type != Void.class && (type.isPrimitive() || type == String.class || type.isEnum());
}
public static boolean isStatic(Field field) {
return Modifier.isStatic(field.getModifiers());
}
@SuppressWarnings("unchecked")
public static <T extends Enum> T parseEnum(Class<T> Tclaz, String image) {
try {
return (T) Enum.valueOf(Tclaz, image); //best case is perfect match
} catch (IllegalArgumentException e) {
final Method parser = methodFor(Tclaz, Parser.class, null);
if (parser != null) {
parser.setAccessible(true);
try {
return (T) parser.invoke(null, new Object[]{image});
} catch (IllegalAccessException | InvocationTargetException e1) {
return null;
}
}
return null;
} catch (NullPointerException e) {
return null;
}
}
/**
* @return factory method for class @param claz with @param args. No arg may be null!
*/
public static Method factoryFor(Class claz, Object... args) {
Method[] candidates = claz.getMethods();
for (Method m : candidates) {
int mods = m.getModifiers();
if (Modifier.isStatic(mods)) {
Class[] plist = m.getParameterTypes();
if (isArglist(plist, args)) {
return m;
}
}
}
return null;
}
public static boolean isArglist(Class[] plist, Object[] args) {
if (plist.length == args.length) {
for (int i = plist.length; i-- > 0; ) {
final Class<?> probate = args[i].getClass();
if (isImplementorOf(probate, plist[i])) {
return true;
}
}
}
return false;
}
/**
* @return constructor for class @param claz with single argument @param argclaz
*/
public static Method factoryFor(Class claz, Class argclaz) {
Method[] candidates = claz.getMethods();
for (Method m : candidates) {
int mods = m.getModifiers();
if (Modifier.isStatic(mods)) {
Class[] plist = m.getParameterTypes();
if (plist.length == 1 && plist[0] == argclaz) {
return m;
}
}
}
return null;
}
/**
* constructs an object IFFI a public static somemethod(String) exists
*/
public static <T> T enumObject(Class<? extends T> fclaz, String string) {
if (string == null) {
return null;
}
Method factory = factoryFor(fclaz, String.class);
if (factory != null) {
try {
//noinspection unchecked
return (T) factory.invoke(string);
} catch (IllegalAccessException | InvocationTargetException e) {
ErrorLogStream.Global().Caught(e, "ReflectX.enumObject on {0}", fclaz);
return null;
}
}
//look for constructor, not quite limiting ourselves to enums if we do.
return null;
}
/**
* @returns whether @param probate can be cast to @param claz
*/
public static boolean isImplementorOf(Class probate, Class claz) {
if (claz != null && probate != null) {
if (claz.equals(probate)) {
return true; //frequent case
}
//noinspection unchecked
if (claz.isAssignableFrom(probate)) {
return true;
}
}
return false;
}
/**
* @returns name of @param child within object @param parent, null if not an accessible child
*/
public static Field findField(Object root, Object child) {
if (child == root) {
return null;
}
for (Field field : root.getClass().getDeclaredFields()) {
try {
Object probate = field.get(root);
if (probate == child) {
field.setAccessible(true);//maybe gratuitous but is fast.
return field;
}
} catch (IllegalAccessException ignored) {
//
}
}
return null;
}
@SuppressWarnings("unchecked")
public static <T> T getAnnotation(Class ref, Class annotation) {
return (T) ref.getAnnotation(annotation);
}
public static boolean ignorable(Field field) {
boolean skipper = field.isAnnotationPresent(Ignore.class);
int modifiers = field.getModifiers();
skipper |= Modifier.isFinal(modifiers);
skipper |= Modifier.isTransient(modifiers);
return skipper;
}
/**
* try to find a static constructor, if not then find a constructor. first one with matching args list wins. @returns new object or null if something fails
*/
@SuppressWarnings("unchecked")
public static <T> T newInstance(Class tclaz, Object... args) {
final Method cfactory = ReflectX.factoryFor(tclaz, args);
if (cfactory != null) {
try {
return (T) cfactory.invoke(args);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
}
final Constructor maker = constructorFor(tclaz, args);
if (maker != null) {
try {
return (T) maker.newInstance(args);
} catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
return null;
}
}
return null;//no available factory
}
/**
* @return string stripped of paymates package root IFF that root is present.
*/
public static String stripPackageRoot(String lookup) {
return StringX.replace(lookup, packageRoot, "");
}
/**
* @return the class name with out package of @param classy
*/
public static String justClassName(Class classy) {
if (classy != null) {
String fullname = classy.getName();
Package packer = classy.getPackage();
String packname = packer.getName();
if (fullname.startsWith(packname)) {
//below creates CamelCase name
return StringX.removeAll("$*?:;", fullname.substring(packname.length() + 1));
} else {
return fullname;//let caller figure out what the problem is
}
} else {
return "NULL";
}
}
/**
* @return the class name with out package of @param instance
*/
public static String justClassName(Object instance) {
return instance != null ? justClassName(instance.getClass()) : "NULL";
}
/**
* @return the class name without the application's root.
* @deprecated at 1.5 use Class.getSimpleName()
*/
public static String shortClassName(Class classy) {
return classy != null ? stripPackageRoot(classy.getName()) : "NULL";
}
/**
* @return the class name without "packageRoot" if that is present.
*/
public static String shortClassName(Object instance) {
return instance != null ? shortClassName(instance.getClass()) : "NULL";
}
/**
* @return @param child prefixed with the class name without the packageRoot if that is present.
*/
public static String shortClassName(Object instance, String child) {
return (instance != null ? shortClassName(instance.getClass()) : "NULL") + "." + child;
}
/**
* @return class object given classname, null on errors (doesn't throw exceptions)
*/
public static Class classForName(String classname) {
try {
return Class.forName(classname.trim());
} catch (ClassNotFoundException cfe) {
if (!classname.startsWith(packageRoot)) {
return classForName(packageRoot + classname);//2nd chance
}
return null;
}
}
/**
* @return no-args constructor instance of given class.
* will try to prefix package root to classes that aren't found.
* On "not found" returns null,
*/
public static Object newInstance(String classname) {
try {
//noinspection ConstantConditions
return classForName(classname).newInstance();
} catch (IllegalAccessException | InstantiationException e) {
return null;
}
}
/**
* @return constructor for class @param claz with single argument @param argclaz
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> constructorFor(Class<? extends T> claz, Object... args) {
try {
Constructor[] ctors = claz.getConstructors();
for (int i = ctors.length; i-- > 0; ) {
Constructor ctor = ctors[i];
Class[] plist = ctor.getParameterTypes();
if (isArglist(plist, args)) {
return ctor;
}
}
return null;
} catch (Exception ex) {
return null;
}
}
/**
* @return constructor for class @param claz with single argument @param argclaz
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> constructorFor(Class<? extends T> claz, Class argclaz) {
try {
Constructor[] ctors = claz.getConstructors();
for (int i = ctors.length; i-- > 0; ) {
Constructor ctor = ctors[i];
Class[] plist = ctor.getParameterTypes();
if (plist.length == 1 && plist[0] == argclaz) {
return ctor;
}
}
return null;
} catch (Exception ex) {
return null;
}
}
/**
* @return new instance of @param classname, constructed with single argument @param arg1
*/
public static Object newInstance(String classname, Object arg1) {
try {
Object[] arglist = new Object[1];
arglist[0] = arg1;
//noinspection ConstantConditions
return constructorFor(classForName(classname), arg1.getClass()).newInstance(arglist);
} catch (Exception ex) {//all sorts of null pointer failures get you here.
System.out.println("failed newInstance: " + ex.getLocalizedMessage());
ex.printStackTrace(System.out);
return null;
}
}
/**
* @returns a method of @param claz that has an annotation of @param noted which matches the optional argument @param matches. The compiler chooses which if there are more than one.
*/
public static <A extends Annotation> Method methodFor(Class claz, Class<A> noted, Predicate<A> matches) {
for (Method method : claz.getDeclaredMethods()) {
A annotation = method.getAnnotation(noted);
if (annotation != null && (matches == null || matches.test(annotation))) {
method.setAccessible(true);
return method;
}
}
// for (Method method : claz.getMethods()) {
// A annotation = method.getAnnotation(noted);
// if (annotation != null && (matches == null || matches.test(annotation))) {
// return method;
// }
// }
return null;
}
/**
* @returns genealogy of @param child within object @param parent, null if not an accessible child
*/
public static <T> Field[] findParentage(Object root, T child) {
if (child == root) {
return new Field[0];
}
Class childClass = child.getClass();
FieldWalker fw = new FieldWalker(root.getClass());
while (fw.hasNext(childClass)) {
Field maybe = fw.next();
try {
Object obj = fw.getObject(root);
if (obj == child) {
return fw.genealogy();
}
} catch (IllegalAccessException ignored) {
}
}
return null;
}
/**
* iterate over the member classes of the given class, which is NOT the classes of the members.
* <p>
* I don't think this is useful.
*/
public static class ClassWalker implements Iterator<Class> {
final Class node;//the starting point, retained for debug
// final boolean local;
protected Class[] parts;//
protected int ci; //class index
//todo:1 double link list for efficiency, or otherwise maintain pointer to most deeply nested instance. Present implementation chases the list with every iteration step.
protected ClassWalker nested;
public ClassWalker(Class node) {
this.node = node;
// this.local = local;
parts = node.getDeclaredClasses();
ci = parts.length;
nest();
}
public void nest() {
nested = ci > 0 ? new ClassWalker(parts[--ci]) : null;//recurses
}
@Override
public boolean hasNext() {
if (nested != null) {
if (nested.hasNext()) {
return true;
} else {
nest();//has a --ci or nested <- null;
return hasNext();
}
} else {
return ci >= 0;
}
}
@Override
public Class next() {
if (nested != null) {
return nested.next();
} else {
--ci;
return node;
}
}
}
/**
* marker for a method that can parse an enum. Used by parseEnum for when the default enum parser faults.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface Parser {
}
/**
* infinite descent if class has an outer class that has other inner classes.
* walk all the Scalar fields of a class hierarchy.
* This looks through definitions, an extended class's fields will NOT be seen.
* To get all actual fields requires objects.
* Scalar fields are members that are single valued as determined by @see ReflectX.isScalar()
*/
public static class FieldWalker implements Iterator<Field> {
final Class ref;//the starting point, retained for debug
protected Field[] fields;
protected int fi;
protected FieldWalker nested = null;
protected boolean aggressive = true;
protected Field lookAhead = null;
/**
* @param ref is root class for the walk
*/
public FieldWalker(Class ref) {
this.ref = ref;
fields = ref.getDeclaredFields();
fi = fields.length;
}
public boolean hasNext(Class childClass) {
if (nested != null) {
if (nested.hasNext(childClass)) {
return true;
} else {
nested = null;
}
}
while (lookAhead == null && fi-- > 0) {//while we haven't found one and there are still some to look at
lookAhead = fields[fi];
if (isImplementorOf(childClass, lookAhead.getType())) {
return true;
}
if (!isScalar(lookAhead) && isNormal(lookAhead)) {//then we have a struct
nested = new FieldWalker(lookAhead.getType());
if (nested.hasNext(childClass)) {//almost always true.
return true;
}
nested = null;
}
lookAhead = null;
}
return false;
}
private static int recursion = 0;
public boolean hasNext() {
// if (++recursion > 5) {
// ErrorLogStream.Global().Location();
// }
try {
if (nested != null) {
if (nested.hasNext()) {
return true;
} else {
nested = null;
}
}
while (lookAhead == null && fi-- > 0) {//while we haven't found one and there are still some to look at
lookAhead = fields[fi];
if (isScalar(lookAhead)) {
return true;
}
if (isNormal(lookAhead)) {
final Class<?> type = lookAhead.getType();
if (!type.getName().startsWith("java")) {//java classes have loops and we are only interested in finding things we can annotate.
nested = new ReflectX.FieldWalker(type);
if (nested.hasNext()) {//almost always true.
return true;
}
nested = null;
}
}
lookAhead = null;
}
return false;
} finally {
--recursion;
}
}
/**
* @returns either a field if there is still one or null. Will return a null 'prematurely' if hasNext is not called as it should be, you can't just iterate until you get a null.
*/
public Field next() {
if (nested != null) {
return nested.next();
}
try {
if (aggressive) {
lookAhead.setAccessible(true);
}
return lookAhead;//should not have been called.
} finally {
lookAhead = null;
}
}
/**
* @returns whether the field is something that a human would see as normal
*/
public boolean isNormal(Field f) {
if (f.isSynthetic()) {
return false;
}
final Class<?> type = f.getType();
if (type.isArray()) {
return false;
}
if (type.isAnnotation()) {
return false;
}
if (type.isAnonymousClass()) {
return false;
}
if (isImplementorOf(type, Iterable.class)) {
return false;
}
return true;
}
/**
* call this after calling next but before calling hasNext to get the parentage of what next() returned, that item will be at the end of the returned array.
*/
public Field[] genealogy() {
int level = depth();
Field[] parentage = new Field[level];
FieldWalker fw = this;
while (level-- > 0) {
parentage[level] = fw.fields[fw.fi];
fw = fw.nested;
}
return parentage;
}
public int depth() {
int count = 1;//count ourself
for (FieldWalker fw = this.nested; fw != null; fw = fw.nested) {
++count;
}
return count;
}
public Object getObject(Object root) throws IllegalAccessException {
root = fields[fi].get(root);
if (nested != null) {
return nested.getObject(root);
}
return root;
}
}
public static class AnnotationWalker extends ReflectX.FieldWalker {
final Class<? extends Annotation> filter;
final boolean all;
public AnnotationWalker(final Class ref, Class<? extends Annotation> filter) {
super(ref);
this.filter = filter;
all = pers.hal42.lang.ReflectX.<java.lang.annotation.Annotation>getAnnotation(ref, filter) != null;
}
@Override
public boolean hasNext() {
while(super.hasNext()) {//while lookahead exists
if (lookAhead.getAnnotation(filter) != null || (all && !ReflectX.ignorable(lookAhead))) {
return true;
}
}
return false;
}
@Override
public Field next() {
return super.next();
}
}
//
// /**
// * make an object given an @param ezc EasyCursor description of it.
// */
// public static Object Create(EasyCursor ezc, ErrorLogStream dbg) {
// try {
// dbg = ErrorLogStream.NonNull(dbg);//ensure a bad debugger doesn't croak us.
// Class[] creatorArgs = {EasyCursor.class};
// Object[] arglist = {ezc};
// String classname = ezc.getString("class");
// dbg.VERBOSE(StringX.bracketed("Create:classname(", classname));
// Class claz = classForName(classname);
// if (claz != null) {
// dbg.VERBOSE("Create:class:" + claz);
// //noinspection unchecked
// Method meth = claz.getMethod("Create", creatorArgs);
// dbg.VERBOSE("Create:Method:" + meth);
// Object obj = meth.invoke(null, arglist);
// dbg.VERBOSE("Create:Object:" + obj);
// return obj;
// }
// return null;
// } catch (Exception any) {
// dbg.WARNING(" Ezc.Create() got {0}, properties: {1}", any.getMessage(), ezc.asParagraph());
// return null;
// }
// }
//
// public static Object Create(EasyCursor ezc) {
// return Create(ezc, ErrorLogStream.Global());
// }
//todo:2 move to ObjectX?
public static String ObjectInfo(Object obj) {
return obj == null ? " null!" : " type: " + shortClassName(obj);
}
public static Object loadClass(String className) {
try {
Class c = Class.forName(className);
return c.newInstance(); // some drivers don't load completely until you do this
} catch (Exception e) {
return null;
}
}
/**
* debug was removed from the following function as it is called during the initialization
* of the classes need by the debug stuff. Any debug will have to be raw stdout debugging.
* <p>
* Try getting them from the preloadClassErrors ..
*/
public static boolean preloadClass(String className, boolean loadObject) {
try {
Class c = classForName(className);
if (loadObject && c != null) {
return c.newInstance() != null; // some drivers don't load completely until you do this
}
return c != null;
} catch (Exception e) {
if (preloadClassErrors == null) {
preloadClassErrors = new TextList();
}
preloadClassErrors.add("Exception \"" + e + "\" loading class \"" + className + "\" with" + (loadObject ? "" : "out") + " loading object");
return false;
}
}
public static boolean preloadClass(String className) {
return preloadClass(className, false);
}
}
| mit |
codingchili/chili-core | core/test/java/com/codingchili/core/storage/StorageLoaderIT.java | 2857 | package com.codingchili.core.storage;
import io.vertx.core.Promise;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.Timeout;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.*;
import org.junit.runner.RunWith;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import com.codingchili.core.context.CoreContext;
import com.codingchili.core.context.SystemContext;
/**
* Tests the loading of the available storage plugins.
*/
@RunWith(VertxUnitRunner.class)
public class StorageLoaderIT {
private static final String TEST_DB = "test";
private static CoreContext context;
@Rule
public Timeout timeout = new Timeout(10, TimeUnit.SECONDS);
@BeforeClass
public static void setUp() {
context = new SystemContext();
}
@AfterClass
public static void tearDown(TestContext test) {
context.close(test.asyncAssertSuccess());
}
@Test
public void testLoadWithFail(TestContext test) {
Async async = test.async();
new StorageLoader<>(context)
.withDB("", "")
.withValue(Storable.class)
.withPlugin("null").build(done -> {
if (done.failed()) {
async.complete();
} else {
test.fail("Expected future to fail.");
}
});
}
@Test
public void testLoadLocalAsyncMap(TestContext test) {
loadStoragePlugin(test, PrivateMap.class);
}
@Test
public void testLoadJsonMap(TestContext test) {
loadStoragePlugin(test, JsonMap.class);
}
@Test
public void testLoadIndexedMapV(TestContext test) {
loadStoragePlugin(test, IndexedMapVolatile.class);
}
@Test
public void testLoadIndexedMapP(TestContext test) {
loadStoragePlugin(test, IndexedMapPersisted.class);
}
@Test
public void testLoadSharedMap(TestContext test) {
loadStoragePlugin(test, SharedMap.class);
}
private void loadStoragePlugin(TestContext test, Class<? extends AsyncStorage> plugin) {
Promise<AsyncStorage<StorableString>> promise = Promise.promise();
Async async = test.async();
new StorageLoader<StorableString>(context)
.withPlugin(plugin)
.withDB(TEST_DB, UUID.randomUUID().toString())
.withValue(StorableString.class)
.build(promise);
promise.future().onComplete(done -> {
if (done.succeeded()) {
async.complete();
}
});
}
private class StorableString implements Storable {
@Override
public String getId() {
return "";
}
}
}
| mit |
y-takano/AndJson | main/jp/gr/java_conf/ke/json/databind/annotation/JsonBean.java | 827 | package jp.gr.java_conf.ke.json.databind.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import jp.gr.java_conf.ke.json.databind.converter.JsonConverter;
import jp.gr.java_conf.ke.json.databind.converter.Converters.DefaultConverter;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.FIELD})
public @interface JsonBean {
String name() default "";
@SuppressWarnings("rawtypes")
Class<? extends JsonConverter> defaultConverter() default DefaultConverter.class;
Policy policy() default
@Policy(read = DetectionPolicy.ENABLE_CONVERT,
write = DetectionPolicy.ENABLE_CONVERT);
Generics[] extention() default {};
}
| mit |
tarcieri/momentum | src/jvm/momentum/async/AsyncSeq.java | 6741 | package momentum.async;
import clojure.lang.*;
import java.util.*;
import java.util.concurrent.atomic.*;
public class AsyncSeq extends Async<ISeq> implements ISeq, Sequential, List, Receiver {
enum State {
FRESH,
INVOKING,
PENDING,
FINAL
}
final AtomicReference<State> cs = new AtomicReference<State>(State.FRESH);
/*
* Function that will realize the sequence
*/
final IFn fn;
/*
* Pending async value that will realize the seq
*/
IAsync pending;
public AsyncSeq(IFn f) {
fn = f;
}
Object setup() {
return fn.invoke();
}
/*
* Evaluate the body of the async seq only once. If the return value is an
* async value of some kind, then register a callback on it.
*/
public final boolean observe() {
if (!cs.compareAndSet(State.FRESH, State.INVOKING)) {
return isRealized();
}
try {
Object ret = setup();
if (ret instanceof IAsync) {
pending = (IAsync) ret;
if (cs.compareAndSet(State.INVOKING, State.PENDING)) {
pending.receive(this);
}
else {
pending.abort(new InterruptedException());
}
}
else {
if (cs.compareAndSet(State.INVOKING, State.FINAL)) {
realizeSeq(ret);
return true;
}
}
}
catch (Exception e) {
if (cs.compareAndSet(State.INVOKING, State.FINAL)) {
realizeError(e);
return true;
}
}
return isRealized();
}
// Find the first unrealized element and abort it
public boolean abort(Exception err) {
ISeq next;
AsyncSeq curr = this;
while (true) {
curr.observe();
State prev = curr.cs.getAndSet(State.FINAL);
if (prev != State.FINAL) {
if (prev == State.PENDING) {
pending.abort(new InterruptedException());
}
// i am epic win
realizeError(err);
return true;
}
if (curr.val == null) {
return false;
}
next = curr.val.next();
if (next instanceof AsyncSeq) {
curr = (AsyncSeq) next;
}
else {
return false;
}
}
}
private final void realizeSeq(Object val) {
try {
realizeSuccess(RT.seq(val));
}
catch (Exception e) {
realizeError(e);
}
}
/*
* Receiver API
*/
public final void success(Object val) {
if (cs.getAndSet(State.FINAL) == State.FINAL) {
return;
}
realizeSeq(val);
}
public final void error(Exception e) {
if (cs.getAndSet(State.FINAL) == State.FINAL) {
return;
}
realizeError(e);
}
final void ensureSuccess() {
if (observe()) {
if (err != null) {
throw Util.runtimeException(err);
}
return;
}
throw new RuntimeException("Async seq has not been realized yet");
}
/*
* ISeq API
*/
final public ISeq seq() {
if (isRealized()) {
if (err != null) {
throw Util.runtimeException(err);
}
return val;
}
return this;
}
final public Object first() {
ensureSuccess();
if (val == null) {
return null;
}
return val.first();
}
final public ISeq next() {
ensureSuccess();
if (val == null) {
return null;
}
return val.next();
}
final public ISeq more() {
ensureSuccess();
if (val == null) {
return PersistentList.EMPTY;
}
return val.more();
}
final public ISeq cons(Object o) {
return new Cons(o, seq());
}
final public int count() {
int c = 0;
for (ISeq s = seq(); s != null; s = s.next()) {
++c;
}
return c;
}
final public IPersistentCollection empty() {
return PersistentList.EMPTY;
}
final public boolean equiv(Object o) {
return equals(o);
}
final public boolean equals(Object o) {
ensureSuccess();
if (val != null) {
return val.equiv(o);
}
else {
return (o instanceof Sequential || o instanceof List) && RT.seq(o) == null;
}
}
/*
* java.util.Collection API
*/
final public Object[] toArray() {
return RT.seqToArray(seq());
}
final public boolean add(Object o) {
throw new UnsupportedOperationException();
}
final public boolean remove(Object o) {
throw new UnsupportedOperationException();
}
final public boolean addAll(Collection c) {
throw new UnsupportedOperationException();
}
final public void clear() {
throw new UnsupportedOperationException();
}
final public boolean retainAll(Collection c) {
throw new UnsupportedOperationException();
}
final public boolean removeAll(Collection c) {
throw new UnsupportedOperationException();
}
final public boolean containsAll(Collection c) {
for (Object o : c) {
if (!contains(o)) {
return false;
}
}
return true;
}
final public Object[] toArray(Object[] a) {
if (a.length >= count()) {
ISeq s = seq();
for (int i = 0; s != null; ++i, s = s.next()) {
a[i] = s.first();
}
if (a.length > count()) {
a[count()] = null;
}
return a;
}
else {
return toArray();
}
}
final public int size() {
return count();
}
final public boolean isEmpty() {
return seq() == null;
}
final public boolean contains(Object o) {
for (ISeq s = seq(); s != null; s = s.next()) {
if (Util.equiv(s.first(), o)) {
return true;
}
}
return false;
}
final public Iterator iterator() {
return new SeqIterator(seq());
}
/*
* java.util.List API
*/
@SuppressWarnings("unchecked")
final List reify() {
return new ArrayList<Object>(this);
}
final public List subList(int fromIndex, int toIndex) {
return reify().subList(fromIndex, toIndex);
}
final public Object set(int index, Object element) {
throw new UnsupportedOperationException();
}
final public Object remove(int index) {
throw new UnsupportedOperationException();
}
final public int indexOf(Object o) {
ISeq s = seq();
for (int i = 0; s != null; s = s.next(), i++) {
if (Util.equiv(s.first(), o)) {
return i;
}
}
return -1;
}
final public int lastIndexOf(Object o) {
return reify().lastIndexOf(o);
}
final public ListIterator listIterator() {
return reify().listIterator();
}
final public ListIterator listIterator(int index) {
return reify().listIterator(index);
}
final public Object get(int index) {
return RT.nth(this, index);
}
final public void add(int index, Object element) {
throw new UnsupportedOperationException();
}
final public boolean addAll(int index, Collection c) {
throw new UnsupportedOperationException();
}
}
| mit |
chrislo27/Stray-core | src/stray/util/render/RandomText.java | 984 | package stray.util.render;
import stray.Main;
import stray.Settings;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.MathUtils;
public class RandomText {
public static void render(Main main, String text, int chance, int maxrender) {
if (text != null) {
float height = main.font.getBounds(text).height;
for (int i = 0; i < maxrender; i++) {
if (MathUtils.random(1, chance) != 1) continue;
main.drawCentered(
text,
MathUtils.random(1, Settings.DEFAULT_WIDTH - 1),
MathUtils.random(Math.round(height),
Math.round(Gdx.graphics.getHeight() - height)));
}
}
}
/**
* synthetic method, turns chance into (10 + fps + (fps / 2))
*
* @param main
* @param text
* @param maxrender
*/
public static void render(Main main, String text, int maxrender) {
render(main, text,
10 + Gdx.graphics.getFramesPerSecond() + (Gdx.graphics.getFramesPerSecond() / 2),
maxrender);
}
}
| mit |
TechReborn/TechReborn | src/main/java/techreborn/blockentity/machine/iron/AbstractIronMachineBlockEntity.java | 6775 | /*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blockentity.machine.iron;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.api.IToolDrop;
import reborncore.api.blockentity.InventoryProvider;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.blockentity.SlotConfiguration;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.RebornInventory;
import techreborn.config.TechRebornConfig;
public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, SlotConfiguration.SlotFilter {
public RebornInventory<?> inventory;
public int burnTime;
public int totalBurnTime;
public int progress;
public int totalCookingTime;
int fuelSlot;
Block toolDrop;
public AbstractIronMachineBlockEntity(BlockEntityType<?> blockEntityTypeIn, BlockPos pos, BlockState state, int fuelSlot, Block toolDrop) {
super(blockEntityTypeIn, pos, state);
this.fuelSlot = fuelSlot;
// default value for vanilla smelting recipes is 200
this.totalCookingTime = (int) (200 / TechRebornConfig.cookingScale);
this.toolDrop = toolDrop;
}
/**
* Checks that we have all inputs and can put output into slot
*
*/
protected abstract boolean canSmelt();
/**
* Turn ingredients into the appropriate smelted
* item in the output slot
*/
protected abstract void smelt();
/**
* Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel
*
* @param stack {@link ItemStack} stack of fuel
* @return {@code int} Number of ticks
*/
private int getItemBurnTime(ItemStack stack) {
if (stack.isEmpty()) {
return 0;
}
return (int) (AbstractFurnaceBlockEntity.createFuelTimeMap().getOrDefault(stack.getItem(), 0) * TechRebornConfig.fuelScale);
}
/**
* Returns remaining fraction of fuel burn time
*
* @param scale {@code int} Scale to use for burn time
* @return {@code int} scaled remaining fuel burn time
*/
public int getBurnTimeRemainingScaled(int scale) {
if (totalBurnTime == 0) {
return 0;
}
return burnTime * scale / totalBurnTime;
}
/**
* Returns crafting progress
*
* @param scale {@code int} Scale to use for crafting progress
* @return {@code int} Scaled crafting progress
*/
public int getProgressScaled(int scale) {
if (totalCookingTime > 0) {
return progress * scale / totalCookingTime;
}
return 0;
}
/**
* Returns true if Iron Machine is burning fuel thus can do work
*
* @return {@code boolean} True if machine is burning
*/
public boolean isBurning() {
return burnTime > 0;
}
private void updateState() {
BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof BlockMachineBase blockMachineBase) {
if (state.get(BlockMachineBase.ACTIVE) != burnTime > 0)
blockMachineBase.setActive(burnTime > 0, world, pos);
}
}
// MachineBaseBlockEntity
@Override
public void readNbt(NbtCompound compoundTag) {
super.readNbt(compoundTag);
burnTime = compoundTag.getInt("BurnTime");
totalBurnTime = compoundTag.getInt("TotalBurnTime");
progress = compoundTag.getInt("Progress");
}
@Override
public void writeNbt(NbtCompound compoundTag) {
super.writeNbt(compoundTag);
compoundTag.putInt("BurnTime", burnTime);
compoundTag.putInt("TotalBurnTime", totalBurnTime);
compoundTag.putInt("Progress", progress);
}
@Override
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {
super.tick(world, pos, state, blockEntity);
if (world.isClient) {
return;
}
boolean isBurning = isBurning();
if (isBurning) {
--burnTime;
}
if (!isBurning && canSmelt()) {
burnTime = totalBurnTime = getItemBurnTime(inventory.getStack(fuelSlot));
if (burnTime > 0) {
// Fuel slot
ItemStack fuelStack = inventory.getStack(fuelSlot);
if (fuelStack.getItem().hasRecipeRemainder()) {
inventory.setStack(fuelSlot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
} else if (fuelStack.getCount() > 1) {
inventory.shrinkSlot(fuelSlot, 1);
} else if (fuelStack.getCount() == 1) {
inventory.setStack(fuelSlot, ItemStack.EMPTY);
}
}
}
if (isBurning() && canSmelt()) {
++progress;
if (progress == totalCookingTime) {
progress = 0;
smelt();
}
} else if (!canSmelt()) {
progress = 0;
}
if (isBurning != isBurning()) {
inventory.setHashChanged();
updateState();
}
if (inventory.hasChanged()) {
markDirty();
}
}
@Override
public boolean canBeUpgraded() {
return false;
}
// InventoryProvider
@Override
public RebornInventory<?> getInventory() {
return inventory;
}
// IToolDrop
@Override
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
return new ItemStack(toolDrop);
}
public int getBurnTime() {
return this.burnTime;
}
public void setBurnTime(int burnTime) {
this.burnTime = burnTime;
}
public int getTotalBurnTime() {
return this.totalBurnTime;
}
public void setTotalBurnTime(int totalBurnTime) {
this.totalBurnTime = totalBurnTime;
}
public int getProgress() {
return progress;
}
public void setProgress(int progress) {
this.progress = progress;
}
}
| mit |
aweijnitz/MiniMon4J | src/main/java/minimon/rest/RESTService.java | 1243 | package minimon.rest;
import io.undertow.Undertow;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* REST Service provider.
* Uses an embedded <a href='http://undertow.io/' target='_top'>Undertow</a> instance
* to serve requests.
* The API takes the name of a metrics archive as part of the path and returns a
* JSON reporesentation of the archive.
*
* Example usage, see class doc for {@link minimon.MiniMonApp.class MiniMonApp}
*
*/
@Service("RESTService")
public class RESTService {
private static Logger logger = Logger.getLogger(RESTService.class);
@Autowired
private DataHTTPHandler handler;
private Undertow server;
public RESTService() { }
public RESTService(String host, int port) {
this.configure(host, port);
}
public void configure(String host, int port) {
logger.info("Configuring server for http://" + host + ":" + port);
this.server = Undertow.builder().addListener(port, "localhost")
.setHandler(handler).build();
}
public void start() {
logger.info("Starting REST service");
server.start();
}
public void stop() {
logger.info("Stopping REST service");
server.stop();
}
}
| mit |
ryohashioka/Visual-Programming-Environment-for-Coordinating-Appliances-and-Services-in-a-Smart-House | Server/HomeServer/src/main/java/inputDevices/Weather.java | 3689 | /*
* Copyright (c) 2015 Ryo Hashioka
*/
package inputDevices;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
import weather.WeatherModule;
/*
* 今回の橋岡さんのでデモでは、取得時点での日付の天気が更新された場合のみ更新したということを知らせるため、
* Timer内部クラスではそのような実装を行っています。
*
*
*/
public class Weather extends InputDevice{
private boolean startFlag = false;
/**
* WeatherModuleクラスのインスタンス
*/
private WeatherModule module;
/**
* Timerクラスのインスタンス
*/
private Timer timer;
/**
* コンストラクタ
*/
public Weather(InputDevicesManager inputMana){
this.module = new WeatherModule();
super.inputMana = inputMana;
class MyWeatherThread implements Runnable {
public void run() {
while (true) {
while (startFlag) {
update("weather,NoUpdate");
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
new Thread(new MyWeatherThread()).start();
}
/**
* startメソッド
* Timerを起動する
*/
public void start(){
this.module.runstart(60000);; // 3,600,000
this.timer = new Timer();
this.timer.schedule(new TimeStar(this,this.module), 0, 1000);
startFlag = true;
}
/**
* stopメソッド
* Timerを停止する
*/
public void stop(){
this.timer.cancel();
this.timer = null;
this.module.runStop();
startFlag = false;
}
/**
* Timerの内部クラス
* @author sumidatomoyuki
*
*/
class TimeStar extends TimerTask {
/**
* 初期化用文字列
*/
public static final String NO_DATA = "No data";
/**
* 取得できる一週間分の天気予報
* 0 = 取得日, 1 = 1日後, 2 = 2日後, 3 = 3日後, 4 = 4日後, 5 = 5日後, 6 = 6日後, 7 = 7日後
*/
private String[] weath = new String[8];
/**
* 取得できる一週間分の予想最高気温
* 0 = 取得日, 1 = 1日後, 2 = 2日後, 3 = 3日後, 4 = 4日後, 5 = 5日後, 6 = 6日後, 7 = 7日後
*/
private String[] maxTemp = new String[8];
/**
* 取得できる一週間分の予想最低気温
* 0 = 取得日, 1 = 1日後, 2 = 2日後, 3 = 3日後, 4 = 4日後, 5 = 5日後, 6 = 6日後, 7 = 7日後
*/
private String[] minTemp = new String[8];
/**
* 山城中部の注意報、または警報を保持する
*/
private String warning_alarm;
/**
* Weatherクラスのインスタンス
*/
private Weather weather;
/**
* WeatherModuleクラスのインスタンス
*/
private WeatherModule module;
/**
* 更新されたデータを一時保管するリスト
*/
private ArrayList<String> list;
/**
* コンストラクタ
* @param we
* @param md
*/
public TimeStar(Weather we,WeatherModule md){
this.weather = we;
this.module = md;
this.list = new ArrayList();
this.warning_alarm = NO_DATA;
for(int i = 0; i < 8; i++){
this.maxTemp[i] = NO_DATA;
this.minTemp[i] = NO_DATA;
this.weath[i] = NO_DATA;
}
}
/**
* runメソッド
*/
public void run() {
if(!this.weath[0].equals(this.module.getWeather(0))){
this.weath[0] = this.module.getWeather(0);
this.weather.update("weather,update weather report");
}
if(!this.warning_alarm.equals(this.module.getYahooWarningAlarm())){
this.warning_alarm = this.module.getYahooWarningAlarm();
if(this.warning_alarm.indexOf("あります") != -1){
this.weather.update("weather,weather warning");
}
}
}
}
}
| mit |
om3g4zell/CityBuilderJSFML | CityBuilderJSFML/src/world/Citizen.java | 2456 | package world;
public class Citizen {
protected static int lastID = 0;
protected int id;
protected int houseId = -1; // House.
protected int workBuildingId = -1; // Work ?
protected int smallFurnitureBuildingId = -1; // Grocery store.
protected int bigFurnitureBuildingId = -1; // Mall.
protected int hobbiesBuildingId = -1; // Hobbies
protected int sportBuildingId = -1; // Stadium
protected int restaurantBuildingId = -1; // Restaurant
protected int pubId = -1; // Pub
public Citizen(int houseId) {
this.houseId = houseId;
this.id = Citizen.lastID++;
}
public int getBigFurnitureBuildingId() {
return bigFurnitureBuildingId;
}
public void setBigFurnitureBuildingId(int bigFurnitureBuildingId) {
this.bigFurnitureBuildingId = bigFurnitureBuildingId;
}
public int getHobbiesBuildingId() {
return hobbiesBuildingId;
}
public void setHobbiesBuildingId(int hobbiesBuildingId) {
this.hobbiesBuildingId = hobbiesBuildingId;
}
public int getSportBuildingId() {
return sportBuildingId;
}
public void setSportBuildingId(int sportBuildingId) {
this.sportBuildingId = sportBuildingId;
}
public int getRestaurantBuildingId() {
return restaurantBuildingId;
}
public void setRestaurantBuildingId(int restaurantBuildingId) {
this.restaurantBuildingId = restaurantBuildingId;
}
public int getPubId() {
return pubId;
}
public void setPubId(int pubId) {
this.pubId = pubId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
/**
* Returns the id of the house.
* @return the id of the work building
*/
public int getHouseId() {
return this.houseId;
}
/**
* Sets the id of the work building.
* @param workBuildingId : the id of the workb building
*/
public void setWorkBuildingId(int workBuildingId) {
this.workBuildingId = id;
}
/**
* Returns the id of the work building.
* @return the id of the work building
*/
public int getWorkBuildingId() {
return this.workBuildingId;
}
/**
* Sets the id of the small furniture building.
* @param smallFoodBuildingId : the id of the small furniture building
*/
public void setSmallFurnitureBuildingId(int smallFurnitureBuildingId) {
this.smallFurnitureBuildingId = smallFurnitureBuildingId;
}
/**
* Returns the id of the small furniture building.
* @return the small furniture building id
*/
public int getSmallFurnitureBuildingId() {
return this.smallFurnitureBuildingId;
}
}
| mit |
madgik/exareme | Exareme-Docker/src/exareme/exareme-master/src/main/java/madgik/exareme/master/gateway/async/handler/HBP/Exceptions/BadRequestException.java | 264 | package madgik.exareme.master.gateway.async.handler.HBP.Exceptions;
public class BadRequestException extends Exception {
public BadRequestException(String algorithmName, String message) {
super(message + " Algorithm: " + algorithmName);
}
} | mit |
freeacs/prov | src/com/owera/xaps/base/Util.java | 1534 | package com.owera.xaps.base;
import java.util.ArrayList;
import java.util.List;
import com.owera.xaps.base.db.DBAccessStatic;
import com.owera.xaps.dbi.UnitParameter;
import com.owera.xaps.dbi.Unittype;
import com.owera.xaps.dbi.UnittypeParameter;
import com.owera.xaps.dbi.util.SystemParameters;
public class Util {
public static void resetReboot(SessionDataI sessionData) {
Log.debug(Util.class, "The reboot parameter is reset to 0 and the reboot will be executed");
Unittype unittype = sessionData.getUnittype();
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(SystemParameters.RESTART);
List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), "0", sessionData.getProfile());
unitParameters.add(up);
DBAccessStatic.queueUnitParameters(sessionData.getUnit(), unitParameters, sessionData.getProfile());
}
public static void resetReset(SessionDataI sessionData) {
Log.debug(Util.class, "The reset parameter is reset to 0 and the factory reset will be executed");
Unittype unittype = sessionData.getUnittype();
UnittypeParameter utp = unittype.getUnittypeParameters().getByName(SystemParameters.RESET);
List<UnitParameter> unitParameters = new ArrayList<UnitParameter>();
UnitParameter up = new UnitParameter(utp, sessionData.getUnitId(), "0", sessionData.getProfile());
unitParameters.add(up);
DBAccessStatic.queueUnitParameters(sessionData.getUnit(), unitParameters, sessionData.getProfile());
}
}
| mit |
abhrajitmukherjee/PopularMovies | app/src/main/java/com/example/android/popularmovies/data/MoviesContract.java | 1365 | package com.example.android.popularmovies.data;
import android.net.Uri;
import android.provider.BaseColumns;
import com.example.android.popularmovies.BuildConfig;
public class MoviesContract {
public static final String CONTENT_AUTHORITY = BuildConfig.APPLICATION_ID + ".provider";
public static final String PATH_MOVIE = "movies";
private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
public static final class MovieEntry implements BaseColumns {
public static final Uri CONTENT_URI =
BASE_CONTENT_URI.buildUpon().appendPath(PATH_MOVIE).build();
public static final String CONTENT_TYPE =
"vnd.android.cursor.dir/" + CONTENT_URI + "/" + PATH_MOVIE;
public static final String CONTENT_ITEM_TYPE =
"vnd.android.cursor.item/" + CONTENT_URI + "/" + PATH_MOVIE;
public static final String TABLE_NAME = "movieMain";
public static final String MOVIE_ID = "movie_id";
public static final String POSTER = "poster";
public static final String TITLE = "title";
public static final String OVERVIEW = "overview";
public static final String RELEASE_DATE = "releaseDate";
public static final String RATING = "rating";
public static final String IS_FAVORITE = "isFavorite";
}
}
| mit |
Nedelosk/OreRegistry | src/main/java/oreregistry/api/CompleteChoosingEvent.java | 1038 | /*
* Copyright (c) 2017 Nedelosk, Mezz
*
* This work (the MOD) is licensed under the "MIT" License, see LICENSE for details.
*/
package oreregistry.api;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.eventhandler.Event;
import oreregistry.api.registry.IProduct;
import oreregistry.api.registry.IResource;
import oreregistry.api.registry.IResourceRegistry;
/**
* This is fired when all products have chosen there chosen variant.
* <p>
* The best way to get the chosen variant of a product is to call {@link IResourceRegistry#registerResource(String)} in the pre init phase of fml.
* The result of this method is a {@link IResource}. Than you register your product variant with {@link IResource#registerProduct(String, ItemStack)}.
* The result of this method is a {@link IProduct}, later with this event you can get the chosen variant from the {@link IProduct} with {@link IProduct#getChosenProduct()}.
*/
public class CompleteChoosingEvent extends Event {
public CompleteChoosingEvent() {
}
}
| mit |
PenguinSquad/Enchiridion | src/main/java/joshie/enchiridion/gui/config/GuiFactory.java | 1674 | package joshie.enchiridion.gui.config;
import joshie.enchiridion.EConfig;
import joshie.enchiridion.lib.EInfo;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.DefaultGuiFactory;
import net.minecraftforge.fml.client.config.DummyConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.IConfigElement;
import java.util.ArrayList;
import java.util.List;
public class GuiFactory extends DefaultGuiFactory {
public GuiFactory() {
super(EInfo.MODID, ".minecraft/config/enchiridion/enchiridion.cfg");
}
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
return new GuiConfig(parentScreen, getConfigElements(), modid, false, false, title);
}
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<>();
List<IConfigElement> settings = new ConfigElement(EConfig.config.getCategory(EConfig.CATEGORY_SETTINGS.toLowerCase())).getChildElements();
List<IConfigElement> modSupport = new ConfigElement(EConfig.config.getCategory(EConfig.CATEGORY_MOD_SUPPORT.toLowerCase())).getChildElements();
list.add(new DummyConfigElement.DummyCategoryElement(EConfig.CATEGORY_SETTINGS, EInfo.MODID + ".config.category.settings", settings));
if (!EConfig.config.getCategory(EConfig.CATEGORY_MOD_SUPPORT).isEmpty()) {
list.add(new DummyConfigElement.DummyCategoryElement(EConfig.CATEGORY_MOD_SUPPORT, EInfo.MODID + ".config.category.modsupport", modSupport));
}
return list;
}
} | mit |
zmattis/University-of-Pittsburgh | CS-0445/Linked-Listed-Integer/RLITest.java | 3518 | // CS 0445 Spring 2017
// Test program for your ReallyLongInt class -- for full credit you CANNOT MODIFY
// this code in ANY WAY.
// This program should execute without error and produce output identical to
// the output shown on the Web site. If your output does not match mine, think
// carefully about what your operations are doing and trace them to find the
// problem.
// If your output does not match mine, or if you must change this file to get
// your code to work, you will lose credit, but you can still get PARTIAL
// credit for your work, so be sure to turn something in no matter what!
import java.util.*;
public class RLITest
{
public static void main (String [] args)
{
ReallyLongInt R1 = new ReallyLongInt("123456789");
ReallyLongInt R2 = new ReallyLongInt("987654321");
System.out.println("R1 = " + R1.toString());
System.out.println("R2 = " + R2.toString());
System.out.println();
// Testing add method
ReallyLongInt R3 = R1.add(R2);
System.out.println(R1 + " + " + R2 + " = " + R3);
R1 = new ReallyLongInt("1");
R2 = new ReallyLongInt("999999999999999");
R3 = R1.add(R2);
ReallyLongInt R4 = R2.add(R1);
System.out.println(R1 + " + " + R2 + " = " + R3);
System.out.println(R2 + " + " + R1 + " = " + R4);
System.out.println();
// Testing subtract method
R1 = new ReallyLongInt("23456");
R2 = new ReallyLongInt("4567");
R3 = R1.subtract(R2);
System.out.println(R1 + " - " + R2 + " = " + R3);
R1 = new ReallyLongInt("1000000");
R2 = new ReallyLongInt("1");
R3 = R1.subtract(R2);
System.out.println(R1 + " - " + R2 + " = " + R3);
R1 = new ReallyLongInt("123456");
R2 = new ReallyLongInt("123455");
R3 = R1.subtract(R2);
System.out.println(R1 + " - " + R2 + " = " + R3);
R1 = new ReallyLongInt("1000");
R2 = new ReallyLongInt("1001");
try
{
R3 = R1.subtract(R2);
}
catch (ArithmeticException e)
{
System.out.println(e);
}
System.out.println();
// Testing copy constructor
ReallyLongInt R5 = new ReallyLongInt(R4);
System.out.println("Copy of " + R4.toString() + " = " + R5.toString());
System.out.println();
// Testing compareTo
ReallyLongInt [] C = new ReallyLongInt[4];
C[0] = new ReallyLongInt("844444444444444");
C[1] = new ReallyLongInt("744444444444444");
C[2] = new ReallyLongInt("844444445444444");
C[3] = new ReallyLongInt("4444");
for (int i = 0; i < C.length; i++)
{
for (int j = 0; j < C.length; j++)
{
int ans = C[i].compareTo(C[j]);
if (ans < 0)
System.out.println(C[i] + " < " + C[j]);
else if (ans > 0)
System.out.println(C[i] + " > " + C[j]);
else
System.out.println(C[i] + " == " + C[j]);
}
}
System.out.println();
Arrays.sort(C);
System.out.println("Here is the sorted array: ");
for (ReallyLongInt R: C)
System.out.println(R);
System.out.println();
// Testing equals
R1 = new ReallyLongInt("12345678987654321");
R2 = new ReallyLongInt("12345678987654321");
R3 = new ReallyLongInt("12345678907654321");
if (R1.equals(R2))
System.out.println(R1 + " equals " + R2);
if (!R1.equals(R3))
System.out.println(R1 + " does not equal " + R3);
System.out.println();
// Testing shift operations
R1 = new ReallyLongInt("1234567");
System.out.println(R1);
R1.multTenToThe(6);
System.out.println(R1);
R1.divTenToThe(8);
System.out.println(R1);
System.out.println();
}
} | mit |
PacketCloud/ALVIS | src/main/java/Cumulus/Managers/PluginManager.java | 830 | package Cumulus.Managers;
import Cumulus.Plugins.Plugin;
import Cumulus.Plugins.PluginList;
import Cumulus.Plugins.PluginLoader;
public class PluginManager {
private PluginList PluginList;
public PluginManager(ClientManager client) {
PluginList = PluginLoader.loadPlugins(client);
}
public void onRestart() {
PluginList.onRestart();
}
public void onRestartComplete() {
PluginList.onRestartComplete();
}
public void onShutdown() {
PluginList.onShutdown();
}
public boolean onConsoleInput(String RawConsoleInput) {
return PluginList.onConsoleInput(RawConsoleInput);
}
public PluginList getPluginList() {
return PluginList;
}
public boolean requestUnload(Plugin p) {
return PluginList.removePlugin(p);
}
}
| mit |
fieldenms/tg | platform-pojo-bl/src/main/java/ua/com/fielden/platform/entity/query/fluent/StandAloneConditionOperand.java | 1172 | package ua.com.fielden.platform.entity.query.fluent;
import ua.com.fielden.platform.entity.AbstractEntity;
import ua.com.fielden.platform.entity.query.fluent.EntityQueryProgressiveInterfaces.IStandAloneConditionComparisonOperator;
import ua.com.fielden.platform.entity.query.fluent.EntityQueryProgressiveInterfaces.IStandAloneConditionCompoundCondition;
import ua.com.fielden.platform.entity.query.fluent.EntityQueryProgressiveInterfaces.IStandAloneConditionOperand;
public final class StandAloneConditionOperand<ET extends AbstractEntity<?>> //
extends WhereWithoutNesting<IStandAloneConditionComparisonOperator<ET>, IStandAloneConditionCompoundCondition<ET>, ET> //
implements IStandAloneConditionOperand<ET> {
public StandAloneConditionOperand(final Tokens tokens) {
super(tokens);
}
@Override
protected IStandAloneConditionCompoundCondition<ET> nextForConditionalOperand(final Tokens tokens) {
return new StandAloneConditionCompoundCondition<ET>(tokens);
}
@Override
protected IStandAloneConditionComparisonOperator<ET> nextForSingleOperand(final Tokens tokens) {
return new StandAloneConditionComparisonOperator<ET>(tokens);
}
} | mit |
alexfrt/tabu | src/main/java/br/uece/tabusearch/TabuSearch.java | 1827 | package br.uece.tabusearch;
import java.util.List;
import org.apache.commons.collections4.IteratorUtils;
/**
* Default implementation of the Tabu Search algorithm
* @author Alex Ferreira
*
*/
public class TabuSearch {
private TabuList tabuList;
private StopCondition stopCondition;
private BestNeighborSolutionLocator solutionLocator;
/**
* Construct a {@link TabuSearch} object
* @param tabuList the tabu list used in the algorithm to handle tabus
* @param stopCondition the algorithm stop condition
* @param solutionLocator the best neightbor solution locator to be used in each algortithm iteration
*/
public TabuSearch(TabuList tabuList, StopCondition stopCondition, BestNeighborSolutionLocator solutionLocator) {
this.tabuList = tabuList;
this.stopCondition = stopCondition;
this.solutionLocator = solutionLocator;
}
/**
* Execute the algorithm to perform a minimization.
* @param initialSolution the start point of the algorithm
* @return the best solution found in the given conditions
*/
public Solution run(Solution initialSolution) {
Solution bestSolution = initialSolution;
Solution currentSolution = initialSolution;
Integer currentIteration = 0;
while (!stopCondition.mustStop(++currentIteration, bestSolution)) {
List<Solution> candidateNeighbors = currentSolution.getNeighbors();
List<Solution> solutionsInTabu = IteratorUtils.toList(tabuList.iterator());
Solution bestNeighborFound = solutionLocator.findBestNeighbor(candidateNeighbors, solutionsInTabu);
if (bestNeighborFound.getValue() < bestSolution.getValue()) {
bestSolution = bestNeighborFound;
}
tabuList.add(currentSolution);
currentSolution = bestNeighborFound;
tabuList.updateSize(currentIteration, bestSolution);
}
return bestSolution;
}
}
| mit |
cybersonic/org.cfeclipse.cfml | src/org/cfeclipse/cfml/editors/contentassist/DefaultAssistState.java | 6345 | /*
* Created on Sep 20, 2004
*
* The MIT License
* Copyright (c) 2004 Oliver Tupman
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.cfeclipse.cfml.editors.contentassist;
//import org.eclipse.core.internal.utils.Assert;
import org.cfeclipse.cfml.editors.partitioner.CFEPartition;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
/**
* This is the default implementation of the assist state information.
* The assist state represents how the user has triggered the content assist
* request. This may be post-trigger char. So the user may not have entered
* a trigger char but be post-trigger and therefore entering text that we
* should filter upon.
*
* @author Oliver Tupman
*/
public class DefaultAssistState implements IAssistState {
private ITextViewer textViewer;
private CFEPartition[] fPartitions = null;
public ITextViewer getITextView() {
//Assert.isNotNull(this.textViewer,"DefaultAssistState::getITextView()");
if(this.textViewer == null)
throw new IllegalArgumentException("DefaultAssistState::getITextView()");
return this.textViewer;
}
public void setTextViewer(ITextViewer newViewer)
{
//Assert.isNotNull(newViewer,"DefaultAssistState::setTextViewer()");
if(newViewer == null)
throw new IllegalArgumentException("DefaultAssistState::setTextViewer()");
this.textViewer = newViewer;
}
/**
* The document
*/
private IDocument doc = null;
/**
* Offset within the document that we're currently at
*/
private int offset = -1;
/**
* The char that triggered the content assist (aka the
* previous character typed in)
*/
private char triggerChar;
/**
* The data since the last delimiter.
*/
private String dataSoFar = null;
/**
* The location of the previous delimter, absolute position.
*/
private int prevDelim = -1;
/**
* The region type in which the user invoked content assist.
*/
private ITypedRegion prevRegion = null;
/**
*
*/
public DefaultAssistState() {
}
/* (non-Javadoc)
* @see org.cfeclipse.cfml.editors.contentassistors.IAssistState#getDocument()
*/
public IDocument getIDocument() {
//Assert.isNotNull(this.doc,"DefaultAssistState::getIDocument()");
if(this.doc == null)
throw new IllegalArgumentException("DefaultAssistState::getIDocument()");
return this.doc;
}
/* (non-Javadoc)
* @see org.cfeclipse.cfml.editors.contentassistors.IAssistState#getOffset()
*/
public int getOffset() {
//Assert.isTrue(this.offset >= 0,"DefaultAssistState::getOffset()");
if(!(this.offset >= 0))
throw new IllegalArgumentException("DefaultAssistState::getOffset()");
return this.offset;
}
/* (non-Javadoc)
* @see org.cfeclipse.cfml.editors.contentassistors.IAssistState#getTriggerData()
*/
public char getTriggerData() {
return this.triggerChar;
}
/* (non-Javadoc)
* @see org.cfeclipse.cfml.editors.contentassistors.IAssistState#getDataSoFar()
*/
public String getDataSoFar() {
//Assert.isNotNull(this.dataSoFar,"DefaultAssistState::getDataSoFar()");
if(this.dataSoFar == null)
throw new IllegalArgumentException("DefaultAssistState::getDataSoFar()");
return this.dataSoFar;
}
/* (non-Javadoc)
* @see org.cfeclipse.cfml.editors.contentassistors.IAssistState#getPreviousDelimiterPosition()
*/
public int getPreviousDelimiterPosition() {
//Assert.isTrue(this.prevDelim >= 0,"DefaultAssistState::getPreviousDelimiterPosition()");
if(!(this.prevDelim >= 0))
throw new IllegalArgumentException("DefaultAssistState::getPreviousDelimiterPosition()");
return this.prevDelim;
}
public void setDoc(IDocument doc) {
//Assert.isNotNull(doc,"DefaultAssistState::setDoc()");
if(doc == null)
throw new IllegalArgumentException("DefaultAssistState::setDoc()");
this.doc = doc;
}
public void setPrevDelim(int prevDelim) {
//Assert.isTrue(prevDelim >= 0,"DefaultAssistState::setPrevDelim()");
if(!(prevDelim >= 0))
throw new IllegalArgumentException("DefaultAssistState::setPrevDelim()");
this.prevDelim = prevDelim;
}
public void setTriggerChar(char triggerChar) {
this.triggerChar = triggerChar;
}
public void setDataSoFar(String dataSoFar) {
//Assert.isNotNull(dataSoFar,"DefaultAssistState::setDataSoFar()");
if(dataSoFar == null)
throw new IllegalArgumentException("DefaultAssistState::setDataSoFar()");
this.dataSoFar = dataSoFar;
}
public void setOffset(int offset) {
//Assert.isTrue(offset >= 0,"DefaultAssistState::setOffset()");
if(!(offset >= 0))
throw new IllegalArgumentException("DefaultAssistState::setPrevDelim()");
this.offset = offset;
}
public ITypedRegion getOffsetPartition() {
return this.prevRegion;
}
public void setOffsetPartition(ITypedRegion prevRegion)
{
this.prevRegion = prevRegion;
}
public void setRelevantPartitions(CFEPartition[] partitions) {
fPartitions = partitions;
}
public CFEPartition[] getRelevantPartitions() {
return fPartitions;
}
}
| mit |
Samuel-Oliveira/Java-Efd-Icms | src/main/java/br/com/swconsultoria/efd/icms/registros/blocoC/RegistroC160.java | 1991 | /**
*
*/
package br.com.swconsultoria.efd.icms.registros.blocoC;
import lombok.EqualsAndHashCode;
/**
* @author Samuel Oliveira
*
*/
@EqualsAndHashCode
public class RegistroC160 {
private final String reg = "C160";
private String cod_part;
private String veic_id;
private String qtd_vol;
private String peso_brt;
private String peso_liq;
private String uf_id;
/**
* @return the cod_part
*/
public String getCod_part() {
return cod_part;
}
/**
* @param cod_part the cod_part to set
*/
public void setCod_part(String cod_part) {
this.cod_part = cod_part;
}
/**
* @return the veic_id
*/
public String getVeic_id() {
return veic_id;
}
/**
* @param veic_id the veic_id to set
*/
public void setVeic_id(String veic_id) {
this.veic_id = veic_id;
}
/**
* @return the qtd_vol
*/
public String getQtd_vol() {
return qtd_vol;
}
/**
* @param qtd_vol the qtd_vol to set
*/
public void setQtd_vol(String qtd_vol) {
this.qtd_vol = qtd_vol;
}
/**
* @return the peso_brt
*/
public String getPeso_brt() {
return peso_brt;
}
/**
* @param peso_brt the peso_brt to set
*/
public void setPeso_brt(String peso_brt) {
this.peso_brt = peso_brt;
}
/**
* @return the peso_liq
*/
public String getPeso_liq() {
return peso_liq;
}
/**
* @param peso_liq the peso_liq to set
*/
public void setPeso_liq(String peso_liq) {
this.peso_liq = peso_liq;
}
/**
* @return the uf_id
*/
public String getUf_id() {
return uf_id;
}
/**
* @param uf_id the uf_id to set
*/
public void setUf_id(String uf_id) {
this.uf_id = uf_id;
}
/**
* @return the reg
*/
public String getReg() {
return reg;
}
}
| mit |
kirgor/enklib | common/src/main/java/com/kirgor/enklib/common/annotation/ConfigPrefix.java | 562 | package com.kirgor.enklib.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation for classes, which are supposed to store configuration values,
* specifies the prefix of considered system properties names.
* Used by {@link com.kirgor.enklib.common.ConfigUtils} loadFromSystemProperties method.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ConfigPrefix {
String value();
}
| mit |
aawuley/evolutionary-computation | ec/algorithms/simulatedannealing/StartTSP.java | 6550 | /*******************************************************************************
* Copyright (c) 2014, 2015
* Anthony Awuley - Brock University Computer Science Department
* All rights reserved. This program and the accompanying materials
* are made available under the Academic Free License version 3.0
* which accompanies this distribution, and is available at
* https://aawuley@bitbucket.org/aawuley/evolvex.git
*
* Contributors:
* ECJ MersenneTwister & MersenneTwisterFast (https://cs.gmu.edu/~eclab/projects/ecj)
* voidException Tabu Search (http://voidException.weebly.com)
* Lucia Blondel Simulated Anealing
*
*
*
*******************************************************************************/
package ec.algorithms.simulatedannealing;
import ec.individuals.representation.tabu.AMatrix;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;
import ec.algorithms.simulatedannealing.core.DistanceMatrix;
import ec.algorithms.simulatedannealing.core.Map;
import ec.algorithms.simulatedannealing.core.Tool;
/**
* Main class of the project
* @author Lucia Blondel
*/
public class StartTSP {
//private static final String pathOfData = "/Users/anthony/Desktop/lucy/data/";
private static final Tool tool = new Tool();
private static String nameOfMap;
private static ArrayList<String> cities = new ArrayList<String>();
private static double[][] distanceMatrix;
private int[] path;
private static double cost;
public static final HashMap<String, Map> maps = new HashMap<String,Map>();
private static Map ch130 = new Map(175375829147462l, 0.2, 0.9999, true);
private static Map d198 = new Map(170240126344462l,1, 0.999, true);
private static Map eil76 = new Map(165144750863462l, 10, 0.999, true);
private static Map fl1577 = new Map(179142946891462l, 0.1, 0.95, false);
private static Map kroA100 = new Map(175595919652462l, 0.5, 0.9999, false);
private static Map lin318 = new Map(170527939861462l, 1, 0.999, false);
private static Map pcb442 = new Map(179566124364462l, 0.5, 0.999, true);
private static Map pr439 = new Map(179780899710462l, 0.5, 0.9999, true);
private static Map rat783 = new Map(160900147239462l, 0.1, 0.995, true);
private static Map u1060 = new Map(161821912575462l, 0.5, 0.99, true);
private static Map map0 = new Map(175375829147462l, 0.1, 0.99999, true);
private static final String defaultMap = "default";
public boolean hybrid = Boolean.FALSE;
private ArrayList<Integer> hybridString;
Properties p;
int run;
public StartTSP(Properties prop, int runNum)
{
p = prop;
run = runNum;
}
public final double start() throws IOException {
maps.put("ch130.tsp", ch130);
maps.put("d198.tsp", d198);
maps.put("eil76.tsp", eil76);
maps.put("fl1577.tsp", fl1577);
maps.put("kroA100.tsp", kroA100);
maps.put("lin318.tsp", lin318);
maps.put("pcb442.tsp", pcb442);
maps.put("pr439.tsp", pr439);
maps.put("rat783.tsp", rat783);
maps.put("u1060.tsp", u1060);
maps.put("default", map0);
//nameOfMap = args[0];
nameOfMap = defaultMap;
long start = System.nanoTime();
/*
read all the cities and position of the cities from the file
ReadFile file = new ReadFile(pathOfData + args[0]);
cities = file.getCities();
build the matrix with the distances
DistanceMatrix d = new DistanceMatrix(cities);
distanceMatrix = d.getDistanceMatrix();
*/
if(hybrid)
{
//distanceMatrix = (new AMatrix()).readINTMatrixFromFile(this.p);
distanceMatrix = (new AMatrix()).readMatrixFromHybrid(this.p,this.getHybridString());
}
else
{
//distanceMatrix = (new AMatrix()).readINTMatrixFromFile(this.p);
distanceMatrix = (new AMatrix()).readMatrixFromFile(this.p);
}
DistanceMatrix d = new DistanceMatrix(this.p,distanceMatrix);
//do simulated annealing
SimulatedAnnealing annealing = new SimulatedAnnealing(d, nameOfMap);
annealing.simulatedAnnealing();
path = annealing.getPath();
cost = tool.computeCost(path, distanceMatrix);
long end = System.nanoTime();
// print out some informations
System.out.println("Time needed");
System.out.println(Math.floor((end-start) * Math.pow(10, -9)));
System.out.println("Path");
String pathString = "[";
for(int i = 0; i < path.length; i++)
{
pathString += (path[i]+1) + "; ";
}
pathString += "]";
System.out.println(pathString);
System.out.println("Cost of the solution");
System.out.println(cost);
System.out.println("Is the solution feasible?");
if (tool.isFeasible(path, cities))
{
System.out.println("yes");
} else
{
System.out.println("no");
}
//return Math.floor((end-start) * Math.pow(10, -9));
return cost;
}
public int[] getPath()
{
return this.path;
}
/**
* @return the hybridString
*/
public ArrayList<Integer> getHybridString() {
return hybridString;
}
/**
* @param hybridString the hybridString to set
*/
public void setHybridString(ArrayList<Integer> hybridString) {
this.hybridString = hybridString;
}
}
| mit |
openregister/openregister-java | src/main/java/uk/gov/register/resources/IndexSizePagination.java | 2950 | package uk.gov.register.resources;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import java.util.Optional;
public class IndexSizePagination implements Pagination {
public static final int ENTRY_LIMIT = 100;
public static final String INDEX_PARAM = "page-index";
public static final String SIZE_PARAM = "page-size";
private final int pageIndex;
private final int totalEntries;
private final int pageSize;
public IndexSizePagination(Optional<Integer> optionalPageIndex, Optional<Integer> optionalPageSize, int totalEntries) {
this.totalEntries = totalEntries;
this.pageIndex = optionalPageIndex.orElse(1);
this.pageSize = optionalPageSize.orElse(ENTRY_LIMIT);
if (this.pageSize <= 0) {
throw new BadRequestException("page-size must be greater than 0.");
}
if (this.pageIndex <= 0) {
throw new BadRequestException("page-index must be greater than 0.");
}
if (this.pageSize > 5000) {
throw new BadRequestException("page-size too big, maximum page size can be 5000.");
}
if (pageIndex > 1 && ((pageIndex - 1) * pageSize) >= totalEntries) {
throw new NotFoundException();
}
}
public int offset() {
return (pageIndex - 1) * pageSize;
}
@Override
public int getTotalEntries() {
return totalEntries;
}
@Override
public boolean isSinglePage() {
return pageIndex == 1 && pageSize >= totalEntries;
}
@Override
public int getFirstEntryNumberOnThisPage() {
return offset() + 1;
}
@Override
public int getLastEntryNumberOnThisPage() {
int lastEntryNumber = pageIndex * pageSize;
return lastEntryNumber > totalEntries ? totalEntries : lastEntryNumber;
}
@Override
public boolean hasNextPage() {
return totalEntries - (pageIndex * pageSize()) > 0;
}
@Override
public boolean hasPreviousPage() {
return pageIndex > 1;
}
@Override
public int getNextPageNumber() {
return pageIndex + 1;
}
@Override
public int getPreviousPageNumber() {
return pageIndex - 1;
}
@Override
public String getNextPageLink() {
return String.format("?" + INDEX_PARAM + "=%s&" + SIZE_PARAM + "=%s", getNextPageNumber(), pageSize());
}
@Override
public String getPreviousPageLink() {
return String.format("?" + INDEX_PARAM + "=%s&" + SIZE_PARAM + "=%s", getPreviousPageNumber(), pageSize());
}
public int pageSize() {
return pageSize;
}
public String getFormattedPageQueryParams() {
return String.format("?%s=%s&%s=%s", INDEX_PARAM, pageIndex, SIZE_PARAM, pageSize);
}
@Override
public int getTotalPages() {
return (int) Math.round(Math.ceil(((double) totalEntries) / pageSize()));
}
}
| mit |
openregister/openregister-java | src/test/java/uk/gov/register/serialization/mappers/EntryToCommandMapperTest.java | 1256 | package uk.gov.register.serialization.mappers;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import uk.gov.register.core.Entry;
import uk.gov.register.core.EntryType;
import uk.gov.register.core.HashingAlgorithm;
import uk.gov.register.serialization.RegisterCommand;
import uk.gov.register.util.HashValue;
import java.time.Instant;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
public class EntryToCommandMapperTest {
private EntryToCommandMapper sutMapper;
@Before
public void setUp() throws Exception {
sutMapper = new EntryToCommandMapper();
}
@Test
public void apply_returnsAppendEntryCommandForEntry() {
Entry entryToMap = new Entry(1, new HashValue(HashingAlgorithm.SHA256, "item-sha"), new HashValue(HashingAlgorithm.SHA256, "blob-sha"), Instant.parse("2016-07-24T16:55:00Z"), "entry1-field-1-value", EntryType.user);
RegisterCommand mapResult = sutMapper.apply(entryToMap);
assertThat(mapResult.getCommandName(), equalTo("append-entry"));
assertThat(mapResult.getCommandArguments(), equalTo(Arrays.asList("user", "entry1-field-1-value", "2016-07-24T16:55:00Z", "sha-256:item-sha")));
}
}
| mit |
jeikerxiao/SpringBootStudy | spring-boot-websocket/src/main/java/com/jeiker/demo/model/RequestMessage.java | 223 | package com.jeiker.demo.model;
/**
* @author : xiao
* @date : 17/11/2 上午11:01
* @description :
*/
public class RequestMessage {
private String name;
public String getName() {
return name;
}
}
| mit |
xmaxing/RxTwitch_MVP_Dagger | pircbotx-2.1/src/main/java/org/pircbotx/cap/TLSCapHandler.java | 2240 | /**
* Copyright (C) 2010-2014 Leon Blakey <lord.quackstar at gmail.com>
*
* This file is part of PircBotX.
*
* PircBotX is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* PircBotX is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* PircBotX. If not, see <http://www.gnu.org/licenses/>.
*/
package org.pircbotx.cap;
import com.google.common.collect.ImmutableList;
import javax.net.ssl.SSLSocketFactory;
import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.pircbotx.PircBotX;
import org.pircbotx.exception.CAPException;
/**
* CAP STARTTLS support <b>*MUST BE LAST CAP HANDLER*</b>. Due to how STARTTLS
* works and how PircBotX is designed this must be the last CAP handler,
* otherwise you will receive an "SSL peer shutdown incorrectly" exception
*
* @author Leon Blakey
*/
@ToString
@Slf4j
public class TLSCapHandler extends EnableCapHandler {
@Getter
protected SSLSocketFactory sslSocketFactory;
public TLSCapHandler() {
super("tls");
this.sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
}
public TLSCapHandler(SSLSocketFactory sslSocketFactory, boolean ignoreFail) {
super("tls", ignoreFail);
this.sslSocketFactory = sslSocketFactory;
}
@Override
public boolean handleACK(PircBotX bot, ImmutableList<String> capabilities) throws CAPException {
if (capabilities.contains("tls")) {
log.debug("Supported capability tls, sending STARTTLS and awaiting 670 response");
bot.sendRaw().rawLineNow("STARTTLS");
//Not finished, still need to wait for 670 line
return false;
}
//Ignore, not for us
return false;
}
@Override
public boolean handleUnknown(PircBotX bot, String rawLine) {
//Finished if we have successfully upgraded the socket
return rawLine.contains(" 670 ");
}
}
| mit |
insano10/puzzlers | src/main/java/com/insano10/puzzlers/trees/RedBlackTree.java | 7339 | package com.insano10.puzzlers.trees;
import com.google.common.annotations.VisibleForTesting;
import java.util.function.Consumer;
import static com.insano10.puzzlers.trees.RedBlackTree.Colour.BLACK;
import static com.insano10.puzzlers.trees.RedBlackTree.Colour.RED;
public class RedBlackTree<T extends Comparable<T>>
{
public enum Colour
{
RED, BLACK
}
private RedBlackNode<T> root = null;
@VisibleForTesting
public RedBlackNode<T> getRoot()
{
return root;
}
public void insert(T data)
{
RedBlackNode<T> node = binaryTreeInsert(data);
rebalance(node);
}
private void rebalance(RedBlackNode<T> node)
{
// rebalance the tree if the newly inserted node is not the root
// and it's parent is red
if (!root.equals(node) && node.getParent().getColour() == RED)
{
RedBlackNode<T> uncle = getUncleOf(node);
if (uncle.getColour() == RED)
{
node.getParent().setColour(BLACK);
uncle.setColour(BLACK);
rebalance(node.getParent().getParent());
}
else
{
if (leftLeftCase(node))
{
rightRotate(node.getParent().getParent());
flipColour(node.getParent());
flipColour(node.getParent().getParent());
}
else if(leftRightCase(node))
{
leftRotate(node.getParent());
//same as leftLeftCase
rightRotate(node.getParent().getParent());
flipColour(node.getParent());
flipColour(node.getParent().getParent());
}
else if(rightRightCase(node))
{
leftRotate(node.getParent().getParent());
flipColour(node.getParent());
flipColour(node.getParent().getParent());
}
else if(rightLeftCase(node))
{
rightRotate(node.getParent());
//same as rightRightCase
leftRotate(node.getParent().getParent());
flipColour(node.getParent());
flipColour(node.getParent().getParent());
}
else
{
throw new RuntimeException("WTF?");
}
}
}
}
private void flipColour(RedBlackNode<T> node)
{
if(node.getColour() == RED)
{
node.setColour(BLACK);
}
else
{
node.setColour(RED);
}
}
/*
[G]
/
[P]
/
[N]
*/
private boolean leftLeftCase(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> grandParent = parent.getParent();
return grandParent.getLeft().equals(parent) &&
parent.getLeft().equals(node);
}
/*
[G]
/
[P]
\
[N]
*/
private boolean leftRightCase(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> grandParent = parent.getParent();
return grandParent.getLeft().equals(parent) &&
parent.getRight().equals(node);
}
/*
[G]
\
[P]
\
[N]
*/
private boolean rightRightCase(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> grandParent = parent.getParent();
return grandParent.getRight().equals(parent) &&
parent.getRight().equals(node);
}
/*
[G]
\
[P]
/
[N]
*/
private boolean rightLeftCase(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> grandParent = parent.getParent();
return grandParent.getRight().equals(parent) &&
parent.getLeft().equals(node);
}
private void rightRotate(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> top = node.getLeft();
node.setLeft(new LeafRedBlackNode<T>());
if(parent == null)
{
//node is the root
root = top;
}
else
{
if(parent.getLeft().equals(node))
{
parent.setLeft(top);
}
else
{
parent.setRight(top);
}
}
top.setRight(node);
}
private void leftRotate(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> top = node.getRight();
node.setRight(new LeafRedBlackNode<T>());
if(parent == null)
{
//node is the root
root = top;
}
else
{
if(parent.getLeft().equals(node))
{
parent.setLeft(top);
}
else
{
parent.setRight(top);
}
}
top.setLeft(node);
}
private RedBlackNode<T> getUncleOf(RedBlackNode<T> node)
{
RedBlackNode<T> parent = node.getParent();
RedBlackNode<T> grandparent = parent.getParent();
return grandparent.getLeft().equals(parent) ? grandparent.getRight() : grandparent.getLeft();
}
public void visitInOrder(Consumer<T> onVisit)
{
traverseInOrder(root, onVisit);
}
private void traverseInOrder(RedBlackNode<T> node, Consumer<T> onVisit)
{
if (!node.isLeaf())
{
traverseInOrder(node.getLeft(), onVisit);
onVisit.accept(node.getData());
traverseInOrder(node.getRight(), onVisit);
}
}
private RedBlackNode<T> binaryTreeInsert(T data)
{
if (root == null)
{
root = new InternalRedBlackNode<>(data, BLACK, null);
return root;
}
else
{
RedBlackNode<T> next = root;
while (true)
{
if (data.compareTo(next.getData()) <= 0)
{
if (next.getLeft().isLeaf())
{
RedBlackNode<T> newNode = new InternalRedBlackNode<>(data, RED, next);
next.setLeft(newNode);
return newNode;
}
next = next.getLeft();
}
else
{
if (next.getRight().isLeaf())
{
RedBlackNode<T> newNode = new InternalRedBlackNode<>(data, RED, next);
next.setRight(newNode);
return newNode;
}
next = next.getRight();
}
}
}
}
}
| mit |
gaoyangtc/CallQueue | app/src/main/java/cn/rlstech/callnumber/utils/JsonHelper.java | 1501 | package cn.rlstech.callnumber.utils;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* json帮助类
* Created by gaouang.
*/
public class JsonHelper {
public static String getString(JSONObject json, String key) {
if(json == null) return null;
if (!json.isNull(key)) {
return json.optString(key);
}
return null;
}
public static int getInt(JSONObject json, String key) {
return getInt(json, key, 0);
}
public static int getInt(JSONObject json, String key, int def) {
if(json == null) return def;
if (!json.isNull(key)) {
return json.optInt(key, def);
}
return def;
}
public static double getDouble(JSONObject json, String key) {
return getDouble(json, key, 0);
}
public static double getDouble(JSONObject json, String key, double def) {
if(json == null) return def;
if (!json.isNull(key)) {
return json.optDouble(key, def);
}
return def;
}
public static JSONArray getJsonArray(JSONObject json, String key) {
if(json == null) return null;
if (!json.isNull(key)) {
return json.optJSONArray(key);
}
return null;
}
public static JSONObject getJsonObject(JSONObject json, String key) {
if(json == null) return null;
if (!json.isNull(key)) {
return json.optJSONObject(key);
}
return null;
}
}
| mit |
dshmif/consoul | src/main/java/com/abstractthis/consoul/ConsoleInputParser.java | 1747 | package com.abstractthis.consoul;
//The MIT License (MIT)
//
//Copyright (c) 2013 David Smith <www.abstractthis.com>
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//THE SOFTWARE.
import com.abstractthis.consoul.commands.ConsoleCommand;
/**
* Allows for each application to determine how it wants to provide
* the command line input into the application.
* <p>
* If a custom parser isn't provided in the <code>console.xml</code> application
* deployment descriptor the default will be used. The default assumes the
* following space-delimited input:
* <p>
* <command> <parameter1> <parameter2> ....
*
* @author David Smith
*
*/
public interface ConsoleInputParser {
public ConsoleCommand parse(String cmdStr);
}
| mit |
sebastienhouzet/nabaztag-source-code | server/MyNabaztag/build/WEB-INF/src/org/apache/jsp/include_005fjsp/myMessage/ajax_005fshuffleNabshare_jsp.java | 6304 | package org.apache.jsp.include_005fjsp.myMessage;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import net.violet.platform.util.StaticTools;
import net.violet.platform.util.SessionTools;
import net.violet.platform.util.DicoTools;
import net.violet.platform.util.MyConstantes;
public final class ajax_005fshuffleNabshare_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.List _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList(1);
_jspx_dependants.add("/include_jsp/utils/inc_dico.jsp");
}
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_define_property_name_id_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_bean_write_property_name_nobody;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_jspx_tagPool_bean_define_property_name_id_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_bean_write_property_name_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_jspx_tagPool_bean_define_property_name_id_nobody.release();
_jspx_tagPool_bean_write_property_name_nobody.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n\r\n\r\n");
response.setContentType("text/html;charset=UTF-8");
out.write("\r\n\r\n\r\n\r\n\r\n");
out.write('\n');
out.write('\r');
out.write('\n');
out.write("\r\n\r\n\n");
String dico_lang = Long.toString(SessionTools.getLangFromSession(session, request).getId());
out.write("\r\n\r\n");
// bean:define
org.apache.struts.taglib.bean.DefineTag _jspx_th_bean_define_0 = (org.apache.struts.taglib.bean.DefineTag) _jspx_tagPool_bean_define_property_name_id_nobody.get(org.apache.struts.taglib.bean.DefineTag.class);
_jspx_th_bean_define_0.setPageContext(_jspx_page_context);
_jspx_th_bean_define_0.setParent(null);
_jspx_th_bean_define_0.setId("musicData");
_jspx_th_bean_define_0.setName("myMessagesNabshareChoiceForm");
_jspx_th_bean_define_0.setProperty("listeNabshareRand");
int _jspx_eval_bean_define_0 = _jspx_th_bean_define_0.doStartTag();
if (_jspx_th_bean_define_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_bean_define_property_name_id_nobody.reuse(_jspx_th_bean_define_0);
return;
}
_jspx_tagPool_bean_define_property_name_id_nobody.reuse(_jspx_th_bean_define_0);
java.lang.Object musicData = null;
musicData = (java.lang.Object) _jspx_page_context.findAttribute("musicData");
out.write("\t\t\t\r\nselectItem(\"");
if (_jspx_meth_bean_write_0(_jspx_page_context))
return;
out.write('"');
out.write(',');
out.write(' ');
if (_jspx_meth_bean_write_1(_jspx_page_context))
return;
out.write(");\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_bean_write_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// bean:write
org.apache.struts.taglib.bean.WriteTag _jspx_th_bean_write_0 = (org.apache.struts.taglib.bean.WriteTag) _jspx_tagPool_bean_write_property_name_nobody.get(org.apache.struts.taglib.bean.WriteTag.class);
_jspx_th_bean_write_0.setPageContext(_jspx_page_context);
_jspx_th_bean_write_0.setParent(null);
_jspx_th_bean_write_0.setName("musicData");
_jspx_th_bean_write_0.setProperty("label");
int _jspx_eval_bean_write_0 = _jspx_th_bean_write_0.doStartTag();
if (_jspx_th_bean_write_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_bean_write_property_name_nobody.reuse(_jspx_th_bean_write_0);
return true;
}
_jspx_tagPool_bean_write_property_name_nobody.reuse(_jspx_th_bean_write_0);
return false;
}
private boolean _jspx_meth_bean_write_1(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// bean:write
org.apache.struts.taglib.bean.WriteTag _jspx_th_bean_write_1 = (org.apache.struts.taglib.bean.WriteTag) _jspx_tagPool_bean_write_property_name_nobody.get(org.apache.struts.taglib.bean.WriteTag.class);
_jspx_th_bean_write_1.setPageContext(_jspx_page_context);
_jspx_th_bean_write_1.setParent(null);
_jspx_th_bean_write_1.setName("musicData");
_jspx_th_bean_write_1.setProperty("id");
int _jspx_eval_bean_write_1 = _jspx_th_bean_write_1.doStartTag();
if (_jspx_th_bean_write_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_bean_write_property_name_nobody.reuse(_jspx_th_bean_write_1);
return true;
}
_jspx_tagPool_bean_write_property_name_nobody.reuse(_jspx_th_bean_write_1);
return false;
}
}
| mit |
TPL-Group/TPL-Compiler | src/scanner/ScanException.java | 686 | package src.scanner;
/**
* This class extends the Exception class.
* When this exception is thrown, it will return a string
* to explain the error.
*/
public class ScanException extends Exception{
/**
* The constructor calls the super class’ constructor.
*
* @param s A string is expected that describes the error
*/
public ScanException( String s ){
super( s , null, true, false);
}
/**
* When this exception is thrown, it will return a string
* to explain the error.
*
* @return String A string to explain the error.
*/
@Override
public String toString(){
return "--A FLAIR SCAN EXCEPTION--\n" + super.toString();
}
}
| mit |
mickleness/pumpernickel | src/main/java/com/pump/plaf/LargeNavigationPanelUI.java | 14682 | /**
* This software is released as part of the Pumpernickel project.
*
* All com.pump resources in the Pumpernickel project are distributed under the
* MIT License:
* https://raw.githubusercontent.com/mickleness/pumpernickel/master/License.txt
*
* More information about the Pumpernickel project is available here:
* https://mickleness.github.io/pumpernickel/
*/
package com.pump.plaf;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.RoundRectangle2D;
import java.util.HashMap;
import java.util.Map;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicButtonUI;
import com.pump.blog.ResourceSample;
import com.pump.icon.FirstIcon;
import com.pump.icon.LastIcon;
import com.pump.icon.TriangleIcon;
import com.pump.swing.NavigationButtons;
/**
* This NavigationPanelUI contains large buttons and a slider.
* <p>
* If the spinner is not implemented as a SpinnerNumberModel (which guarantees a
* min and a max), then the slider, first and last buttons are all made
* invisible. A label is added instead to describe the current selection.
*
* <!-- ======== START OF AUTOGENERATED SAMPLES ======== -->
* <p>
* Here are some samples:
* <table summary="Resource Samples for com.pump.plaf.LargeNavigationPanelUI">
* <tr>
* <td></td>
* <td><img src=
* "https://raw.githubusercontent.com/mickleness/pumpernickel/master/resources/samples/LargeNavigationPanelUI/SpinnerNumberModel.png"
* alt="com.pump.plaf.LargeNavigationPanelUI.createDemo(true)"></td>
* <td><img src=
* "https://raw.githubusercontent.com/mickleness/pumpernickel/master/resources/samples/LargeNavigationPanelUI/Any Other Model.png"
* alt="com.pump.plaf.LargeNavigationPanelUI.createDemo(false)"></td>
* </tr>
* <tr>
* <td></td>
* <td>SpinnerNumberModel</td>
* <td>Any Other Model</td>
* </tr>
* <tr>
* </tr>
* </table>
* <!-- ======== END OF AUTOGENERATED SAMPLES ======== -->
*/
@ResourceSample(sample = {
"com.pump.plaf.LargeNavigationPanelUI.createDemo(true)",
"com.pump.plaf.LargeNavigationPanelUI.createDemo(false)" }, names = {
"SpinnerNumberModel", "Any Other Model" })
public class LargeNavigationPanelUI extends NavigationPanelUI {
/** Create a minimal demo for the javadoc. */
public static JSpinner createDemo(boolean useNumbers) {
JSpinner spinner;
if (useNumbers) {
spinner = new JSpinner(new SpinnerNumberModel(5, 1, 10, 1));
} else {
spinner = new JSpinner(new SpinnerListModel(new Object[] { "Red",
"Green", "Blue" }));
}
spinner.setUI(new LargeNavigationPanelUI());
spinner.setBorder(new EmptyBorder(5, 5, 5, 5));
return spinner;
}
protected static final String SLIDER_NAME = "Spinner.slider";
protected static final String FIRST_BUTTON_NAME = "Spinner.firstButton";
protected static final String LAST_BUTTON_NAME = "Spinner.lastButton";
private int sliderAdjusting = 0;
protected AbstractButton firstButton, lastButton;
@Override
protected void updateEnabledState(boolean isSpinnerEnabled,
boolean hasPreviousValue, boolean hasNextValue) {
super.updateEnabledState(isSpinnerEnabled, hasPreviousValue,
hasNextValue);
getComponent(spinner, FIRST_BUTTON_NAME).setEnabled(
isSpinnerEnabled && hasPreviousValue);
getComponent(spinner, LAST_BUTTON_NAME).setEnabled(
isSpinnerEnabled && hasNextValue);
getComponent(spinner, SLIDER_NAME).setEnabled(isSpinnerEnabled);
}
@Override
protected Component createPreviousButton() {
AbstractButton button = NavigationButtons.createPrev();
format(button);
button.setIcon(new TriangleIcon(SwingConstants.WEST, 24, 24,
Color.lightGray));
button.setRolloverIcon(new TriangleIcon(SwingConstants.WEST, 24, 24,
Color.white));
button.setDisabledIcon(new TriangleIcon(SwingConstants.WEST, 24, 24,
Color.darkGray));
button.setName(PREV_BUTTON_NAME);
installPreviousButtonListeners(button);
return button;
}
@Override
protected Component createNextButton() {
AbstractButton button = NavigationButtons.createNext();
format(button);
button.setIcon(new TriangleIcon(SwingConstants.EAST, 24, 24,
Color.lightGray));
button.setRolloverIcon(new TriangleIcon(SwingConstants.EAST, 24, 24,
Color.white));
button.setDisabledIcon(new TriangleIcon(SwingConstants.EAST, 24, 24,
Color.darkGray));
button.setName(NEXT_BUTTON_NAME);
installNextButtonListeners(button);
return button;
}
protected JSlider createSlider() {
JSlider slider = new JSlider(0, 1000);
slider.setOpaque(false);
slider.setName(SLIDER_NAME);
installSliderListener(slider);
return slider;
}
protected void updateSliderState(JSlider slider) {
sliderAdjusting++;
try {
boolean useSlider = false;
if (spinner.getModel() instanceof SpinnerNumberModel) {
useSlider = true;
SpinnerNumberModel numberModel = (SpinnerNumberModel) spinner
.getModel();
Number min = (Number) numberModel.getMinimum();
Number max = (Number) numberModel.getMaximum();
float range = max.floatValue() - min.floatValue();
float pos = (((Number) numberModel.getValue()).floatValue() - min
.floatValue()) / range;
int sliderRange = slider.getMaximum() - slider.getMinimum();
int sliderValue = (int) (pos * sliderRange + slider
.getMinimum());
slider.setValue(sliderValue);
}
if (useSlider != slider.isVisible())
slider.setVisible(useSlider);
if (useSlider != firstButton.isVisible())
firstButton.setVisible(useSlider);
if (useSlider != lastButton.isVisible())
lastButton.setVisible(useSlider);
if (useSlider == getLabel().isVisible())
getLabel().setVisible(!useSlider);
} finally {
sliderAdjusting--;
}
}
protected void installSliderListener(final JSlider slider) {
spinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updateSliderState(slider);
}
});
slider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (sliderAdjusting > 0)
return;
float sliderRange = slider.getMaximum() - slider.getMinimum();
float pos = slider.getValue();
pos = (pos - slider.getMinimum()) / sliderRange;
SpinnerNumberModel numberModel = (SpinnerNumberModel) spinner
.getModel();
Number min = (Number) numberModel.getMinimum();
Number max = (Number) numberModel.getMaximum();
float range = max.floatValue() - min.floatValue();
float spinnerPos = pos * range + min.floatValue();
if (min instanceof Integer && max instanceof Integer) {
spinner.setValue(Integer.valueOf((int) (spinnerPos + .5)));
} else {
spinner.setValue(Float.valueOf(spinnerPos));
}
}
});
}
protected AbstractButton createFirstButton() {
AbstractButton button = new JButton();
format(button);
button.setIcon(new FirstIcon(2, 24, 24, Color.lightGray));
button.setRolloverIcon(new FirstIcon(2, 24, 24, Color.white));
button.setDisabledIcon(new FirstIcon(2, 24, 24, Color.darkGray));
button.setName("Spinner.firstButton");
installFirstButtonListeners(button);
return button;
}
protected AbstractButton createLastButton() {
AbstractButton button = new JButton();
format(button);
button.setIcon(new LastIcon(2, 24, 24, Color.lightGray));
button.setRolloverIcon(new LastIcon(2, 24, 24, Color.white));
button.setDisabledIcon(new LastIcon(2, 24, 24, Color.darkGray));
button.setName("Spinner.lastButton");
installLastButtonListeners(button);
return button;
}
protected void installFirstButtonListeners(final AbstractButton button) {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) spinner
.getModel();
model.setValue(model.getMinimum());
}
});
}
protected void installLastButtonListeners(final AbstractButton button) {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SpinnerNumberModel model = (SpinnerNumberModel) spinner
.getModel();
model.setValue(model.getMaximum());
}
});
}
@Override
protected LayoutManager createLayout() {
return new LargeLayeredLayout();
}
@Override
public void paint(Graphics g0, JComponent c) {
Graphics2D g = (Graphics2D) g0.create();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Shape roundRect = new RoundRectangle2D.Float(0, 0, c.getWidth(),
c.getHeight(), 9, 9);
g.setColor(new Color(30, 30, 30, 200));
g.fill(roundRect);
g.dispose();
}
@Override
protected JComponent createEditor() {
return null;
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
JSlider slider = createSlider();
firstButton = createFirstButton();
lastButton = createLastButton();
maybeAdd(firstButton, "First");
maybeAdd(lastButton, "Last");
maybeAdd(slider, "Slider");
updateSliderState(slider);
getLabel().setUI(
new EmphasizedLabelUI(new Color(0xeeeeee), new Color(0xeeeeee),
new Color(0x444444)));
}
protected void format(AbstractButton button) {
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.setUI(new BasicButtonUI());
}
static class LargeLayeredLayout implements LayoutManager {
Map<String, Component> constraintMap = new HashMap<>();
Insets buttonInsets = new Insets(3, 3, 3, 3);
Insets labelInsets = new Insets(3, 3, 3, 3);
Insets masterInsets = new Insets(3, 3, 3, 3);
@Override
public void addLayoutComponent(String name, Component component) {
constraintMap.put(name, component);
}
@Override
public void removeLayoutComponent(Component comp) {
constraintMap.values().remove(comp);
}
@Override
public Dimension preferredLayoutSize(Container parent) {
Component prev = constraintMap.get("Previous");
Component next = constraintMap.get("Next");
Component first = constraintMap.get("First");
Component last = constraintMap.get("Last");
Component slider = constraintMap.get("Slider");
Component label = constraintMap.get("Label");
int width = masterInsets.left + masterInsets.right;
int height = 0;
if (first != null && first.isVisible()) {
Dimension firstD = first.getPreferredSize();
width += firstD.width + buttonInsets.left + buttonInsets.right;
height = Math.max(firstD.height + buttonInsets.top
+ buttonInsets.bottom, height);
}
if (prev != null && prev.isVisible()) {
Dimension prevD = prev.getPreferredSize();
width += prevD.width + buttonInsets.left + buttonInsets.right;
height = Math.max(prevD.height + buttonInsets.top
+ buttonInsets.bottom, height);
}
if (next != null && next.isVisible()) {
Dimension nextD = next.getPreferredSize();
width += nextD.width + buttonInsets.left + buttonInsets.right;
height = Math.max(nextD.height + buttonInsets.top
+ buttonInsets.bottom, height);
}
if (last != null && last.isVisible()) {
Dimension lastD = last.getPreferredSize();
width += lastD.width + buttonInsets.left + buttonInsets.right;
height = Math.max(lastD.height + buttonInsets.top
+ buttonInsets.bottom, height);
}
height += masterInsets.top + masterInsets.bottom;
if (label != null && label.isVisible()) {
Dimension labelD = label.getPreferredSize();
height += labelD.height + labelInsets.top + labelInsets.bottom;
}
if (slider != null && slider.isVisible()) {
Dimension editorD = slider.getPreferredSize();
height += editorD.height;
}
return new Dimension(width, height);
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return preferredLayoutSize(parent);
}
@Override
public void layoutContainer(Container parent) {
Component prev = constraintMap.get("Previous");
Component next = constraintMap.get("Next");
Component first = constraintMap.get("First");
Component last = constraintMap.get("Last");
Component slider = constraintMap.get("Slider");
Component label = constraintMap.get("Label");
int left = masterInsets.left;
int x = left;
int y = masterInsets.top + buttonInsets.top;
int y2 = y;
if (first != null && first.isVisible()) {
Dimension firstD = first.getPreferredSize();
x += buttonInsets.left;
first.setBounds(x, y + buttonInsets.top, firstD.width,
firstD.height);
x += firstD.width + buttonInsets.right;
y2 = Math.max(y2, y + firstD.height + buttonInsets.bottom);
}
if (prev != null && prev.isVisible()) {
Dimension prevD = prev.getPreferredSize();
x += buttonInsets.left;
prev.setBounds(x, y + buttonInsets.top, prevD.width,
prevD.height);
x += prevD.width + buttonInsets.right;
y2 = Math.max(y2, y + prevD.height + buttonInsets.bottom);
}
if (next != null && next.isVisible()) {
Dimension nextD = next.getPreferredSize();
x += buttonInsets.left;
next.setBounds(x, y + buttonInsets.top, nextD.width,
nextD.height);
x += nextD.width + buttonInsets.right;
y2 = Math.max(y2, y + nextD.height + buttonInsets.bottom);
}
if (last != null && last.isVisible()) {
Dimension lastD = last.getPreferredSize();
x += buttonInsets.left;
last.setBounds(x, y + buttonInsets.top, lastD.width,
lastD.height);
x += lastD.width + buttonInsets.right;
y2 = Math.max(y2, y + lastD.height + buttonInsets.bottom);
}
int innerWidth = parent.getWidth() - left - masterInsets.right;
if (label != null && label.isVisible()) {
y2 += labelInsets.top;
Dimension labelD = label.getPreferredSize();
labelD.width = Math.min(innerWidth - labelInsets.left
- labelInsets.right, labelD.width);
label.setBounds(parent.getWidth() / 2 - labelD.width / 2, y2,
labelD.width, labelD.height);
y2 += labelD.height + labelInsets.bottom;
}
if (slider != null && slider.isVisible()) {
Dimension editorD = slider.getPreferredSize();
slider.setBounds(left, y2, innerWidth, editorD.height);
}
}
}
} | mit |
opennars/opennars | src/main/java/org/opennars/control/concept/ProcessGoal.java | 24908 | /*
* The MIT License
*
* Copyright 2018 The OpenNARS authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.opennars.control.concept;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.opennars.control.DerivationContext;
import org.opennars.entity.BudgetValue;
import org.opennars.entity.Concept;
import org.opennars.entity.Sentence;
import org.opennars.entity.Stamp;
import org.opennars.entity.Stamp.BaseEntry;
import org.opennars.entity.Task;
import org.opennars.entity.TruthValue;
import org.opennars.inference.LocalRules;
import static org.opennars.inference.LocalRules.revisible;
import static org.opennars.inference.LocalRules.revision;
import static org.opennars.inference.LocalRules.trySolution;
import org.opennars.inference.TemporalRules;
import org.opennars.inference.TruthFunctions;
import org.opennars.io.Symbols;
import org.opennars.io.events.Events;
import org.opennars.language.CompoundTerm;
import org.opennars.language.Conjunction;
import org.opennars.language.Equivalence;
import org.opennars.language.Implication;
import org.opennars.language.Interval;
import org.opennars.language.Product;
import org.opennars.language.Term;
import org.opennars.language.Variable;
import org.opennars.language.Variables;
import org.opennars.main.Debug;
import org.opennars.operator.FunctionOperator;
import org.opennars.operator.Operation;
import org.opennars.operator.Operator;
import org.opennars.plugin.mental.InternalExperience;
/**
*
* @author Patrick Hammer
*/
public class ProcessGoal {
/**
* To accept a new goal, and check for revisions and realization, then
* decide whether to actively pursue it, potentially executing in case of an operation goal
*
* @param concept The concept of the goal
* @param nal The derivation context
* @param task The goal task to be processed
*/
protected static void processGoal(final Concept concept, final DerivationContext nal, final Task task) {
final Sentence goal = task.sentence;
final Task oldGoalT = concept.selectCandidate(task, concept.desires, nal.time); // revise with the existing desire values
Sentence oldGoal = null;
final Stamp newStamp = goal.stamp;
if (oldGoalT != null) {
oldGoal = oldGoalT.sentence;
final Stamp oldStamp = oldGoal.stamp;
if (newStamp.equals(oldStamp,false,false,true)) {
return; // duplicate
}
}
Task beliefT = null;
if(task.aboveThreshold()) {
beliefT = concept.selectCandidate(task, concept.beliefs, nal.time);
for (final Task iQuest : concept.quests ) {
trySolution(task.sentence, iQuest, nal, true);
}
// check if the Goal is already satisfied
if (beliefT != null) {
// check if the Goal is already satisfied (manipulate budget)
trySolution(beliefT.sentence, task, nal, true);
}
}
if (oldGoalT != null && revisible(goal, oldGoal, nal.narParameters)) {
final Stamp oldStamp = oldGoal.stamp;
nal.setTheNewStamp(newStamp, oldStamp, nal.time.time());
final Sentence projectedGoal = oldGoal.projection(task.sentence.getOccurenceTime(), newStamp.getOccurrenceTime(), concept.memory);
if (projectedGoal!=null) {
nal.setCurrentBelief(projectedGoal);
final boolean wasRevised = revision(task.sentence, projectedGoal, concept, false, nal);
if (wasRevised) {
/* It was revised, so there is a new task for which this method will be called
* with higher/lower desire.
* We return because it is not allowed to go on directly due to decision making.
* see https://groups.google.com/forum/#!topic/open-nars/lQD0no2ovx4
*/
return;
}
}
}
final Stamp s2=goal.stamp.clone();
s2.setOccurrenceTime(nal.time.time());
if(s2.after(task.sentence.stamp, nal.narParameters.DURATION)) {
// this task is not up to date we have to project it first
final Sentence projGoal = task.sentence.projection(nal.time.time(), nal.narParameters.DURATION, nal.memory);
if(projGoal!=null && projGoal.truth.getExpectation() > nal.narParameters.DECISION_THRESHOLD) {
// keep goal updated
nal.singlePremiseTask(projGoal, task.budget.clone());
// we don't return here, allowing "roundtrips now", relevant for executing multiple steps of learned implication chains
}
}
if (!task.aboveThreshold()) {
return;
}
double AntiSatisfaction = 0.5f; // we dont know anything about that goal yet
if (beliefT != null) {
final Sentence belief = beliefT.sentence;
final Sentence projectedBelief = belief.projection(task.sentence.getOccurenceTime(), nal.narParameters.DURATION, nal.memory);
AntiSatisfaction = task.sentence.truth.getExpDifAbs(projectedBelief.truth);
}
task.setPriority(task.getPriority()* (float)AntiSatisfaction);
if (!task.aboveThreshold()) {
return;
}
final boolean isFullfilled = AntiSatisfaction < nal.narParameters.SATISFACTION_TRESHOLD;
final Sentence projectedGoal = goal.projection(nal.time.time(), nal.time.time(), nal.memory);
if (!(projectedGoal != null && task.aboveThreshold() && !isFullfilled)) {
return;
}
final boolean inhitedBabblingGoal = task.isInput() && !concept.allowBabbling;
if(inhitedBabblingGoal) {
return;
}
bestReactionForGoal(concept, nal, projectedGoal, task);
questionFromGoal(task, nal);
concept.addToTable(task, false, concept.desires, nal.narParameters.CONCEPT_GOALS_MAX, Events.ConceptGoalAdd.class, Events.ConceptGoalRemove.class);
InternalExperience.InternalExperienceFromTask(concept.memory, task, false, nal.time);
if(!(task.sentence.getTerm() instanceof Operation)) {
return;
}
processOperationGoal(projectedGoal, nal, concept, oldGoalT, task);
}
/**
* To process an operation for potential execution
* only called by processGoal
*
* @param projectedGoal The current goal
* @param nal The derivation context
* @param concept The concept of the current goal
* @param oldGoalT The best goal in the goal table
* @param task The goal task
*/
protected static void processOperationGoal(final Sentence projectedGoal, final DerivationContext nal, final Concept concept, final Task oldGoalT, final Task task) {
if(projectedGoal.truth.getExpectation() > nal.narParameters.DECISION_THRESHOLD) {
//see whether the goal evidence is fully included in the old goal, if yes don't execute
//as execution for this reason already happened (or did not since there was evidence against it)
final Set<BaseEntry> oldEvidence = new LinkedHashSet<>();
boolean Subset=false;
if(oldGoalT != null) {
Subset = true;
for(final BaseEntry l: oldGoalT.sentence.stamp.evidentialBase) {
oldEvidence.add(l);
}
for(final BaseEntry l: task.sentence.stamp.evidentialBase) {
if(!oldEvidence.contains(l)) {
Subset = false;
break;
}
}
}
if(!Subset && !executeOperation(nal, task)) {
concept.memory.emit(Events.UnexecutableGoal.class, task, concept, nal);
return; //it was made true by itself
}
}
}
/**
* Generate <?how =/> g>? question for g! goal.
* only called by processGoal
*
* @param task the task for which the question should be processed
* @param nal The derivation context
*/
public static void questionFromGoal(final Task task, final DerivationContext nal) {
if(nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING || nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
//ok, how can we achieve it? add a question of whether it is fullfilled
final List<Term> qu= new ArrayList<>();
if(nal.narParameters.HOW_QUESTION_GENERATION_ON_DECISION_MAKING) {
if(!(task.sentence.term instanceof Equivalence) && !(task.sentence.term instanceof Implication)) {
final Variable how=new Variable("?how");
//Implication imp=Implication.make(how, task.sentence.term, TemporalRules.ORDER_CONCURRENT);
final Implication imp2=Implication.make(how, task.sentence.term, TemporalRules.ORDER_FORWARD);
//qu.add(imp);
if(!(task.sentence.term instanceof Operation)) {
qu.add(imp2);
}
}
}
if(nal.narParameters.QUESTION_GENERATION_ON_DECISION_MAKING) {
qu.add(task.sentence.term);
}
for(final Term q : qu) {
if(q!=null) {
final Stamp st = new Stamp(task.sentence.stamp, nal.time.time());
st.setOccurrenceTime(task.sentence.getOccurenceTime()); //set tense of question to goal tense
final Sentence s = new Sentence(
q,
Symbols.QUESTION_MARK,
null,
st);
if(s!=null) {
final BudgetValue budget=new BudgetValue(task.getPriority()*nal.narParameters.CURIOSITY_DESIRE_PRIORITY_MUL,
task.getDurability()*nal.narParameters.CURIOSITY_DESIRE_DURABILITY_MUL,
1, nal.narParameters);
nal.singlePremiseTask(s, budget);
}
}
}
}
}
private static class ExecutablePrecondition {
public Operation bestop = null;
public float bestop_truthexp = 0.0f;
public TruthValue bestop_truth = null;
public Task executable_precond = null;
public long mintime = -1;
public long maxtime = -1;
public float timeOffset;
public Map<Term,Term> substitution;
}
/**
* When a goal is processed, use the best memorized reaction
* that is applicable to the current context (recent events) in case that it exists.
* This is a special case of the choice rule and allows certain behaviors to be automated.
*
* @param concept The concept of the goal to realize
* @param nal The derivation context
* @param projectedGoal The current goal
* @param task The goal task
*/
public static void bestReactionForGoal(final Concept concept, final DerivationContext nal, final Sentence projectedGoal, final Task task) {
concept.incAcquiredQuality(); //useful as it is represents a goal concept that can hold important procedure knowledge
//1. pull up variable based preconditions from component concepts without replacing them
Map<Term, Integer> ret = (projectedGoal.getTerm()).countTermRecursively(null);
List<Task> generalPreconditions = new ArrayList<>();
for(Term t : ret.keySet()) {
final Concept get_concept = nal.memory.concept(t); //the concept to pull preconditions from
if(get_concept == null || get_concept == concept) { //target concept does not exist or is the same as the goal concept
continue;
}
//pull variable based preconditions from component concepts
synchronized(get_concept) {
boolean useful_component = false;
for(Task precon : get_concept.general_executable_preconditions) {
//check whether the conclusion matches
if(Variables.findSubstitute(nal.memory.randomNumber, Symbols.VAR_INDEPENDENT, ((Implication)precon.sentence.term).getPredicate(), projectedGoal.term, new LinkedHashMap<>(), new LinkedHashMap<>())) {
for(Task prec : get_concept.general_executable_preconditions) {
generalPreconditions.add(prec);
useful_component = true;
}
}
}
if(useful_component) {
get_concept.incAcquiredQuality(); //useful as it contributed predictive hypotheses
}
}
}
//2. Accumulate all general preconditions of itself too and create list for anticipations
generalPreconditions.addAll(concept.general_executable_preconditions);
Map<Operation,List<ExecutablePrecondition>> anticipationsToMake = new LinkedHashMap<>();
//3. For the more specific hypotheses first and then the general
for(List<Task> table : new List[] {concept.executable_preconditions, generalPreconditions}) {
//4. Apply choice rule, using the highest truth expectation solution and anticipate the results
ExecutablePrecondition bestOpWithMeta = calcBestExecutablePrecondition(nal, concept, projectedGoal, table, anticipationsToMake);
//5. And executing it, also forming an expectation about the result
if(executePrecondition(nal, bestOpWithMeta, concept, projectedGoal, task)) {
Concept op = nal.memory.concept(bestOpWithMeta.bestop);
if(op != null && bestOpWithMeta.executable_precond.sentence.truth.getConfidence() > nal.narParameters.MOTOR_BABBLING_CONFIDENCE_THRESHOLD) {
synchronized(op) {
op.allowBabbling = false;
}
}
System.out.println("Executed based on: " + bestOpWithMeta.executable_precond);
for(ExecutablePrecondition precon : anticipationsToMake.get(bestOpWithMeta.bestop)) {
float distance = precon.timeOffset - nal.time.time();
float urgency = 2.0f + 1.0f/distance;
ProcessAnticipation.anticipate(nal, precon.executable_precond.sentence, precon.executable_precond.budget, precon.mintime, precon.maxtime, urgency, precon.substitution);
}
return; //don't try the other table as a specific solution was already used
}
}
}
/**
* Search for the best precondition that best matches recent events, and is most successful in leading to goal fulfilment
*
* @param nal The derivation context
* @param concept The goal concept
* @param projectedGoal The goal projected to the current time
* @param execPreconditions The procedural hypotheses with the executable preconditions
* @return The procedural hypothesis with the highest result truth expectation
*/
private static ExecutablePrecondition calcBestExecutablePrecondition(final DerivationContext nal, final Concept concept, final Sentence projectedGoal, List<Task> execPreconditions, Map<Operation,List<ExecutablePrecondition>> anticipationsToMake) {
ExecutablePrecondition result = new ExecutablePrecondition();
for(final Task t: execPreconditions) {
final CompoundTerm precTerm = ((Conjunction) ((Implication) t.getTerm()).getSubject());
final Term[] prec = precTerm.term;
final Term[] newprec = new Term[prec.length-3];
System.arraycopy(prec, 0, newprec, 0, prec.length - 3);
float timeOffset = (long) (((Interval)prec[prec.length-1]).time);
float timeWindowHalf = timeOffset * nal.narParameters.ANTICIPATION_TOLERANCE;
final Operation op = (Operation) prec[prec.length-2];
final Term precondition = Conjunction.make(newprec,TemporalRules.ORDER_FORWARD);
long newesttime = -1;
Task bestsofar = null;
List<Float> prec_intervals = new ArrayList<>();
for(Long l : CompoundTerm.extractIntervals(nal.memory, precTerm)) {
prec_intervals.add((float) l);
}
Map<Term,Term> subsconc = new LinkedHashMap<>();
boolean conclusionMatches = Variables.findSubstitute(nal.memory.randomNumber, Symbols.VAR_INDEPENDENT,
CompoundTerm.replaceIntervals(((Implication) t.getTerm()).getPredicate()),
CompoundTerm.replaceIntervals(projectedGoal.getTerm()), subsconc, new LinkedHashMap<>());
//ok we can look now how much it is fullfilled
//check recent events in event bag
Map<Term,Term> subsBest = new LinkedHashMap<>();
synchronized(concept.memory.seq_current) {
for(final Task p : concept.memory.seq_current) {
if(p.sentence.isJudgment() && !p.sentence.isEternal() && p.sentence.getOccurenceTime() > newesttime && p.sentence.getOccurenceTime() <= nal.time.time()) {
Map<Term,Term> subs = new LinkedHashMap<>(subsconc);
boolean preconditionMatches = Variables.findSubstitute(nal.memory.randomNumber, Symbols.VAR_INDEPENDENT,
CompoundTerm.replaceIntervals(precondition),
CompoundTerm.replaceIntervals(p.sentence.term), subs, new LinkedHashMap<>());
if(preconditionMatches && conclusionMatches){
Task pNew = new Task(p.sentence.clone(), p.budget.clone(), p.isInput() ? Task.EnumType.INPUT : Task.EnumType.DERIVED);
newesttime = p.sentence.getOccurenceTime();
//Apply interval penalty for interval differences in the precondition
LocalRules.intervalProjection(nal, pNew.sentence.term, precondition, prec_intervals, pNew.sentence.truth);
bestsofar = pNew;
subsBest = subs;
}
}
}
}
if(bestsofar == null) {
continue;
}
//ok now we can take the desire value:
final TruthValue A = projectedGoal.getTruth();
//and the truth of the hypothesis:
final TruthValue Hyp = t.sentence.truth;
//and derive the conjunction of the left side:
final TruthValue leftside = TruthFunctions.desireDed(A, Hyp, concept.memory.narParameters);
//overlap will almost never happen, but to make sure
if(Stamp.baseOverlap(projectedGoal.stamp, t.sentence.stamp) ||
Stamp.baseOverlap(bestsofar.sentence.stamp, t.sentence.stamp) ||
Stamp.baseOverlap(projectedGoal.stamp, bestsofar.sentence.stamp)) {
continue;
}
//and the truth of the precondition:
final Sentence projectedPrecon = bestsofar.sentence.projection(nal.time.time() /*- distance*/, nal.time.time(), concept.memory);
if(projectedPrecon.isEternal()) {
continue; //projection wasn't better than eternalization, too long in the past
}
final TruthValue precon = projectedPrecon.truth;
//in order to derive the operator desire value:
final TruthValue opdesire = TruthFunctions.desireDed(precon, leftside, concept.memory.narParameters);
final float expecdesire = opdesire.getExpectation();
Operation bestop = (Operation) ((CompoundTerm)op).applySubstitute(subsBest);
long mintime = (long) (nal.time.time() + timeOffset - timeWindowHalf);
long maxtime = (long) (nal.time.time() + timeOffset + timeWindowHalf);
if(expecdesire > result.bestop_truthexp) {
result.bestop = bestop;
result.bestop_truthexp = expecdesire;
result.bestop_truth = opdesire;
result.executable_precond = t;
result.substitution = subsBest;
result.mintime = mintime;
result.maxtime = maxtime;
result.timeOffset = timeOffset;
if(anticipationsToMake.get(result.bestop) == null) {
anticipationsToMake.put(result.bestop, new ArrayList<ExecutablePrecondition>());
}
anticipationsToMake.get(result.bestop).add(result);
}
}
return result;
}
/**
* Execute the operation suggested by the most applicable precondition
*
* @param nal The derivation context
* @param precon The procedural hypothesis leading to goal
* @param concept The concept of the goal
* @param projectedGoal The goal projected to the current time
* @param task The goal task
*/
private static boolean executePrecondition(final DerivationContext nal, ExecutablePrecondition precon, final Concept concept, final Sentence projectedGoal, final Task task) {
if(precon.bestop != null && precon.bestop_truthexp > nal.narParameters.DECISION_THRESHOLD /*&& Math.random() < bestop_truthexp */) {
final Sentence createdSentence = new Sentence(
precon.bestop,
Symbols.GOAL_MARK,
precon.bestop_truth,
projectedGoal.stamp);
final Task t = new Task(createdSentence,
new BudgetValue(1.0f,1.0f,1.0f, nal.narParameters),
Task.EnumType.DERIVED);
//System.out.println("used " +t.getTerm().toString() + String.valueOf(nal.memory.randomNumber.nextInt()));
if(!task.sentence.stamp.evidenceIsCyclic()) {
if(!executeOperation(nal, t)) { //this task is just used as dummy
concept.memory.emit(Events.UnexecutableGoal.class, task, concept, nal);
return false;
}
return true;
}
}
return false;
}
/**
* Entry point for all potentially executable operation tasks.
* Returns true if the Task has a Term which can be executed
*
* @param nal The derivation concept
* @param t The operation goal task
*/
public static boolean executeOperation(final DerivationContext nal, final Task t) {
final Term content = t.getTerm();
if(!(nal.memory.allowExecution) || !(content instanceof Operation)) {
return false;
}
final Operation op=(Operation)content;
final Operator oper = op.getOperator();
final Product prod = (Product) op.getSubject();
final Term arg = prod.term[0];
if(oper instanceof FunctionOperator) {
for(int i=0;i<prod.term.length-1;i++) { //except last one, the output arg
if(prod.term[i].hasVarDep() || prod.term[i].hasVarIndep()) {
return false;
}
}
} else {
if(content.hasVarDep() || content.hasVarIndep()) {
return false;
}
}
if(!arg.equals(Term.SELF)) { //will be deprecated in the future
return false;
}
op.setTask(t);
if(!oper.call(op, nal.memory, nal.time)) {
return false;
}
if (Debug.DETAILED) {
System.out.println(t.toStringLong());
}
return true;
}
}
| mit |
tfunato/vicuna | src/main/java/jp/canetrash/vicuna/logic/ReadMailLogic.java | 4477 | package jp.canetrash.vicuna.logic;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import jp.canetrash.vicuna.dao.DamagePortalDao;
import jp.canetrash.vicuna.dao.DamageReportMailDaoImpl;
import jp.canetrash.vicuna.dao.PortalDao;
import jp.canetrash.vicuna.entity.DamagePortalEntity;
import jp.canetrash.vicuna.entity.DamageReportMailEntity;
import jp.canetrash.vicuna.entity.PortalEntity;
import jp.canetrash.vicuna.parser.DamageReportMail;
import jp.canetrash.vicuna.parser.MailParser;
import jp.canetrash.vicuna.parser.Portal;
import jp.canetrash.vicuna.web.websocket.ProcessStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import com.google.api.client.repackaged.org.apache.commons.codec.binary.Base64;
import com.google.api.services.gmail.Gmail.Users.Messages;
import com.google.api.services.gmail.model.Message;
import com.google.api.services.gmail.model.ModifyMessageRequest;
@Component
public class ReadMailLogic {
protected Log logger = LogFactory.getLog(ReadMailLogic.class);
@Autowired
private DamageReportMailDaoImpl damageReportMailDao;
@Autowired
private DamagePortalDao damagePortalDao;
@Autowired
private PortalDao portalDao;
@Autowired
private MailParser jsoupMailParser;
@Async
public Future<String> parallelReadMailWithAsync(CountDownLatch latch,
Messages messages, List<String> msgIdList, ProcessStatus status)
throws IOException, MessagingException {
logger.info("processing...[" + msgIdList.size() + "]");
int cnt = 0;
List<String> removeLabels = Arrays.asList(new String[] { "UNREAD" });
try {
for (String msgId : msgIdList) {
cnt++;
if (!isStored(msgId)) {
Message msg = messages.get(OAuthLogic.USER, msgId)
.setFormat("raw").execute();
byte[] emailBytes = Base64.decodeBase64(msg.getRaw());
MimeMessage email = new MimeMessage(null,
new ByteArrayInputStream(emailBytes));
// store database
storeDamageMail(msgId, jsoupMailParser.parse(email));
}
// marks as 'read' at this mail
messages.modify(
OAuthLogic.USER,
msgId,
new ModifyMessageRequest()
.setRemoveLabelIds(removeLabels)).execute();
status.incrementCounter();
if (cnt % 200 == 0) {
logger.info(cnt + " done.");
}
}
logger.info("processing done.");
return new AsyncResult<String>(Thread.currentThread().getName()
+ ":" + msgIdList.size());
} finally {
latch.countDown();
}
}
private synchronized boolean isStored(String msgId) {
// exist check
return this.damageReportMailDao.exists(msgId);
}
/**
* store mail
*
* @param mail
*/
private synchronized void storeDamageMail(String msgId,
DamageReportMail mail) {
Assert.notNull(msgId);
Assert.notNull(mail);
DamageReportMailEntity mailEntity = new DamageReportMailEntity();
mailEntity.setGmailId(msgId);
mailEntity.setMessageId(mail.getMessageId());
mailEntity.setAttackDate(mail.getDate());
mailEntity.setOppositeAgentName(mail.getOppositeAgentName());
mailEntity.setCreateDate(new Date());
this.damageReportMailDao.save(mailEntity);
int seq = 0;
for (Portal portal : mail.getPortals()) {
Float lat = Float.parseFloat(portal.getLatitude());
Float lng = Float.parseFloat(portal.getLongitude());
PortalEntity portalEntity = this.portalDao.findByLatLng(lat, lng);
if (portalEntity == null) {
portalEntity = new PortalEntity();
portalEntity.setPortalName(portal.getPortalName());
portalEntity.setPortalIntelUrl(portal.getPortalIntelUrl());
portalEntity.setLongitude(lng);
portalEntity.setLatitude(lat);
portalEntity = this.portalDao.save(portalEntity);
}
DamagePortalEntity damagePortalEntity = new DamagePortalEntity();
damagePortalEntity.setMessageId(mail.getMessageId());
damagePortalEntity.setSeq(seq++);
damagePortalEntity.setPortalId(portalEntity.getId());
this.damagePortalDao.save(damagePortalEntity);
}
}
}
| mit |