blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
1336d97c9bd9de34fa81e42e5bfdf2a44ba8d7db
Java
pinkproblem/RadarBeacon
/app/src/main/java/edu/kit/teco/radarbeacon/compass/CompassManager.java
UTF-8
2,804
2.59375
3
[]
no_license
package edu.kit.teco.radarbeacon.compass; import android.app.Activity; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import java.util.ArrayList; /** * Created by Iris on 17.08.2015. */ public class CompassManager implements SensorEventListener { private Context context; // private float rotation; private SensorManager sensorManager; private Sensor accelerometer; private Sensor magnetometer; //raw sensor value buffers private float[] gravity; private float[] magnetic; //listeners for rotation change events private ArrayList<RotationChangeListener> listeners; public CompassManager(Context context) { this.context = context; sensorManager = (SensorManager) context.getSystemService(Activity.SENSOR_SERVICE); accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); magnetometer = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); listeners = new ArrayList<>(); } public void start() { sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(this, magnetometer, SensorManager.SENSOR_DELAY_NORMAL); } public void stop() { sensorManager.unregisterListener(this); } @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) gravity = event.values; if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) magnetic = event.values; //calculate orientation from both sensors if (gravity != null && magnetic != null) { float R[] = new float[9]; float I[] = new float[9]; boolean success = SensorManager.getRotationMatrix(R, I, gravity, magnetic); if (success) { float orientation[] = new float[3]; SensorManager.getOrientation(R, orientation); //extract azimuth float newAzimuth = orientation[0]; notifyListeners(newAzimuth); } } } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { //nothing needed here } public void registerRotationListener(RotationChangeListener listener) { listeners.add(listener); } public void unregisterRotationListener(RotationChangeListener listener) { listeners.remove(listener); } private void notifyListeners(float newAzimuth) { for (RotationChangeListener lst : listeners) { lst.onAzimuthChange(newAzimuth); } } }
true
e7fd4438d96fa1590f20996c0ca41a1395849213
Java
425868130/HelloSpring
/src/main/java/hellospring/model/User.java
UTF-8
2,037
2.171875
2
[]
no_license
package hellospring.model; import java.sql.Timestamp; import org.springframework.stereotype.Component; /** * 用户实体 * @author Dream Sky * */ @Component public class User { private long UersID; private String UCount; private String UNickName; private boolean USex; private String UPswd; private String UImg; private String UEmail; private String USign; private int ULevel; private int UType; private boolean UIsOnline; private Timestamp URegTime; private Timestamp ULoginTime; public User() { super(); } public long getUersID() { return UersID; } public void setUersID(long uersID) { UersID = uersID; } public String getUCount() { return UCount; } public void setUCount(String uCount) { UCount = uCount; } public String getUNickName() { return UNickName; } public void setUNickName(String uNickName) { UNickName = uNickName; } public boolean getUSex() { return USex; } public void setUSex(boolean uSex) { USex = uSex; } public String getUPswd() { return UPswd; } public void setUPswd(String uPswd) { UPswd = uPswd; } public String getUImg() { return UImg; } public void setUImg(String uImg) { UImg = uImg; } public String getUEmail() { return UEmail; } public void setUEmail(String uEmail) { UEmail = uEmail; } public String getUSign() { return USign; } public void setUSign(String uSign) { USign = uSign; } public int getULevel() { return ULevel; } public void setULevel(int uLevel) { ULevel = uLevel; } public int getUType() { return UType; } public void setUType(int uType) { UType = uType; } public boolean isUIsOnline() { return UIsOnline; } public void setUIsOnline(boolean uIsOnline) { UIsOnline = uIsOnline; } public Timestamp getURegTime() { return URegTime; } public void setURegTime(Timestamp timestamp) { URegTime = timestamp; } public Timestamp getULoginTime() { return ULoginTime; } public void setULoginTime(Timestamp uLoginTime) { ULoginTime = uLoginTime; } }
true
e538719cb2615e2e600c21943d005b3bb2955b86
Java
iurinh/my-project-iuri
/Projeto_Joilson_LabBD_SalonSoft/src/control/ControllerAgendamento.java
ISO-8859-1
6,443
2.328125
2
[]
no_license
package control; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dao.AbstractDAO; import dao.AgendamentoDAO; import entity.Agendamento; import entity.Cliente; import entity.Funcionario; import entity.Servico; @WebServlet("/ControllerAgendamento") public class ControllerAgendamento extends HttpServlet{ private static final long serialVersionUID = 1L; private String cmd; private Agendamento agendamento; private RequestDispatcher rd; private AbstractDAO<Agendamento> daoAgendamento; private String idClienteSelecionado; private String idFuncionarioSelecionado; private String idServicoSelecionado; private String idAgendamentoSelecionado; private ControllerCliente ctrlCliente; private ControllerFuncionario ctrlFuncionario; private ControllerServico ctrlServico; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("Reiniciando Controller Agendamento"); cmd = req.getParameter("cmd"); idAgendamentoSelecionado = req.getParameter("idAgendamento"); idClienteSelecionado = req.getParameter("idCliente"); idFuncionarioSelecionado = req.getParameter("idFuncionario"); idServicoSelecionado = req.getParameter("idServico"); try{ if("0".equalsIgnoreCase(idClienteSelecionado) || "0".equalsIgnoreCase(idFuncionarioSelecionado) || "0".equalsIgnoreCase(idServicoSelecionado)){ req.setAttribute("MSG", "Por favor, selecione todas as opcoes."); rd = req.getRequestDispatcher("./alterar_excluir_agendamento.jsp"); rd.include(req, resp); } else if("LimparFormulario".equalsIgnoreCase(cmd)){ rd = req.getRequestDispatcher("./novo_agendamento.jsp"); rd.include(req, resp); } else if("Adicionar".equalsIgnoreCase(cmd)){ agendamento = new Agendamento(); agendamento.setData(new SimpleDateFormat("dd/MM/yyyy").parse(req.getParameter("txtData"))); agendamento.setHorario(req.getParameter("txtHorario")); agendamento.setCliente(new ControllerCliente().searchById(idClienteSelecionado)); agendamento.setFuncionario(new ControllerFuncionario().searchById(idFuncionarioSelecionado)); agendamento.setServico(new ControllerServico().searchById(idServicoSelecionado)); daoAgendamento = new AgendamentoDAO(); daoAgendamento.insert(agendamento); req.setAttribute("MSG", "O agendamento foi inserido com sucesso"); rd = req.getRequestDispatcher("./novo_agendamento.jsp"); rd.include(req, resp); } else if("Pesquisar".endsWith(cmd)){ Agendamento agendamentoSearch = searchById(idAgendamentoSelecionado); if(agendamentoSearch == null){ req.setAttribute("MSG", "Engracado, mas esse agendamento no possui mais dados no nosso banco..."); System.out.println("Busca por agendamento retornou nulo"); } else{ agendamento = agendamentoSearch; req.setAttribute("Agendamento", agendamento); } rd = req.getRequestDispatcher("./alterar_excluir_agendamento.jsp"); rd.include(req, resp); } else if("Alterar".equalsIgnoreCase(cmd)){ agendamento = new Agendamento(); System.out.println(idAgendamentoSelecionado); agendamento.setNumAgendamento(Integer.parseInt(idAgendamentoSelecionado)); agendamento.setData(new SimpleDateFormat("dd/MM/yyyy").parse(req.getParameter("txtData"))); agendamento.setHorario(req.getParameter("txtHorario")); agendamento.setCliente(new ControllerCliente().searchById(idClienteSelecionado)); agendamento.setFuncionario(new ControllerFuncionario().searchById(idFuncionarioSelecionado)); agendamento.setServico(new ControllerServico().searchById(idServicoSelecionado)); daoAgendamento = new AgendamentoDAO(); daoAgendamento.update(agendamento);; req.setAttribute("MSG", "Agendamento alterado com sucesso!"); rd = req.getRequestDispatcher("./alterar_excluir_agendamento.jsp"); rd.include(req, resp); } else if("Excluir".equalsIgnoreCase(cmd)){ agendamento = new Agendamento(); agendamento.setNumAgendamento(Integer.parseInt(idAgendamentoSelecionado)); agendamento.setData(new SimpleDateFormat("dd/MM/yyyy").parse(req.getParameter("txtData"))); agendamento.setHorario(req.getParameter("txtHorario")); agendamento.setCliente(new ControllerCliente().searchById(idClienteSelecionado)); agendamento.setFuncionario(new ControllerFuncionario().searchById(idFuncionarioSelecionado)); agendamento.setServico(new ControllerServico().searchById(idServicoSelecionado)); daoAgendamento = new AgendamentoDAO(); daoAgendamento.delete(agendamento);; req.setAttribute("MSG", "Agendamento excluido com sucesso!"); rd = req.getRequestDispatcher("./alterar_excluir_agendamento.jsp"); rd.include(req, resp); } } catch (ParseException e) { e.printStackTrace(); } } public Agendamento getAgendamentoVazio(){ agendamento = new Agendamento(); return agendamento; } public List<Agendamento> getListaAgendamentos(){ daoAgendamento = new AgendamentoDAO(); return daoAgendamento.selectAll(); } public List<Cliente> getListaClientes(){ ctrlCliente = new ControllerCliente(); return ctrlCliente.getListaClientes(); } public List<Funcionario> getListaFuncionarios(){ ctrlFuncionario = new ControllerFuncionario(); return ctrlFuncionario.getListaFuncionarios(); } public List<Servico> getListaServicos(){ ctrlServico = new ControllerServico(); return ctrlServico.getListaServicos(); } public Agendamento searchById(String value) { daoAgendamento = new AgendamentoDAO(); List<Agendamento> lsAgendamentos = daoAgendamento.selectAll(); for(int i = 0; i < lsAgendamentos.size(); i++){ if(lsAgendamentos.get(i).getNumAgendamento() == Integer.parseInt(value)){ System.out.println("Encontrado" + i + " value " + value); return lsAgendamentos.get(i); } } System.out.println("Nao encontrou ninguem com o searchById()"); return null; } }
true
88fa227b72cfa3ed2a9e190a9107c3ba028d7c5b
Java
AmanaAdvisors/ta4j
/ta4j-core/src/test/java/org/ta4j/core/analysis/criteria/OpenedTradeUtils.java
UTF-8
832
2.46875
2
[ "MIT" ]
permissive
package org.ta4j.core.analysis.criteria; import org.ta4j.core.AnalysisCriterion; import org.ta4j.core.Order; import org.ta4j.core.Trade; import org.ta4j.core.mocks.MockTimeSeries; import org.ta4j.core.num.Num; import java.util.function.Function; import static org.ta4j.core.TestUtils.assertNumEquals; public class OpenedTradeUtils { public void testCalculateOneOpenTradeShouldReturnExpectedValue(Function<Number, Num> numFunction, AnalysisCriterion criterion, int expectedValue) { MockTimeSeries series = new MockTimeSeries(numFunction, 100, 105, 110, 100, 95, 105); Trade trade = new Trade(Order.OrderType.BUY); trade.operate(0, series.numOf(2.5), series.numOf(1)); final Num value = criterion.calculate(series, trade); assertNumEquals(expectedValue, value); } }
true
e7cc876bb1d9eec84e16a0833dec831ff6dbcc7d
Java
jiyonguk/Java
/java_project/FirstJAVA/src/chapter1/ex4.java
UTF-8
260
2.765625
3
[]
no_license
package chapter1; public class ex4 { public static void main(String[] args) { byte b = 0; int i = 0; for(int x=0;x<270;x++) { System.out.print(b++); System.out.print("\t"); //System.out.println(); System.out.println(i++); } } }
true
ca37c4929ebfc12a1479b71aea4466f5535c8655
Java
SetsunaChyan/JavaWeb-QASystem
/src/manager/showQuestion.java
UTF-8
1,150
2.1875
2
[]
no_license
package manager; import dao.QuestionDaoImpl; import dao.ReplyDaoImpl; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name="showQuestion", urlPatterns={"/index/showQuestion"}) public class showQuestion extends HttpServlet { private static QuestionDaoImpl QDao=new QuestionDaoImpl(); private static ReplyDaoImpl ReplyDao=new ReplyDaoImpl(); protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { int qid=Integer.parseInt(request.getParameter("qid")); request.setAttribute("question",QDao.findById(qid)); request.setAttribute("replies",ReplyDao.findByQuestion(qid)); request.getRequestDispatcher("/index/showReply.jsp?qid="+qid).forward(request,response); } protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } }
true
7c23ec98e20d12389de118cdb0d1917688142a07
Java
thomas-wroblewski/awroby-homeauto
/src/main/java/com/awroby/auto/dao/OutletRepository.java
UTF-8
311
2.03125
2
[]
no_license
package com.awroby.auto.dao; import java.util.List; import org.springframework.data.mongodb.repository.MongoRepository; import com.awroby.auto.objects.Outlet; public interface OutletRepository extends MongoRepository<Outlet, String>{ public List<Outlet> findAll(); public Outlet findById(String id); }
true
605025edfdbd85bed6039acb45841fcda41b7351
Java
parsaalian/ap-project
/Game/src/network/public_chat/Status.java
UTF-8
1,544
2.703125
3
[]
no_license
package network.public_chat; import java.io.Serializable; public class Status implements Serializable { private String name; private double health; private double maxHealth; private double energy; private double maxEnergy; private double stamina; private double maxStamina; private double satiety; private double maxSatiety; private int money; public Status(String name, double health, double maxHealth, double energy, double maxEnergy, double stamina, double maxStamina, double satiety, double maxSatiety, int money) { this.name = name; this.health = health; this.maxHealth = maxHealth; this.energy = energy; this.maxEnergy = maxEnergy; this.stamina = stamina; this.maxStamina = maxStamina; this.satiety = satiety; this.maxSatiety = maxSatiety; this.money = money; } public String getName() { return name; } public double getHealth() { return health; } public double getMaxHealth() { return maxHealth; } public double getEnergy() { return energy; } public double getMaxEnergy() { return maxEnergy; } public double getStamina() { return stamina; } public double getMaxStamina() { return maxStamina; } public double getSatiety() { return satiety; } public double getMaxSatiety() { return maxSatiety; } public int getMoney() { return money; } }
true
3043de568c3308b99adfebadaf6b8e90821ddfba
Java
maedere/Pool_reservation_3
/app/app/src/main/java/org/project/poolreservation/models/TimeOfDay.java
UTF-8
1,211
2.53125
3
[]
no_license
package org.project.poolreservation.models; public class TimeOfDay { private String time; private String gender; private int capacity; private int off; private String price; private String id; private boolean show=true; public TimeOfDay(String id,String price,String time, String gender, int capacity) { this.price=price; this.id=id; this.time = time; this.gender = gender; this.capacity = capacity; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public int getOff() { return off; } public String getPrice() { return price; } public void setOff(int off) { this.off = off; } public boolean isShow() { return show; } public void setShow(boolean show) { this.show = show; } }
true
d24724b4a2eee455871fe70ba6aef1be7de1ff67
Java
stormbreaker11/scst
/src/main/java/com/nic/in/model/Mandal.java
UTF-8
324
1.953125
2
[]
no_license
package com.nic.in.model; public class Mandal { private String mname; private String mcode; public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getMcode() { return mcode; } public void setMcode(String mcode) { this.mcode = mcode; } }
true
f594f22bb38457ab76184fff08578d45504848d5
Java
onap/aai-aai-common
/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/DuplicateNodeDefinitionValidationModule.java
UTF-8
1,827
2.109375
2
[ "Apache-2.0" ]
permissive
/** * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017-18 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= */ package org.onap.aai.validation.nodes; import java.util.List; import org.onap.aai.setup.SchemaVersion; /** * Defines rules for duplicate node definitions in a set of files * (where the intent is the set of files is all the OXM for one version). * * Example Options: * -Any duplicated definition found is an error * -Duplicates within a namespace are OK but not across namespaces * -Anything goes * etc. */ public interface DuplicateNodeDefinitionValidationModule { /** * Finds any duplicates according to the defined rules * * @param files - the OXM files to use with full directory * @return empty String if none found, else a String * with appropriate information about what node types * were found */ String findDuplicates(List<String> files, SchemaVersion v); }
true
65b6d31f530e3af7f38f3d8584358372f0f19001
Java
mameports/arcadeflex-037b8
/convertor/java_code/drivers/toaplan2.java
UTF-8
146,052
2.28125
2
[]
no_license
/***************************************************************************** ToaPlan game hardware from 1991-1994 ------------------------------------ Driver by: Quench and Yochizo Supported games: Name Board No Maker Game name ---------------------------------------------------------------------------- tekipaki TP-020 Toaplan Teki Paki ghox TP-021 Toaplan Ghox dogyuun TP-022 Toaplan Dogyuun kbash TP-023 Toaplan Knuckle Bash tatsujn2 TP-024 Toaplan Truxton 2 / Tatsujin 2 pipibibs TP-025 Toaplan Pipi & Bibis whoopee TP-025 Toaplan Whoopee pipibibi bootleg? Toaplan Pipi & Bibis fixeight TP-026 Toaplan FixEight grindstm TP-027 Toaplan Grind Stormer (1992) vfive TP-027 Toaplan V-V (V-Five) (1993 - Japan only) batsugun TP-030 Toaplan Batsugun batugnsp TP-030 Toaplan Batsugun (Special Version) snowbro2 ?????? Toaplan Snow Bros. 2 - With New Elves mahoudai ?????? Raizing Mahou Daisakusen shippu ?????? Raizing Shippu Mahou Daisakusen Not supported games yet: Name Board No Maker Game name ---------------------------------------------------------------------------- batrider ?????? Raizing Armed Police Batrider btlgaleg ?????? Raizing Battle Galegga Game status: Teki Paki Working, but no sound. Missing sound MCU dump Ghox Working, but no sound. Missing sound MCU dump Dogyuun Working, but no sound. MCU type unknown - its a Z?80 of some sort. Knuckle Bash Working, but no sound. MCU dump exists, its a Z?80 of some sort. Tatsujin 2 Working. Pipi & Bibis Working. Whoopee Working. Missing sound MCU dump. Using bootleg sound CPU dump for now Pipi & Bibis Ryouta Kikaku - Working. FixEight Not working. MCU type unknown - its a Z?80 of some sort. Grind Stormer Working, but no sound. MCU type unknown - its a Z?80 of some sort. VFive Working, but no sound. MCU type unknown - its a Z?80 of some sort. Batsugun Working, but no sound and wrong GFX priorities. MCU type unknown - its a Z?80 of some sort. Batsugun Sp' Working, but no sound and wrong GFX priorities. MCU type unknown - its a Z?80 of some sort. Snow Bros. 2 Working. Mahou Daisaks Working. Shippu Mahou Working. Notes: See Input Port definition header below, for instructions on how to enter pause/slow motion modes. To Do / Unknowns: - Whoopee/Teki Paki sometimes tests bit 5 of the territory port just after testing for vblank. Why ? - Whoppee is currently using the sound CPU ROM (Z80) from a differnt (pirate ?) version of Pipi and Bibis (Ryouta Kikaku copyright). It really has a HD647180 CPU, and its internal ROM needs to be dumped. - Code at $20A26 forces territory to Japan in V-Five. Some stuff NOP'd at reset vector, and Z?80 CPU post test is skipped (bootleg ?) - Fixed top-character-layer. - Added unsupported games which work in this driver. *****************************************************************************/ /* * ported to v0.37b8 * using automatic conversion tool v0.01 */ package drivers; public class toaplan2 { /**************** Machine stuff ******************/ #define HD64x180 0 /* Define if CPU support is available */ #define Zx80 0 #define CPU_2_NONE 0x00 #define CPU_2_Z80 0x5a #define CPU_2_HD647180 0xa5 #define CPU_2_Zx80 0xff static UBytePtr toaplan2_shared_ram; static UBytePtr raizing_shared_ram; /* Added by Yochizo */ static UBytePtr Zx80_shared_ram; static int mcu_data = 0; int toaplan2_sub_cpu = 0; static INT8 old_p1_paddle_h; static INT8 old_p1_paddle_v; static INT8 old_p2_paddle_h; static INT8 old_p2_paddle_v; /********* Video wrappers for PIPIBIBI *********/ /**************** Video stuff ******************/ /* Added by Yochizo 2000/08/19 */ /* --------------------------- */ /* Added by Yochizo 2000/08/19 */ extern UBytePtr textvideoram; /* Video ram for extra-text layer */ /* --------------------------- */ static int video_status = 0; static public static InitDriverPtr init_toaplan2 = new InitDriverPtr() { public void handler() { old_p1_paddle_h = 0; old_p1_paddle_v = 0; old_p2_paddle_h = 0; old_p2_paddle_v = 0; toaplan2_sub_cpu = CPU_2_HD647180; mcu_data = 0; } }; static public static InitDriverPtr init_toaplan3 = new InitDriverPtr() { public void handler() { toaplan2_sub_cpu = CPU_2_Zx80; mcu_data = 0; } }; static public static InitDriverPtr init_pipibibs = new InitDriverPtr() { public void handler() { toaplan2_sub_cpu = CPU_2_Z80; } }; static public static InitDriverPtr init_pipibibi = new InitDriverPtr() { public void handler() { int A; int oldword, newword; UBytePtr pipibibi_68k_rom = memory_region(REGION_CPU1); toaplan2_sub_cpu = CPU_2_Z80; /* unscramble the 68K ROM data. */ for (A = 0; A < 0x040000; A+=8) { newword = 0; oldword = READ_WORD (&pipibibi_68k_rom[A]); newword |= ((oldword & 0x0001) << 9); newword |= ((oldword & 0x0002) << 14); newword |= ((oldword & 0x0004) << 8); newword |= ((oldword & 0x0018) << 1); newword |= ((oldword & 0x0020) << 9); newword |= ((oldword & 0x0040) << 7); newword |= ((oldword & 0x0080) << 5); newword |= ((oldword & 0x0100) << 3); newword |= ((oldword & 0x0200) >> 1); newword |= ((oldword & 0x0400) >> 8); newword |= ((oldword & 0x0800) >> 10); newword |= ((oldword & 0x1000) >> 12); newword |= ((oldword & 0x6000) >> 7); newword |= ((oldword & 0x8000) >> 12); WRITE_WORD (&pipibibi_68k_rom[A],newword); newword = 0; oldword = READ_WORD (&pipibibi_68k_rom[A+2]); newword |= ((oldword & 0x0001) << 8); newword |= ((oldword & 0x0002) << 12); newword |= ((oldword & 0x0004) << 5); newword |= ((oldword & 0x0008) << 11); newword |= ((oldword & 0x0010) << 2); newword |= ((oldword & 0x0020) << 10); newword |= ((oldword & 0x0040) >> 1); newword |= ((oldword & 0x0080) >> 7); newword |= ((oldword & 0x0100) >> 4); newword |= ((oldword & 0x0200) << 0); newword |= ((oldword & 0x0400) >> 7); newword |= ((oldword & 0x0800) >> 1); newword |= ((oldword & 0x1000) >> 10); newword |= ((oldword & 0x2000) >> 2); newword |= ((oldword & 0x4000) >> 13); newword |= ((oldword & 0x8000) >> 3); WRITE_WORD (&pipibibi_68k_rom[A+2],newword); newword = 0; oldword = READ_WORD (&pipibibi_68k_rom[A+4]); newword |= ((oldword & 0x000f) << 4); newword |= ((oldword & 0x00f0) >> 4); newword |= ((oldword & 0x0100) << 3); newword |= ((oldword & 0x0200) << 1); newword |= ((oldword & 0x0400) >> 1); newword |= ((oldword & 0x0800) >> 3); newword |= ((oldword & 0x1000) << 3); newword |= ((oldword & 0x2000) << 1); newword |= ((oldword & 0x4000) >> 1); newword |= ((oldword & 0x8000) >> 3); WRITE_WORD (&pipibibi_68k_rom[A+4],newword); newword = 0; oldword = READ_WORD (&pipibibi_68k_rom[A+6]); newword |= ((oldword & 0x000f) << 4); newword |= ((oldword & 0x00f0) >> 4); newword |= ((oldword & 0x0100) << 7); newword |= ((oldword & 0x0200) << 5); newword |= ((oldword & 0x0400) << 3); newword |= ((oldword & 0x0800) << 1); newword |= ((oldword & 0x1000) >> 1); newword |= ((oldword & 0x2000) >> 3); newword |= ((oldword & 0x4000) >> 5); newword |= ((oldword & 0x8000) >> 7); WRITE_WORD (&pipibibi_68k_rom[A+6],newword); } } }; /* Added by Yochizo 2000/08/16 */ static public static InitDriverPtr init_tatsujn2 = new InitDriverPtr() { public void handler() { UBytePtr RAM = memory_region(REGION_CPU1); /* Fix checksum from the source of Raine. */ WRITE_WORD(&RAM[0x2EC10],0x4E71); // NOP /* Fix 60000 from the source of Raine. */ WRITE_WORD(&RAM[0x1F6E8],0x4E75); // RTS WRITE_WORD(&RAM[0x009FE],0x4E71); // NOP WRITE_WORD(&RAM[0x01276],0x4E71); // NOP WRITE_WORD(&RAM[0x012BA],0x4E71); // NOP WRITE_WORD(&RAM[0x03150],0x4E71); // NOP WRITE_WORD(&RAM[0x031B4],0x4E71); // NOP WRITE_WORD(&RAM[0x0F20C],0x4E71); // NOP WRITE_WORD(&RAM[0x1EBFA],0x4E71); // NOP WRITE_WORD(&RAM[0x1EC7A],0x4E71); // NOP WRITE_WORD(&RAM[0x1ECE8],0x4E71); // NOP WRITE_WORD(&RAM[0x1ED00],0x4E71); // NOP WRITE_WORD(&RAM[0x1ED5E],0x4E71); // NOP WRITE_WORD(&RAM[0x1ED9A],0x4E71); // NOP WRITE_WORD(&RAM[0x1EDB2],0x4E71); // NOP WRITE_WORD(&RAM[0x1EEA2],0x4E71); // NOP WRITE_WORD(&RAM[0x1EEBA],0x4E71); // NOP WRITE_WORD(&RAM[0x1EEE6],0x4E71); // NOP WRITE_WORD(&RAM[0x1EF72],0x4E71); // NOP WRITE_WORD(&RAM[0x1EFD0],0x4E71); // NOP WRITE_WORD(&RAM[0x1F028],0x4E71); // NOP WRITE_WORD(&RAM[0x1F05E],0x4E71); // NOP WRITE_WORD(&RAM[0x1F670],0x4E71); // NOP WRITE_WORD(&RAM[0x1F6C0],0x4E71); // NOP WRITE_WORD(&RAM[0x1FA08],0x4E71); // NOP WRITE_WORD(&RAM[0x1FAA4],0x4E71); // NOP WRITE_WORD(&RAM[0x1FADA],0x4E71); // NOP WRITE_WORD(&RAM[0x1FBA2],0x4E71); // NOP WRITE_WORD(&RAM[0x1FBDC],0x4E71); // NOP WRITE_WORD(&RAM[0x1FC1C],0x4E71); // NOP WRITE_WORD(&RAM[0x1FC8A],0x4E71); // NOP WRITE_WORD(&RAM[0x1FD24],0x4E71); // NOP WRITE_WORD(&RAM[0x1FD7A],0x4E71); // NOP WRITE_WORD(&RAM[0x2775A],0x4E71); // NOP WRITE_WORD(&RAM[0x277D8],0x4E71); // NOP WRITE_WORD(&RAM[0x2788C],0x4E71); // NOP WRITE_WORD(&RAM[0x278BA],0x4E71); // NOP WRITE_WORD(&RAM[0x2EC54],0x4E71); // NOP WRITE_WORD(&RAM[0x2EC90],0x4E71); // NOP WRITE_WORD(&RAM[0x2ECAC],0x4E71); // NOP WRITE_WORD(&RAM[0x2ECCA],0x4E71); // NOP WRITE_WORD(&RAM[0x2ECE6],0x4E71); // NOP WRITE_WORD(&RAM[0x2ED1E],0x4E71); // NOP WRITE_WORD(&RAM[0x2EC26],0x4E71); // NOP } }; static public static InitDriverPtr init_snowbro2 = new InitDriverPtr() { public void handler() { toaplan2_sub_cpu = CPU_2_NONE; } }; /* Added by Yochizo 2000/08/16 */ public static InterruptPtr tatsujn2_interrupt = new InterruptPtr() { public int handler() { return MC68000_IRQ_2; /* Tatsujin2 uses IRQ level 2 */ } }; public static InterruptPtr toaplan2_interrupt = new InterruptPtr() { public int handler() { return MC68000_IRQ_4; } }; public static WriteHandlerPtr toaplan2_coin_w = new WriteHandlerPtr() {public void handler(int offset, int data) { data &= 0xffff; switch (data & 0x0f) { case 0x00: coin_lockout_global_w(1); break; /* Lock all coin slots */ case 0x0c: coin_lockout_global_w(0); break; /* Unlock all coin slots */ case 0x0d: coin_counter_w.handler(0,1); coin_counter_w.handler(0,0); /* Count slot A */ logerror("Count coin slot A\n"); break; case 0x0e: coin_counter_w.handler(1,1); coin_counter_w.handler(1,0); /* Count slot B */ logerror("Count coin slot B\n"); break; /* The following are coin counts after coin-lock active (faulty coin-lock ?) */ case 0x01: coin_counter_w.handler(0,1); coin_counter_w.handler(0,0); coin_lockout_w.handler(0,1); break; case 0x02: coin_counter_w.handler(1,1); coin_counter_w.handler(1,0); coin_lockout_global_w(1); break; default: logerror("Writing unknown command (%04x) to coin control\n",data); break; } if (data > 0xf) { logerror("Writing unknown upper bits command (%04x) to coin control\n",data); } } }; public static WriteHandlerPtr oki_bankswitch_w = new WriteHandlerPtr() {public void handler(int offset, int data) { OKIM6295_set_bank_base(0, (data & 1) * 0x40000); } }; public static ReadHandlerPtr toaplan2_shared_r = new ReadHandlerPtr() { public int handler(int offset) { return toaplan2_shared_ram[offset>>1]; } }; public static WriteHandlerPtr toaplan2_shared_w = new WriteHandlerPtr() {public void handler(int offset, int data) { toaplan2_shared_ram[offset>>1] = data; } }; public static WriteHandlerPtr toaplan2_hd647180_cpu_w = new WriteHandlerPtr() {public void handler(int offset, int data) { /* Command sent to secondary CPU. Support for HD647180 will be required when a ROM dump becomes available for this hardware */ if (toaplan2_sub_cpu == CPU_2_Z80) /* Whoopee */ { toaplan2_shared_ram[0] = data; } else /* Teki Paki */ { mcu_data = data; logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n",cpu_getpreviouspc(),mcu_data); } } }; public static ReadHandlerPtr c2map_port_6_r = new ReadHandlerPtr() { public int handler(int offset) { /* bit 4 high signifies secondary CPU is ready */ /* bit 5 is tested low before V-Blank bit ??? */ switch (toaplan2_sub_cpu) { case CPU_2_Z80: mcu_data = toaplan2_shared_ram[0]; break; case CPU_2_HD647180: mcu_data = 0xff; break; default: mcu_data = 0x00; break; } if (mcu_data == 0xff) mcu_data = 0x10; else mcu_data = 0x00; return ( mcu_data | input_port_6_r.handler(0) ); } }; public static ReadHandlerPtr pipibibi_z80_status_r = new ReadHandlerPtr() { public int handler(int offset) { return toaplan2_shared_ram[0]; } }; public static WriteHandlerPtr pipibibi_z80_task_w = new WriteHandlerPtr() {public void handler(int offset, int data) { toaplan2_shared_ram[0] = data; } }; public static ReadHandlerPtr video_count_r = new ReadHandlerPtr() { public int handler(int offset) { /* Maybe this should return which scan line number is being drawn */ /* Raizing games wait until its between F0h (240) and FFh (255) ??? */ /* Video busy while bit 8 is low. Maybe once it clocks */ /* over to 100h (256) or higher, it means frame done ??? */ video_status += 0x50; /* use a value to help prevent tight loop hangs */ video_status &= 0x1f0; if ((video_status & 0xf0) == 0x40) video_status += 0x10; return video_status; } }; public static ReadHandlerPtr ghox_p1_h_analog_r = new ReadHandlerPtr() { public int handler(int offset) { INT8 value, new_value; new_value = input_port_7_r.handler(0); if (new_value == old_p1_paddle_h) return 0; value = new_value - old_p1_paddle_h; old_p1_paddle_h = new_value; return value; } }; public static ReadHandlerPtr ghox_p1_v_analog_r = new ReadHandlerPtr() { public int handler(int offset) { INT8 new_value; new_value = input_port_9_r.handler(0); /* fake vertical movement */ if (new_value == old_p1_paddle_v) return input_port_1_r.handler(0); if (new_value > old_p1_paddle_v) { old_p1_paddle_v = new_value; return (input_port_1_r.handler(0) | 2); } old_p1_paddle_v = new_value; return (input_port_1_r.handler(0) | 1); } }; public static ReadHandlerPtr ghox_p2_h_analog_r = new ReadHandlerPtr() { public int handler(int offset) { INT8 value, new_value; new_value = input_port_8_r.handler(0); if (new_value == old_p2_paddle_h) return 0; value = new_value - old_p2_paddle_h; old_p2_paddle_h = new_value; return value; } }; public static ReadHandlerPtr ghox_p2_v_analog_r = new ReadHandlerPtr() { public int handler(int offset) { INT8 new_value; new_value = input_port_10_r.handler(0); /* fake vertical movement */ if (new_value == old_p2_paddle_v) return input_port_2_r.handler(0); if (new_value > old_p2_paddle_v) { old_p2_paddle_v = new_value; return (input_port_2_r.handler(0) | 2); } old_p2_paddle_v = new_value; return (input_port_2_r.handler(0) | 1); } }; public static ReadHandlerPtr ghox_mcu_r = new ReadHandlerPtr() { public int handler(int offset) { return 0xff; } }; public static WriteHandlerPtr ghox_mcu_w = new WriteHandlerPtr() {public void handler(int offset, int data) { data &= 0xffff; mcu_data = data; if ((data >= 0xd0) && (data < 0xe0)) { offset = ((data & 0x0f) * 4) + 0x38; WRITE_WORD (&toaplan2_shared_ram[offset ],0x05); /* Return address for */ WRITE_WORD (&toaplan2_shared_ram[offset-2],0x56); /* RTS instruction */ } else { logerror("PC:%08x Writing %08x to HD647180 cpu shared ram status port\n",cpu_getpreviouspc(),mcu_data); } WRITE_WORD (&toaplan2_shared_ram[0x56],0x4e); /* Return a RTS instruction */ WRITE_WORD (&toaplan2_shared_ram[0x58],0x75); if (data == 0xd3) { WRITE_WORD (&toaplan2_shared_ram[0x56],0x3a); // move.w d1,d5 WRITE_WORD (&toaplan2_shared_ram[0x58],0x01); WRITE_WORD (&toaplan2_shared_ram[0x5a],0x08); // bclr.b #0,d5 WRITE_WORD (&toaplan2_shared_ram[0x5c],0x85); WRITE_WORD (&toaplan2_shared_ram[0x5e],0x00); WRITE_WORD (&toaplan2_shared_ram[0x60],0x00); WRITE_WORD (&toaplan2_shared_ram[0x62],0xcb); // muls.w #3,d5 WRITE_WORD (&toaplan2_shared_ram[0x64],0xfc); WRITE_WORD (&toaplan2_shared_ram[0x66],0x00); WRITE_WORD (&toaplan2_shared_ram[0x68],0x03); WRITE_WORD (&toaplan2_shared_ram[0x6a],0x90); // sub.w d5,d0 WRITE_WORD (&toaplan2_shared_ram[0x6c],0x45); WRITE_WORD (&toaplan2_shared_ram[0x6e],0xe5); // lsl.b #2,d1 WRITE_WORD (&toaplan2_shared_ram[0x70],0x09); WRITE_WORD (&toaplan2_shared_ram[0x72],0x4e); // rts WRITE_WORD (&toaplan2_shared_ram[0x74],0x75); } } }; public static ReadHandlerPtr ghox_shared_ram_r = new ReadHandlerPtr() { public int handler(int offset) { /* Ghox 68K reads data from MCU shared RAM and writes it to main RAM. It then subroutine jumps to main RAM and executes this code. Here, i'm just returning a RTS instruction for now. See above ghox_mcu_w routine. Offset $56 and $58 is accessed around PC:F814 Offset $38 and $36 is accessed from around PC:DA7C Offset $3c and $3a is accessed from around PC:2E3C Offset $40 and $3E is accessed from around PC:103EE Offset $44 and $42 is accessed from around PC:FB52 Offset $48 and $46 is accessed from around PC:6776 */ int data = READ_WORD (&toaplan2_shared_ram[offset]); return data; } }; public static WriteHandlerPtr ghox_shared_ram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { WRITE_WORD (&toaplan2_shared_ram[offset],data); } }; public static ReadHandlerPtr kbash_sub_cpu_r = new ReadHandlerPtr() { public int handler(int offset) { /* Knuckle Bash's 68000 reads secondary CPU status via an I/O port. If a value of 2 is read, then secondary CPU is busy. Secondary CPU must report 0xff when no longer busy, to signify that it has passed POST. */ mcu_data=0xff; return mcu_data; } }; public static WriteHandlerPtr kbash_sub_cpu_w = new WriteHandlerPtr() {public void handler(int offset, int data) { logerror("PC:%08x writing %04x to Zx80 secondary CPU status port %02x\n",cpu_getpreviouspc(),mcu_data,offset/2); } }; public static ReadHandlerPtr shared_ram_r = new ReadHandlerPtr() { public int handler(int offset) { /* Other games using a Zx80 based secondary CPU, have shared memory between the 68000 and the Zx80 CPU. The 68000 reads the status of the Zx80 via a location of the shared memory. */ int data = READ_WORD (&toaplan2_shared_ram[offset]); return data; } }; public static WriteHandlerPtr shared_ram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { if (offset == 0x9e8) { WRITE_WORD (&toaplan2_shared_ram[offset + 2],data); } if (offset == 0xff8) { WRITE_WORD (&toaplan2_shared_ram[offset + 2],data); logerror("PC:%08x Writing (%04x) to secondary CPU\n",cpu_getpreviouspc(),data); if ((data & 0xffff) == 0x81) data = 0x01; } WRITE_WORD (&toaplan2_shared_ram[offset],data); } }; public static ReadHandlerPtr Zx80_status_port_r = new ReadHandlerPtr() { public int handler(int offset) { /*** Status port includes Zx80 CPU POST codes. ************ *** This is actually a part of the 68000/Zx80 Shared RAM */ int data; if (mcu_data == 0x800000aa) mcu_data = 0xff; /* dogyuun */ if (mcu_data == 0x00) mcu_data = 0x800000aa; /* dogyuun */ if (mcu_data == 0x8000ffaa) mcu_data = 0xffff; /* fixeight */ if (mcu_data == 0xffaa) mcu_data = 0x8000ffaa; /* fixeight */ if (mcu_data == 0xff00) mcu_data = 0xffaa; /* fixeight */ logerror("PC:%08x reading %08x from Zx80 secondary CPU command/status port\n",cpu_getpreviouspc(),mcu_data); data = mcu_data & 0x0000ffff; return data; } }; public static WriteHandlerPtr Zx80_command_port_w = new WriteHandlerPtr() {public void handler(int offset, int data) { mcu_data = data; logerror("PC:%08x Writing command (%04x) to Zx80 secondary CPU command/status port\n",cpu_getpreviouspc(),mcu_data); } }; public static ReadHandlerPtr Zx80_sharedram_r = new ReadHandlerPtr() { public int handler(int offset) { return Zx80_shared_ram[offset / 2]; } }; public static WriteHandlerPtr Zx80_sharedram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { Zx80_shared_ram[offset / 2] = data; } }; public static ReadHandlerPtr raizing_shared_ram_r = new ReadHandlerPtr() { public int handler(int offset) { offset >>= 1; offset &= 0x3fff; return raizing_shared_ram[offset]; } }; public static WriteHandlerPtr raizing_shared_ram_w = new WriteHandlerPtr() {public void handler(int offset, int data) { offset >>= 1; offset &= 0x3fff; raizing_shared_ram[offset] = data & 0xff; } }; public static Memory_ReadAddress tekipaki_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x01ffff, MRA_ROM ), new Memory_ReadAddress( 0x020000, 0x03ffff, MRA_ROM ), /* extra for Whoopee */ new Memory_ReadAddress( 0x080000, 0x082fff, MRA_BANK1 ), new Memory_ReadAddress( 0x0c0000, 0x0c0fff, paletteram_word_r ), new Memory_ReadAddress( 0x140004, 0x140007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x14000c, 0x14000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x180000, 0x180001, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x180010, 0x180011, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x180020, 0x180021, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x180030, 0x180031, c2map_port_6_r ), /* CPU 2 busy and Territory Jumper block */ new Memory_ReadAddress( 0x180050, 0x180051, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x180060, 0x180061, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress tekipaki_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x01ffff, MWA_ROM ), new Memory_WriteAddress( 0x020000, 0x03ffff, MWA_ROM ), /* extra for Whoopee */ new Memory_WriteAddress( 0x080000, 0x082fff, MWA_BANK1 ), new Memory_WriteAddress( 0x0c0000, 0x0c0fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x140000, 0x140001, toaplan2_0_voffs_w ), new Memory_WriteAddress( 0x140004, 0x140007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x140008, 0x140009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x14000c, 0x14000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x180040, 0x180041, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress( 0x180070, 0x180071, toaplan2_hd647180_cpu_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress ghox_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x03ffff, MRA_ROM ), new Memory_ReadAddress( 0x040000, 0x040001, ghox_p2_h_analog_r ), /* Paddle 2 */ new Memory_ReadAddress( 0x080000, 0x083fff, MRA_BANK1 ), new Memory_ReadAddress( 0x0c0000, 0x0c0fff, paletteram_word_r ), new Memory_ReadAddress( 0x100000, 0x100001, ghox_p1_h_analog_r ), /* Paddle 1 */ new Memory_ReadAddress( 0x140004, 0x140007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x14000c, 0x14000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x180000, 0x180001, ghox_mcu_r ), /* really part of shared RAM */ new Memory_ReadAddress( 0x180006, 0x180007, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x180008, 0x180009, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x180010, 0x180011, input_port_3_r ), /* Coin/System inputs */ // new Memory_ReadAddress( 0x18000c, 0x18000d, input_port_1_r ), /* Player 1 controls (real) */ // new Memory_ReadAddress( 0x18000e, 0x18000f, input_port_2_r ), /* Player 2 controls (real) */ new Memory_ReadAddress( 0x18000c, 0x18000d, ghox_p1_v_analog_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x18000e, 0x18000f, ghox_p2_v_analog_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x180500, 0x180fff, ghox_shared_ram_r ), new Memory_ReadAddress( 0x18100c, 0x18100d, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress ghox_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x03ffff, MWA_ROM ), new Memory_WriteAddress( 0x080000, 0x083fff, MWA_BANK1 ), new Memory_WriteAddress( 0x0c0000, 0x0c0fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x140000, 0x140001, toaplan2_0_voffs_w ), new Memory_WriteAddress( 0x140004, 0x140007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x140008, 0x140009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x14000c, 0x14000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x180000, 0x180001, ghox_mcu_w ), /* really part of shared RAM */ new Memory_WriteAddress( 0x180500, 0x180fff, ghox_shared_ram_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x181000, 0x181001, toaplan2_coin_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress dogyuun_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x103fff, MRA_BANK1 ), new Memory_ReadAddress( 0x200010, 0x200011, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x200014, 0x200015, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x200018, 0x200019, input_port_3_r ), /* Coin/System inputs */ #if Zx80 new Memory_ReadAddress( 0x21e000, 0x21fbff, shared_ram_r ), /* $21f000 status port */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_ReadAddress( 0x21e000, 0x21efff, shared_ram_r ), new Memory_ReadAddress( 0x21f000, 0x21f001, Zx80_status_port_r ), /* Zx80 status port */ new Memory_ReadAddress( 0x21f004, 0x21f005, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x21f006, 0x21f007, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x21f008, 0x21f009, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif /***** The following in 0x30000x are for video controller 1 ******/ new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), /***** The following in 0x50000x are for video controller 2 ******/ new Memory_ReadAddress( 0x500004, 0x500007, toaplan2_1_videoram_r ), /* tile layers 2 */ new Memory_ReadAddress( 0x700000, 0x700001, video_count_r ), /* test bit 8 */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress dogyuun_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x103fff, MWA_BANK1 ), new Memory_WriteAddress( 0x200008, 0x200009, OKIM6295_data_0_w ), new Memory_WriteAddress( 0x20001c, 0x20001d, toaplan2_coin_w ), #if Zx80 new Memory_WriteAddress( 0x21e000, 0x21fbff, shared_ram_w, toaplan2_shared_ram ), /* $21F000 */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_WriteAddress( 0x21e000, 0x21efff, shared_ram_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x21f000, 0x21f001, Zx80_command_port_w ), /* Zx80 command port */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif /***** The following in 0x30000x are for video controller 1 ******/ new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), /***** The following in 0x50000x are for video controller 2 ******/ new Memory_WriteAddress( 0x500000, 0x500001, toaplan2_1_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x500004, 0x500007, toaplan2_1_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x500008, 0x500009, toaplan2_1_scroll_reg_select_w ), new Memory_WriteAddress( 0x50000c, 0x50000d, toaplan2_1_scroll_reg_data_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress kbash_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x103fff, MRA_BANK1 ), new Memory_ReadAddress( 0x200000, 0x200001, kbash_sub_cpu_r ), new Memory_ReadAddress( 0x200004, 0x200005, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x200006, 0x200007, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x200008, 0x200009, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x208010, 0x208011, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x208014, 0x208015, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x208018, 0x208019, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x700000, 0x700001, video_count_r ), /* test bit 8 */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress kbash_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x103fff, MWA_BANK1 ), new Memory_WriteAddress( 0x200000, 0x200003, kbash_sub_cpu_w ), /* sound number to play */ // new Memory_WriteAddress( 0x200002, 0x200003, kbash_sub_cpu_w2 ), /* ??? */ new Memory_WriteAddress( 0x20801c, 0x20801d, toaplan2_coin_w ), new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; /* Fixed by Yochizo 2000/08/16 */ public static Memory_ReadAddress tatsujn2_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x10ffff, MRA_BANK1 ), new Memory_ReadAddress( 0x200004, 0x200007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x20000c, 0x20000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x300000, 0x300fff, paletteram_word_r ), // new Memory_ReadAddress( 0x400000, 0x403fff, MRA_BANK2 ), new Memory_ReadAddress( 0x400000, 0x403fff, raizing_textram_r ), new Memory_ReadAddress( 0x500000, 0x50ffff, MRA_BANK3 ), new Memory_ReadAddress( 0x600000, 0x600001, video_count_r ), new Memory_ReadAddress( 0x700000, 0x700001, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x700002, 0x700003, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x700004, 0x700005, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x700006, 0x700007, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x700008, 0x700009, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x70000a, 0x70000b, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x700016, 0x700017, YM2151_status_port_0_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress tatsujn2_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x10ffff, MWA_BANK1 ), new Memory_WriteAddress( 0x200000, 0x200001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x200004, 0x200007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x200008, 0x200009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x20000c, 0x20000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x300000, 0x300fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), // new Memory_WriteAddress( 0x400000, 0x403fff, MWA_BANK2 ), /* TEXT RAM */ new Memory_WriteAddress( 0x400000, 0x403fff, raizing_textram_w, textvideoram ), new Memory_WriteAddress( 0x500000, 0x50ffff, MWA_BANK3 ), new Memory_WriteAddress( 0x700010, 0x700011, OKIM6295_data_0_w ), new Memory_WriteAddress( 0x700014, 0x700015, YM2151_register_port_0_w ), new Memory_WriteAddress( 0x700016, 0x700017, YM2151_data_port_0_w ), new Memory_WriteAddress( 0x70001e, 0x70001f, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress pipibibs_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x03ffff, MRA_ROM ), new Memory_ReadAddress( 0x080000, 0x082fff, MRA_BANK1 ), new Memory_ReadAddress( 0x0c0000, 0x0c0fff, paletteram_word_r ), new Memory_ReadAddress( 0x140004, 0x140007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x14000c, 0x14000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x190000, 0x190fff, toaplan2_shared_r ), new Memory_ReadAddress( 0x19c020, 0x19c021, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x19c024, 0x19c025, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x19c028, 0x19c029, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x19c02c, 0x19c02d, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x19c030, 0x19c031, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x19c034, 0x19c035, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress pipibibs_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x03ffff, MWA_ROM ), new Memory_WriteAddress( 0x080000, 0x082fff, MWA_BANK1 ), new Memory_WriteAddress( 0x0c0000, 0x0c0fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x140000, 0x140001, toaplan2_0_voffs_w ), new Memory_WriteAddress( 0x140004, 0x140007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x140008, 0x140009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x14000c, 0x14000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x190000, 0x190fff, toaplan2_shared_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x19c01c, 0x19c01d, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress pipibibi_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x03ffff, MRA_ROM ), new Memory_ReadAddress( 0x080000, 0x082fff, MRA_BANK1 ), new Memory_ReadAddress( 0x083000, 0x0837ff, pipibibi_spriteram_r ), new Memory_ReadAddress( 0x083800, 0x087fff, MRA_BANK2 ), new Memory_ReadAddress( 0x0c0000, 0x0c0fff, paletteram_word_r ), new Memory_ReadAddress( 0x120000, 0x120fff, MRA_BANK3 ), new Memory_ReadAddress( 0x180000, 0x182fff, pipibibi_videoram_r ), new Memory_ReadAddress( 0x190002, 0x190003, pipibibi_z80_status_r ), /* Z80 ready ? */ new Memory_ReadAddress( 0x19c020, 0x19c021, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x19c024, 0x19c025, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x19c028, 0x19c029, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x19c02c, 0x19c02d, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x19c030, 0x19c031, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x19c034, 0x19c035, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress pipibibi_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x03ffff, MWA_ROM ), new Memory_WriteAddress( 0x080000, 0x082fff, MWA_BANK1 ), new Memory_WriteAddress( 0x083000, 0x0837ff, pipibibi_spriteram_w ), /* SpriteRAM */ new Memory_WriteAddress( 0x083800, 0x087fff, MWA_BANK2 ), /* SpriteRAM (unused) */ new Memory_WriteAddress( 0x0c0000, 0x0c0fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x120000, 0x120fff, MWA_BANK3 ), /* Copy of SpriteRAM ? */ // new Memory_WriteAddress( 0x13f000, 0x13f001, MWA_NOP ), /* ??? */ new Memory_WriteAddress( 0x180000, 0x182fff, pipibibi_videoram_w ), /* TileRAM */ new Memory_WriteAddress( 0x188000, 0x18800f, pipibibi_scroll_w ), new Memory_WriteAddress( 0x190010, 0x190011, pipibibi_z80_task_w ), /* Z80 task to perform */ new Memory_WriteAddress( 0x19c01c, 0x19c01d, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress fixeight_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x103fff, MRA_BANK1 ), new Memory_ReadAddress( 0x200008, 0x200009, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x20000c, 0x20000d, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x200010, 0x200011, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x200014, 0x200015, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x200018, 0x200019, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x280000, 0x28dfff, MRA_BANK2 ), /* part of shared ram ? */ #if Zx80 new Memory_ReadAddress( 0x28e000, 0x28fbff, shared_ram_r ), /* $21f000 status port */ new Memory_ReadAddress( 0x28fc00, 0x28ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_ReadAddress( 0x28e000, 0x28efff, shared_ram_r ), new Memory_ReadAddress( 0x28f000, 0x28f001, Zx80_status_port_r ), /* Zx80 status port */ new Memory_ReadAddress( 0x28f002, 0x28fbff, MRA_BANK3 ), /* part of shared ram ? */ new Memory_ReadAddress( 0x28fc00, 0x28ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x500000, 0x501fff, MRA_BANK4 ), new Memory_ReadAddress( 0x502000, 0x5021ff, MRA_BANK5 ), new Memory_ReadAddress( 0x503000, 0x5031ff, MRA_BANK6 ), new Memory_ReadAddress( 0x600000, 0x60ffff, MRA_BANK7 ), new Memory_ReadAddress( 0x800000, 0x800001, video_count_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress fixeight_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x103fff, MWA_BANK1 ), new Memory_WriteAddress( 0x20001c, 0x20001d, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress( 0x280000, 0x28dfff, MWA_BANK2 ), /* part of shared ram ? */ #if Zx80 new Memory_WriteAddress( 0x28e000, 0x28fbff, shared_ram_w, toaplan2_shared_ram ), /* $21F000 */ new Memory_WriteAddress( 0x28fc00, 0x28ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_WriteAddress( 0x28e000, 0x28efff, shared_ram_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x28f000, 0x28f001, Zx80_command_port_w ), /* Zx80 command port */ new Memory_WriteAddress( 0x28f002, 0x28fbff, MWA_BANK3 ), /* part of shared ram ? */ new Memory_WriteAddress( 0x28fc00, 0x28ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x500000, 0x501fff, MWA_BANK4 ), new Memory_WriteAddress( 0x502000, 0x5021ff, MWA_BANK5 ), new Memory_WriteAddress( 0x503000, 0x5031ff, MWA_BANK6 ), new Memory_WriteAddress( 0x600000, 0x60ffff, MWA_BANK7 ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress vfive_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x103fff, MRA_BANK1 ), // new Memory_ReadAddress( 0x200000, 0x20ffff, MRA_ROM ), /* Sound ROM is here ??? */ new Memory_ReadAddress( 0x200010, 0x200011, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x200014, 0x200015, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x200018, 0x200019, input_port_3_r ), /* Coin/System inputs */ #if Zx80 new Memory_ReadAddress( 0x21e000, 0x21fbff, shared_ram_r ), /* $21f000 status port */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_ReadAddress( 0x21e000, 0x21efff, shared_ram_r ), new Memory_ReadAddress( 0x21f000, 0x21f001, Zx80_status_port_r ), /* Zx80 status port */ new Memory_ReadAddress( 0x21f004, 0x21f005, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x21f006, 0x21f007, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x21f008, 0x21f009, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x700000, 0x700001, video_count_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress vfive_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x103fff, MWA_BANK1 ), // new Memory_WriteAddress( 0x200000, 0x20ffff, MWA_ROM ), /* Sound ROM is here ??? */ new Memory_WriteAddress( 0x20001c, 0x20001d, toaplan2_coin_w ), /* Coin count/lock */ #if Zx80 new Memory_WriteAddress( 0x21e000, 0x21fbff, shared_ram_w, toaplan2_shared_ram ), /* $21F000 */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_WriteAddress( 0x21e000, 0x21efff, shared_ram_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x21f000, 0x21f001, Zx80_command_port_w ), /* Zx80 command port */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress batsugun_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x10ffff, MRA_BANK1 ), new Memory_ReadAddress( 0x200010, 0x200011, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x200014, 0x200015, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x200018, 0x200019, input_port_3_r ), /* Coin/System inputs */ new Memory_ReadAddress( 0x210000, 0x21bbff, MRA_BANK2 ), #if Zx80 new Memory_ReadAddress( 0x21e000, 0x21fbff, shared_ram_r ), /* $21f000 status port */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_ReadAddress( 0x21e000, 0x21efff, shared_ram_r ), new Memory_ReadAddress( 0x21f000, 0x21f001, Zx80_status_port_r ), /* Zx80 status port */ new Memory_ReadAddress( 0x21f004, 0x21f005, input_port_4_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x21f006, 0x21f007, input_port_5_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x21f008, 0x21f009, input_port_6_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_r ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif /***** The following in 0x30000x are for video controller 2 ******/ new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_1_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), /***** The following in 0x50000x are for video controller 1 ******/ new Memory_ReadAddress( 0x500004, 0x500007, toaplan2_0_videoram_r ), /* tile layers 2 */ new Memory_ReadAddress( 0x700000, 0x700001, video_count_r ), /* test bit 8 */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress batsugun_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x10ffff, MWA_BANK1 ), new Memory_WriteAddress( 0x20001c, 0x20001d, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress( 0x210000, 0x21bbff, MWA_BANK2 ), #if Zx80 new Memory_WriteAddress( 0x21e000, 0x21fbff, shared_ram_w, toaplan2_shared_ram ), /* $21F000 */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #else new Memory_WriteAddress( 0x21e000, 0x21efff, shared_ram_w, toaplan2_shared_ram ), new Memory_WriteAddress( 0x21f000, 0x21f001, Zx80_command_port_w ), /* Zx80 command port */ new Memory_WriteAddress( 0x21fc00, 0x21ffff, Zx80_sharedram_w, Zx80_shared_ram ), /* 16-bit on 68000 side, 8-bit on Zx80 side */ #endif /***** The following in 0x30000x are for video controller 2 ******/ new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_1_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_1_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_1_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_1_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), /***** The following in 0x50000x are for video controller 1 ******/ new Memory_WriteAddress( 0x500000, 0x500001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x500004, 0x500007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x500008, 0x500009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x50000c, 0x50000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress snowbro2_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x10ffff, MRA_BANK1 ), new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x500002, 0x500003, YM2151_status_port_0_r ), new Memory_ReadAddress( 0x600000, 0x600001, OKIM6295_status_0_r ), new Memory_ReadAddress( 0x700000, 0x700001, input_port_8_r ), /* Territory Jumper block */ new Memory_ReadAddress( 0x700004, 0x700005, input_port_6_r ), /* Dip Switch A */ new Memory_ReadAddress( 0x700008, 0x700009, input_port_7_r ), /* Dip Switch B */ new Memory_ReadAddress( 0x70000c, 0x70000d, input_port_1_r ), /* Player 1 controls */ new Memory_ReadAddress( 0x700010, 0x700011, input_port_2_r ), /* Player 2 controls */ new Memory_ReadAddress( 0x700014, 0x700015, input_port_3_r ), /* Player 3 controls */ new Memory_ReadAddress( 0x700018, 0x700019, input_port_4_r ), /* Player 4 controls */ new Memory_ReadAddress( 0x70001c, 0x70001d, input_port_5_r ), /* Coin/System inputs */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress snowbro2_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x10ffff, MWA_BANK1 ), new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x500000, 0x500001, YM2151_register_port_0_w ), new Memory_WriteAddress( 0x500002, 0x500003, YM2151_data_port_0_w ), new Memory_WriteAddress( 0x600000, 0x600001, OKIM6295_data_0_w ), new Memory_WriteAddress( 0x700030, 0x700031, oki_bankswitch_w ), /* Sample bank switch */ new Memory_WriteAddress( 0x700034, 0x700035, toaplan2_coin_w ), /* Coin count/lock */ new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress mahoudai_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x07ffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x10ffff, MRA_BANK1 ), new Memory_ReadAddress( 0x218000, 0x21bfff, raizing_shared_ram_r ), new Memory_ReadAddress( 0x21c002, 0x21c003, YM2151_status_port_0_r ), // new Memory_ReadAddress( 0x21c008, 0x21c009, OKIM6295_status_0_r ), new Memory_ReadAddress( 0x21c020, 0x21c021, input_port_1_r ), new Memory_ReadAddress( 0x21c024, 0x21c025, input_port_2_r ), new Memory_ReadAddress( 0x21c028, 0x21c029, input_port_3_r ), new Memory_ReadAddress( 0x21c02c, 0x21c02d, input_port_4_r ), new Memory_ReadAddress( 0x21c030, 0x21c031, input_port_5_r ), new Memory_ReadAddress( 0x21c034, 0x21c035, input_port_6_r ), new Memory_ReadAddress( 0x21c03c, 0x21c03d, video_count_r ), new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x500000, 0x503fff, raizing_textram_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress mahoudai_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x07ffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x10ffff, MWA_BANK1 ), new Memory_WriteAddress( 0x218000, 0x21bfff, raizing_shared_ram_w, raizing_shared_ram ), new Memory_WriteAddress( 0x21c000, 0x21c001, YM2151_register_port_0_w ), new Memory_WriteAddress( 0x21c004, 0x21c005, YM2151_data_port_0_w ), new Memory_WriteAddress( 0x21c008, 0x21c009, OKIM6295_data_0_w ), new Memory_WriteAddress( 0x21c01c, 0x21c01d, toaplan2_coin_w ), new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x500000, 0x503fff, raizing_textram_w, textvideoram), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress shippumd_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x000000, 0x0fffff, MRA_ROM ), new Memory_ReadAddress( 0x100000, 0x10ffff, MRA_BANK1 ), new Memory_ReadAddress( 0x218000, 0x21bfff, raizing_shared_ram_r ), new Memory_ReadAddress( 0x21c002, 0x21c003, YM2151_status_port_0_r ), // new Memory_ReadAddress( 0x21c008, 0x21c009, OKIM6295_status_0_r ), new Memory_ReadAddress( 0x21c020, 0x21c021, input_port_1_r ), new Memory_ReadAddress( 0x21c024, 0x21c025, input_port_2_r ), new Memory_ReadAddress( 0x21c028, 0x21c029, input_port_3_r ), new Memory_ReadAddress( 0x21c02c, 0x21c02d, input_port_4_r ), new Memory_ReadAddress( 0x21c030, 0x21c031, input_port_5_r ), new Memory_ReadAddress( 0x21c034, 0x21c035, input_port_6_r ), new Memory_ReadAddress( 0x21c03c, 0x21c03d, video_count_r ), new Memory_ReadAddress( 0x300004, 0x300007, toaplan2_0_videoram_r ), /* tile layers */ new Memory_ReadAddress( 0x30000c, 0x30000d, input_port_0_r ), /* VBlank */ new Memory_ReadAddress( 0x400000, 0x400fff, paletteram_word_r ), new Memory_ReadAddress( 0x500000, 0x503fff, raizing_textram_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress shippumd_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x000000, 0x0fffff, MWA_ROM ), new Memory_WriteAddress( 0x100000, 0x10ffff, MWA_BANK1 ), new Memory_WriteAddress( 0x218000, 0x21bfff, raizing_shared_ram_w, raizing_shared_ram ), new Memory_WriteAddress( 0x21c000, 0x21c001, YM2151_register_port_0_w ), new Memory_WriteAddress( 0x21c004, 0x21c005, YM2151_data_port_0_w ), new Memory_WriteAddress( 0x21c008, 0x21c009, OKIM6295_data_0_w ), new Memory_WriteAddress( 0x21c01c, 0x21c01d, toaplan2_coin_w ), new Memory_WriteAddress( 0x300000, 0x300001, toaplan2_0_voffs_w ), /* VideoRAM selector/offset */ new Memory_WriteAddress( 0x300004, 0x300007, toaplan2_0_videoram_w ), /* Tile/Sprite VideoRAM */ new Memory_WriteAddress( 0x300008, 0x300009, toaplan2_0_scroll_reg_select_w ), new Memory_WriteAddress( 0x30000c, 0x30000d, toaplan2_0_scroll_reg_data_w ), new Memory_WriteAddress( 0x400000, 0x400fff, paletteram_xBBBBBGGGGGRRRRR_word_w, paletteram ), new Memory_WriteAddress( 0x500000, 0x503fff, raizing_textram_w, textvideoram), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; public static Memory_ReadAddress sound_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x0000, 0x7fff, MRA_ROM ), new Memory_ReadAddress( 0x8000, 0x87ff, MRA_RAM ), new Memory_ReadAddress( 0xe000, 0xe000, YM3812_status_port_0_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress sound_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x0000, 0x7fff, MWA_ROM ), new Memory_WriteAddress( 0x8000, 0x87ff, MWA_RAM, toaplan2_shared_ram ), new Memory_WriteAddress( 0xe000, 0xe000, YM3812_control_port_0_w ), new Memory_WriteAddress( 0xe001, 0xe001, YM3812_write_port_0_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; /* Added by Yochizo 2000/08/20 */ public static Memory_ReadAddress raizing_sound_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x0000, 0xbfff, MRA_ROM ), new Memory_ReadAddress( 0xc000, 0xdfff, MRA_RAM ), new Memory_ReadAddress( 0xe001, 0xe001, YM2151_status_port_0_r ), // new Memory_ReadAddress( 0xe004, 0xe004, OKIM6295_status_0_r ), new Memory_ReadAddress( 0xe010, 0xe010, input_port_1_r ), new Memory_ReadAddress( 0xe012, 0xe012, input_port_2_r ), new Memory_ReadAddress( 0xe014, 0xe014, input_port_3_r ), new Memory_ReadAddress( 0xe016, 0xe016, input_port_4_r ), new Memory_ReadAddress( 0xe018, 0xe018, input_port_5_r ), new Memory_ReadAddress( 0xe01a, 0xe01a, input_port_6_r ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress raizing_sound_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x0000, 0xbfff, MWA_ROM ), new Memory_WriteAddress( 0xc000, 0xdfff, MWA_RAM, raizing_shared_ram ), new Memory_WriteAddress( 0xe000, 0xe000, YM2151_register_port_0_w ), new Memory_WriteAddress( 0xe001, 0xe001, YM2151_data_port_0_w ), new Memory_WriteAddress( 0xe004, 0xe004, OKIM6295_data_0_w ), new Memory_WriteAddress( 0xe00e, 0xe00e, toaplan2_coin_w ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; #if HD64x180 public static Memory_ReadAddress hd647180_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x0000, 0x7fff, MRA_ROM ), new Memory_ReadAddress( 0xfe00, 0xffff, MRA_RAM ), /* Internal 512 bytes of RAM */ new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress hd647180_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x0000, 0x7fff, MWA_ROM ), new Memory_WriteAddress( 0xfe00, 0xffff, MWA_RAM ), /* Internal 512 bytes of RAM */ new Memory_WriteAddress(MEMPORT_MARKER, 0) }; #endif #if Zx80 public static Memory_ReadAddress Zx80_readmem[]={ new Memory_ReadAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_READ | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_ReadAddress( 0x0000, 0x7fff, MRA_RAM ), new Memory_ReadAddress(MEMPORT_MARKER, 0) }; public static Memory_WriteAddress Zx80_writemem[]={ new Memory_WriteAddress(MEMPORT_MARKER, MEMPORT_DIRECTION_WRITE | MEMPORT_TYPE_MEM | MEMPORT_WIDTH_8), new Memory_WriteAddress( 0x0000, 0x07fff, MWA_RAM, Zx80_sharedram ), new Memory_WriteAddress(MEMPORT_MARKER, 0) }; #endif /***************************************************************************** Input Port definitions Service input of the TOAPLAN2_SYSTEM_INPUTS is used as a Pause type input. If you press then release the following buttons, the following occurs: Service & P2 start : The game will pause. P1 start : The game will continue. Service & P1 start & P2 start : The game will play in slow motion. *****************************************************************************/ #define TOAPLAN2_PLAYER_INPUT( player, button3 ) \ PORT_START(); \ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | player );\ PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | player );\ PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | player );\ PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | player );\ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 | player); \ PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 | player); \ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, button3 ); \ PORT_BIT( 0xff80, IP_ACTIVE_HIGH, IPT_UNKNOWN ); #define TOAPLAN2_SYSTEM_INPUTS \ PORT_START(); \ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_COIN3 ); \ PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_TILT );\ PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 ); PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_COIN1 );\ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_COIN2 );\ PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_START1 );\ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_START2 );\ PORT_BIT( 0xff80, IP_ACTIVE_HIGH, IPT_UNKNOWN ); #define TOAPLAN2_DSW_A \ PORT_START(); \ PORT_DIPNAME( 0x01, 0x00, DEF_STR( "Unused") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); \ PORT_DIPSETTING( 0x01, DEF_STR( "On") ); \ PORT_DIPNAME( 0x02, 0x00, DEF_STR( "Flip_Screen") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); \ PORT_DIPSETTING( 0x02, DEF_STR( "On") ); \ PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ); /* Service Mode */ \ PORT_DIPNAME( 0x08, 0x00, DEF_STR( "Demo_Sounds") ); \ PORT_DIPSETTING( 0x08, DEF_STR( "Off") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "On") ); \ PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); \ PORT_DIPSETTING( 0x30, DEF_STR( "4C_1C") ); \ PORT_DIPSETTING( 0x20, DEF_STR( "3C_1C") ); \ PORT_DIPSETTING( 0x10, DEF_STR( "2C_1C") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); \ PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "1C_2C") ); \ PORT_DIPSETTING( 0x40, DEF_STR( "1C_3C") ); \ PORT_DIPSETTING( 0x80, DEF_STR( "1C_4C") ); \ PORT_DIPSETTING( 0xc0, DEF_STR( "1C_6C") ); \ /* Non-European territories coin setups \ PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); \ PORT_DIPSETTING( 0x20, DEF_STR( "2C_1C") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); \ PORT_DIPSETTING( 0x30, DEF_STR( "2C_3C") ); \ PORT_DIPSETTING( 0x10, DEF_STR( "1C_2C") ); \ PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); \ PORT_DIPSETTING( 0x80, DEF_STR( "2C_1C") ); \ PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); \ PORT_DIPSETTING( 0xc0, DEF_STR( "2C_3C") ); \ PORT_DIPSETTING( 0x40, DEF_STR( "1C_2C") ); \ */ static InputPortPtr input_ports_tekipaki = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS TOAPLAN2_DSW_A PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x01, "Easy" ); PORT_DIPSETTING( 0x00, "Medium" ); PORT_DIPSETTING( 0x02, "Hard" ); PORT_DIPSETTING( 0x03, "Hardest" ); PORT_DIPNAME( 0x04, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x04, DEF_STR( "On") ); PORT_DIPNAME( 0x08, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x08, DEF_STR( "On") ); PORT_DIPNAME( 0x10, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x10, DEF_STR( "On") ); PORT_DIPNAME( 0x20, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x20, DEF_STR( "On") ); PORT_DIPNAME( 0x40, 0x00, "Game Mode" ); PORT_DIPSETTING( 0x00, "Normal" ); PORT_DIPSETTING( 0x40, "Stop" ); PORT_DIPNAME( 0x80, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x0f, 0x02, "Territory" ); PORT_DIPSETTING( 0x02, "Europe" ); PORT_DIPSETTING( 0x01, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x03, "Hong Kong" ); PORT_DIPSETTING( 0x05, "Taiwan" ); PORT_DIPSETTING( 0x04, "Korea" ); PORT_DIPSETTING( 0x07, "USA (Romstar); ) PORT_DIPSETTING( 0x08, "Hong Kong (Honest Trading Co.); ) PORT_DIPSETTING( 0x06, "Taiwan (Spacy Co. Ltd); ) PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_ghox = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS TOAPLAN2_DSW_A PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x01, "Easy" ); PORT_DIPSETTING( 0x00, "Medium" ); PORT_DIPSETTING( 0x02, "Hard" ); PORT_DIPSETTING( 0x03, "Hardest" ); PORT_DIPNAME( 0x0c, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x00, "100K, every 200K" ); PORT_DIPSETTING( 0x04, "100K, every 300K" ); PORT_DIPSETTING( 0x08, "100K" ); PORT_DIPSETTING( 0x0c, "None" ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x30, "1" ); PORT_DIPSETTING( 0x20, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x10, "5" ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x0f, 0x02, "Territory" ); PORT_DIPSETTING( 0x02, "Europe" ); PORT_DIPSETTING( 0x01, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x04, "Korea" ); PORT_DIPSETTING( 0x03, "Hong Kong (Honest Trading Co." ); PORT_DIPSETTING( 0x05, "Taiwan" ); PORT_DIPSETTING( 0x06, "Spain & Portugal (APM Electronics SA); ) PORT_DIPSETTING( 0x07, "Italy (Star Electronica SRL); ) PORT_DIPSETTING( 0x08, "UK (JP Leisure Ltd); ) PORT_DIPSETTING( 0x0a, "Europe (Nova Apparate GMBH & Co); ) PORT_DIPSETTING( 0x0d, "Europe (Taito Corporation Japan); ) PORT_DIPSETTING( 0x09, "USA (Romstar); ) PORT_DIPSETTING( 0x0b, "USA (Taito America Corporation); ) PORT_DIPSETTING( 0x0c, "USA (Taito Corporation Japan); ) PORT_DIPSETTING( 0x0e, "Japan (Taito Corporation); ) PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (7) Paddle 1 (left-right) read at $100000 */ PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_PLAYER1, 25, 15, 0, 0xff ); PORT_START(); /* (8) Paddle 2 (left-right) read at $040000 */ PORT_ANALOG( 0xff, 0x00, IPT_DIAL | IPF_PLAYER2, 25, 15, 0, 0xff ); PORT_START(); /* (9) Paddle 1 (fake up-down) */ PORT_ANALOG( 0xff, 0x00, IPT_DIAL_V | IPF_PLAYER1, 15, 0, 0, 0xff ); PORT_START(); /* (10) Paddle 2 (fake up-down) */ PORT_ANALOG( 0xff, 0x00, IPT_DIAL_V | IPF_PLAYER2, 15, 0, 0, 0xff ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_dogyuun = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_BUTTON3 | IPF_PLAYER1 ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_BUTTON3 | IPF_PLAYER2 ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, "Play Mode" ); PORT_DIPSETTING( 0x0000, "Coin Play" ); PORT_DIPSETTING( 0x0001, DEF_STR( "Free_Play")); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0030, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x0020, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x0080, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "1C_6C") ); /* Non-European territories coin setups PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0xc0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); */ PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "200K, 400K, 600K" ); PORT_DIPSETTING( 0x0000, "200K" ); PORT_DIPSETTING( 0x0008, "400K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x0f, 0x03, "Territory" ); PORT_DIPSETTING( 0x03, "Europe" ); PORT_DIPSETTING( 0x01, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x05, "Korea (Unite Trading license); ) PORT_DIPSETTING( 0x04, "Hong Kong (Charterfield license); ) PORT_DIPSETTING( 0x06, "Taiwan" ); PORT_DIPSETTING( 0x08, "South East Asia (Charterfield license); ) PORT_DIPSETTING( 0x0c, "USA (Atari Games Corp license); ) PORT_DIPSETTING( 0x0f, "Japan (Taito Corp license); ) /* Duplicate settings PORT_DIPSETTING( 0x0b, "Europe" ); PORT_DIPSETTING( 0x07, "USA" ); PORT_DIPSETTING( 0x0a, "Korea (Unite Trading license); ) PORT_DIPSETTING( 0x09, "Hong Kong (Charterfield license); ) PORT_DIPSETTING( 0x0b, "Taiwan" ); PORT_DIPSETTING( 0x0d, "South East Asia (Charterfield license); ) PORT_DIPSETTING( 0x0c, "USA (Atari Games Corp license); ) */ PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* bit 0x10 sound ready */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_kbash = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_BUTTON3 | IPF_PLAYER1 ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_BUTTON3 | IPF_PLAYER2 ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, "Continue Mode" ); PORT_DIPSETTING( 0x0000, "Normal" ); PORT_DIPSETTING( 0x0001, "Discount" ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0030, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x0020, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x0080, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "1C_6C") ); /* Non-European territories coin setup PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); */ PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0000, "100K, every 400K" ); PORT_DIPSETTING( 0x0004, "100K" ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0020, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0000, "2" ); PORT_DIPSETTING( 0x0020, "3" ); PORT_DIPSETTING( 0x0010, "4" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x000f, 0x000a, "Territory" ); PORT_DIPSETTING( 0x000a, "Europe" ); PORT_DIPSETTING( 0x0009, "USA" ); PORT_DIPSETTING( 0x0000, "Japan" ); PORT_DIPSETTING( 0x0003, "Korea" ); PORT_DIPSETTING( 0x0004, "Hong Kong" ); PORT_DIPSETTING( 0x0007, "Taiwan" ); PORT_DIPSETTING( 0x0006, "South East Asia" ); PORT_DIPSETTING( 0x0002, "Europe, USA (Atari License); ) PORT_DIPSETTING( 0x0001, "USA, Europe (Atari License); ) PORT_BIT( 0xfff0, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; /* Added by Yochizo 2000/08/16 */ static InputPortPtr input_ports_tatsujn2 = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_DIPNAME( 0x0004, 0x0000, "Test Switch" ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0004, DEF_STR( "On") ); PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0000, "70K, and 200K" ); PORT_DIPSETTING( 0x0004, "100K, and 250K" ); PORT_DIPSETTING( 0x0008, "100K" ); PORT_DIPSETTING( 0x000c, "200K" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "2" ); PORT_DIPSETTING( 0x0020, "4" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x07, 0x02, "Territory" ); PORT_DIPSETTING( 0x02, "Europe" ); PORT_DIPSETTING( 0x01, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x03, "Hong Kong" ); PORT_DIPSETTING( 0x05, "Taiwan" ); PORT_DIPSETTING( 0x06, "Asia" ); PORT_DIPSETTING( 0x04, "Korea" ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_pipibibs = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS TOAPLAN2_DSW_A PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x01, "Easy" ); PORT_DIPSETTING( 0x00, "Medium" ); PORT_DIPSETTING( 0x02, "Hard" ); PORT_DIPSETTING( 0x03, "Hardest" ); PORT_DIPNAME( 0x0c, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x04, "150K, every 200K" ); PORT_DIPSETTING( 0x00, "200K, every 300K" ); PORT_DIPSETTING( 0x08, "200K" ); PORT_DIPSETTING( 0x0c, "None" ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x30, "1" ); PORT_DIPSETTING( 0x20, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x10, "5" ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x07, 0x06, "Territory" ); PORT_DIPSETTING( 0x06, "Europe" ); PORT_DIPSETTING( 0x04, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x02, "Hong Kong" ); PORT_DIPSETTING( 0x03, "Taiwan" ); PORT_DIPSETTING( 0x01, "Asia" ); PORT_DIPSETTING( 0x07, "Europe (Nova Apparate GMBH & Co); ) PORT_DIPSETTING( 0x05, "USA (Romstar); ) PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_whoopee = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x01, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x01, DEF_STR( "On") ); PORT_DIPNAME( 0x02, 0x00, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x02, DEF_STR( "On") ); PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x08, 0x00, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x08, DEF_STR( "Off") ); PORT_DIPSETTING( 0x00, DEF_STR( "On") ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x20, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x30, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x10, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x80, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0xc0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x40, DEF_STR( "1C_2C") ); /* European territories coin setups PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x30, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x20, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x10, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x40, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x80, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0xc0, DEF_STR( "1C_6C") ); */ PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x01, "Easy" ); PORT_DIPSETTING( 0x00, "Medium" ); PORT_DIPSETTING( 0x02, "Hard" ); PORT_DIPSETTING( 0x03, "Hardest" ); PORT_DIPNAME( 0x0c, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x04, "150K, every 200K" ); PORT_DIPSETTING( 0x00, "200K, every 300K" ); PORT_DIPSETTING( 0x08, "200K" ); PORT_DIPSETTING( 0x0c, "None" ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x30, "1" ); PORT_DIPSETTING( 0x20, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x10, "5" ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x07, 0x06, "Territory" ); PORT_DIPSETTING( 0x06, "Europe" ); PORT_DIPSETTING( 0x04, "USA" ); PORT_DIPSETTING( 0x00, "Japan" ); PORT_DIPSETTING( 0x02, "Hong Kong" ); PORT_DIPSETTING( 0x03, "Taiwan" ); PORT_DIPSETTING( 0x01, "Asia" ); PORT_DIPSETTING( 0x07, "Europe (Nova Apparate GMBH & Co); ) PORT_DIPSETTING( 0x05, "USA (Romstar); ) PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* bit 0x10 sound ready */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_pipibibi = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ // PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); /* This video HW */ // PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); /* doesnt wait for VBlank */ TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x01, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x01, DEF_STR( "On") ); // PORT_DIPNAME( 0x02, 0x00, DEF_STR( "Flip_Screen") ); /* This video HW */ // PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); /* doesn't support */ // PORT_DIPSETTING( 0x02, DEF_STR( "On") ); /* flip screen */ PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x08, 0x00, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x08, DEF_STR( "Off") ); PORT_DIPSETTING( 0x00, DEF_STR( "On") ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x20, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x30, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x10, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x80, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0xc0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x40, DEF_STR( "1C_2C") ); /* European territories coin setups PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x30, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x20, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x10, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0xc0, 0x00, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x00, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x40, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x80, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0xc0, DEF_STR( "1C_6C") ); */ PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x03, 0x00, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x01, "Easy" ); PORT_DIPSETTING( 0x00, "Medium" ); PORT_DIPSETTING( 0x02, "Hard" ); PORT_DIPSETTING( 0x03, "Hardest" ); PORT_DIPNAME( 0x0c, 0x00, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x04, "150K, every 200K" ); PORT_DIPSETTING( 0x00, "200K, every 300K" ); PORT_DIPSETTING( 0x08, "200K" ); PORT_DIPSETTING( 0x0c, "None" ); PORT_DIPNAME( 0x30, 0x00, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x30, "1" ); PORT_DIPSETTING( 0x20, "2" ); PORT_DIPSETTING( 0x00, "3" ); PORT_DIPSETTING( 0x10, "5" ); PORT_BITX( 0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x40, DEF_STR( "On") ); PORT_DIPNAME( 0x80, 0x00, DEF_STR( "Unused") ); PORT_DIPSETTING( 0x00, DEF_STR( "Off") ); PORT_DIPSETTING( 0x80, DEF_STR( "On") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x07, 0x05, "Territory" ); PORT_DIPSETTING( 0x07, "World (Ryouta Kikaku); ) PORT_DIPSETTING( 0x00, "Japan (Ryouta Kikaku); ) PORT_DIPSETTING( 0x02, "World" ); PORT_DIPSETTING( 0x05, "Europe" ); PORT_DIPSETTING( 0x04, "USA" ); PORT_DIPSETTING( 0x01, "Hong Kong (Honest Trading Co." ); PORT_DIPSETTING( 0x06, "Spain & Portugal (APM Electronics SA); ) // PORT_DIPSETTING( 0x03, "World" ); PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_grindstm = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( "Cabinet") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Upright") ); PORT_DIPSETTING( 0x0001, DEF_STR( "Cocktail") ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0030, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x0020, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x0080, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "1C_6C") ); /* Non-European territories coin setups PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); */ PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x0004, "300K, then every 800K" ); PORT_DIPSETTING( 0x0000, "300K, and 800K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x0f, 0x08, "Territory" ); PORT_DIPSETTING( 0x08, "Europe" ); PORT_DIPSETTING( 0x0b, "USA" ); PORT_DIPSETTING( 0x01, "Korea" ); PORT_DIPSETTING( 0x03, "Hong Kong" ); PORT_DIPSETTING( 0x05, "Taiwan" ); PORT_DIPSETTING( 0x07, "South East Asia" ); PORT_DIPSETTING( 0x0a, "USA (American Sammy Corporation License); ) PORT_DIPSETTING( 0x00, "Korea (Unite Trading License); ) PORT_DIPSETTING( 0x02, "Hong Kong (Charterfield License); ) PORT_DIPSETTING( 0x04, "Taiwan (Anomoto International Inc License); ) PORT_DIPSETTING( 0x06, "South East Asia (Charterfield License); ) /* Duplicate settings PORT_DIPSETTING( 0x09, "Europe" ); PORT_DIPSETTING( 0x0d, "USA" ); PORT_DIPSETTING( 0x0e, "Korea" ); PORT_DIPSETTING( 0x0f, "Korea" ); PORT_DIPSETTING( 0x0c, "USA (American Sammy Corporation License); ) */ PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* bit 0x10 sound ready */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_vfive = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( "Cabinet") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Upright") ); PORT_DIPSETTING( 0x0001, DEF_STR( "Cocktail") ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "300K, then every 800K" ); PORT_DIPSETTING( 0x0000, "300K, and 800K" ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ /* Territory is forced to Japan in this set. */ PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* bit 0x10 sound ready */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_batsugun = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, "Continue Mode" ); PORT_DIPSETTING( 0x0000, "Normal" ); PORT_DIPSETTING( 0x0001, "Discount" ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0030, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x0020, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x0080, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "1C_6C") ); /* Non-European territories coin setups PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); */ PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "500K, then every 600K" ); PORT_DIPSETTING( 0x0000, "1 Million" ); PORT_DIPSETTING( 0x0008, "1.5 Million" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ PORT_DIPNAME( 0x000f, 0x0009, "Territory" ); PORT_DIPSETTING( 0x0009, "Europe" ); PORT_DIPSETTING( 0x000b, "USA" ); PORT_DIPSETTING( 0x000e, "Japan" ); // PORT_DIPSETTING( 0x000f, "Japan" ); PORT_DIPSETTING( 0x0001, "Korea" ); PORT_DIPSETTING( 0x0003, "Hong Kong" ); PORT_DIPSETTING( 0x0005, "Taiwan" ); PORT_DIPSETTING( 0x0007, "South East Asia" ); PORT_DIPSETTING( 0x0008, "Europe (Taito Corp License); ) PORT_DIPSETTING( 0x000a, "USA (Taito Corp License); ) PORT_DIPSETTING( 0x000c, "Japan (Taito Corp License); ) // PORT_DIPSETTING( 0x000d, "Japan (Taito Corp License); ) PORT_DIPSETTING( 0x0000, "Korea (Unite Trading License); ) PORT_DIPSETTING( 0x0002, "Hong Kong (Taito Corp License); ) PORT_DIPSETTING( 0x0004, "Taiwan (Taito Corp License); ) PORT_DIPSETTING( 0x0006, "South East Asia (Taito Corp License); ) PORT_BIT( 0xfff0, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* bit 0x10 sound ready */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_snowbro2 = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER3, IPT_START3 ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER4, IPT_START4 ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (6) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, "Continue Mode" ); PORT_DIPSETTING( 0x0000, "Normal" ); PORT_DIPSETTING( 0x0001, "Discount" ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); /* The following are listed in service mode for European territory, but are not actually used in game play. PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0030, DEF_STR( "4C_1C") ); PORT_DIPSETTING( 0x0020, DEF_STR( "3C_1C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_2C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_3C") ); PORT_DIPSETTING( 0x0080, DEF_STR( "1C_4C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "1C_6C") ); */ PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (7) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "100K, every 500K" ); PORT_DIPSETTING( 0x0000, "100K" ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "4" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Maximum Players" ); PORT_DIPSETTING( 0x0080, "2" ); PORT_DIPSETTING( 0x0000, "4" ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (8) Territory Jumper block */ PORT_DIPNAME( 0x1c00, 0x0800, "Territory" ); PORT_DIPSETTING( 0x0800, "Europe" ); PORT_DIPSETTING( 0x0400, "USA" ); PORT_DIPSETTING( 0x0000, "Japan" ); PORT_DIPSETTING( 0x0c00, "Korea" ); PORT_DIPSETTING( 0x1000, "Hong Kong" ); PORT_DIPSETTING( 0x1400, "Taiwan" ); PORT_DIPSETTING( 0x1800, "South East Asia" ); PORT_DIPSETTING( 0x1c00, DEF_STR( "Unused") ); PORT_DIPNAME( 0x2000, 0x0000, "Show All Rights Reserved" ); PORT_DIPSETTING( 0x0000, DEF_STR( "No") ); PORT_DIPSETTING( 0x2000, DEF_STR( "Yes") ); PORT_BIT( 0xc3ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; static InputPortPtr input_ports_mahoudai = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( "Free_Play") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0001, DEF_STR( "On") ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "200K, 500K" ); PORT_DIPSETTING( 0x0000, "every 300K" ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNKNOWN );/* not used, it seems */ INPUT_PORTS_END(); }}; static InputPortPtr input_ports_shippumd = new InputPortPtr(){ public void handler() { PORT_START(); /* (0) VBlank */ PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK ); PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN ); TOAPLAN2_PLAYER_INPUT( IPF_PLAYER1, IPT_UNKNOWN ) TOAPLAN2_PLAYER_INPUT( IPF_PLAYER2, IPT_UNKNOWN ) TOAPLAN2_SYSTEM_INPUTS PORT_START(); /* (4) DSWA */ PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( "Free_Play") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0001, DEF_STR( "On") ); PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( "Flip_Screen") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0002, DEF_STR( "On") ); PORT_SERVICE( 0x0004, IP_ACTIVE_HIGH ); /* Service Mode */ PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( "Demo_Sounds") ); PORT_DIPSETTING( 0x0008, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0000, DEF_STR( "On") ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Coin_A") ); PORT_DIPSETTING( 0x0020, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x0030, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0010, DEF_STR( "1C_2C") ); PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( "Coin_B") ); PORT_DIPSETTING( 0x0080, DEF_STR( "2C_1C") ); PORT_DIPSETTING( 0x0000, DEF_STR( "1C_1C") ); PORT_DIPSETTING( 0x00c0, DEF_STR( "2C_3C") ); PORT_DIPSETTING( 0x0040, DEF_STR( "1C_2C") ); PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN ); PORT_START(); /* (5) DSWB */ PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( "Difficulty") ); PORT_DIPSETTING( 0x0001, "Easy" ); PORT_DIPSETTING( 0x0000, "Medium" ); PORT_DIPSETTING( 0x0002, "Hard" ); PORT_DIPSETTING( 0x0003, "Hardest" ); PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( "Bonus_Life") ); PORT_DIPSETTING( 0x0004, "200K, 500K" ); PORT_DIPSETTING( 0x0000, "every 300K" ); PORT_DIPSETTING( 0x0008, "200K" ); PORT_DIPSETTING( 0x000c, "None" ); PORT_DIPNAME( 0x0030, 0x0000, DEF_STR( "Lives") ); PORT_DIPSETTING( 0x0030, "1" ); PORT_DIPSETTING( 0x0020, "2" ); PORT_DIPSETTING( 0x0000, "3" ); PORT_DIPSETTING( 0x0010, "5" ); PORT_BITX( 0x0040, 0x0000, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE ); PORT_DIPSETTING( 0x0000, DEF_STR( "Off") ); PORT_DIPSETTING( 0x0040, DEF_STR( "On") ); PORT_DIPNAME( 0x0080, 0x0000, "Allow Continue" ); PORT_DIPSETTING( 0x0080, DEF_STR( "No") ); PORT_DIPSETTING( 0x0000, DEF_STR( "Yes") ); PORT_START(); /* (6) Territory Jumper block */ /* title screen is wrong when set to other countries */ PORT_DIPNAME( 0x000e, 0x0000, "Territory" ); PORT_DIPSETTING( 0x0004, "Europe" ); PORT_DIPSETTING( 0x0002, "USA" ); PORT_DIPSETTING( 0x0000, "Japan" ); PORT_DIPSETTING( 0x0006, "South East Asia" ); PORT_DIPSETTING( 0x0008, "China" ); PORT_DIPSETTING( 0x000a, "Korea" ); PORT_DIPSETTING( 0x000c, "Hong Kong" ); PORT_DIPSETTING( 0x000e, "Taiwan" ); PORT_BIT( 0xfff1, IP_ACTIVE_HIGH, IPT_UNKNOWN ); INPUT_PORTS_END(); }}; static GfxLayout tilelayout = new GfxLayout ( 16,16, /* 16x16 */ RGN_FRAC(1,2), /* Number of tiles */ 4, /* 4 bits per pixel */ new int[] { RGN_FRAC(1,2)+8, RGN_FRAC(1,2), 8, 0 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8*16+0, 8*16+1, 8*16+2, 8*16+3, 8*16+4, 8*16+5, 8*16+6, 8*16+7 }, new int[] { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 }, 8*4*16 ); static GfxLayout spritelayout = new GfxLayout ( 8,8, /* 8x8 */ RGN_FRAC(1,2), /* Number of 8x8 sprites */ 4, /* 4 bits per pixel */ new int[] { RGN_FRAC(1,2)+8, RGN_FRAC(1,2), 8, 0 }, new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }, new int[] { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, 8*16 ); #ifdef LSB_FIRST static GfxLayout tatsujn2_textlayout = new GfxLayout ( 8,8, /* 8x8 characters */ 1024, /* 1024 characters */ 4, /* 4 bits per pixel */ new int[] { 0, 1, 2, 3 }, new int[] { 8, 12, 0, 4, 24, 28, 16, 20 }, new int[] { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, 8*32 ); #else static GfxLayout tatsujn2_textlayout = new GfxLayout ( 8,8, /* 8x8 characters */ 1024, /* 1024 characters */ 4, /* 4 bits per pixel */ new int[] { 0, 1, 2, 3 }, new int[] { 0, 4, 8, 12, 16, 20, 24, 28 }, new int[] { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, 8*32 ); #endif static GfxLayout raizing_textlayout = new GfxLayout ( 8,8, /* 8x8 characters */ 1024, /* 1024 characters */ 4, /* 4 bits per pixel */ new int[] { 0, 1, 2, 3 }, new int[] { 0, 4, 8, 12, 16, 20, 24, 28 }, new int[] { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, 8*32 ); static GfxDecodeInfo gfxdecodeinfo[] = { new GfxDecodeInfo( REGION_GFX1, 0, tilelayout, 0, 128 ), new GfxDecodeInfo( REGION_GFX1, 0, spritelayout, 0, 64 ), new GfxDecodeInfo( -1 ) /* end of array */ }; static GfxDecodeInfo gfxdecodeinfo_2[] = { new GfxDecodeInfo( REGION_GFX1, 0, tilelayout, 0, 128 ), new GfxDecodeInfo( REGION_GFX1, 0, spritelayout, 0, 64 ), new GfxDecodeInfo( REGION_GFX2, 0, tilelayout, 0, 128 ), new GfxDecodeInfo( REGION_GFX2, 0, spritelayout, 0, 64 ), new GfxDecodeInfo( -1 ) /* end of array */ }; /* Added by Yochizo 2000/08/19 */ static GfxDecodeInfo tatsujn2_gfxdecodeinfo[] = { new GfxDecodeInfo( REGION_GFX1, 0, tilelayout, 0, 128 ), new GfxDecodeInfo( REGION_GFX1, 0, spritelayout, 0, 64 ), /* Tatsujin2 have extra-text tile data in CPU rom */ new GfxDecodeInfo( REGION_CPU1, 0x40000, tatsujn2_textlayout, 0, 128 ), new GfxDecodeInfo( -1 ) /* end of array */ }; static GfxDecodeInfo raizing_gfxdecodeinfo[] = { new GfxDecodeInfo( REGION_GFX1, 0, tilelayout, 0, 128 ), new GfxDecodeInfo( REGION_GFX1, 0, spritelayout, 0, 64 ), new GfxDecodeInfo( REGION_GFX2, 0, raizing_textlayout, 0, 128 ), /* Extra-text layer */ new GfxDecodeInfo( -1 ) /* end of array */ }; // Not used yet //static GfxDecodeInfo raizing_gfxdecodeinfo_2[] = //{ // new GfxDecodeInfo( REGION_GFX1, 0, tilelayout, 0, 128 ), // new GfxDecodeInfo( REGION_GFX1, 0, spritelayout, 0, 64 ), // new GfxDecodeInfo( REGION_GFX2, 0, tilelayout, 0, 128 ), // new GfxDecodeInfo( REGION_GFX2, 0, spritelayout, 0, 64 ), // new GfxDecodeInfo( REGION_GFX3, 0, textlayout, 0, 128 ), /* Extra-text layer */ // new GfxDecodeInfo( -1 ) /* end of array */ //}; static void irqhandler(int linestate) { cpu_set_irq_line(1,0,linestate); } static YM3812interface ym3812_interface = new YM3812interface ( 1, /* 1 chip */ 27000000/8, /* 3.375MHz , 27MHz Oscillator */ new WriteYmHandlerPtr[] { 100 }, /* volume */ { irqhandler }, ); static YM2151interface ym2151_interface = new YM2151interface ( 1, /* 1 chip */ 27000000/8, /* 3.375MHz , 27MHz Oscillator */ new WriteYmHandlerPtr[] { YM3012_VOL(45,MIXER_PAN_LEFT,45,MIXER_PAN_RIGHT) }, new WriteHandlerPtr[] { 0 } ); static OKIM6295interface okim6295_interface = new OKIM6295interface ( 1, /* 1 chip */ new int[] { 22050 }, /* frequency (Hz). M6295 has 1MHz on its clock input */ new int[] { REGION_SOUND1 }, /* memory region */ new int[] { 47 } ); /* Added by Yochizo */ /* This is M6295 interface for Raizing games. Raizing games use lower sampling */ /* frequency probably but I don't know real number. */ static OKIM6295interface okim6295_raizing_interface = new OKIM6295interface ( 1, /* 1 chip */ new int[] { 11025 }, /* frequency (Hz). M6295 has 1MHz on its clock input */ new int[] { REGION_SOUND1 }, /* memory region */ new int[] { 47 } ); static MachineDriver machine_driver_tekipaki = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ tekipaki_readmem,tekipaki_writemem,null,null, toaplan2_interrupt,1 ), #if HD64x180 new MachineCPU( CPU_Z80, /* HD647180 CPU actually */ 10000000, /* 10MHz Oscillator */ hd647180_readmem,hd647180_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan2, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ 0,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM3812, ym3812_interface ), } ); static MachineDriver machine_driver_ghox = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ ghox_readmem,ghox_writemem,null,null, toaplan2_interrupt,1 ), #if HD64x180 new MachineCPU( CPU_Z80, /* HD647180 CPU actually */ 10000000, /* 10MHz Oscillator */ hd647180_readmem,hd647180_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan2, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ) } ); static MachineDriver machine_driver_dogyuun = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, /* 16MHz Oscillator */ dogyuun_readmem,dogyuun_writemem,null,null, toaplan2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 16000000, /* 16MHz Oscillator */ Zx80_readmem,Zx80_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan3, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo_2, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_1_eof_callback, toaplan2_1_vh_start, toaplan2_1_vh_stop, toaplan2_1_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_interface ) } ); static MachineDriver machine_driver_kbash = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, /* 16MHz Oscillator */ kbash_readmem,kbash_writemem,null,null, toaplan2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 16000000, /* 16MHz Oscillator */ Zx80_readmem,Zx80_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan2, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_interface ) } ); /* Fixed by Yochizo 2000/08/16 */ static MachineDriver machine_driver_tatsujn2 = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, /* 16MHz Oscillator */ tatsujn2_readmem,tatsujn2_writemem,null,null, tatsujn2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 16000000, /* 16MHz Oscillator */ Zx80_readmem,Zx80_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_tatsujn2, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), tatsujn2_gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, raizing_0_vh_start, toaplan2_0_vh_stop, raizing_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_interface ) } ); static MachineDriver machine_driver_pipibibs = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ pipibibs_readmem,pipibibs_writemem,null,null, toaplan2_interrupt,1 ), new MachineCPU( CPU_Z80, 27000000/8, /* ??? 3.37MHz , 27MHz Oscillator */ sound_readmem,sound_writemem,0,null, ignore_interrupt,0 ) }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 10, init_pipibibs, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (128*16), (128*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ 0,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM3812, ym3812_interface ), } ); static MachineDriver machine_driver_whoopee = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ tekipaki_readmem,tekipaki_writemem,null,null, toaplan2_interrupt,1 ), new MachineCPU( CPU_Z80, /* This should be a HD647180 */ 27000000/8, /* Change this to 10MHz when HD647180 gets dumped. 10MHz Oscillator */ sound_readmem,sound_writemem,null,null, ignore_interrupt,0 ) }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 10, init_pipibibs, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (128*16), (128*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ 0,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM3812, ym3812_interface ), } ); static MachineDriver machine_driver_pipibibi = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ pipibibi_readmem,pipibibi_writemem,null,null, toaplan2_interrupt,1 ), new MachineCPU( CPU_Z80, 27000000/8, /* ??? 3.37MHz */ sound_readmem,sound_writemem,null,null, ignore_interrupt,0 ) }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 10, init_pipibibs, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (128*16), (128*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ 0,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM3812, ym3812_interface ), } ); static MachineDriver machine_driver_fixeight = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, /* 16MHz Oscillator */ fixeight_readmem,fixeight_writemem,null,null, toaplan2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 16000000, /* 16MHz Oscillator */ Zx80_readmem,Zx80_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan3, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ) } ); static MachineDriver machine_driver_vfive = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 10000000, /* 10MHz Oscillator */ vfive_readmem,vfive_writemem,null,null, toaplan2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 10000000, /* 10MHz Oscillator */ Zx80_readmem,Zx80_writemem,null,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan3, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ) } ); static MachineDriver machine_driver_batsugun = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 32000000/2, /* 16MHz , 32MHz Oscillator */ batsugun_readmem,batsugun_writemem,0,null, toaplan2_interrupt,1 ), #if Zx80 new MachineCPU( CPU_Z80, /* Z?80 type Toaplan marked CPU ??? */ 32000000/2, /* 16MHz , 32MHz Oscillator */ Zx80_readmem,Zx80_writemem,0,null, ignore_interrupt,0 ) #endif }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan3, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo_2, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_1_eof_callback, toaplan2_1_vh_start, toaplan2_1_vh_stop, batsugun_1_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_interface ) } ); static MachineDriver machine_driver_snowbro2 = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, snowbro2_readmem,snowbro2_writemem,null,null, toaplan2_interrupt,1 ), }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 1, init_toaplan2, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), gfxdecodeinfo, (64*16)+(64*16), (64*16)+(64*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, toaplan2_0_vh_start, toaplan2_0_vh_stop, toaplan2_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_interface ) } ); static MachineDriver machine_driver_mahoudai = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, mahoudai_readmem,mahoudai_writemem,null,null, toaplan2_interrupt,1 ), new MachineCPU( CPU_Z80, 4000000, /* ??? */ raizing_sound_readmem,raizing_sound_writemem,null,null, ignore_interrupt,0 ) }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 10, null, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), raizing_gfxdecodeinfo, (128*16), (128*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, raizing_0_vh_start, toaplan2_0_vh_stop, raizing_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_raizing_interface ) } ); static MachineDriver machine_driver_shippumd = new MachineDriver ( /* basic machine hardware */ new MachineCPU[] { new MachineCPU( CPU_M68000, 16000000, shippumd_readmem,shippumd_writemem,null,null, toaplan2_interrupt,1 ), new MachineCPU( CPU_Z80, 4000000, /* ??? */ raizing_sound_readmem,raizing_sound_writemem,null,null, ignore_interrupt,0 ) }, 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */ 10, null, /* video hardware */ 32*16, 32*16, new rectangle( 0, 319, 0, 239 ), raizing_gfxdecodeinfo, (128*16), (128*16), 0, VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK, /* Sprites are buffered too */ toaplan2_0_eof_callback, raizing_0_vh_start, toaplan2_0_vh_stop, raizing_0_vh_screenrefresh, /* sound hardware */ SOUND_SUPPORTS_STEREO,0,0,0, new MachineSound[] { new MachineSound( SOUND_YM2151, ym2151_interface ), new MachineSound( SOUND_OKIM6295, okim6295_raizing_interface ) } ); /*************************************************************************** Game driver(s) ***************************************************************************/ /* -------------------------- Toaplan games ------------------------- */ static RomLoadPtr rom_tekipaki = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x020000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "tp020-1.bin", 0x000000, 0x010000, 0xd8420bd5 ); ROM_LOAD_ODD ( "tp020-2.bin", 0x000000, 0x010000, 0x7222de8e ); #if HD64x180 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound 647180 code */ /* sound CPU is a HD647180 (Z180) with internal ROM - not yet supported */ ROM_LOAD( "hd647180.020", 0x00000, 0x08000, 0x00000000 ); #endif ROM_REGION( 0x100000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp020-4.bin", 0x000000, 0x080000, 0x3ebbe41e ); ROM_LOAD( "tp020-3.bin", 0x080000, 0x080000, 0x2d5e2201 ); ROM_END(); }}; static RomLoadPtr rom_ghox = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x040000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "tp021-01.u10", 0x000000, 0x020000, 0x9e56ac67 ); ROM_LOAD_ODD ( "tp021-02.u11", 0x000000, 0x020000, 0x15cac60f ); #if HD64x180 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound 647180 code */ /* sound CPU is a HD647180 (Z180) with internal ROM - not yet supported */ ROM_LOAD( "hd647180.021", 0x00000, 0x08000, 0x00000000 ); #endif ROM_REGION( 0x100000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp021-03.u36", 0x000000, 0x080000, 0xa15d8e9d ); ROM_LOAD( "tp021-04.u37", 0x080000, 0x080000, 0x26ed1c9a ); ROM_END(); }}; static RomLoadPtr rom_dogyuun = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "tp022_1.r16", 0x000000, 0x080000, 0x72f18907 ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Secondary CPU code */ /* Secondary CPU is a Toaplan marked chip ??? */ // ROM_LOAD( "tp022.mcu", 0x00000, 0x08000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD_GFX_SWAP( "tp022_3.r16", 0x000000, 0x100000, 0x191b595f ) ROM_LOAD_GFX_SWAP( "tp022_4.r16", 0x100000, 0x100000, 0xd58d29ca ) ROM_REGION( 0x400000, REGION_GFX2 | REGIONFLAG_DISPOSE ); ROM_LOAD_GFX_SWAP( "tp022_5.r16", 0x000000, 0x200000, 0xd4c1db45 ) ROM_LOAD_GFX_SWAP( "tp022_6.r16", 0x200000, 0x200000, 0xd48dc74f ) ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "tp022_2.rom", 0x00000, 0x40000, 0x043271b3 ); ROM_END(); }}; static RomLoadPtr rom_kbash = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE_SWAP( "kbash01.bin", 0x000000, 0x080000, 0x2965f81d ); /* Secondary CPU is a Toaplan marked chip, (TS-004-Dash TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z?80 code */ #else ROM_REGION( 0x8000, REGION_USER1 ); #endif ROM_LOAD( "kbash02.bin", 0x00200, 0x07e00, 0x4cd882a1 ); ROM_CONTINUE( 0x00000, 0x00200 ); ROM_REGION( 0x800000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "kbash03.bin", 0x000000, 0x200000, 0x32ad508b ); ROM_LOAD( "kbash05.bin", 0x200000, 0x200000, 0xb84c90eb ); ROM_LOAD( "kbash04.bin", 0x400000, 0x200000, 0xe493c077 ); ROM_LOAD( "kbash06.bin", 0x600000, 0x200000, 0x9084b50a ); ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "kbash07.bin", 0x00000, 0x40000, 0x3732318f ); ROM_END(); }}; static RomLoadPtr rom_tatsujn2 = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "tsj2rom1.bin", 0x000000, 0x080000, 0xf5cfe6ee ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Secondary CPU code */ /* Secondary CPU is a Toaplan marked chip ??? */ // ROM_LOAD( "tp024.mcu", 0x00000, 0x08000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tsj2rom4.bin", 0x000000, 0x100000, 0x805c449e ); ROM_LOAD( "tsj2rom3.bin", 0x100000, 0x100000, 0x47587164 ); ROM_REGION( 0x80000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "tsj2rom2.bin", 0x00000, 0x80000, 0xf2f6cae4 ); ROM_END(); }}; static RomLoadPtr rom_pipibibs = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x040000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "tp025-1.bin", 0x000000, 0x020000, 0xb2ea8659 ); ROM_LOAD_ODD ( "tp025-2.bin", 0x000000, 0x020000, 0xdc53b939 ); ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z80 code */ ROM_LOAD( "tp025-5.bin", 0x0000, 0x8000, 0xbf8ffde5 ); ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp025-4.bin", 0x000000, 0x100000, 0xab97f744 ); ROM_LOAD( "tp025-3.bin", 0x100000, 0x100000, 0x7b16101e ); ROM_END(); }}; static RomLoadPtr rom_whoopee = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x040000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "whoopee.1", 0x000000, 0x020000, 0x28882e7e ); ROM_LOAD_ODD ( "whoopee.2", 0x000000, 0x020000, 0x6796f133 ); ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z80 code */ /* sound CPU is a HD647180 (Z180) with internal ROM - not yet supported */ /* use the Z80 version from the bootleg Pipi & Bibis set for now */ ROM_LOAD( "hd647180.025", 0x00000, 0x08000, BADCRC( 0x101c0358 )); ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp025-4.bin", 0x000000, 0x100000, 0xab97f744 ); ROM_LOAD( "tp025-3.bin", 0x100000, 0x100000, 0x7b16101e ); ROM_END(); }}; static RomLoadPtr rom_pipibibi = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x040000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "ppbb06.bin", 0x000000, 0x020000, 0x14c92515 ); ROM_LOAD_ODD ( "ppbb05.bin", 0x000000, 0x020000, 0x3d51133c ); ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z80 code */ ROM_LOAD( "ppbb08.bin", 0x0000, 0x8000, 0x101c0358 ); ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); /* GFX data differs slightly from Toaplan boards ??? */ ROM_LOAD_GFX_EVEN( "ppbb01.bin", 0x000000, 0x080000, 0x0fcae44b ) ROM_LOAD_GFX_ODD ( "ppbb02.bin", 0x000000, 0x080000, 0x8bfcdf87 ) ROM_LOAD_GFX_EVEN( "ppbb03.bin", 0x100000, 0x080000, 0xabdd2b8b ) ROM_LOAD_GFX_ODD ( "ppbb04.bin", 0x100000, 0x080000, 0x70faa734 ) ROM_REGION( 0x8000, REGION_USER1 ); /* ??? Some sort of table */ ROM_LOAD( "ppbb07.bin", 0x0000, 0x8000, 0x456dd16e ); ROM_END(); }}; static RomLoadPtr rom_fixeight = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE_SWAP( "tp-026-1", 0x000000, 0x080000, 0xf7b1746a ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Secondary CPU code */ /* Secondary CPU is a Toaplan marked chip, (TS-001-Turbo TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ // ROM_LOAD( "tp-026.mcu", 0x0000, 0x8000, 0x00000000 ); #endif ROM_REGION( 0x400000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp-026-3", 0x000000, 0x200000, 0xe5578d98 ); ROM_LOAD( "tp-026-4", 0x200000, 0x200000, 0xb760cb53 ); ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "tp-026-2", 0x00000, 0x40000, 0x85063f1f ); ROM_REGION( 0x80, REGION_USER1 ); /* Serial EEPROM (93C45) connected to Secondary CPU */ ROM_LOAD( "93c45.u21", 0x00, 0x80, 0x40d75df0 ); ROM_END(); }}; static RomLoadPtr rom_grindstm = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "01.bin", 0x000000, 0x080000, 0x99af8749 ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound CPU code */ /* Secondary CPU is a Toaplan marked chip, (TS-007-Spy TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ // ROM_LOAD( "tp027.mcu", 0x8000, 0x8000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp027_02.bin", 0x000000, 0x100000, 0x877b45e8 ); ROM_LOAD( "tp027_03.bin", 0x100000, 0x100000, 0xb1fc6362 ); ROM_END(); }}; static RomLoadPtr rom_vfive = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "tp027_01.bin", 0x000000, 0x080000, 0x98dd1919 ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound CPU code */ /* Secondary CPU is a Toaplan marked chip, (TS-007-Spy TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ // ROM_LOAD( "tp027.mcu", 0x8000, 0x8000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp027_02.bin", 0x000000, 0x100000, 0x877b45e8 ); ROM_LOAD( "tp027_03.bin", 0x100000, 0x100000, 0xb1fc6362 ); ROM_END(); }}; static RomLoadPtr rom_batsugun = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "tp030_1.bin", 0x000000, 0x080000, 0xe0cd772b ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound CPU code */ /* Secondary CPU is a Toaplan marked chip, (TS-007-Spy TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ // ROM_LOAD( "tp030.mcu", 0x8000, 0x8000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp030_5.bin", 0x000000, 0x100000, 0xbcf5ba05 ); ROM_LOAD( "tp030_6.bin", 0x100000, 0x100000, 0x0666fecd ); ROM_REGION( 0x400000, REGION_GFX2 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp030_3l.bin", 0x000000, 0x100000, 0x3024b793 ); ROM_LOAD( "tp030_3h.bin", 0x100000, 0x100000, 0xed75730b ); ROM_LOAD( "tp030_4l.bin", 0x200000, 0x100000, 0xfedb9861 ); ROM_LOAD( "tp030_4h.bin", 0x300000, 0x100000, 0xd482948b ); ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "tp030_2.bin", 0x00000, 0x40000, 0x276146f5 ); ROM_END(); }}; static RomLoadPtr rom_batugnsp = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE( "tp030-sp.u69", 0x000000, 0x080000, 0xaeca7811 ); #if Zx80 ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound CPU code */ /* Secondary CPU is a Toaplan marked chip, (TS-007-Spy TOA PLAN) */ /* Its a Z?80 of some sort - 94 pin chip. */ // ROM_LOAD( "tp030.mcu", 0x8000, 0x8000, 0x00000000 ); #endif ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp030_5.bin", 0x000000, 0x100000, 0xbcf5ba05 ); ROM_LOAD( "tp030_6.bin", 0x100000, 0x100000, 0x0666fecd ); ROM_REGION( 0x400000, REGION_GFX2 | REGIONFLAG_DISPOSE ); ROM_LOAD( "tp030_3l.bin", 0x000000, 0x100000, 0x3024b793 ); ROM_LOAD( "tp030_3h.bin", 0x100000, 0x100000, 0xed75730b ); ROM_LOAD( "tp030_4l.bin", 0x200000, 0x100000, 0xfedb9861 ); ROM_LOAD( "tp030_4h.bin", 0x300000, 0x100000, 0xd482948b ); ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "tp030_2.bin", 0x00000, 0x40000, 0x276146f5 ); ROM_END(); }}; static RomLoadPtr rom_snowbro2 = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE_SWAP( "pro-4", 0x000000, 0x080000, 0x4c7ee341 ); ROM_REGION( 0x300000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "rom2-l", 0x000000, 0x100000, 0xe9d366a9 ); ROM_LOAD( "rom2-h", 0x100000, 0x080000, 0x9aab7a62 ); ROM_LOAD( "rom3-l", 0x180000, 0x100000, 0xeb06e332 ); ROM_LOAD( "rom3-h", 0x280000, 0x080000, 0xdf4a952a ); ROM_REGION( 0x80000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "rom4", 0x00000, 0x80000, 0x638f341e ); ROM_END(); }}; /* -------------------------- Raizing games ------------------------- */ static RomLoadPtr rom_mahoudai = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x080000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_WIDE_SWAP( "ra_ma_01.01", 0x000000, 0x080000, 0x970ccc5c ); ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z80 code */ ROM_LOAD( "ra_ma_01.02", 0x00000, 0x10000, 0xeabfa46d ); ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "ra_ma_01.03", 0x000000, 0x100000, 0x54e2bd95 ); ROM_LOAD( "ra_ma_01.04", 0x100000, 0x100000, 0x21cd378f ); ROM_REGION( 0x008000, REGION_GFX2 | REGIONFLAG_DISPOSE ); ROM_LOAD( "ra_ma_01.05", 0x000000, 0x008000, 0xc00d1e80 ); ROM_REGION( 0x40000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "ra_ma_01.06", 0x00000, 0x40000, 0x6edb2ab8 ); ROM_END(); }}; static RomLoadPtr rom_shippumd = new RomLoadPtr(){ public void handler(){ ROM_REGION( 0x100000, REGION_CPU1 ); /* Main 68K code */ ROM_LOAD_EVEN( "ma02rom1.bin", 0x000000, 0x080000, 0xa678b149 ); ROM_LOAD_ODD ( "ma02rom0.bin", 0x000000, 0x080000, 0xf226a212 ); ROM_REGION( 0x10000, REGION_CPU2 ); /* Sound Z80 code */ ROM_LOAD( "ma02rom2.bin", 0x00000, 0x10000, 0xdde8a57e ); ROM_REGION( 0x400000, REGION_GFX1 | REGIONFLAG_DISPOSE ); ROM_LOAD( "ma02rom3.bin", 0x000000, 0x200000, 0x0e797142 ); ROM_LOAD( "ma02rom4.bin", 0x200000, 0x200000, 0x72a6fa53 ); ROM_REGION( 0x008000, REGION_GFX2 | REGIONFLAG_DISPOSE ); ROM_LOAD( "ma02rom5.bin", 0x000000, 0x008000, 0x116ae559 ); ROM_REGION( 0x80000, REGION_SOUND1 ); /* ADPCM Samples */ ROM_LOAD( "ma02rom6.bin", 0x00000, 0x80000, 0x199e7cae ); ROM_END(); }}; /* The following is in order of Toaplan Board/game numbers */ /* See list at top of file */ /* Whoopee machine to be changed to Teki Paki when (if) HD647180 is dumped */ /* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME FLAGS ) */ public static GameDriver driver_tekipaki = new GameDriver("1991" ,"tekipaki" ,"toaplan2.java" ,rom_tekipaki,null ,machine_driver_tekipaki ,input_ports_tekipaki ,init_toaplan2 ,ROT0 , "Toaplan", "Teki Paki", GAME_NO_SOUND ) public static GameDriver driver_ghox = new GameDriver("1991" ,"ghox" ,"toaplan2.java" ,rom_ghox,null ,machine_driver_ghox ,input_ports_ghox ,init_toaplan2 ,ROT270 , "Toaplan", "Ghox", GAME_NO_SOUND ) public static GameDriver driver_dogyuun = new GameDriver("1991" ,"dogyuun" ,"toaplan2.java" ,rom_dogyuun,null ,machine_driver_dogyuun ,input_ports_dogyuun ,init_toaplan3 ,ROT270 , "Toaplan", "Dogyuun", GAME_NO_SOUND ) public static GameDriver driver_kbash = new GameDriver("1993" ,"kbash" ,"toaplan2.java" ,rom_kbash,null ,machine_driver_kbash ,input_ports_kbash ,init_toaplan2 ,ROT0_16BIT , "Toaplan", "Knuckle Bash", GAME_NO_SOUND ) public static GameDriver driver_tatsujn2 = new GameDriver("1992" ,"tatsujn2" ,"toaplan2.java" ,rom_tatsujn2,null ,machine_driver_tatsujn2 ,input_ports_tatsujn2 ,init_tatsujn2 ,ROT270 , "Toaplan", "Truxton II / Tatsujin II / Tatsujin Oh (Japan)" ) public static GameDriver driver_pipibibs = new GameDriver("1991" ,"pipibibs" ,"toaplan2.java" ,rom_pipibibs,null ,machine_driver_pipibibs ,input_ports_pipibibs ,init_pipibibs ,ROT0 , "Toaplan", "Pipi & Bibis / Whoopee (Japan)" ) public static GameDriver driver_whoopee = new GameDriver("1991" ,"whoopee" ,"toaplan2.java" ,rom_whoopee,driver_pipibibs ,machine_driver_whoopee ,input_ports_whoopee ,init_pipibibs ,ROT0 , "Toaplan", "Whoopee (Japan) / Pipi & Bibis (World)" ) public static GameDriver driver_pipibibi = new GameDriver("1991" ,"pipibibi" ,"toaplan2.java" ,rom_pipibibi,driver_pipibibs ,machine_driver_pipibibi ,input_ports_pipibibi ,init_pipibibi ,ROT0 , "[Toaplan] Ryouta Kikaku", "Pipi & Bibis / Whoopee (Japan) [bootleg ?]" ) public static GameDriver driver_fixeight = new GameDriver("1992" ,"fixeight" ,"toaplan2.java" ,rom_fixeight,null ,machine_driver_fixeight ,input_ports_vfive ,init_toaplan3 ,ROT270 , "Toaplan", "FixEight", GAME_NOT_WORKING ) public static GameDriver driver_grindstm = new GameDriver("1992" ,"grindstm" ,"toaplan2.java" ,rom_grindstm,driver_vfive ,machine_driver_vfive ,input_ports_grindstm ,init_toaplan3 ,ROT270 , "Toaplan", "Grind Stormer", GAME_NO_SOUND ) public static GameDriver driver_vfive = new GameDriver("1993" ,"vfive" ,"toaplan2.java" ,rom_vfive,null ,machine_driver_vfive ,input_ports_vfive ,init_toaplan3 ,ROT270 , "Toaplan", "V-Five (Japan)", GAME_NO_SOUND ) public static GameDriver driver_batsugun = new GameDriver("1993" ,"batsugun" ,"toaplan2.java" ,rom_batsugun,null ,machine_driver_batsugun ,input_ports_batsugun ,init_toaplan3 ,ROT270_16BIT , "Toaplan", "Batsugun", GAME_NO_SOUND ) public static GameDriver driver_batugnsp = new GameDriver("1993" ,"batugnsp" ,"toaplan2.java" ,rom_batugnsp,driver_batsugun ,machine_driver_batsugun ,input_ports_batsugun ,init_toaplan3 ,ROT270_16BIT , "Toaplan", "Batsugun Special Ver.", GAME_NO_SOUND ) public static GameDriver driver_snowbro2 = new GameDriver("1994" ,"snowbro2" ,"toaplan2.java" ,rom_snowbro2,null ,machine_driver_snowbro2 ,input_ports_snowbro2 ,init_snowbro2 ,ROT0_16BIT , "[Toaplan] Hanafram", "Snow Bros. 2 - With New Elves" ) public static GameDriver driver_mahoudai = new GameDriver("1993" ,"mahoudai" ,"toaplan2.java" ,rom_mahoudai,null ,machine_driver_mahoudai ,input_ports_mahoudai ,null ,ROT270 , "Raizing (Able license)", "Mahou Daisakusen (Japan)" ) public static GameDriver driver_shippumd = new GameDriver("1994" ,"shippumd" ,"toaplan2.java" ,rom_shippumd,null ,machine_driver_shippumd ,input_ports_shippumd ,null ,ROT270 , "Raizing", "Shippu Mahou Daisakusen (Japan)" ) }
true
2b1f8c0fa63fa4f2e550e02929c5c79d285c18bd
Java
Fireserdg/job4j
/chapter_101/src/test/java/ru/job4j/generic/SimpleArrayTest.java
UTF-8
4,240
3.296875
3
[ "Apache-2.0" ]
permissive
package ru.job4j.generic; import org.junit.Test; import java.util.Iterator; import java.util.NoSuchElementException; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; /** * Test class for check Simple Array. * * @author Sergey Filippov ([email protected]). * @version $Id$. * @since 06.08.2018. */ public class SimpleArrayTest { @Test public void whenAddItemInArray() { SimpleArray<Integer> array = new SimpleArray<>(10); array.add(1); array.add(2); array.add(3); array.add(4); array.add(5); int result = array.get(2); assertThat(result, is(3)); } @Test public void whenDeleteItemFromTheArray() { SimpleArray<Integer> array = new SimpleArray<>(5); array.add(1); array.add(2); array.add(3); array.add(4); array.add(5); array.delete(0); int result = array.get(0); assertThat(result, is(2)); } @Test public void whenDeleteLastItemAndAfterThatAddItem() { SimpleArray<Integer> array = new SimpleArray<>(4); array.add(1); array.add(2); array.add(3); array.add(4); array.delete(3); array.add(10); int result = array.get(3); assertThat(result, is(10)); } @Test public void whenGetItemByIndexAndResultTrue() { SimpleArray<String> array = new SimpleArray<>(4); array.add("1"); array.add("2"); array.add("3"); String result = array.get(2); assertThat(result, is("3")); } @Test public void whenSetNewItemInArray() { SimpleArray<String> array = new SimpleArray<>(4); array.add("1"); array.add("2"); array.add("3"); array.add("4"); array.set(1, "8"); assertThat(array.get(1), is("8")); } @Test public void whenAddFourItemInArrayAndWantShowResult() { SimpleArray<String> array = new SimpleArray<>(10); array.add("1"); array.add("2"); array.add("3"); array.add("4"); assertThat(array.toString(), is("[1, 2, 3, 4]")); } @Test public void whenIterateSimpleArrayEachItem() { SimpleArray<Integer> array = new SimpleArray<>(4); array.add(1); array.add(2); array.add(3); array.add(4); Iterator<Integer> iter = array.iterator(); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(1)); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(2)); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(3)); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(4)); assertThat(iter.hasNext(), is(false)); } @Test (expected = NoSuchElementException.class) public void invocationOfNextMethodShouldThrowNoSuchElementException() { SimpleArray<Integer> array = new SimpleArray<>(3); array.add(1); array.add(2); array.add(3); Iterator<Integer> iter = array.iterator(); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(1)); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(2)); assertThat(iter.hasNext(), is(true)); assertThat(iter.next(), is(3)); iter.next(); } @Test (expected = ArrayIndexOutOfBoundsException.class) public void whenAddElementAndShouldException() { SimpleArray<Integer> array = new SimpleArray<>(4); array.add(1); array.add(2); array.add(3); array.add(4); array.add(5); } @Test (expected = IndexOutOfBoundsException.class) public void whenGetItemByIndexAndShouldException() { SimpleArray<Double> array = new SimpleArray<>(3); array.add(1.0); array.add(2.0); array.add(3.0); array.get(3); } @Test (expected = IndexOutOfBoundsException.class) public void whenDeleteItemByIndexAndShouldException() { SimpleArray<Character> array = new SimpleArray<>(3); array.add('A'); array.add('B'); array.add('C'); array.delete(3); } }
true
2cb85149c318c0c582a07323310ce3618da10233
Java
aniket00197/ankysoft
/src/main/java/controller/FunctionListController.java
UTF-8
746
2.21875
2
[]
no_license
package controller; import applicationui.MainScreen; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; public class FunctionListController { @FXML Button button; @FXML public void setUI(ActionEvent event) { button = (Button) event.getSource(); if(button.getText().equals("Wealth")) { //MainScreen.mainRoot.setCenter(MainScreen.wealth.wealthUI()); System.out.println("Wealth"); } if(button.getText().equals("Health")) { //MainScreen.mainRoot.setCenter(MainScreen.health.healthUI()); System.out.println("Health"); } if(button.getText().equals("Report")) { System.out.println("Report"); } } }
true
708c694b0ae4b651aca0e05f19dd8664d72e57aa
Java
edersonjseder/beautyfit
/beautyfit_oauth2/src/main/java/br/com/beautyfit/Application.java
UTF-8
2,332
2.140625
2
[]
no_license
package br.com.beautyfit; import javax.annotation.PostConstruct; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.jdbc.core.JdbcTemplate; @SpringBootApplication @ComponentScan(basePackages = { "br.com.beautyfit" }) public class Application extends SpringBootServletInitializer { private static final String CREATE_OAUTH_ACCESS_TOKEN_SQL = "create table if not exists oauth_access_token ("+ "token_id VARCHAR(256),"+ "token blob,"+ "authentication_id VARCHAR(256) PRIMARY KEY,"+ "user_name VARCHAR(256),"+ "client_id VARCHAR(256),"+ "authentication blob,"+ "refresh_token VARCHAR(256)"+ ");"; private static final String DROP_TABLE_TOKEN = "DROP TABLE IF EXISTS oauth_access_token;"; private static final String DELETE_TOKENS_SQL = "delete from oauth_access_token"; private static final String DELETE_DATA_SQL = "delete from user"; private static final String INSERT_DATA = "INSERT INTO user(user_id, email, password, username, user_role_id)" + "VALUES (null, '[email protected]', 'admin', 'admin', null);"; @Autowired private DataSource dataSource; @PostConstruct public void setUpTokenDatasource() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.execute(DROP_TABLE_TOKEN); jdbcTemplate.execute(CREATE_OAUTH_ACCESS_TOKEN_SQL); jdbcTemplate.execute(DELETE_TOKENS_SQL); jdbcTemplate.execute(DELETE_DATA_SQL); jdbcTemplate.execute(INSERT_DATA); } public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
true
323ac751ca6e58eafc39ab1c862c779baeec3b04
Java
meryathadt/test-jenkon-digitoll-services-dev
/commons/src/main/java/com/digitoll/commons/kapsch/response/VignetteRegistrationResponseContent.java
UTF-8
2,174
2.359375
2
[]
no_license
package com.digitoll.commons.kapsch.response; import com.digitoll.commons.model.Vehicle; import com.digitoll.commons.model.VignettePrice; import com.digitoll.commons.kapsch.classes.EVignetteProduct; import com.digitoll.commons.kapsch.classes.VignettePurchase; import com.digitoll.commons.kapsch.classes.VignetteValidity; import java.util.Objects; public class VignetteRegistrationResponseContent { private String id; private EVignetteProduct product; private Integer status; private Vehicle vehicle; private VignetteValidity validity; private VignettePrice price; private VignettePurchase purchase; public String getId() { return id; } public void setId(String id) { this.id = id; } public EVignetteProduct getProduct() { return product; } public void setProduct(EVignetteProduct product) { this.product = product; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Vehicle getVehicle() { return vehicle; } public void setVehicle(Vehicle vehicle) { this.vehicle = vehicle; } public VignetteValidity getValidity() { return validity; } public void setValidity(VignetteValidity validity) { this.validity = validity; } public VignettePrice getPrice() { return price; } public void setPrice(VignettePrice price) { this.price = price; } public VignettePurchase getPurchase() { return purchase; } public void setPurchase(VignettePurchase purchase) { this.purchase = purchase; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; VignetteRegistrationResponseContent that = (VignetteRegistrationResponseContent) o; return Objects.equals(id, that.id) && Objects.equals(product, that.product) && Objects.equals(status, that.status) && Objects.equals(vehicle, that.vehicle) && Objects.equals(validity, that.validity) && Objects.equals(price, that.price) && Objects.equals(purchase, that.purchase); } @Override public int hashCode() { return Objects.hash(id, product, status, vehicle, validity, price, purchase); } }
true
196a6a59cc7958b66a13ee87d6d2d500b6a6b8dd
Java
yuta-pharmacy2359/Java_Object
/第2章/src/sample/ExecToString.java
UTF-8
235
2.328125
2
[]
no_license
package sample; import java.time.LocalDate; public class ExecToString { public static void main(String[] args) { Product p1 = new Product("A100", "XenPad", 35760, LocalDate.of(2016, 9, 16), true); System.out.println(p1); } }
true
29ac7d387582df3089ea1bbed102acf573ff3e5e
Java
shiyuneau/mobileback
/admin/src/main/java/com/sy/mobileback/web/core/config/FileConfig.java
UTF-8
774
1.90625
2
[]
no_license
package com.sy.mobileback.web.core.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author shiyu * @Description * @create 2019-04-06 0:25 */ @Component @ConfigurationProperties(prefix = "mobileback") public class FileConfig { /** * 版本 */ private String version; /** * 上传文件路径 */ private static String profile; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public static String getProfile() { return profile; } public void setProfile(String profile) { FileConfig.profile = profile; } }
true
139b787ebd69fda7cbe15fdc34627ae8b94e5f75
Java
yiyeshua/XXYaYa
/app/src/main/java/com/yiyeshu/xxyaya/ui/fragment/MainFragment.java
UTF-8
1,477
2.09375
2
[]
no_license
package com.yiyeshu.xxyaya.ui.fragment; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.util.Log; import com.yiyeshu.xxyaya.R; import com.yiyeshu.xxyaya.adapter.MainPagerAdapter; import com.yiyeshu.xxyaya.base.BaseFragment; import java.util.ArrayList; import java.util.List; import butterknife.BindView; /** * Created by lhw on 2017/5/18. */ public class MainFragment extends BaseFragment { private static final String TAG = "MainFragment"; @BindView(R.id.sliding_tabs) TabLayout mSlidingTabs; //选项卡标题 @BindView(R.id.viewpager) ViewPager mViewpager; //vierpager页面 private List<String> titles; @Override protected int getContentViewLayoutID() { return R.layout.layout_main_fragment; } @Override protected void setUpView() { titles=new ArrayList<>(); titles.add("书籍"); titles.add("电影"); } @Override protected void setUpData() { MainPagerAdapter mainFraViewAdapter=new MainPagerAdapter(getChildFragmentManager(),getContext(),titles); // mViewpager.setOffscreenPageLimit(0); mViewpager.setAdapter(mainFraViewAdapter); mSlidingTabs.setTabMode(TabLayout.MODE_FIXED); mSlidingTabs.setupWithViewPager(mViewpager); } @Override public void onDestroy() { super.onDestroy(); Log.e(TAG, "onDestroy: " + "0000000000000000000"); } }
true
07c98ad829421e10b4b89f65490153e2b27a5637
Java
CalinDS/Planner
/server/src/main/java/server/convert/EventConvertor.java
UTF-8
987
2.53125
3
[]
no_license
package server.convert; import lib.dto.EventDto; import server.model.Event; import server.model.Reminder; import server.model.User; import java.util.ArrayList; import java.util.List; public final class EventConvertor { private EventConvertor() { } public static Event convert(EventDto eventDto) { var event = new Event(); event.setId(eventDto.getId()); event.setTime(eventDto.getTime()); event.setTitle(eventDto.getTitle()); return event; } public static EventDto convert(Event event) { var eventDto = new EventDto(event.getTitle(), event.getTime()); System.out.println(event); eventDto.setId(event.getId()); eventDto.setUserId(event.getUser().getId()); List<Integer> reminderIds = new ArrayList<>(); for (Reminder r : event.getReminders()) { reminderIds.add(r.getId()); } eventDto.setReminderIds(reminderIds); return eventDto; } }
true
f6ce134eb7469992244393822cb7422758e08232
Java
chieping/typesafe_config_sample
/src/main/java/com/honda/Main.java
UTF-8
1,230
2.890625
3
[]
no_license
import com.typesafe.config.*; public class Main { public static void main(String... args) throws Exception { Main.class.getMethod(args[0], null).invoke(null); } public static void load() { Config conf = ConfigFactory.load(); System.out.println("The answer is: " + conf.getString("simple-app.answer")); System.out.println("dynamodb.table_name_prefix: " + conf.getString("dynamodb.table_name_prefix")); } public static void getString() { Config conf = ConfigFactory.parseString("sample=hoge, fuga=moge"); System.out.println(conf.getString("sample")); System.out.println(conf.getString("fuga")); Config conf2 = ConfigFactory.parseString("sample2=\"double\\\"quote\", sample3=\"includes,comma\", sample4=\"includes=equal\""); System.out.println(conf2.getString("sample2")); System.out.println(conf2.getString("sample3")); System.out.println(conf2.getString("sample4")); Config conf3 = ConfigFactory.parseString("sample.sample5=nested_value"); System.out.println(conf3.getString("sample.sample5")); Config conf4 = ConfigFactory.parseString("sample=[list1, list2]"); // Config conf4 = ConfigFactory.parseString("sample.0=list1, sample.1=list2"); System.out.println(conf4.getList("sample")); } }
true
658677b6115fe3d2ea82037468874c530978bdd5
Java
Sakthiben/testAndReport
/src/main/java/com/karya/bean/StockEntryBean.java
UTF-8
2,035
2.40625
2
[]
no_license
package com.karya.bean; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotEmpty; public class StockEntryBean { private int stockid; //@NotNull //@NotEmpty(message = "Please enter the material request") private String materialrequest; private String date; private int itemid; //@NotNull //@NotEmpty(message = "Please enter quantity") private int Quantity; // @NotNull // @NotEmpty(message = "Please enter transfered quantity") private double TransferedQty ; // @NotNull //@NotEmpty(message = "Please enter qtytotransfer") private double Qtytotransfer; //@NotNull //@NotEmpty(message = "Please enter description") private String description; @NotNull @NotEmpty(message = "Please enter company") private String Company; public int getItemid() { return itemid; } public void setItemid(int itemid) { this.itemid = itemid; } public int getStockid() { return stockid; } public void setStockid(int stockid) { this.stockid = stockid; } public String getMaterialrequest() { return materialrequest; } public void setMaterialrequest(String materialrequest) { this.materialrequest = materialrequest; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public double getTransferedQty() { return TransferedQty; } public void setTransferedQty(double transferedQty) { TransferedQty = transferedQty; } public double getQtytotransfer() { return Qtytotransfer; } public int getQuantity() { return Quantity; } public void setQuantity(int quantity) { Quantity = quantity; } public void setQtytotransfer(double qtytotransfer) { Qtytotransfer = qtytotransfer; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getCompany() { return Company; } public void setCompany(String company) { Company = company; } }
true
dc79c0ab810c8167c72268ef8d0550523082caba
Java
harshitha20/quizQuestion1
/src/main/java/org/codejudge/sb/controller/exception/QuizNotFoundException.java
UTF-8
321
1.945313
2
[]
no_license
package org.codejudge.sb.controller.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class QuizNotFoundException extends RuntimeException{ public QuizNotFoundException() { super(); } }
true
f8cf1249d37e455b6deb8d5a4cab74643cf9d6bf
Java
thoratou/sbs
/sbs-core/src/main/java/screen/tools/sbs/component/ComponentLibrary.java
UTF-8
3,185
1.929688
2
[]
no_license
/***************************************************************************** * This source file is part of SBS (Screen Build System), * * which is a component of Screen Framework * * * * Copyright (c) 2008-2013 Ratouit Thomas * * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 3 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 Lesser * * General Public License for more details. * * * * You should have received a copy of the GNU Lesser 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, or go to * * http://www.gnu.org/copyleft/lesser.txt. * *****************************************************************************/ package screen.tools.sbs.component; import screen.tools.sbs.fields.FieldFactory; import screen.tools.sbs.fields.FieldString; import screen.tools.sbs.fields.interfaces.FieldBuildModeInterface; import screen.tools.sbs.fields.interfaces.FieldLibraryNameInterface; import screen.tools.sbs.fields.interfaces.FieldToolChainInterface; import screen.tools.sbs.objects.Entry; public class ComponentLibrary implements Entry<ComponentLibrary>, FieldLibraryNameInterface, FieldToolChainInterface, FieldBuildModeInterface { private FieldString libraryName; private FieldString toolChain; private FieldString buildMode; public ComponentLibrary(){ libraryName = FieldFactory.createMandatoryFieldString(); toolChain = FieldFactory.createOptionalFieldString("all"); buildMode = FieldFactory.createOptionalFieldString("all"); } public ComponentLibrary(ComponentLibrary library) { libraryName = library.libraryName.copy(); toolChain = library.toolChain.copy(); buildMode = library.buildMode.copy(); } @Override public FieldString getLibraryName() { return libraryName; } @Override public FieldString getToolChain() { return toolChain; } @Override public FieldString getBuildMode() { return buildMode; } @Override public void merge(ComponentLibrary library) { libraryName.merge(library.libraryName); toolChain.merge(library.toolChain); buildMode.merge(library.buildMode); } @Override public ComponentLibrary copy() { return new ComponentLibrary(this); } }
true
9341e6add64a524813222105653b07896f6b32e3
Java
u10k/JavaBase
/io/src/test/java/com/github/kuangcp/PropertiesTest.java
UTF-8
876
2.46875
2
[ "MIT" ]
permissive
package com.github.kuangcp; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Properties; import lombok.extern.slf4j.Slf4j; import org.junit.Test; /** * @author kuangcp on 18-8-21-下午4:51 */ @Slf4j public class PropertiesTest { @Test public void testRead() throws IOException { Properties properties = new Properties(); // String path = Properties.class.getResource("./properties/main.properties").getPath(); System.out.println(new File("").getAbsolutePath()); properties.load(new FileInputStream("src/test/resources/properties/main.properties")); String a = properties.getProperty("A"); String b = new String(properties.getProperty("B").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); log.info("a={} b={}", a, b); } }
true
3ce5f4ceb5eaf9bfded8148b798411c858b25c0b
Java
alldatacenter/alldata
/lake/paimon/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/BinaryRowTypeSerializerTest.java
UTF-8
1,810
1.898438
2
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 org.apache.paimon.flink; import org.apache.paimon.data.BinaryRow; import org.apache.flink.api.common.typeutils.SerializerTestBase; import org.apache.flink.api.common.typeutils.TypeSerializer; import java.util.Random; import static org.apache.paimon.io.DataFileTestUtils.row; /** Test for {@link BinaryRowTypeSerializer}. */ public class BinaryRowTypeSerializerTest extends SerializerTestBase<BinaryRow> { @Override protected TypeSerializer<BinaryRow> createSerializer() { return new BinaryRowTypeSerializer(2); } @Override protected int getLength() { return -1; } @Override protected Class<BinaryRow> getTypeClass() { return BinaryRow.class; } @Override protected BinaryRow[] getTestData() { Random rnd = new Random(); return new BinaryRow[] { row(1, 1), row(2, 2), row(rnd.nextInt(), rnd.nextInt()), row(rnd.nextInt(), rnd.nextInt()) }; } }
true
1835da7673a7678c6c3da86a44a6b8b2e2e5637a
Java
dzzhyk/excel-upload
/src/main/java/com/yankaizhang/excel/response/LayuiResult.java
UTF-8
744
2.140625
2
[ "MIT" ]
permissive
package com.yankaizhang.excel.response; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; import java.util.List; /** * layui-table响应体 */ @Data @AllArgsConstructor @NoArgsConstructor @ToString public class LayuiResult <T> { private static final int SUCCESS = 0; private static final int FAILED = -1; private int code; private String msg; private long count; private List<T> data; public static <T> LayuiResult<T> success(long count, List<T> data){ return new LayuiResult<T>(SUCCESS, "", count, data); } public static <T> LayuiResult <T> failed(String msg){ return new LayuiResult<T>(FAILED, msg, 0, null); } }
true
bef895c4cb262dcb81fb05ebe5ab070a26d171af
Java
ro0sterjam/cracking-the-coding-interview
/src/test/java/com/ro0sterjam/ctci/LinkedListTest.java
UTF-8
12,060
3.140625
3
[]
no_license
package com.ro0sterjam.ctci; import org.junit.Test; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import static com.ro0sterjam.ctci.LinkedList.*; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; /** * Created by kenwang on 2016-03-13. */ public class LinkedListTest { @Test public void testRemoveDuplicates_emptyList() { LinkedList<Integer> list = new LinkedList<>(); list.removeDuplicates(); assertArrayEquals(new Integer[0], list.toArray()); } @Test public void testRemoveDuplicates_singleElement() { LinkedList<Integer> list = LinkedList.of(4); list.removeDuplicates(); assertArrayEquals(new Integer[]{4}, list.toArray()); } @Test public void testRemoveDuplicates_twoUniqueElements() { LinkedList<Integer> list = LinkedList.of(4, 7); list.removeDuplicates(); assertArrayEquals(new Integer[]{4, 7}, list.toArray()); } @Test public void testRemoveDuplicates_twoSameElements() { LinkedList<Integer> list = LinkedList.of(4, 4); list.removeDuplicates(); assertArrayEquals(new Integer[]{4}, list.toArray()); } @Test public void testRemoveDuplicates_twoSameElementsPlusOtherUniqueElements() { LinkedList<Integer> list = LinkedList.of(4, 3, 8, 4, 9); list.removeDuplicates(); assertArrayEquals(new Integer[]{4, 3, 8, 9}, list.toArray()); } @Test public void testRemoveDuplicates_multipleOfSameElementPlusOtherUniqueElements() { LinkedList<Integer> list = LinkedList.of(4, 3, 8, 4, 9, 4, 7, 4); list.removeDuplicates(); assertArrayEquals(new Integer[]{4, 3, 8, 9, 7}, list.toArray()); } @Test public void testRemoveDuplicates_multipleDuplicates() { LinkedList<Integer> list = LinkedList.of(4, 3, 8, 4, 3, 4, 7, 4); list.removeDuplicates(); assertArrayEquals(new Integer[]{4, 3, 8, 7}, list.toArray()); } @Test public void testRemoveDuplicates_multipleDuplicatesSideBySide() { LinkedList<Integer> list = LinkedList.of(4, 4, 8, 3, 3, 3, 7, 9); list.removeDuplicates(); assertArrayEquals(new Integer[]{4, 8, 3, 7, 9}, list.toArray()); } @Test(expected = IndexOutOfBoundsException.class) public void testReverseGet_emptyList() { LinkedList<Integer> list = new LinkedList<>(); list.reverseGet(0); } @Test public void testReverseGet_singleElement() { LinkedList<Integer> list = LinkedList.of(5); assertThat(list.reverseGet(0), is(5)); } @Test(expected = IndexOutOfBoundsException.class) public void testReverseGet_negativeIndex() { LinkedList<Integer> list = LinkedList.of(5); list.reverseGet(-1); } @Test(expected = IndexOutOfBoundsException.class) public void testReverseGet_indexOutOfBounds() { LinkedList<Integer> list = LinkedList.of(5); list.reverseGet(1); } @Test public void testReverseGet_lastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.reverseGet(0), is(1)); } @Test public void testReverseGet_secondLastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.reverseGet(1), is(2)); } @Test public void testReverseGet_thirdLastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.reverseGet(2), is(3)); } @Test(expected = IndexOutOfBoundsException.class) public void testGet_emptyList() { LinkedList<Integer> list = new LinkedList<>(); list.get(0); } @Test public void testGet_singleElement() { LinkedList<Integer> list = LinkedList.of(5); assertThat(list.get(0), is(5)); } @Test public void testGet_negativeIndex() { LinkedList<Integer> list = LinkedList.of(5); assertThat(list.get(-1), is(5)); } @Test(expected = IndexOutOfBoundsException.class) public void testGet_indexOutOfBounds() { LinkedList<Integer> list = LinkedList.of(5); list.get(1); } @Test(expected = IndexOutOfBoundsException.class) public void testGet_negativeIndexOutOfBounds() { LinkedList<Integer> list = LinkedList.of(5); list.get(-2); } @Test public void testGet_firstElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(0), is(5)); } @Test public void testGet_secondElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(1), is(4)); } @Test public void testGet_thirdElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(2), is(3)); } @Test public void testGet_lastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(-1), is(1)); } @Test public void testGet_secondLastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(-2), is(2)); } @Test public void testGet_thirdLastElement() { LinkedList<Integer> list = LinkedList.of(5, 4, 3, 2, 1); assertThat(list.get(-3), is(3)); } @Test public void testPartition_emptyList() { LinkedList<Integer> list = new LinkedList<>(); partition(list, 7); assertArrayEquals(new Integer[0], list.toArray()); } @Test public void testPartition_singleElement() { LinkedList<Integer> list = LinkedList.of(2); partition(list, 7); assertArrayEquals(new Integer[]{2}, list.toArray()); } @Test public void testPartition_allElementsSmaller() { LinkedList<Integer> list = LinkedList.of(7, 3, 4, 2, 9, 23, 11); Set<Integer> lt = new HashSet<>(Arrays.asList(7, 3, 4, 2, 9, 23, 11)); Set<Integer> ge = new HashSet<>(Arrays.asList()); partition(list, 55); assertPartitions(list, lt, ge); } @Test public void testPartition_allElementsLarger() { LinkedList<Integer> list = LinkedList.of(7, 3, 4, 2, 9, 23, 11); Set<Integer> lt = new HashSet<>(Arrays.asList()); Set<Integer> ge = new HashSet<>(Arrays.asList(7, 3, 4, 2, 9, 23, 11)); partition(list, 1); assertPartitions(list, lt, ge); } @Test public void testPartition_middlePartition() { LinkedList<Integer> list = LinkedList.of(7, 3, 4, 2, 9, 23, 11); Set<Integer> lt = new HashSet<>(Arrays.asList(3, 4, 2)); Set<Integer> ge = new HashSet<>(Arrays.asList(7, 9, 23, 11)); partition(list, 7); assertPartitions(list, lt, ge); } @Test public void testPartition_middlePartitionAndElementNotInList() { LinkedList<Integer> list = LinkedList.of(7, 3, 4, 2, 9, 23, 11); Set<Integer> lt = new HashSet<>(Arrays.asList(7, 3, 4, 2, 9)); Set<Integer> ge = new HashSet<>(Arrays.asList(23, 11)); partition(list, 10); assertPartitions(list, lt, ge); } @Test public void testReverseSum_emptyLists() { LinkedList<Integer> list1 = new LinkedList<>(); LinkedList<Integer> list2 = new LinkedList<>(); assertArrayEquals(new Integer[0], reverseSum(list1, list2).toArray()); } @Test public void testReverseSum_equalLengthsNoCarries() { LinkedList<Integer> list1 = LinkedList.of(1, 2, 3, 4); LinkedList<Integer> list2 = LinkedList.of(4, 3, 2, 1); assertArrayEquals(new Integer[]{ 5, 5, 5, 5 }, reverseSum(list1, list2).toArray()); } @Test public void testReverseSum_equalLengthsWithCarries() { LinkedList<Integer> list1 = LinkedList.of(7, 9, 3, 6); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 1, 3, 2, 5, 1 }, reverseSum(list1, list2).toArray()); } @Test public void testReverseSum_differentLengths() { LinkedList<Integer> list1 = LinkedList.of(7, 9, 3, 6, 4, 5, 3); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 1, 3, 2, 5, 5, 5, 3 }, reverseSum(list1, list2).toArray()); } @Test public void testReverseSum_cascadedCarry() { LinkedList<Integer> list1 = LinkedList.of(7, 6, 3, 6); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 1, 0, 2, 5, 1 }, reverseSum(list1, list2).toArray()); } @Test public void testSum_emptyLists() { LinkedList<Integer> list1 = new LinkedList<>(); LinkedList<Integer> list2 = new LinkedList<>(); assertArrayEquals(new Integer[0], sum(list1, list2).toArray()); } @Test public void testSum_ofZero() { LinkedList<Integer> list1 = LinkedList.of(0); LinkedList<Integer> list2 = LinkedList.of(0); assertArrayEquals(new Integer[]{ 0 }, sum(list1, list2).toArray()); } @Test public void testSum_oneEmpty() { LinkedList<Integer> list1 = LinkedList.of(1, 2, 3, 4); LinkedList<Integer> list2 = new LinkedList<>(); assertArrayEquals(new Integer[]{ 1, 2, 3, 4 }, sum(list1, list2).toArray()); } @Test public void testSum_equalLengthsNoCarries() { LinkedList<Integer> list1 = LinkedList.of(1, 2, 3, 4); LinkedList<Integer> list2 = LinkedList.of(4, 3, 2, 1); assertArrayEquals(new Integer[]{ 5, 5, 5, 5 }, sum(list1, list2).toArray()); } @Test public void testSum_equalLengthsWithCarries() { LinkedList<Integer> list1 = LinkedList.of(7, 9, 3, 6); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 1, 2, 3, 2, 4 }, sum(list1, list2).toArray()); } @Test public void testSum_differentLengths() { LinkedList<Integer> list1 = LinkedList.of(7, 9, 3, 6, 4, 5, 3); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 7, 9, 4, 0, 8, 4, 1 }, sum(list1, list2).toArray()); } @Test public void testSum_cascadedCarry() { LinkedList<Integer> list1 = LinkedList.of(7, 6, 3, 6); LinkedList<Integer> list2 = LinkedList.of(4, 3, 8, 8); assertArrayEquals(new Integer[]{ 1, 2, 0, 2, 4 }, sum(list1, list2).toArray()); } @Test public void testIsPalindrome_emptyList() { LinkedList<Character> list = new LinkedList<>(); assertTrue(list.isPalindrome()); } @Test public void testIsPalindrome_singleElement() { LinkedList<Character> list = LinkedList.of('f'); assertTrue(list.isPalindrome()); } @Test public void testIsPalindrome_twoSameElements() { LinkedList<Character> list = LinkedList.of('f', 'f'); assertTrue(list.isPalindrome()); } @Test public void testIsPalindrome_twoDifferentElements() { LinkedList<Character> list = LinkedList.of('f', 'e'); assertFalse(list.isPalindrome()); } @Test public void testIsPalindrome_true() { LinkedList<Character> list = LinkedList.of('r', 'a', 'c', 'e', 'c', 'a', 'r'); assertTrue(list.isPalindrome()); } @Test public void testIsPalindrome_false() { LinkedList<Character> list = LinkedList.of('f', 'l', 'a', 'n', 'n', 'e', 'l'); assertFalse(list.isPalindrome()); } private void assertPartitions(LinkedList<Integer> list, Set<Integer> lt, Set<Integer> ge) { for (int i = 0; i < list.size(); i++) { int element = list.get(i); if (!lt.isEmpty()) { assertTrue(lt.contains(element)); lt.remove(element); } else { assertTrue(ge.contains(element)); ge.remove(element); } } assertTrue(lt.isEmpty() && ge.isEmpty()); } }
true
d812f635a8a694640d34196ac18eaeed2a6c9e6c
Java
HamiltonGravito/dio-bootcamp-everis
/src/main/java/com/github/hamiltongravito/citiesapi/countries/CountryResources.java
UTF-8
1,260
2.3125
2
[]
no_license
package com.github.hamiltongravito.citiesapi.countries; import com.github.hamiltongravito.citiesapi.countries.Country; import com.github.hamiltongravito.citiesapi.countries.repository.CountryRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Optional; @RestController @RequestMapping("/countries") public class CountryResources { @Autowired private CountryRepository repository; @GetMapping public Page<Country> countries(Pageable page){ return repository.findAll(page); } @GetMapping("/{id}") public ResponseEntity getOne(@PathVariable Long id){ Optional<Country> country = repository.findById(id); if(country.isPresent()){ return ResponseEntity.ok().body(country.get()); }else { return ResponseEntity.notFound().build(); } } }
true
91ddeefafc2c70c75fbb0b9adbc29f28b7779d36
Java
davidliuzd/spring-boot-v2
/Chapter16/src/main/java/net/liuzd/spring/boot/v2/config/MvcConfiguration.java
UTF-8
1,293
2.234375
2
[ "MIT" ]
permissive
package net.liuzd.spring.boot.v2.config; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.support.WebBindingInitializer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import net.liuzd.spring.boot.v2.config.enums.EnumConverterFactory; @Configuration public class MvcConfiguration implements WebMvcConfigurer, WebBindingInitializer { /** * [get]请求中,将int值转换成枚举类 * @param registry */ @Override public void addFormatters(FormatterRegistry registry) { registry.addConverterFactory(new EnumConverterFactory()); } /** * [GET]请求下,将所有参数的空格trim掉 * 如果前台必须保留空格,前后空格请用%20转移 * @param webDataBinder 数据绑定器 */ @Override @InitBinder public void initBinder(WebDataBinder webDataBinder) { webDataBinder.registerCustomEditor(String.class, new StringTrimmerEditor(false)); } }
true
1b9143d3f1e522cd4895b178141475930438cbc8
Java
saikirank1910/pkmachine
/Event-rest/src/main/java/com/pkrm/event/dao/RegionDaoImpl.java
UTF-8
970
2.28125
2
[]
no_license
package com.pkrm.event.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; import com.pkrm.event.model.Region; @Repository public class RegionDaoImpl implements RegionDao{ private String getAllRegionsSql="SELECT region_id,region_name FROM region"; @Autowired private NamedParameterJdbcTemplate namedParameterJdbcTemplate; public List<Region> getAllRegions() { return namedParameterJdbcTemplate.query(getAllRegionsSql, new RowMapper<Region>() { public Region mapRow(ResultSet resultSet, int index) throws SQLException { Region region = new Region(); region.setRegionId(resultSet.getInt(1)); region.setRegionName(resultSet.getString(2)); return region; } }); } }
true
0f3d33f04e9d232e6c8305e45cb4ff14b998d793
Java
brunofilipe/LS-ISEL
/src/main/java/pt/isel/ls/academicActivities/view/commands/user/GetUsersViewHtml.java
UTF-8
2,964
2.34375
2
[]
no_license
package pt.isel.ls.academicActivities.view.commands.user; import pt.isel.ls.academicActivities.engine.UrlTo; import pt.isel.ls.academicActivities.model.IEntity; import pt.isel.ls.academicActivities.model.Student; import pt.isel.ls.academicActivities.model.Teacher; import pt.isel.ls.academicActivities.utils.Writable; import pt.isel.ls.academicActivities.utils.html.HtmlElem; import pt.isel.ls.academicActivities.utils.html.HtmlPage; import java.io.IOException; import java.io.Writer; import java.util.List; import static pt.isel.ls.academicActivities.utils.html.Html.*; import static pt.isel.ls.academicActivities.utils.html.Html.text; import static pt.isel.ls.academicActivities.utils.html.Html.th; public class GetUsersViewHtml implements Writable { private List<IEntity> users; public GetUsersViewHtml(List<IEntity> users) { this.users = users; } @Override public void writeTo(Writer w) throws IOException { String title = "LS - AcademicActivities"; String header = "Existing users :"; HtmlElem tableBodyUsers = new HtmlElem("tbody"); users.forEach(user -> { if ( user instanceof Teacher ) { Teacher teacher = (Teacher)user; tableBodyUsers.withContent( tr( td(a(UrlTo.teacher(teacher.getTeacherId()), teacher.getTeacherId() +"")), td(text(teacher.getTeacherName())), td(text(teacher.getTeacherEmail())) ) ); } else { Student student = (Student)user; tableBodyUsers.withContent( tr( td(a(UrlTo.student(student.getStudentId()),student.getStudentId() +"")), td(text(student.getStudentName())), td(text(student.getStudentEmail())) ) ); } }); HtmlPage page = new HtmlPage( title, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css", div( h3(text(header)), table( new HtmlElem("thead", tr( th(text("User ID")), th(text("User Name")), th(text("User Email")) ) ), tableBodyUsers ).withAttr("border","4").withAttr("class","table"), p(text("return to the "), a(UrlTo.homepage(),"Homepage")) ).withAttr("class","container") ); page.writeTo(w); } }
true
2542d2d8ace4d62ba3c44cffaea0f0618599327e
Java
piotr-j/tastyjam
/jam/src/io/piotrjastrzebski/jam/ecs/components/rendering/AtlasAssetDef.java
UTF-8
317
1.953125
2
[]
no_license
package io.piotrjastrzebski.jam.ecs.components.rendering; import com.artemis.PooledComponent; import com.badlogic.gdx.graphics.g2d.TextureAtlas; public class AtlasAssetDef extends PooledComponent { public String atlas; public String path; @Override protected void reset () { atlas = null; path = null; } }
true
9401f4c3819384a4fd92ab26dabed9fe75fa6518
Java
kristianloseth/Asciiladden
/Asciiladden/src/asciiladden/Asciiladden.java
UTF-8
296
1.84375
2
[]
no_license
package asciiladden; public class Asciiladden { public static void main(String[] args) throws Exception { GetMinne minne = new GetMinne(args[0]); String streng = minne.getRespons(); System.out.println(streng); minne.getInfo(streng); } }
true
0c40cc64a817a5f39d13d12045b759765fe38c7d
Java
prajwalwakekar/Framework
/FedCapturev1/src/test/java/com/salesforce/utilities/ExcelDataProvider.java
UTF-8
1,121
2.6875
3
[]
no_license
package com.salesforce.utilities; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelDataProvider { XSSFWorkbook wb; public ExcelDataProvider() { File src = new File("./TestData/LoginData.xlsx"); try { FileInputStream fin = new FileInputStream(src); wb = new XSSFWorkbook(fin); } catch (Exception e) { System.out.println("Unable to read file" +e.getMessage()); } } public String getStringData(int sheetIndex, int rowCount, int colCount)// to get value by index { return wb.getSheetAt(sheetIndex).getRow(rowCount).getCell(colCount).getStringCellValue(); } public String getStringData(String sheetName, int rowCount, int colCount) { return wb.getSheet(sheetName).getRow(rowCount).getCell(colCount).getStringCellValue(); } public double getNumericData(String sheetName, int rowCount, int colCount) { return wb.getSheet(sheetName).getRow(rowCount).getCell(colCount).getNumericCellValue(); } }
true
a78bae749f18f888165646ad83cf7b096a767eba
Java
LoganYue/TheProfessionals
/app/src/main/java/professional/team17/com/professional/Activity/AddReview.java
UTF-8
2,601
2.609375
3
[ "Apache-2.0" ]
permissive
/* * AddReview * * April 02, 2018 * * Copyright @ 2018 Team 17, CMPUT 301, University of Alberta - All Rights Reserved. * You may use, distribute, or modify this code under terms and conditions of the Code of Student Behaviour at the University of Alberta. * You can find a copy of the license in the github wiki for this project. */ package professional.team17.com.professional.Activity; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.RatingBar; import android.widget.TextView; import professional.team17.com.professional.Controllers.AddReviewController; import professional.team17.com.professional.R; /** * Allows the user to add a review to a user who has completed a task for them * * @see AddReviewController */ public class AddReview extends AppCompatActivity { private String profile; /** * Initializes the activity and sets listeners for buttons * @param savedInstanceState holds value from intent "profile" */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_review); profile = getIntent().getStringExtra("profile"); final Button submit = findViewById(R.id.submitButton); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onSubmit(); } }); final ImageButton back = findViewById(R.id.backButton); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } /** * retrieves the values from the view and sends them to the AddReviewController * * @see AddReviewController */ private void onSubmit(){ AddReviewController controller = new AddReviewController(this); EditText commentBox = findViewById(R.id.commentBox); RatingBar ratingBar = findViewById(R.id.ratingBar); float rating = ratingBar.getRating(); String comment = commentBox.getText().toString(); if (comment.length() > 300){ TextView errorMessage = findViewById(R.id.errorBox); errorMessage.setText(R.string.charLimit); } else { controller.setReview(profile, rating, comment); finish(); } } }
true
80aa76d6035fd39c02625102f78ed0f458ab26ba
Java
VallamkondaNeelima/ThoughtWorksAssignments
/src/com/thoughtworks/AllocateLab.java
UTF-8
997
3.53125
4
[]
no_license
package com.thoughtworks; import java.util.*; public class AllocateLab { public static void main(String[] args) { // write your code here int labCapacity[] = new int[3]; int studentCount, min = Integer.MAX_VALUE; String allocatedLab = ""; Scanner sc = new Scanner(System.in); for (int i = 0; i < 3; i++) { labCapacity[i] = sc.nextInt(); } studentCount = sc.nextInt(); for (int j = 0; j < 3; j++) { if (studentCount <= labCapacity[j]) { if (labCapacity[j] - studentCount < min) { min = labCapacity[j] - studentCount; allocatedLab = j + 1 + " "; } else if (labCapacity[j] - studentCount == min) allocatedLab += j + 1 + " "; } } if (allocatedLab == "") System.out.println("No Labs are allocated"); else System.out.println(allocatedLab); } }
true
124891f124944a611e49237389849f982d082fd5
Java
CheungChan/litespring
/src/main/java/org/litespring/beans/factory/BeanCreateException.java
UTF-8
809
2.78125
3
[]
no_license
package org.litespring.beans.factory; import org.litespring.beans.BeansException; public class BeanCreateException extends BeansException { private String beanName; public BeanCreateException(String msg) { super(msg); } public BeanCreateException(String msg, Throwable cause) { super(msg, cause); } public BeanCreateException(String beanName, String msg) { super("Error create bean with name " + beanName + ":" + msg); this.beanName = beanName; } public BeanCreateException(String beanName, String msg, Throwable cause) { this(beanName, msg); initCause(cause); } public String getBeanName() { return beanName; } public void setBeanName(String beanName) { this.beanName = beanName; } }
true
2b2b37ea1c3d3d3a13fdc5d19e6261299bf4eb84
Java
bbossgroups/bboss
/bboss-htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java
UTF-8
6,526
2.421875
2
[ "Apache-2.0" ]
permissive
// HTMLParser Library $Name: v1_5 $ - A java-based parser for HTML // http://sourceforge.org/projects/htmlparser // Copyright (C) 2005 Derrick Oswald // // Revision Control Information // // $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/parserapplications/filterbuilder/wrappers/HasSiblingFilterWrapper.java,v $ // $Author: derrickoswald $ // $Date: 2005/04/12 11:27:42 $ // $Revision: 1.2 $ // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // package org.htmlparser.parserapplications.filterbuilder.wrappers; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.htmlparser.Node; import org.htmlparser.NodeFilter; import org.htmlparser.Parser; import org.htmlparser.filters.HasSiblingFilter; import org.htmlparser.parserapplications.filterbuilder.Filter; import org.htmlparser.parserapplications.filterbuilder.SubFilterList; /** * Wrapper for HasSiblingFilters. */ public class HasSiblingFilterWrapper extends Filter implements ActionListener { /** * The underlying filter. */ protected HasSiblingFilter mFilter; /** * The drop target container. */ protected SubFilterList mContainer; /** * Create a wrapper over a new HasParentFilter. */ public HasSiblingFilterWrapper () { mFilter = new HasSiblingFilter (); // add the subfilter container mContainer = new SubFilterList (this, "Sibling Filter", 1); add (mContainer); } // // Filter overrides and concrete implementations // /** * Get the name of the filter. * @return A descriptive name for the filter. */ public String getDescription () { return ("Has Sibling"); } /** * Get the resource name for the icon. * @return The icon resource specification. */ public String getIconSpec () { return ("images/HasSiblingFilter.gif"); } /** * Get the underlying node filter object. * @return The node filter object suitable for serialization. */ public NodeFilter getNodeFilter () { NodeFilter filter; HasSiblingFilter ret; ret = new HasSiblingFilter (); filter = mFilter.getSiblingFilter (); if (null != filter) ret.setSiblingFilter (((Filter)filter).getNodeFilter ()); return (ret); } /** * Assign the underlying node filter for this wrapper. * @param filter The filter to wrap. * @param context The parser to use for conditioning this filter. * Some filters need contextual information to provide to the user, * i.e. for tag names or attribute names or values, * so the Parser context is provided. */ public void setNodeFilter (NodeFilter filter, Parser context) { mFilter = (HasSiblingFilter)filter; } /** * Get the underlying node filter's subordinate filters. * @return The node filter object's contained filters. */ public NodeFilter[] getSubNodeFilters () { NodeFilter filter; NodeFilter[] ret; filter = mFilter.getSiblingFilter (); if (null != filter) ret = new NodeFilter[] { filter }; else ret = new NodeFilter[0]; return (ret); } /** * Assign the underlying node filter's subordinate filters. * @param filters The filters to insert into the underlying node filter. */ public void setSubNodeFilters (NodeFilter[] filters) { if (0 != filters.length) mFilter.setSiblingFilter (filters[0]); else mFilter.setSiblingFilter (null); } /** * Convert this filter into Java code. * Output whatever text necessary and return the variable name. * @param out The output buffer. * @param context Three integers as follows: * <li>indent level - the number of spaces to insert at the beginning of each line</li> * <li>filter number - the next available filter number</li> * <li>filter array number - the next available array of filters number</li> * @return The variable name to use when referencing this filter (usually "filter" + context[1]++) */ public String toJavaCode (StringBuilder out, int[] context) { String name; String ret; if (null != mFilter.getSiblingFilter ()) name = ((Filter)mFilter.getSiblingFilter ()).toJavaCode (out, context); else name = null; ret = "filter" + context[1]++; spaces (out, context[0]); out.append ("HasSiblingFilter "); out.append (ret); out.append (" = new HasSiblingFilter ();"); newline (out); if (null != name) { spaces (out, context[0]); out.append (ret); out.append (".setSiblingFilter ("); out.append (name); out.append (");"); newline (out); } return (ret); } // // NodeFilter interface // /** * Predicate to determine whether or not to keep the given node. * The behaviour based on this outcome is determined by the context * in which it is called. It may lead to the node being added to a list * or printed out. See the calling routine for details. * @return <code>true</code> if the node is to be kept, <code>false</code> * if it is to be discarded. * @param node The node to test. */ public boolean accept (Node node) { return (mFilter.accept (node)); } // // ActionListener interface // /** * Invoked when an action occurs. * @param event Details about the action event. */ public void actionPerformed (ActionEvent event) { } }
true
05c61d3d15afac93a51b2b6e3d41c15cdc1c5910
Java
donthadineshkumar/spring-demo-pro-with-tests-using-javaconfig
/src/test/java/com/web/EmployeeRepoTest.java
UTF-8
1,759
2.40625
2
[]
no_license
package com.web; import static org.junit.Assert.assertEquals; import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.config.RootConfig; import com.model.Employee; import com.repository.EmployeeRepository; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( classes = {RootConfig.class, EmployeeRepository.class} ) public class EmployeeRepoTest { @Autowired EmployeeRepository employeeRepository; @Test public void findEmployee(){ Employee emp =employeeRepository.findEmployee(1); assertNotNull(emp); System.out.println(emp.getSalary()); assertEquals("dinesh", emp.getName()); } @Test public void testSave(){ Employee emp1 = new Employee(); emp1.setName("manju"); emp1.setDept("java"); emp1.setSalary(new Double(565.34)); Employee emp2 = employeeRepository.saveEmployee(emp1); System.out.println(emp2.getEmpno()); assertEquals(new Integer(2), emp2.getEmpno()); } @Test public void testEdit(){ Employee emp1 = new Employee(); emp1.setEmpno(new Integer(2)); emp1.setName("Varsha"); emp1.setDept("ROR"); emp1.setSalary(new Double(565.34)); employeeRepository.updateEmployee(emp1); Employee emp = employeeRepository.findEmployee(2); System.out.println(emp.getDept()); assertEquals("ROR",emp.getDept()); } @Test public void testDelete(){ Employee emp1 = employeeRepository.findEmployee(5); Employee emp = employeeRepository.deleteEmployee(emp1); //System.out.println(emp.getDept()); assertNull(emp); } }
true
c08338b65e1d629178c651caca03a3b571a890fa
Java
hk057/ICT311
/app/src/main/java/com/bignerdranch/android/triplogger/SettingListFragment.java
UTF-8
5,169
2.28125
2
[]
no_license
package com.bignerdranch.android.triplogger; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import java.util.List; /** * Created by harpreet multani on 31/10/2016. */ public class SettingListFragment extends Fragment { private RecyclerView mSettingRecyclerView; private SettingAdapter mAdapter; private Button mNewButton; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_setting_list, container, false); mSettingRecyclerView = (RecyclerView) view .findViewById(R.id.setting_recycler_view); mSettingRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mNewButton = (Button) view.findViewById(R.id.new_setting_button); mNewButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Setting setting = new Setting (); SettingLab.get(getActivity()).addSetting(setting); Log.d("TEST", "The new trip id is : " + setting.getID()); Intent intent = TripActivity.newIntent(getActivity(), setting.getID()); startActivity(intent); } }); updateUI(); return view; } private void updateUI(){ SettingLab settingLab = SettingLab.get(getActivity()); List<Setting> settings = settingLab.getSettings(); if (mAdapter == null) { mAdapter = new SettingAdapter(settings); mSettingRecyclerView.setAdapter(mAdapter); }else{ mAdapter.setSettings(settings); mAdapter.notifyDataSetChanged(); } } private class SettingHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ private Setting mSetting; private TextView mNameTextView; private TextView mIDTextView; private TextView mGenderTextView; private TextView mEmailTextView; private TextView mCommentTextView; public SettingHolder(View itemView){ super(itemView); itemView.setOnClickListener(this); mNameTextView = (TextView) itemView.findViewById(R.id.list_item_setting_name_text_view); mIDTextView = (TextView) itemView.findViewById(R.id.list_item_setting_id_text_view); mGenderTextView = (TextView) itemView.findViewById(R.id.list_item_setting_gender_text_view); mEmailTextView = (TextView) itemView.findViewById(R.id.list_item_setting_email_text_view); mCommentTextView = (TextView) itemView.findViewById(R.id.list_item_setting_comment_text_view); } @Override public void onClick(View v) { Setting setting = new Setting (); SettingLab.get(getActivity()).addSetting(setting); Log.d("TEST", "The new setting id is : " + setting.getID()); Intent intent = TripActivity.newIntent(getActivity(), mSetting.getID()); startActivity(intent); } public void bindSetting(Setting setting){ mSetting = setting; mNameTextView.setText(mSetting.getName()); mIDTextView.setText(mSetting.getID().toString()); mGenderTextView.setText(mSetting.getGender()); mCommentTextView.setText(mSetting.getComment()); mEmailTextView.setText(mSetting.getEmail()); } } private class SettingAdapter extends RecyclerView.Adapter<SettingHolder>{ private List<Setting> mSettings; public SettingAdapter(List<Setting> settings){ mSettings = settings; } @Override public SettingHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View view = layoutInflater .inflate(R.layout.list_item_setting, parent, false); return new SettingHolder(view); } @Override public void onBindViewHolder(SettingHolder holder, int position) { Setting setting = mSettings.get(position); Log.d("TEST", "Setting record number: " + mSettings.size()); holder.bindSetting(setting); } @Override public int getItemCount() { return mSettings.size(); } public void setSettings(List<Setting> settings) { mSettings = settings; } } }
true
e4f5786e13237b6bdce82f4bcf514b69b9b9166e
Java
rathorerahul326/truckdispatcher
/TruckDispatcher/src/com/dao/Connect.java
UTF-8
602
2.515625
3
[ "MIT" ]
permissive
package com.dao; import java.sql.*; public class Connect { private static Connect con; static String driver="com.mysql.jdbc.Driver"; static String url="jdbc:mysql://localhost:3306/truckdispatcher"; static String uname="root"; static String pass="rahul@123"; static{ try{ Class.forName(driver); } catch(Exception e){} } public static Connection get(){ Connection con=null; try{ con=DriverManager.getConnection(url,uname,pass); } catch(Exception e) { System.out.println(e); } finally{ return con; } } }
true
186921e942a457c72e15cf7037632990d54e0615
Java
gitter-badger/adeptj-modules
/viewengine/handlebars/src/main/java/com/adeptj/modularweb/viewengine/api/ViewEngine.java
UTF-8
2,101
2.28125
2
[ "Apache-2.0" ]
permissive
/* * ============================================================================= * * Copyright (c) 2016 AdeptJ * Copyright (c) 2016 Rakesh Kumar <[email protected]> * * 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.adeptj.modularweb.viewengine.api; import com.adeptj.modularweb.viewengine.core.ViewEngineContext; import com.adeptj.modularweb.viewengine.core.ViewEngineException; /** * ViewEngine. * * @author Rakesh.Kumar, AdeptJ. */ public interface ViewEngine { String DEFAULT_VIEW_FOLDER = "/views"; /** * Returns <code>true</code> if this engine can process the view or * <code>false</code> otherwise. * * @param view * the view. * @return outcome of supports test. */ boolean supports(String view); /** * <p> * Process a view given a * {@link com.adeptj.modularweb.viewengine.core.ViewEngineContext}. Processing a * view involves <i>merging</i> the model and template data and writing the * result to an output stream. * </p> * * <p> * Following the Java EE threading model, the underlying view engine * implementation must support this method being called by different * threads. Any resources allocated during view processing must be released * before the method returns. * </p> * * @param context * the context needed for processing. * @throws ViewEngineException * if an error occurs during processing. */ void processView(ViewEngineContext engineContext) throws ViewEngineException; }
true
2b3102663edd7d14b8c8efc45d73918e8ae53e6a
Java
FMammadzada/Assigment4
/library/src/main/java/edu/ada/service/library/controller/impl/BookLibraryWSImpl.java
UTF-8
3,722
2.3125
2
[]
no_license
package edu.ada.service.library.controller.impl; import edu.ada.service.library.controller.BookLibraryWS; import edu.ada.service.library.model.dto.BookModel; import edu.ada.service.library.model.entity.Books; import edu.ada.service.library.service.BookLibraryService; import edu.ada.service.library.service.ReservedPeriodService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.text.ParseException; import java.util.ArrayList; import java.util.List; @RestController public class BookLibraryWSImpl implements BookLibraryWS { @Autowired private BookLibraryService bookLibraryService; @Autowired private ReservedPeriodService reservedPeriodService; @Override @RequestMapping(value = "/book/findByName", method = RequestMethod.GET) public ResponseEntity findByName(@RequestParam(name = "bookName", required = true) String bookName) { int result = bookLibraryService.findByName(bookName); return new ResponseEntity(bookLibraryService.findBookByName(bookName), HttpStatus.OK); } @Override @RequestMapping(value = "/book/findByAvailability", method = RequestMethod.GET) public ResponseEntity findAllByAvailability() { return ResponseEntity.ok(bookLibraryService.findAllBooksByReserved(0)); } @Override @RequestMapping(value = "/books", method = RequestMethod.GET) public ResponseEntity listOfBooks() { List<Books> list = bookLibraryService.findAll(); List<BookModel> list1 = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { BookModel bookModel = new BookModel(); bookModel.setName(list.get(i).getName()); bookModel.setUserId(list.get(i).getReserved()); list1.add(bookModel); } return ResponseEntity.ok(list1); } @Override @RequestMapping(value = "/book/pickUp", method = RequestMethod.GET) public ResponseEntity pickUp(@RequestParam(name = "userId", required = true) int userId, @RequestParam(name = "bookName", required = true) String bookName) throws ParseException { if(reservedPeriodService.checking(bookName)) { reservedPeriodService.pickUp(userId, bookName); return ResponseEntity.ok("You Have Been Successfully Pick Up"); } return ResponseEntity.ok("Sorry Book is not available"); } @Override @RequestMapping(value = "/book/dropOff", method = RequestMethod.GET) public ResponseEntity dropOff(@RequestParam(name = "userId", required = true) int userId, @RequestParam(name = "bookName", required = true) String bookName) throws ParseException { reservedPeriodService.dropOff(userId, bookName); return ResponseEntity.ok("You Have Been Successfully Drop Off"); } @Override @RequestMapping(value = "/book/history", method = RequestMethod.GET) public ResponseEntity history(@RequestParam(name = "userId", required = true) int userId) { return ResponseEntity.ok(reservedPeriodService.history(userId)); } @Override @RequestMapping(value = "/book/historyCurrent", method = RequestMethod.GET) public ResponseEntity historyCurrently(@RequestParam(name = "userId", required = true) int userId) throws ParseException { return ResponseEntity.ok(reservedPeriodService.historyCurrently(userId)); } }
true
40f43419e11543b3db9698f5564ea8fa2811d22f
Java
Shubhamjain2908/DS-Algo
/src/Graph/TopologicalSort.java
UTF-8
2,105
3.5
4
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Graph; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Stack; /** * * @author SHUBHAM */ public class TopologicalSort { static class Graph { private final int V; private final List<Integer>[] adjListArray; public List<Integer>[] getAdjListArray() { return adjListArray; } public Graph(int V) { this.V = V; adjListArray = new ArrayList[V]; for (int i = 0; i < V; i++) { adjListArray[i] = new ArrayList<>(); } } public void addEdge(int src, int dest) { adjListArray[src].add(dest); adjListArray[dest].add(src); } public void printAdjacencyList() { for (int i = 0; i < V; i++) { System.out.print("head " + i + " : "); for (Integer p: adjListArray[i]) { System.out.print(" -> " + p); } System.out.println(""); } } } public static void main(String[] args) { int V = 8; Graph graph = new Graph(V); graph.addEdge( 0, 2); graph.addEdge( 1, 2); graph.addEdge( 2, 3); graph.addEdge( 3, 5); graph.addEdge( 5, 6); graph.addEdge( 1, 4); graph.addEdge( 4, 5); graph.printAdjacencyList(); topologicalSort(graph); } private static void topologicalSort(Graph graph) { Stack<Integer> st = new Stack<>(); Set<Integer> visited = new HashSet<>(); List<Integer>[] adjListArray = graph.getAdjListArray(); for (int i = 0; i < adjListArray.length; i++) { if (true) { } } } }
true
324f7cd457cb6cb5f1e0ad175bbf0a02e1831166
Java
Evelinaholtho/Blomapp2
/app/src/main/java/com/example/evelina/blomapp/interfaces/PlantStore.java
UTF-8
323
2.046875
2
[]
no_license
package com.example.evelina.blomapp.interfaces; import com.example.evelina.blomapp.Plant; import java.util.List; /** * Created by Evelina on 2017-11-15. */ public interface PlantStore { List<Plant> getAllPlants(); void fillPlantList(); void addPlant(Plant plant); void updatePlant (Plant plant); }
true
9ddabb0b52978961d784fc13133c79fbc8cae7b3
Java
OYousryB/SocketXpt
/AsynchronousSocketServer/src/main/try/sparkTCP/ServerWithObjects.java
UTF-8
2,389
3.015625
3
[]
no_license
package sparkTCP; import objects.Lineitem; import java.io.*; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.List; public class ServerWithObjects { private ServerWithObjects(int port) { DataInputStream rawData; ObjectOutputStream outStream; List<Lineitem> lineitems = new ArrayList<>(); try { ServerSocket server = new ServerSocket(port); System.out.println("Spark Server started"); System.out.println("Waiting for Incorta Client ..."); Socket socket = server.accept(); outStream = new ObjectOutputStream(socket.getOutputStream()); System.out.println("Connected with Incorta Client"); rawData = new DataInputStream(new FileInputStream("/home/yousry/dummy_db/tpch/1/tbl/lineitem/lineitem.tbl.1")); String newLine = rawData.readLine(); while (newLine != null){ String[] items = newLine.split("\\|"); lineitems.add(new Lineitem(Long.parseLong(items[0]), Long.parseLong(items[1]), Long.parseLong(items[2]), Long.parseLong(items[3]), Double.parseDouble(items[4]), Double.parseDouble(items[5]), Double.parseDouble(items[6]), Double.parseDouble(items[7]), items[8], items[9], items[10], items[11], items[12], items[13], items[14], items[15])); newLine = rawData.readLine(); } System.out.println("Finished Serializing Data"); Thread.sleep(10000); ObjectOutputStream finalOutStream = outStream; long start = System.currentTimeMillis(); lineitems.forEach(object -> { try { finalOutStream.writeObject(object); // Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } }); long finish = System.currentTimeMillis(); System.out.println("Finished in : " + ((finish - start)/ 1000) + " Secs"); rawData.close(); outStream.close(); socket.close(); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { new ServerWithObjects(6000); } }
true
5f7d88945ad81c77ae7ffdd48fa325879236e5c3
Java
ArbustaIT/CapacitacionAutomation
/src/main/java/co/com/arbusta/capacitacion/autoScreenplayCucumber/userinterfaces/UImenuCategorias.java
UTF-8
832
1.570313
2
[]
no_license
package co.com.arbusta.capacitacion.autoScreenplayCucumber.userinterfaces; import org.openqa.selenium.By; import net.serenitybdd.core.pages.PageObject; import net.serenitybdd.screenplay.targets.Target; import net.thucydides.core.annotations.DefaultUrl; @DefaultUrl("http://automationpractice.com/") public class UImenuCategorias extends PageObject { public static final Target DRP_WOMEN= Target.the("Desplegable a seccion Mujer").located(By.xpath("//*[@id=\"block_top_menu\"]/ul/li[1]/a")); public static final Target DRP_BLOUSES = Target.the("Boton a subseccion de blusas").located(By.xpath("//*[@id=\"block_top_menu\"]/ul/li[1]/ul/li[1]/ul/li[2]/a")); public static final Target BOX_TITULO_DE_SECCION = Target.the("Boton a subseccion de blusas").located(By.xpath("//*[@id=\"center_column\"]/div[1]/div/div/span")); }
true
23a333b92d5b55e7f3d56b3612cce5af3eadf728
Java
nut077/docker
/src/main/java/com/github/nut077/docker/controller/JwtAuthenicationController.java
UTF-8
2,921
2.1875
2
[]
no_license
package com.github.nut077.docker.controller; import com.github.nut077.docker.util.JwtTokenUtil; import com.github.nut077.docker.dto.UserDto; import com.github.nut077.docker.entity.JwtRequest; import com.github.nut077.docker.entity.JwtResponse; import com.github.nut077.docker.entity.User; import com.github.nut077.docker.service.JwtUserDetailsService; import lombok.RequiredArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import static com.github.nut077.docker.dto.response.SuccessResponse.builder; import static org.springframework.http.ResponseEntity.ok; @Log4j2 @CrossOrigin @RestController @RequiredArgsConstructor public class JwtAuthenicationController extends CommonController { private final AuthenticationManager authenticationManager; private final JwtTokenUtil jwtTokenUtil; private final JwtUserDetailsService userDetailsService; @PostMapping("/authenticate") public ResponseEntity createAuthenticationToken(@RequestBody JwtRequest authenticationRequest) throws Exception { authenticate(authenticationRequest.getUsername(), authenticationRequest.getPassword()); UserDetails userDetails = userDetailsService.loadUserByUsername(authenticationRequest.getUsername()); String token = jwtTokenUtil.generateToken(userDetails); return ok() .header("Authorization", "Bearer " + token) .body(builder(new JwtResponse(token)).build()); } @PostMapping("/register") public ResponseEntity saveUser(@RequestBody UserDto userDto) { User user = userDetailsService.save(userDto); UserDetails userDetails = new org.springframework.security.core.userdetails.User(user.getUsername(), user.getPassword(), new ArrayList<>()); String token = jwtTokenUtil.generateToken(userDetails); return ok() .header("Authorization", "Bearer " + token) .body(builder(user).build()); } private void authenticate(String username, String password) throws Exception { try { authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password)); } catch (DisabledException e) { throw new Exception("USER_DISABLED", e); } catch (BadCredentialsException e) { throw new Exception("INVALID_CREDENTIALS", e); } } }
true
b67fb2c87459b88093ce8609509034f1f02f3876
Java
Taskukello/shootDEMdown
/shootdemdown/src/main/java/toiminta/Logiikka.java
UTF-8
12,600
2.375
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package toiminta; import toiminta.vihollisobjekti.ObjektinArpoja; import toiminta.vihollisobjekti.VihollisObjekti; import java.awt.List; import java.util.ArrayList; import javax.swing.SwingUtilities; import kayttoliittyma.Kayttoliittyma; import kayttoliittyma.NappaimistonKuuntelija; import toiminta.pelaaja.Alus; import toiminta.pelaaja.Ammus; /** * luokka on pelin toiminan ydin. kaiken olennaisen liikkumisen ylläpitämisen ja * pisteiden ylläpitämisen - * * @author Aki */ public class Logiikka { private ArrayList<VihollisObjekti> viholliset = new ArrayList<VihollisObjekti>(); private ArrayList<VihollisObjekti> poistettavat = new ArrayList<VihollisObjekti>(); private ArrayList<Ammus> poistettavatAmmukset = new ArrayList<Ammus>(); private ArrayList<Ammus> ammukset = new ArrayList<Ammus>(); private Alus alus = new Alus(); private int liikkumiskerrat = 42; private boolean kuoleekoPelaaja = true; private Kayttoliittyma liittyma; private int viivytysAika = 1000; private int pisteet = 0; private int osumat = 0; private long liikuntaRajotin = 0; private long odotusAika = 100; private int erikoisVihollinen = 0; public Logiikka(Kayttoliittyma liittyma) { this.liittyma = liittyma; } public Logiikka() { //tämä ei liittymää luova on tässä testien takia this.viivytysAika = 0; } /** * viivyttää ohjelman toimintaa tarvitteasse kuten vuorojen välissä huomio. * kriittinen (tuntemattomista syistä) metodi käyttöliittymän luomisen * kannalta. */ public void viivyta() { if (viivytysAika > 0) { try { Thread.sleep(viivytysAika); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } } /** * alustaa käyttöliittymän pelille huom! viivytysajan asettaminen tuhanteen * on välttämätön muuten käyttliittymä sekoaa. */ public void valmisteleAlusta() { viivyta(); this.liittyma.setAlus(alus); this.liittyma.luoNappaimistonKuuntelija(); } /** * Metodi aloittaa pelin, ja ylläpitää vuoroja. Tarkennus. Vuoro tarkoittaa * tässä tapauksessa pelin vihollisen ja ammusten liikkumista. */ public void pelaa() { while (kuoleekoPelaaja == true) { int k = this.liikkumiskerrat; luoBlokki(); while (k >= 0) { liittymanPaivitys(); if (System.currentTimeMillis() - this.liikuntaRajotin > this.odotusAika) { liikutaKaikkiaVihollisia(); liikutaKaikkiaAmmuksia(); k--; this.liikuntaRajotin = System.currentTimeMillis(); } } } lopetaPeli(); } /** * lopettaa pelin ja antaa käyttöliittymälle komennon tuottaa loppunäkymän */ public void lopetaPeli() { this.ammukset.removeAll(ammukset); this.viholliset.removeAll(ammukset); this.liittyma.luoLoppuNakyma(this.liittyma.getFrame().getContentPane()); } /** * aloittaa uuden vuoron liikuttamalla jokaista olemassaolevaa vihollista * kun ehdot täyttyvät. */ public void liikutaKaikkiaVihollisia() { int liikkumiset = 0; if (!this.viholliset.isEmpty()) { for (VihollisObjekti objekti : viholliset) { if (liikutaJaTarkistaKuolema(objekti) == true) { break; } } poistaVihollisia(); } } /** * liikuttaa kaikkia olemassaolevia ammuksia ja tarpeentullen tuhoaa ne. */ public void liikutaKaikkiaAmmuksia() { this.ammukset = alus.getAmmukset(); for (Ammus ammus : ammukset) { ammus.siirry(); osuukoAmmus(ammus); if (ammus.getY() == 700) { this.poistettavatAmmukset.add(ammus); } } poistaAmmuksia(); alus.setAmmukset(ammukset); } /** * tarkistaa koordinaattiin y=100 päässeen objektin, että törmääkö se * alukseen * * @param objekti joka on saavuttanut koordinaatin Y= 100 Huom! tämä metodi * vasta valmistelee itse tarkistuksen tarkistuksen itse suorittaa * katsotaanpaOsumaTilannetta() * @return palauttaa true jos objekti on osumassa alukseen. */ public boolean liikutaJaTarkistaKuolema(VihollisObjekti objekti) { OsumanTarkistaja tarkista = new OsumanTarkistaja(this.alus, objekti); objekti.liiku(); return katsotaanpaOsumaTilannetta(objekti, tarkista) == true; } /** * vuoron loputtua päivittää käyttöliittymän senhtekiseen tilaan. */ public void liittymanPaivitys() { if (this.liittyma != null) { //tämä if on puhtaasti testien takia. this.liittyma.setViholliset(this.viholliset); this.liittyma.setAmmukset(ammukset); this.liittyma.paivita(); } } /** * Metodi tarkistaa ammuksen mahdollisen osuman verraten sen koordinaatteja * olemassaoleviin vihollisobjekteihin Huom! tämä metodi toistaiseksi myös * vastaa pisteiden lisäämisestä ja muusta mistä sen ei tulisi välittää * Huom2! ylimääräiset turhakkeet tullaan siirtämään uuteen metodiin. * * @param ammus ammus joka saattaa osua vihollisobjektiin */ public void osuukoAmmus(Ammus ammus) { for (VihollisObjekti objekti : viholliset) { if (ammus.getY() == objekti.getY() - 20 || ammus.getY() < objekti.getY() && ammus.getY() > objekti.getY() - 20) { int x = ammus.getX(); int objektix = objekti.getX(); if (x == objektix || x > objektix && x < objektix + 20 || x < objektix && x + 5 > objektix) { poistettavat.add(objekti); poistettavatAmmukset.add(ammus); pisteet++; osumat++; lisaaVaikeutta(); lisaaPistePaneeliin(); } } } } /** * kun pelaaja on tuhonnut kolme vihollista peli lisää vaikeutta * vähentämällä liikkumiskertoja enne uuden vihollisen syntymistä Huom! jos * objektit liikkuvat enään 15 kertaa vuorossa (max 42) ei peli enään * vähennnä vuoroja Tämän jälkeen peli puolestaan aloittaa vähentämään * vuorojen välistä viivytysaikaa. */ public void lisaaVaikeutta() { if (this.osumat == 2 && this.liikkumiskerrat == 42 && this.odotusAika > 22) { this.odotusAika = this.odotusAika - 2; this.osumat = 0; } if (this.osumat == 3 && this.liikkumiskerrat - 3 >= 20 && this.odotusAika == 22) { this.liikkumiskerrat = this.liikkumiskerrat - 3; this.osumat = 0; } } /** * tarkistaa osuuko vihollisobjekti alukseen ja määrittää annetaanko elämä * vai otetaanko * * @param objekti objekti joka ehkä osuu * @param tarkista luokka OsumanTarkistaja, joka kysyy onko objekti * elämääantava vai ei * @return palauttaa true jos alus on menettänyt jokaisen elämän. */ public boolean katsotaanpaOsumaTilannetta(VihollisObjekti objekti, OsumanTarkistaja tarkista) { int ox = objekti.getX(); int ax = alus.getX(); if (objekti.getY() <= 120 && objekti.getY() > 80) { if (ox < ax && ox + objekti.getKoko() > ax || ox > ax && ox < ax + this.alus.getKoko() || ax == ox) { int k = tarkista.osuma(); if (k == 2) { lyhennaAmmuksenAmmuntaAikaa(); } this.poistettavat.add(objekti); if (loppuukoPeli() == true) { return true; } } } if (objekti.kuoleekoSeinaan() == true) { poistettavat.add(objekti); alus.menetaElama(); if (loppuukoPeli() == true) { return true; } } return false; } /** * arpoo millainen vihollisobjekti syntyy ja luo sen rajoittaa * erikoisblokkien syntymistä * * @return return arvot ovat avustamaan testien toimintaa */ public int luoBlokki() { ObjektinArpoja arpoja = new ObjektinArpoja(); VihollisObjekti objekti; int k = 0; if (erikoisVihollinen == -5) { arpoja = new ObjektinArpoja(true); objekti = new VihollisObjekti(arpoja.arvoObjekti(), arpoja.arvoKoordinaatti()); erikoisVihollinen--; erikoisVihollinen = 1; k = 1; } else if (erikoisVihollinen > 0) { objekti = new VihollisObjekti(1, arpoja.arvoKoordinaatti()); erikoisVihollinen--; k = 2; } else { int muoto = arpoja.arvoObjekti(); objekti = new VihollisObjekti(muoto, arpoja.arvoKoordinaatti()); this.erikoisVihollinen--; k = 3; if (muoto == 2 || muoto == 3) { this.erikoisVihollinen = 3; k = 3; } } this.viholliset.add(objekti); return k; } /** * nopeuttaa ammusten laukasunopeutta kunnes rajotin on 100 */ public void lyhennaAmmuksenAmmuntaAikaa() { Long jokuHauskaNimi = this.liittyma.getNappaimistonKuuntelija().getAmmusRajotin(); if (jokuHauskaNimi - 25 >= 100) { this.liittyma.getNappaimistonKuuntelija().setAmmusRajotin(jokuHauskaNimi - 25); } } /** * lisää käyttöliittymään pisteet */ public void lisaaPistePaneeliin() { if (this.liittyma != null) { this.liittyma.paivitaPistePalkki(pisteet); } } /** * poistaa kuolleet viholliset pelistä. */ public void poistaVihollisia() { this.viholliset.removeAll(this.poistettavat); this.poistettavat.clear(); } /** * poistaa tuhoutuneet ammukset pelistä */ public void poistaAmmuksia() { this.ammukset.removeAll(poistettavatAmmukset); this.poistettavatAmmukset.clear(); } /** * tarkistaa että saavuttaako elämät nollan jolloin peli loppuu * * @return true jos pelaaja kuolee */ public boolean loppuukoPeli() { if (this.alus.getElamat() == 0) { this.kuoleekoPelaaja = false; return true; } else { return false; } } public void setLiikkumisKerrat(int o) { this.liikkumiskerrat = o; } public int getVihollisetKoko() { return this.viholliset.size(); } public ArrayList<VihollisObjekti> getViholliset() { return this.viholliset; } public Alus getAlus() { return this.alus; } public void setPoistettavat(ArrayList<VihollisObjekti> poistettavat) { this.poistettavat = poistettavat; } public void setViivytysAika(int aika) { this.viivytysAika = aika; } public ArrayList<VihollisObjekti> getPoistettavat() { return this.poistettavat; } /** * lisää halutun vihollisen vihollis listalle * @param objekti haluttu vihollisobjekti. */ public void addVihollinen(VihollisObjekti objekti) { this.viholliset.add(objekti); } public void setOsumat(int maara) { this.osumat = maara; } public int getOsumat() { return this.osumat; } public int getLiikkumisKerrat() { return this.liikkumiskerrat; } public int getPisteet() { return this.pisteet; } public ArrayList<Ammus> getAmmukset() { return this.ammukset; } public long getOdotusAika() { return odotusAika; } public void setOdotusAika(long odotus) { this.odotusAika = odotus; } public void setErikoisVihollinen(int arvo) { this.erikoisVihollinen = arvo; } public int getErikoisVihollinen() { return this.erikoisVihollinen; } public void setPisteet(int k) { this.pisteet = k; } }
true
493d7b3449a2260e4452d9b5b38268c1391e401c
Java
dongyj1/coding_practice
/src/ObjectOrientedDesign/PizzaDeliver/Pizza.java
UTF-8
1,095
3.09375
3
[]
no_license
package ObjectOrientedDesign.PizzaDeliver; /** * Created by dyj on 7/4/18. */ public class Pizza { Type type; double price; int size; String description; Restaurant restaurant; public void setType(Type type) { this.type = type; } public void setPrice(double price) { this.price = price; } public void setSize(int size) { this.size = size; } public void setDescription(String description) { this.description = description; } public void setRestaurant(Restaurant restaurant) { this.restaurant = restaurant; } public Type getType() { return type; } public double getPrice() { return price; } public int getSize() { return size; } public String getDescription() { return description; } public Restaurant getRestaurant() { return restaurant; } } enum Type { Italian("Italian"), California("Californian"), Greek("Greek"); private String name; Type(String n) { name = n; } }
true
914b91aee2d89d2ada53c18b2f989027b27353cf
Java
oushuhua/Project_Afc_For_Eclipse
/TestAfc/src/com/afc/product/fragment/ShoppingAdFrgm.java
UTF-8
4,864
1.765625
2
[]
no_license
package com.afc.product.fragment; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.afc.App.BasicFrgm; import com.afc.App.UrlPool; import com.afc.R; import com.afc.Utils.ViewFlowUitil.ADImageAdapter; import com.afc.Utils.ViewFlowUitil.CircleFlowIndicator; import com.afc.Utils.ViewFlowUitil.ViewFlow; import com.afc.event.ADEntity; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.squareup.okhttp.OkHttp; import com.squareup.okhttp.Params; import com.squareup.okhttp.RespondCallBack; import java.util.ArrayList; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by Administrator on 2016/5/15. */ public class ShoppingAdFrgm extends BasicFrgm { private Context mContext; @Bind(R.id.viewflow) ViewFlow viewFlow; @Bind(R.id.indicatorLayout) LinearLayout indicatorLayout; private boolean hasRequest = false; private List<ADEntity.Detail> adList = new ArrayList<ADEntity.Detail>(); public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.product_add_advertising, container, false); mContext = getActivity(); ButterKnife.bind(this, root); mContext.registerReceiver(receiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); openEventBus(); return root; } protected BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { ConnectivityManager connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connectivityManager.getActiveNetworkInfo(); if (info != null && info.isAvailable()) { if (adList.size() == 0){ //reqDatas(); } } } } }; private void reqDatas() { if (hasRequest) return; hasRequest = true; Params params = new Params(); params.add("fromApp", "1"); JSONArray array = new JSONArray(); JSONObject obj = new JSONObject(); obj.put("pageId", 3); obj.put("localId", 1); obj.put("categoryId", 1); array.add(obj); params.add("list", array); OkHttp.post(UrlPool.QueryCarouselAds, params, new RespondCallBack<List<ADEntity>>() { @Override protected List<ADEntity> convert(String json) { String list = JSON.parseObject(json).getString("list"); return JSON.parseArray(list, ADEntity.class); } @Override public void onSuccess(List<ADEntity> data) { hasRequest = false; if (getActivity() == null || getActivity().isFinishing()) return; adList.clear(); for (int i = 0; i < data.size(); i++) { ADEntity temp = data.get(i); if (temp.getLocalID() == 1) { adList.addAll(temp.getDetail()); } } if (adList.size() > 0) { initAD(); } } @Override public void onFailure(int errorCode, String msg) { hasRequest = false; } }, TAG); } private void initAD() { // 广告 图片轮播 Begin // adSize=adList.size(); viewFlow.adList = adList; viewFlow.setAdapter(new ADImageAdapter(adList, viewFlow)); viewFlow.setmSideBuffer(adList.size()); LinearLayout includeLayout = (LinearLayout) View.inflate(mContext, R.layout.include_circle_flow_indicator, null); indicatorLayout.removeAllViews(); indicatorLayout.addView(includeLayout); CircleFlowIndicator indic = (CircleFlowIndicator) includeLayout.findViewById(R.id.viewflowindic); viewFlow.setFlowIndicator(indic); viewFlow.setTimeSpan(3000); viewFlow.setSelection(1); // 设置初始位置 if (adList.size() > 1) { viewFlow.startAutoFlowTimer(); } viewFlow.startAutoFlowTimer(); // 启动自动播放 } }
true
a8e93730780a57926e048d21de4034c1f4adcb79
Java
mandyssst/MyCode
/Forest_simulator/Helper.java
UTF-8
1,996
3.25
3
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package forest_simulator; import java.util.Scanner; /** * * @author songx544 */ public class Helper { public static boolean bool(String str) { if (str.equalsIgnoreCase("yes")) { return true; } else if (str.equalsIgnoreCase("no")) { return false; } else { System.out.println("Invalid Input"); System.out.println("Default: Select from liibrary"); return true; } } public static void UserInput() { Scanner scan = new Scanner(System.in); System.out.println("Hi, welcome to forest simulator!!"); System.out.println("Do you want to select a simulator from our library or create one?"); System.out.println("We have Amazon Rainforest, Sequoia National Forest, Redwood National Park, Beech Forest, Black Forest"); System.out.println("Please enter yes/no"); boolean TF = Helper.bool(scan.next()); if (TF) { System.out.println("Which one would you like to choose? In presented order, each one is labelled 1-5, enter the number"); Simulator.setForest(Data.getForest(scan.nextInt())); } else { System.out.println("rainForest, desert, grassland, Decidous, alpine"); System.out.println("Enter temperature, precipitation and name, seperated by space"); int num = scan.nextInt(); int num2 = scan.nextInt(); String name = scan.next(); Forest newF = new Forest( name, new climate(num2, num)); Simulator.setForest(newF); } System.out.println("How long would you like the simulation last"); System.out.println("Suggest to put in 500-600, since the default values fit"); Simulator.setYear(scan.nextInt()); } }
true
aa23dac92aa31aa5a5565cb6586d689edad48ea6
Java
xiaozi0513/anyway
/anyway-plugins/ipip-client/src/main/java/com/anyway/ipip/util/ThreadUtil.java
UTF-8
444
2.46875
2
[]
no_license
package com.anyway.ipip.util; import lombok.extern.slf4j.Slf4j; /** * @author: wang_hui * @date: 2019/5/9 上午10:23 */ @Slf4j public class ThreadUtil { /** * 休眠 * * @param millis 休眠时间,单位:毫秒 */ public static void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { log.info("sleep error.", e); } } }
true
4adc691583f5e37fd901a66d2c02f5bcf92539d8
Java
Abin7677/Logical-Questions
/company_questions/src/company/Cipher_char.java
UTF-8
331
2.6875
3
[]
no_license
package company; import java.util.Scanner; public class Cipher_char { public static void main(String arg[]) { Scanner s=new Scanner(System.in); String c=s.nextLine(); int a=s.nextInt(); char ch=0; for(int i=0;i<1;i++) { ch=(char) (c.charAt(0)+a); System.out.print(ch); } } }
true
4eb44de159717da24a5d8836dbb60b93d5d739d6
Java
TatianeAnjos/ComunicaoRede-Java
/src/Entities/Servidor.java
ISO-8859-1
2,449
3.421875
3
[]
no_license
package Entities; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.ServerSocket; import java.net.Socket; import java.util.Enumeration; import java.util.Vector; public class Servidor extends Thread { private static Socket conexao; private String nomeCliente; private int chave = 0; private static Vector clientes; // Construtor, recebe a porta pra conectar public Servidor(Socket socket) { this.conexao = socket; } // Inicia o servidor, recebe uma conexo na porta, e inicia num novo thread para // cada cliente public static void iniciaServidor(int porta) { try { clientes = new Vector(); ServerSocket server = new ServerSocket(porta); System.out.println("Servidor ativo na porta " + porta); while (true) { Socket conexao = server.accept(); Thread thread = new Servidor(conexao); thread.start(); } } catch (IOException e) { System.out.println("IOException: " + e); } } //recebe o nome do cliente e adiciona na lista de clientes conectados, assim possvel mandar msg a todos. public void run() { try { //recebe o que alguem esta mandando BufferedReader entrada = new BufferedReader(new InputStreamReader(this.conexao.getInputStream())); //envia a mensagem deste cliente para os outros PrintStream saida = new PrintStream(this.conexao.getOutputStream()); this.nomeCliente = entrada.readLine(); System.out.println(this.nomeCliente + ": entrou no chat!"); clientes.add(saida); String msg = entrada.readLine(); // manda msg pra todos while (msg != null && !(msg.trim().equals(""))) { notificaClientes(saida, msg); msg = entrada.readLine(); } System.out.println(this.nomeCliente + " saiu!"); notificaClientes(saida, "saiu!"); clientes.remove(this.nomeCliente); this.conexao.close(); } catch (IOException e) { System.out.println("Erro: " + e); } } // Recebe todos os clientes na lista e envia a todos os outros exceto a quem // est enviando a msg public void notificaClientes(PrintStream saida, String msg) throws IOException { Enumeration e = clientes.elements(); while (e.hasMoreElements()) { PrintStream ps = (PrintStream) e.nextElement(); if (ps != saida) { ps.println(this.nomeCliente + ": " + msg); } } } }
true
de006bb2ca2316c89ac8f886006b909c515c5933
Java
guidobonerz/snatchfreezer
/SnatchFreezer/src/main/java/de/drazil/snatchfreezer/model/ActionItemPropertyBean.java
UTF-8
3,217
2.171875
2
[]
no_license
package de.drazil.snatchfreezer.model; import org.nield.dirtyfx.beans.DirtyBooleanProperty; import org.nield.dirtyfx.beans.DirtyLongProperty; import javafx.beans.property.SimpleLongProperty; public class ActionItemPropertyBean { private SimpleLongProperty index; private DirtyLongProperty delay; private DirtyLongProperty release; private DirtyLongProperty delayIncrement; private DirtyLongProperty releaseIncrement; private DirtyBooleanProperty ignore; private ActionItemBean bean; public ActionItemPropertyBean() { this(new ActionItemBean()); } public ActionItemPropertyBean(ActionItemBean bean) { this(bean.getId(), bean.getDelay(), bean.getRelease(), bean.getDelayIncrement(), bean.getReleaseIncrement(), bean.isIgnore()); this.bean = bean; } public ActionItemPropertyBean(long index) { this(index, 0L, 0L, 0L, 0L, false); } public ActionItemPropertyBean(final Long index, final Long delay, final Long release, final Long delayIncrement, final Long releaseIncrement, Boolean ignore) { this.index = new SimpleLongProperty(index); this.delay = new DirtyLongProperty(delay); this.release = new DirtyLongProperty(release); this.delayIncrement = new DirtyLongProperty(delayIncrement); this.releaseIncrement = new DirtyLongProperty(releaseIncrement); this.ignore = new DirtyBooleanProperty(ignore); } public Long getIndex() { return index.get(); } public void setIndex(final Long index) { this.index.set(index); bean.setId(index); } public Long getDelay() { return delay.get(); } public void setDelay(final Long delay) { this.delay.set(delay); bean.setDelay(delay); } public Long getRelease() { return release.get(); } public void setRelease(final Long release) { this.release.set(release); bean.setRelease(release); } public Long getDelayIncrement() { return delayIncrement.get(); } public void setDelayIncrement(final Long delayIncrement) { this.delayIncrement.set(delayIncrement); bean.setDelayIncrement(delayIncrement); } public Long getReleaseIncrement() { return releaseIncrement.get(); } public void setReleaseIncrement(final Long releaseIncrement) { this.releaseIncrement.set(releaseIncrement); bean.setReleaseIncrement(releaseIncrement); } public Boolean getIgnore() { return ignore.get(); } public void setIgnore(final Boolean ignore) { this.ignore.set(ignore); bean.setIgnore(ignore); } public boolean isDelayDirty() { return delay.isDirty(); } public boolean isReleaseDirty() { return release.isDirty(); } public boolean isDelayIncrementDirty() { return delayIncrement.isDirty(); } public boolean isReleaseIncrementDirty() { return releaseIncrement.isDirty(); } public void reset() { bean.setDelay(delay.getOriginalValue()); bean.setRelease(release.getOriginalValue()); bean.setDelayIncrement(delayIncrement.getOriginalValue()); bean.setReleaseIncrement(releaseIncrement.getOriginalValue()); bean.setIgnore(ignore.getOriginalValue()); delay.reset(); release.reset(); delayIncrement.reset(); releaseIncrement.reset(); } public ActionItemBean getBean() { return bean; } public void setBean(ActionItemBean bean) { this.bean = bean; } }
true
a5f7c886f208ebb8921acb7903fae7e81cd4caf4
Java
hongnam207/pi-network-source
/java/com/facebook/ads/redexgen/X/C0273Af.java
UTF-8
1,327
2.109375
2
[]
no_license
package com.facebook.ads.redexgen.X; import androidx.annotation.Nullable; /* renamed from: com.facebook.ads.redexgen.X.Af reason: case insensitive filesystem */ public final class C0273Af { public static final C0273Af A02 = new C0273Af(Long.MAX_VALUE, Long.MAX_VALUE); public static final C0273Af A03 = A04; public static final C0273Af A04 = new C0273Af(0, 0); public static final C0273Af A05 = new C0273Af(0, Long.MAX_VALUE); public static final C0273Af A06 = new C0273Af(Long.MAX_VALUE, 0); public final long A00; public final long A01; public C0273Af(long j, long j2) { boolean z; boolean z2 = true; if (j >= 0) { z = true; } else { z = false; } I1.A03(z); I1.A03(j2 < 0 ? false : z2); this.A01 = j; this.A00 = j2; } public final boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } C0273Af af = (C0273Af) obj; if (this.A01 == af.A01 && this.A00 == af.A00) { return true; } return false; } public final int hashCode() { return (((int) this.A01) * 31) + ((int) this.A00); } }
true
c153bcf44f770f1e5437dec05cbbe63ec61186e5
Java
DarkDrogan/EnglTrainer
/src/main/java/cf/darkdrogan/apps/englTrainer/StorageForWords/IrVerbWords.java
UTF-8
20,199
2.5625
3
[]
no_license
package cf.darkdrogan.apps.englTrainer.StorageForWords; import java.util.Random; /** * ?? */ public class IrVerbWords implements Words { //Array of the irregular verbs, may be changed to SQL or XML||JSon list for parsing /** * private String VERB = "rusInfinitive iDo rootDo rootDid firstVerb secondVerb typeWord RegularOrIrregular rusFormOf-be-verb+ed"; * @see cf.darkdrogan.apps.englTrainer.TrainingModuls.WordsParser */ //a private String arise = "поднимать поднимаю поднима поднимал arise arose arisen 1 1 поднят"; private String awake = "просыпаться просыпаюсь просыпае проснулся awake awoke awoke 4 1 проснулся(страдательное)"; //b //exception //String[] be = {"быть", "есть", "есть", "был", "be", "was|were", "been", "4", "1"}; // наподобие дерусь private String bear = "рождать рожаю рожа рожал bear bore born 1 1 рожден"; private String aBear = "носить ношу нос носил bear bore borne 2 1 поношен"; private String beat = "бить бью бь бил beat beat beaten 1 1 побит"; private String become = "становиться становлюсь станови становил become became become 4 1 стал"; private String bend = "гнуть гну гн гнул bend bent bent 3 1 погнут"; private String begin = "начинать начинаю начина начинал begin began begun 1 1 начат"; private String bind = "связывать связываю связыва связал bind bound bound 1 1 связан"; private String bite = "кусать кусаю куса кусал bite bit bitten 1 1 укушен"; private String blow = "дуть дую ду дул blow blew blown 1 1 надут"; private String bleed = "кровоточить кровоточу кровоточ кровоточил bleed bled bled 2 1 кровоточен(кровоточить)"; //я люблю русский язык private String aBreak = "разбивать разбиваю разбива разбил break broke broken 1 1 разбит"; private String breed = "выводить вывожу вывод вывел breed bred bred 2 1 выведен"; private String bring = "нести несу нес нес bring brought brought 1 1 отнесен"; private String broadcast = "(по_радио)передавать передаю переда передал broadcast broadcast broadcast 1 1 передан"; private String build = "строить строю стро строил build built built 1 1 построен"; private String burn = "жечь жгу жг сжог burn burnt burnt 3 1 сожжен"; private String burst = "разрываться разрываю разрыва разрывал burst burst burst 1 1 разорван"; private String buy = "покупать покупаю покупа купил buy bought bought 1 1 куплен"; //c private String cast = "кидать кидаю кида кидал cast cast cast 1 1 брошен(кидать)"; private String aCatch = "ловить ловлю лов ловил catch caught caught 2 1 пойман"; private String choose = "выбирать выбираю выбира выбирал choose chose chosen 1 1 выбран"; private String cling = "прилипать прилипаю прилипа прилипал cling clung clung 1 1 прилеплен"; private String come = "приходить прихожу приход приходил come came come 2 1 пройден"; private String cost = "стоить стою сто стоил cost cost cost 2 1 оценен"; private String creep = "ползать ползу полз ползал creep crept crept 1 1 дотащен(ползти)"; //! //d private String aDo = "делать делаю дела делал do did done 1 1 сделан"; private String deal = "торговать торгую торгу торговал deal dealt dealt 1 1 (торговать)заключен"; private String dig = "копать копаю копа копал dig dug dug 1 1 откопан"; private String draw = "рисовать рисую рису рисовал draw drew drawn 1 1 нарисован"; private String dream = "мечтать мечтаю мечта мечтал dream dreamt dreamt 1 1 выдуман("; //! private String drink = "пить пью пь пил drink drank drunk 1 1 пьян"; //! private String drive = "вести веду вед вел drive drove driven 3 1 проведен"; private String dwell = "обитать обитаю обита обитал dwell dwelt dwelt 1 1 (страдательное)обитать"; //e //исключение с русским словом - надо думать !!! //private String eat = "есть ем ед ел eat ate eaten /*may be 5*/ 1 1 съеден"; //f private String fall = "падать падаю пада упал fall fell fallen 1 1 пал("; //! private String feed = "кормить кормлю корм кормил feed fed fed 2 1 накормлен"; private String feel = "чувствовать чувствую чувству чувствовал feel felt felt 1 1 почувствован("; //! private String find = "находить нахожу наход находил find found found 2 1 найден"; private String fight = "драться дерусь дерe драл fight fought fought 4 1 побит"; private String flee = "спасаться спасаюсь спасае спасал flee fled fled 4 1 спасен"; private String fling = "кидать кидаю кида кидал fling flung flung 1 1 кинут"; private String fly = "летать лечу лет летел fly flew flown 2 1 лечен(летать)"; //бяка! в страдательном private String forbit = "запрещать запрещаю запреща запрещал forbit forbade forbidden 1 1 запрещен"; private String forget = "забывать забываю забыва забыл forget forgot forgotten 1 1 забыт"; private String forgive = "прощать прощаю проща простил forgive forgave forgiven 1 1 прощен"; private String freeze = "замораживать замораживаю заморажива заморозил freeze froze frozen 1 1 заморожен"; //g private String get = "получать получаю получа получил get got gotten 1 1 получен"; private String give = "давать даю да давал give gave given 1 1 отдан"; private String go = "идти иду ид ходил go went gone 3 1 пройден"; private String grind = "молот перемалываю перемалыва перемолол grind ground ground 1 1 перемолен"; private String grow = "расти расту раст grow grew grown 3 1выращен"; //h //слово исключение, продумать насчет третьего лица ибо "has" //String[] aHave = {"иметь", "имею", "име", "имел", "have", "had", "had", "1", "1"}; private String hang = "вешать вешаю вешаю веша вешал hang hung hund 1 1 повешен"; private String hear = "слышать слышу слыш слышал hear heard heard 1 1 услышан"; private String hide = "прятать прячу пряч прятал hide hid hidden 1 1 спрятан"; private String hit = "ударять ударяю ударя ударил hit hit hit 1 1 ударен"; private String hold = "держать держу держ держал hold heald heald 2 1 удержан"; private String hurt = "вредить врежу вред вредил hurt hurt hurt 2 1 поврежден"; //i //j //k private String keep = "хранить храню хран хранил keep kept kept 2 1 сохранен"; //private String kneel = "становиться на колени"; - надо думать private String know = "знать знаю зна знал know knew known 1 1 известен(знать)"; //l private String lay = "класть кладу клад клал lay laid laid 1 1 (класть)положен"; private String lead = "вести веду вед вел lead led led 3 1 проведен"; private String lean = "нагибать нагибаю нагиба нагибал lean leant leant 1 1 нагнут"; private String leap = "прыгать прыгаю прыга прыгнул leap leapt leapt 1 1 (прыгать)подброшен"; private String learn = "учить учу уч учил learn learnt learnt 2 1 выучен"; private String leave = "покидать покидаю покида покинул leave left left 1 1 покинут"; private String lend = "одолжить одалживаю одалжива одолжил lend lent lent 1 1 одолжен"; private String let = "позволять позволяю позволя ползволял let let let 1 1 позволен"; private String lie = "лежать лежу леж лежал lie lay lain 2 1 положен(лежать)"; private String light = "зажигать зажигаю зажига зажигал light lit lit 1 1 зажжен"; private String lose = "терять теряю теря потерял lose lost lost 1 1 потерян"; //m private String make = "создавать создаю созда создал make made made 1 1 создан"; private String mean = "значить значу знач значил mean meant meant 2 1 означал"; private String meet = "встречать встречаю встреча встречал meet met met 1 1 встречен"; //n //o //p private String pay = "платить плачу плат платил pay paid paid 2 1 оплачен"; private String put = "ложить ложу лож ложил put put put 2 1 положен"; //q //r private String read = "читать читаю чита читал read read read 1 1 прочитан"; private String ride = "ездить езжу езд ездил ride rode ridden 2 1 объезжен("; //! private String ring = "звонить звоню звон звонил ring rang rung 2 1 звенел"; private String rise = "подниматься поднимаюсь поднимае поднял rise rose risen 4 1 поднят"; private String run = "бежать бегу беж бежал run ran run 2 1 (бежать)пройден"; //s private String say = "говорить говорю говор говорил say said said 2 1 сказан"; private String saw = "пилить пилю пил пилил saw sawed sawn 1 1 распилен"; private String see = "видеть вижу вид видел see saw seen 2 1 увиден"; private String seek = "искать исчу исч искал seek sought sought 1 1 найден(искать)"; //! private String sell = "продавать продаю прода продал pay sold sold 1 1 продан"; private String send = "посылать посылаю посыла послал send sent sent 1 1 послан"; private String set = "помещать помещаю помеща помещал set set set 1 1 помещен"; private String shake = "трясти трясу тряс тряс shake shook shaken 3 1 потрясен"; private String shed = "проливать проливаю пролива проливал shed shed shed 1 1 пролит"; private String shine = "сиять сияю сия сиял shine shone shone 1 1 (сиять)освещен"; private String shoot = "стрелять стреляю стреля стрелял shoot shot shot 1 1 стрелян("; //! private String show = "показывать показываю показыва показал show showed shown 1 1 показан"; private String shrink = "сморщиваться морщусь морщи морщился shrink shrank shrunk 4 1 сморщен"; private String shut = "закрывать закрываю закрыва закрывал shut shut shut 1 1 закрыт"; private String sing = "петь пою по пел sing sang sung 1 1 пропет"; private String sink = "тонуть тону тон тонул sink sank sunk 3 1 утоплен"; private String sit = "сидеть сижу сид сидел sit sat sat 2 1 посажен"; private String sleep = "спать сплю сп спал sleep slept slept 2 1 (спать)проспан"; private String slide = "скользить скольжу скольз скользил slide slid slid 2 1 проскользил"; private String smell = "нюхать нюхаю нюха нюхал smell smelt smelt 1 1 пахнет"; private String sow = "сеять сею се сеял sow sowed sonw 1 1 посеян"; private String speak = "говорить говорю говор говорил speak spoke spoken 2 1 сказан"; private String speed = "спешить спешу спеш спешил speed sped sped 2 1 спешен"; //в жопу все=( //private String spell = "читать или писать по буквам - надо думать"; private String spend = "тратить трачу трат тратил spend spent spent 2 1 потрачен"; private String spill = "проливать проливаю пролива пролил spill spilt spilt 1 1 пролит"; private String spin = "крутить кручу крут крутил spin span spun 2 1 покручен"; private String spit = "плевать плюю плю плевал spit spat spat 1 1 оплеван"; private String split = "раскалывать раскалываю раскалыва раскалывал split split split 1 1 расколот"; private String spoil = "портить порчу порт портил spoil spoilt spoilt 2 1 испорчен"; private String spread = "распространять распространяю распространя распространил spread spread spread 1 1 распространен"; private String spring = "прыгать прыгаю прыга прыгал spring sprang sprung 1 1 подброшен(прыгать)"; //don't like that private String stand = "стоять стою сто стоял stand stood stood 2 1 (страдательный)стоять"; // private String steal = "красть краду крад крал steal stole stolen 1 1 украден"; private String stick = "приклеивать приклеиваю приклеива приклеил stick stuck stuck 1 1 приклеен"; private String sting = "жалить жалю жал жалил sting stung stung 2 1 ужален"; private String strike = "ударять ударяю ударя ударил strike struck struck 1 1 ударен"; private String strive = "стремить стремлюсь стреми стремил strive strove striven 4 1 устремлен"; private String swear = "клясться клянусь кляне клял swear swore sworn 4 1 заклят(клясться)"; private String sweep = "мести мету мет мел sweep swept swept 3 1 подметен"; private String swell = "опухать опухаю опуха опух swell swelled swollen 1 1 опух("; //! private String swim = "плавать плаваю плава плавал swim swam swum 1 1 приплыл(плавать)"; //it's holy shit private String swing = "качаться качаюсь качае качал swing swung swung 4 1 раскачен"; //t private String take = "брать беру бер брал take took taken 3 1 взят"; private String tear = "рвать рву рв рвал tear tore torn 3 1 порван"; private String teach = "учить учу уч учил teach taught taught 2 1 обучен"; private String tell = "рассказывать рассказываю рассказыва рассказывал tell told told 1 1 рассказан"; private String think = "думать думаю дума думал think thought thought 1 1 обдуман("; private String aThrow = "бросать бросаю броса бросал throw threw thrown 1 1 брошен"; private String tread = "ступать ступаю ступа ступал tread trod trodden 1 1 наступлен(ступать)"; //убейте меня не больно, этот страдательный залог //u private String understand = "понимать понимаю понима понял understand understood understood 1 1 понят"; //w private String wake = "будить бужу буд будил wake woke woken 2 1 разбужен"; private String wear = "носить ношу нос носил wear wore worn 2 1 поношен"; private String weep = "плакать плачу плач плакал weep wept wept 1 1 оплакан("; //! private String win = "побеждать побеждаю побежда победил win won won 1 1 побежден"; private String wind = "виться вьюсь вье вился wind wound wound 4 1 обвит"; private String write = "писать пишу пиш писал write wrote written 1 1 написан"; // // // //загоняет все переменные в массив, для удобства взятия рандомной строки. 137 глаголов ~_~ // move this shit to javadoc) private String[] words = {arise, spoil, stand, stick, sting, sweep, swing, teach, tell, understand, wake, win, wind, bear, aBear, become, bind, bite, begin, blow, aBreak, bring, burst, cast, aCatch, choose, come, creep, cost, aDo, draw, dream, drink, drive, fall, feel, find, fight, fly, forbit, forget, forgive, freeze, get, give, go, grow, hear, hide, hit, hurt, know, lean, let, lie, make, meet, put, read, lay, lead, leap, learn, leave, lend, light, lose, mean, pay, run, sell, send, shine, sit, sleep, slide, smell, speed, spend, spill, ride, ring, rise, say, saw, see, seek, set, shake, shed, shoot, show, shrink, shut, sing, sink, sow, awake, beat, bend, bleed, breed, broadcast, build, burn, buy, cling, deal, dig, dwell, feed, flee, fling, grind, hang, hold, keep, speak, spit, spin, split, spread, spring, steal, strike, strive, swear, swell, swim, take, tear, think, aThrow, tread, wear, weep, write}; /** * This getter take random word from array and split string on array for trainer and other rules of the trainer. * @return Array of words */ public final String[] getWords() { Random rand = new Random(); return words[rand.nextInt(words.length)].split(" "); } /** * New features for take concrete word - soon I'll take getter all irVerbs with number of string for concreteGetter. * Rename i please. It assumes no sense. * @param i ?? * @return ?? */ public final String[] getWords(final int i) { return words[i].split(" "); } /** * for number of string ~_~ - WAT. * @param args ?? */ public static void main(final String[] args) { IrVerbWords v = new IrVerbWords(); int i = 0; for (String e : v.words) { System.out.println(i++ + " :" + e); } } }
true
83feed818984862d4e59e7812081c3098f31d679
Java
INBio/m3s
/m3s-service/src/test/java/org/inbio/m3s/dao/INBioTaxonDAOTest.java
UTF-8
3,497
2.328125
2
[]
no_license
package org.inbio.m3s.dao; import org.inbio.m3s.dao.core.TaxonDAO; import org.inbio.m3s.model.atta.INBioTaxon; import org.inbio.m3s.model.taxonomy.Taxon; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; public class INBioTaxonDAOTest extends AbstractDependencyInjectionSpringContextTests{ @Override protected String[] getConfigLocations() { return new String [] { //"classpath*:/**/applicationContext-*.xml", //"classpath*:**/applicationContext-*.xml", //"classpath*:org/inbio/m3s/**/applicationContext-*.xml", //"classpath*:/org/inbio/m3s/**/impl/applicationContext-*-test.xml", "classpath*:org/inbio/m3s/dao/applicationContext-dao.xml", "classpath*:org/inbio/m3s/dao/applicationContext-factories.xml", //"classpath*:/org/inbio/m3s/service/impl/applicationContext-service-test.xml" }; } public void testFindById(){ TaxonDAO taxonDAO = (TaxonDAO) applicationContext.getBean("INBioTaxonDAO"); INBioTaxon t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(63799)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(2)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(5)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(119)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(29)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(881)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(3474)); System.out.println(t.toString()); t = (INBioTaxon) taxonDAO.findById(Taxon.class, new Integer(13024)); System.out.println(t.toString()); assertTrue( true ); } /* public void testGetTaxonLiteFromGatheringCode(){ TaxonDAO taxonDAO = (TaxonDAO) applicationContext.getBean("INBioTaxonDAO"); String gatheringCode1 ="Alexander Rodríguez;11370"; String gatheringCode2 ="Daniel Solano;4177"; String gatheringCode3 ="Daniel Santamaría;7839"; String gatheringCode4 ="Daniel Solano;2989"; List<TaxonLite> taxonsList; try { System.out.println(gatheringCode1+":"); taxonsList = taxonDAO.getTaxonLiteFromGatheringCode(gatheringCode1); for (TaxonLite tl : taxonsList) System.out.println("\n\t"+ tl.getDefaultName()); } catch (Exception e){ System.out.println(e.getMessage()); //assertTrue( false ); } try { System.out.println(gatheringCode2+":"); taxonsList = taxonDAO.getTaxonLiteFromGatheringCode(gatheringCode2); for (TaxonLite tl : taxonsList) System.out.println("\n\t"+ tl.getDefaultName()); } catch (Exception e){ System.out.println(e.getMessage()); //assertTrue( false ); } try { System.out.println(gatheringCode3+":"); taxonsList = taxonDAO.getTaxonLiteFromGatheringCode(gatheringCode3); for (TaxonLite tl : taxonsList) System.out.println("\n\t"+ tl.getDefaultName()); } catch (Exception e){ System.out.println(e.getMessage()); //assertTrue( false ); } try { System.out.println(gatheringCode4+":"); taxonsList = taxonDAO.getTaxonLiteFromGatheringCode(gatheringCode4); for (TaxonLite tl : taxonsList) System.out.println("\n\t"+ tl.getDefaultName()); } catch (Exception e){ System.out.println(e.getMessage()); //assertTrue( false ); } assertTrue( true ); } */ }
true
88cbca48898d7b2aee087b0981da80acc47804d8
Java
jcaso26/Kamaduino_Back
/src/main/java/com/kamaduino/converter/TemperaturaConverter.java
UTF-8
836
2.390625
2
[ "Apache-2.0" ]
permissive
package com.kamaduino.converter; import com.kamaduino.dto.TemperaturaDTO; import com.kamaduino.entity.Temperatura; public class TemperaturaConverter { public static TemperaturaDTO entityToDTO(Temperatura temperatura){ TemperaturaDTO temperaturaDTO = new TemperaturaDTO(temperatura.getId(), temperatura.getTemperaturaSuperior(), temperatura.getTemperaturaInferior(), temperatura.getTime()); return temperaturaDTO; } // public static TemperaturaDTO entityToDTO(Temperatura temperatura){ // //TODO // TemperaturaDTO temperaturaDTO = new TemperaturaDTO(); // // return temperaturaDTO; // } // // public static Temperatura dtoToEntity(TemperaturaDTO temperaturaDTO){ // //TODO // Temperatura temperatura = new Temperatura(); // // return temperatura; // } }
true
df4e0ee56a0b3fc55a3b42726826bf4e0d3de882
Java
gui-gui-maker/MyFrame
/SYTSB1/.svn/pristine/3f/3f94ed45710d1450ab249ace44c3e28ce30ac5bb.svn-base
UTF-8
5,284
2.140625
2
[]
no_license
package com.fwxm.scientific.web; import java.util.Date; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.alibaba.fastjson.JSON; import com.fwxm.scientific.bean.Instruction; import com.fwxm.scientific.bean.InstructionInfo; import com.fwxm.scientific.bean.InstrumentDevice; import com.fwxm.scientific.bean.InstrumentDeviceInfo; import com.fwxm.scientific.service.InstrumentDeviceInfoManager; import com.fwxm.scientific.service.InstrumentDeviceManager; import com.khnt.core.crud.web.SpringSupportAction; import com.khnt.core.crud.web.support.JsonWrapper; import com.khnt.security.CurrentSessionUser; import com.khnt.security.util.SecurityUtil; /** * <p> * 类说明 * </p> * * @ClassName InstrumentDevice * @JDK 1.7 * @author CODER_V3.0 * @date 2018-01-18 15:20:10 */ @SuppressWarnings("serial") @Controller @RequestMapping("com/tjy2/instrumentDevice") public class InstrumentDeviceAction extends SpringSupportAction<InstrumentDevice, InstrumentDeviceManager> { @Autowired private InstrumentDeviceManager instrumentDeviceManager; @Autowired private InstrumentDeviceInfoManager instrumentDeviceInfoManager; /** * 保存 * * @param request * @param employeeCert * @throws Exception */ @RequestMapping(value = "saveBasic") @ResponseBody public HashMap<String, Object> saveBasic(HttpServletRequest request) throws Exception { HashMap<String, Object> map=new HashMap<String, Object>(); CurrentSessionUser user=SecurityUtil.getSecurityUser(); String instruction=request.getParameter("instruction").toString(); InstrumentDevice entity=JSON.parseObject(instruction, InstrumentDevice.class); try { if(entity.getId()==null||entity.getId().equals("")||entity.getStatus().equals("0")){ entity.setCreateDate(new Date()); entity.setCreateId(user.getId()); entity.setCreateMan(user.getName()); entity.setStatus("0"); } instrumentDeviceManager.save(entity); // 保存信息 for (InstrumentDeviceInfo info :entity.getInstrumentDeviceInfo()) { info.setInstrumentDevice(entity); instrumentDeviceInfoManager.save(info); } map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); return JsonWrapper.failureWrapperMsg("保存失败,请重试!"); } return map; } /** 获取信息 **/ @RequestMapping(value = "getDetail") @ResponseBody public HashMap<String, Object> getDetail(HttpServletRequest request) throws Exception { HashMap<String, Object> map=new HashMap<String, Object>(); String id = request.getParameter("id"); try { InstrumentDevice instruction = instrumentDeviceManager.getDetail(id); map.put("data", instruction); map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); // TODO: handle exception } return map; } /** 提交审核**/ @RequestMapping(value = "subAudit") @ResponseBody public HashMap<String, Object> subAudit(HttpServletRequest request,String id,String opinion,String remark) throws Exception { HashMap<String, Object> map=new HashMap<String, Object>(); CurrentSessionUser user=SecurityUtil.getSecurityUser(); try { InstrumentDevice instruction =instrumentDeviceManager.get(id); instruction.setStatus("1");//提交 instrumentDeviceManager.save(instruction); map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); // TODO: handle exception } return map; } /** 项目负责人审核**/ @RequestMapping(value = "audit") @ResponseBody public HashMap<String, Object> audit (HttpServletRequest request,String id,String result,String remark) throws Exception { HashMap<String, Object> map=new HashMap<String, Object>(); CurrentSessionUser user=SecurityUtil.getSecurityUser(); try { InstrumentDevice instruction =instrumentDeviceManager.get(id); if(result.equals("1")){ instruction.setStatus("2");//审核通过 }else{ instruction.setStatus("0");//审核通过 } instruction.setRemark(remark); instrumentDeviceManager.save(instruction); map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); // TODO: handle exception } return map; } /** 删除**/ @RequestMapping(value = "deleteBase") @ResponseBody public HashMap<String, Object> deleteBase(HttpServletRequest request,String id) throws Exception { HashMap<String, Object> map=new HashMap<String, Object>(); CurrentSessionUser user=SecurityUtil.getSecurityUser(); try { String[] ids=id.split(","); for (int i = 0; i < ids.length; i++) { InstrumentDevice instruction =instrumentDeviceManager.get(ids[i]); instruction.setStatus("99");//删除 instrumentDeviceManager.save(instruction); } map.put("success", true); } catch (Exception e) { e.printStackTrace(); map.put("success", false); // TODO: handle exception } return map; } }
true
dd93d9395be0a44c99158421392a88c33af99740
Java
focusxyhoo/leetcode
/src/examination/Huawei02.java
UTF-8
3,472
3.28125
3
[]
no_license
package examination; import java.util.*; /** * created with IntelliJ IDEA * author : focusxyhoo * date : 2019-08-14 * time : 18:55 * description : */ public class Huawei02 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); int n = s.length(); if (null == s || n == 0) return; Deque<Character> stack = new LinkedList<>(); boolean hasQuote = false; List<String> ans = new ArrayList<>(); for (int i = 0; i < n; i++) { char temp = s.charAt(i); if (temp != ',') { if (temp != '"') { stack.push(temp); } else { hasQuote = true; stack.push(temp); } } else { // if not ',', pop if (hasQuote) stack.push(temp); else { StringBuilder sb = new StringBuilder(); while (!stack.isEmpty()) { sb.append(stack.pop()); } sb = sb.reverse(); String str = sb.toString(); if (str.length() == 0) { ans.add("--"); } else { if (isIllegal(str)) { if (str.charAt(0) == '"') { ans.add(removeExtra(str.substring(1, str.length() - 1))); } else ans.add(removeExtra(str)); } else { return; } } } hasQuote = false; } } if (!stack.isEmpty()) { StringBuilder sb = new StringBuilder(); while (!stack.isEmpty()) sb.append(stack.pop()); sb = sb.reverse(); String str = sb.toString(); if (str.length() == 0) { ans.add("--"); } else { if (isIllegal(str)) { if (str.charAt(0) == '"') { ans.add(removeExtra(str.substring(1, str.length() - 1))); } else ans.add(removeExtra(str)); } else { return; } } hasQuote = false; } System.out.println(ans.size()); for (String str : ans) { System.out.println(str); } } private static boolean isIllegal(String s) { int n = s.length(); if (s.contains(",") || s.contains("\"")) { if (s.charAt(0) != '"' || s.charAt(n - 1) != '"') return false; } for (int i = 0; i < n; ) { if (s.charAt(i) == '"') { if (i == 0 || i == n - 1) { i++; } else { if (s.charAt(i + 1) != '"') return false; i += 2; } } else i++; } return true; } private static String removeExtra(String s) { int len = s.length(); int n = 0; if (s.charAt(0) == '"') n = 1; StringBuilder sb = new StringBuilder(); for (int i = n; i < len - n; i++) { sb.append(s.charAt(i)); if (s.charAt(i) == '"') i++; } return sb.toString(); } }
true
34345be7ce6e084ecee6b26c6248811102f460f5
Java
matthiaw/quarxs
/QuarXs/src/main/java/org/rogatio/quarxs/GraphEventListener.java
UTF-8
32,501
1.960938
2
[]
no_license
package org.rogatio.quarxs; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Provider; import org.rogatio.quarxs.util.Constants; import org.rogatio.quarxs.util.ObjectQuery; import org.rogatio.quarxs.util.PrettyIdConverter; import org.slf4j.Logger; import org.xwiki.bridge.event.AbstractDocumentEvent; import org.xwiki.bridge.event.DocumentCreatedEvent; import org.xwiki.bridge.event.DocumentUpdatedEvent; import org.xwiki.component.annotation.Component; import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentManager; import org.xwiki.context.Execution; import org.xwiki.model.reference.DocumentReference; import org.xwiki.model.reference.EntityReference; import org.xwiki.observation.EventListener; import org.xwiki.observation.event.Event; import org.xwiki.query.QueryManager; import org.xwiki.rendering.block.Block; import org.xwiki.rendering.block.LinkBlock; import org.xwiki.rendering.block.WordBlock; import org.xwiki.rendering.listener.reference.ResourceReference; import org.xwiki.rendering.listener.reference.ResourceType; import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.XWikiException; import com.xpn.xwiki.doc.XWikiDocument; import com.xpn.xwiki.objects.BaseObject; @Component @Named("GraphEventListener") public class GraphEventListener implements EventListener { @Inject private Logger logger; @Inject @Named("context") private Provider<ComponentManager> componentManagerProvider; @Inject private QueryManager queryManager; @Override public List<Event> getEvents() { List<Event> events = new ArrayList<Event>(); events.add(new DocumentUpdatedEvent()); events.add(new DocumentCreatedEvent()); return events; } @Inject private Execution execution; @Override public String getName() { return "graph"; } private BaseObject getNodeObject(XWikiDocument doc) { EntityReference entRef = doc.resolveClassReference(Constants.SPACE + "." + Node.CLASS + "Class"); if (doc.getXObjects(entRef) != null) { return doc.getXObjects(entRef).get(0); } return null; } private boolean documentContainsNodeObject(XWikiDocument doc) { EntityReference entRef = doc.resolveClassReference(Constants.SPACE + "." + Node.CLASS + "Class"); List<BaseObject> list = doc.getXObjects(entRef); if (list != null) { if (list.size() != 0) { return true; } } return false; } @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiContext context = (XWikiContext) data; // Is Document created? if (event instanceof DocumentCreatedEvent) { // Check if a Graph Node exists. When not then create one System.out.println(doc.getName() + " contains Node: " + documentContainsNodeObject(doc)); if (!documentContainsNodeObject(doc)) { createNode(doc, context); } } // Document potentially renamed? if (event instanceof AbstractDocumentEvent) { BaseObject node = getNodeObject(doc); if (node != null) { String prettyId = node.getStringValue("prettyid"); if (prettyId != null) { if (prettyId.trim().equals("")) { System.out.println("ERROR: PrettyId of Node is not set. Force Change to Document '" + doc.getName() + "' to create one."); } } String label = node.getStringValue("label"); String guid = node.getGuid(); String nodeDocName = PrettyIdConverter.getDocumentName(prettyId); if (nodeDocName == null) { System.out.println("ERROR: DocumentName from PrettyId could not be found in Node '" + prettyId + "'"); } String nodeDocSpace = PrettyIdConverter.getSpace(prettyId); if (nodeDocSpace == null) { System.out.println("ERROR: Space from PrettyId could not be found in Node '" + prettyId + "'"); } String docName = doc.getDocumentReference().getName(); String docSpace = doc.getDocumentReference().getLastSpaceReference().getName(); // Rename PrettyId if Document-Name is not correct if (!(docSpace + "." + docName).equals(nodeDocSpace + "." + nodeDocName)) { node.set("prettyid", doc.getDocumentReference().getLastSpaceReference().getName() + "." + doc.getDocumentReference().getName() + "." + label + " (" + guid + ")", context); try { context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } } } } // is document created or changed? if (((event instanceof DocumentUpdatedEvent) || (event instanceof DocumentCreatedEvent)) && documentContainsNodeObject(doc)) { EdgeType edgeWikiType = getEdgeTypeWikiRelation(); EntityReference refEdge = doc.resolveClassReference("QuarXs.EdgeClass"); List<ResourceReference> links = new ArrayList<ResourceReference>(); getLinks(links, doc.getXDOM().getRoot()); /** * Delete the Wiki-Relation-Edge-Object when no Link is used */ if (doc.getXObjects(refEdge) != null) { boolean onefound = false; for (BaseObject baseObject : doc.getXObjects(refEdge)) { if (baseObject != null) { String type = baseObject.getStringValue("edgetype"); String nodeSource = baseObject.getStringValue("nodesource"); String nodeTarget = baseObject.getStringValue("nodetarget"); boolean found = false; for (ResourceReference resourceReference : links) { if (nodeSource.contains(doc.getDocumentReference().getName()) && nodeTarget.contains(resourceReference.getReference()) && type.equals(edgeWikiType.getPrettyId())) { found = true; } } if (!found) { if (type.equals(edgeWikiType.getPrettyId())) { doc.removeXObject(baseObject); onefound = true; } } } } if (onefound) { try { context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } } } /** * Create Wiki-Relation-Edge when Link is set */ for (ResourceReference resourceReference : links) { boolean createEdge = false; if (doc.getXObjects(refEdge) != null) { boolean found = false; for (BaseObject baseObject : doc.getXObjects(refEdge)) { if (baseObject != null) { String type = baseObject.getStringValue("edgetype"); String nodeSource = baseObject.getStringValue("nodesource"); String nodeTarget = baseObject.getStringValue("nodetarget"); if (nodeSource.contains(doc.getDocumentReference().getName()) && nodeTarget.contains(resourceReference.getReference()) && type.equals(edgeWikiType.getPrettyId())) { found = true; } } } if (!found) { createEdge = true; } } else { createEdge = true; } if (createEdge) { createEdge(doc, context, resourceReference); } } } // Is Document changed? if ((event instanceof DocumentUpdatedEvent)) { EntityReference entRef = doc.resolveClassReference(Constants.SPACE + "." + Node.CLASS + "Class"); /** * Create Data-Object for Node if it not exists */ // Do the Page contain a Node? if (doc.getXObjects(entRef) != null) { // When yes, then get Nodes for (BaseObject obj : doc.getXObjects(entRef)) { if (obj != null) { String nodeLabel = obj.getStringValue("label"); // Node contains NodeType if (!obj.getStringValue("nodetype").equals("")) { // Get NodeTypeObject from PrettyId NodeType nodeType = getNodeType(obj.getStringValue("nodetype")); // If NodeType contains DataEntity String entity = nodeType.getEntity(); if (!entity.equals("")) { // Create Object-Instance of DataEntity if it // not already exists logger.info("DataObject '" + entity + "' created for Node '" + obj.getStringValue("label") + "'."); System.out.println("DataObject '" + entity + "' created for Node '" + obj.getStringValue("label") + "'."); BaseObject dataObject = this.createDataObjectNode(doc, context, entity, obj.getStringValue("prettyid")); // If dataObject exists, check if prettyid is correct if (dataObject != null) { String id = dataObject.getStringValue("node"); String label = PrettyIdConverter.getName(id); if (!label.equals(nodeLabel)) { dataObject.set("node", PrettyIdConverter.replaceName(id, nodeLabel), context); try { context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } } } } } } } } entRef = doc.resolveClassReference(Constants.SPACE + "." + Edge.CLASS + "Class"); /** * Create Data-Object for Edge if it not exists */ // Do the Page contain a Edge? if (doc.getXObjects(entRef) != null) { // System.out.println("Size: "+doc.getXObjects(entRef).size()); // When yes, then get Edges for (BaseObject obj : doc.getXObjects(entRef)) { if (obj != null) { String edgeLabel = obj.getStringValue("label"); // System.out.println("label: "+edgeLabel); // Edge contains EdgeType if (!obj.getStringValue("edgetype").equals("")) { // Get EdgeTypeObject from PrettyId EdgeType edgeType = getEdgeType(obj.getStringValue("edgetype")); // System.out.println("EdgeType: "+edgeType.getName()); // If EdgeType contains DataEntity String entity = edgeType.getEntity(); if (!entity.equals("")) { // Create Object-Instance of DataEntity if it // not already exists logger.info("DataObject '" + entity + "' created for Edge '" + obj.getStringValue("prettyid") + "'."); System.out.println("DataObject '" + entity + "' created for Edge '" + obj.getStringValue("prettyid") + "'."); BaseObject dataObject = this.createDataObjectEdge(doc, context, entity, obj.getStringValue("prettyid")); // If dataObject exists, check if prettyid is correct // System.out.println(obj.getStringValue("prettyid")+" is Data-created to "+dataObject); if (dataObject != null) { String id = dataObject.getStringValue("edge"); // String label = PrettyIdConverter.getName(id); if (!obj.getStringValue("prettyid").equals(id)) { dataObject.set("edge", PrettyIdConverter.replaceName(id, edgeLabel), context); try { context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } } } } } } } } /** * Update edge-links of node-label is changed */ // Do the Page contain a Node? if (doc.getXObjects(entRef) != null) { // When yes, then get Nodes for (BaseObject obj : doc.getXObjects(entRef)) { if (obj != null) { String prettyidNode = obj.getStringValue("prettyid"); String nodeLabel = obj.getStringValue("label"); String nodeGuid = PrettyIdConverter.getGuid(prettyidNode); // Iterate over all existing edges for (Edge edge : getEdges(context)) { if (edge != null) { String spaceNameEdge = PrettyIdConverter.getSpace(edge.getPrettyId()).trim(); String docNameEdge = PrettyIdConverter.getDocumentName(edge.getPrettyId()).trim(); // If Source-Node is attached if (edge.getSource() != null) { String guid = PrettyIdConverter.getGuid(edge.getSource().getPrettyId()).trim(); String label = PrettyIdConverter.getName(edge.getSource().getPrettyId()).trim(); // check if Source-Node is node in document if (guid.equals(nodeGuid)) { // if node-label is not the same with // the edge if (!label.equals(nodeLabel)) { EntityReference refEdge = doc.resolveClassReference("QuarXs.EdgeClass"); if (edge.getDocument().getXObjects(refEdge) != null) { for (BaseObject baseObject : edge.getDocument().getXObjects(refEdge)) { // load relevant // edge-baseobject if (edge.getPrettyId() .equals(baseObject.getStringValue("prettyid"))) { // replace prettyid in // edge baseObject.set("nodesource", PrettyIdConverter.replaceName(prettyidNode, nodeLabel), context); try { // save edge in // edge-holding // document XWikiContext wikicontext = (XWikiContext) this.execution.getContext().getProperty( "xwikicontext"); DocumentReference docRef = new DocumentReference(context.getDatabase(), spaceNameEdge, docNameEdge); XWikiDocument docEdge = wikicontext.getWiki().getDocument(docRef, wikicontext); wikicontext.getWiki().saveDocument(docEdge, wikicontext); } catch (XWikiException e) { e.printStackTrace(); } } } } } } } if (edge.getTarget() != null) { String guid = PrettyIdConverter.getGuid(edge.getTarget().getPrettyId()).trim(); String label = PrettyIdConverter.getName(edge.getTarget().getPrettyId()).trim(); if (guid.equals(nodeGuid)) { if (!label.equals(nodeLabel)) { EntityReference refEdge = doc.resolveClassReference("QuarXs.EdgeClass"); if (edge.getDocument().getXObjects(refEdge) != null) { for (BaseObject baseObject : edge.getDocument().getXObjects(refEdge)) { if (edge.getPrettyId() .equals(baseObject.getStringValue("prettyid"))) { baseObject.set("nodetarget", PrettyIdConverter.replaceName(prettyidNode, nodeLabel), context); try { XWikiContext wikicontext = (XWikiContext) this.execution.getContext().getProperty( "xwikicontext"); DocumentReference docRef = new DocumentReference(context.getDatabase(), spaceNameEdge, docNameEdge); XWikiDocument docEdge = wikicontext.getWiki().getDocument(docRef, wikicontext); wikicontext.getWiki().saveDocument(docEdge, wikicontext); } catch (XWikiException e) { e.printStackTrace(); } } } } } } } } } } } } } } private void getLinks(List<ResourceReference> list, Block block) { if (block instanceof LinkBlock) { LinkBlock linkBlock = (LinkBlock) block; ResourceReference ref = linkBlock.getReference(); if (ref.getType().equals(ResourceType.DOCUMENT)) { list.add(ref); } } List<Block> children = block.getChildren(); for (Block cBlock : children) { getLinks(list, cBlock); } } private EdgeType getEdgeTypeWikiRelation() { try { if (componentManagerProvider.get().getInstanceList(EdgeType.class).size() == 0) { System.out.println("ERROR: No EdgeTypes found!"); } for (Object edgeTypeObj : componentManagerProvider.get().getInstanceList(EdgeType.class)) { EdgeType edgeType = (EdgeType) edgeTypeObj; if (edgeType.getName().equals("DocumentRelation")) { return edgeType; } } } catch (ComponentLookupException e) { e.printStackTrace(); } System.out.println("ERROR: DocumentRelation-EdgeType is missing!"); return null; } private NodeType getNodeTypeDefault() { try { for (Object nodeTypeObj : componentManagerProvider.get().getInstanceList(NodeType.class)) { NodeType nodeType = (NodeType) nodeTypeObj; if (nodeType.getName().equals("Default")) { return nodeType; } } } catch (ComponentLookupException e) { e.printStackTrace(); } System.out.println("ERROR: Default-NodeType is missing!"); return null; } private void createEdge(XWikiDocument doc, XWikiContext context, ResourceReference resourceReference) { String space = doc.getDocumentReference().getLastSpaceReference().getName(); String name = doc.getDocumentReference().getName(); EdgeType edgeWikiType = getEdgeTypeWikiRelation(); try { boolean targetContainsNode = false; EntityReference entRef = doc.resolveClassReference(Constants.SPACE + "." + Edge.CLASS + "Class"); int objectIndex = doc.createXObject(entRef, context); BaseObject obj = doc.getXObjects(entRef).get(objectIndex); obj.set("prettyid", space + "." + name + "." + " (" + obj.getGuid() + ")", context); List<Node> nodes = getNodes(); for (Node node : nodes) { if (node.getPrettyId().contains(space + "." + name)) { obj.set("nodesource", node.getPrettyId(), context); } if (node.getPrettyId().contains(space + "." + resourceReference.getReference())) { obj.set("nodetarget", node.getPrettyId(), context); targetContainsNode = true; } } obj.set("edgetype", edgeWikiType.getPrettyId(), context); if (targetContainsNode) { context.getWiki().saveDocument(doc, context); } } catch (XWikiException e) { e.printStackTrace(); } } private void createNode(XWikiDocument doc, XWikiContext context) { EntityReference entRef = doc.resolveClassReference(Constants.SPACE + "." + Node.CLASS + "Class"); try { int objectIndex = doc.createXObject(entRef, context); BaseObject obj = doc.getXObjects(entRef).get(objectIndex); obj.set("label", doc.getDocumentReference().getName(), context); obj.set( "prettyid", doc.getDocumentReference().getLastSpaceReference().getName() + "." + doc.getDocumentReference().getName() + "." + doc.getDocumentReference().getName() + " (" + obj.getGuid() + ")", context); NodeType nt = getNodeTypeDefault(); if (nt != null) { obj.set("nodetype", nt.getPrettyId(), context); context.getWiki().saveDocument(doc, context); logger.info("Node in Document '" + doc.getName() + "' created."); System.out.println("Node in Document '" + doc.getName() + "' created."); } else { System.out.println("ERROR: Default NodeType not exists! Could not create Node!"); } } catch (XWikiException e) { e.printStackTrace(); } } private BaseObject createDataObjectEdge(XWikiDocument doc, XWikiContext context, String dataClass, String edgePrettyId) { EntityReference entRefData = doc.resolveClassReference(dataClass); if (doc == null) { return null; } if (doc.getXObjects(entRefData) != null) { for (BaseObject baseObject : doc.getXObjects(entRefData)) { if (baseObject == null) { return null; } if (baseObject.getStringValue("edge") == null) { return null; } if (baseObject.getStringValue("edge").equals("")) { return null; } if (PrettyIdConverter.getGuid(baseObject.getStringValue("edge")).equals( PrettyIdConverter.getGuid(edgePrettyId))) { return baseObject; } } } try { int objectIndex = doc.createXObject(entRefData, context); BaseObject objData = doc.getXObjects(entRefData).get(objectIndex); objData.set("edge", edgePrettyId, context); context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } return null; } private BaseObject createDataObjectNode(XWikiDocument doc, XWikiContext context, String dataClass, String nodePrettyId) { EntityReference entRefData = doc.resolveClassReference(dataClass); if (doc == null) { return null; } if (doc.getXObjects(entRefData) != null) { for (BaseObject baseObject : doc.getXObjects(entRefData)) { if (baseObject == null) { return null; } if (baseObject.getStringValue("node") == null) { return null; } if (baseObject.getStringValue("node").equals("")) { return null; } if (PrettyIdConverter.getGuid(baseObject.getStringValue("node")).equals( PrettyIdConverter.getGuid(nodePrettyId))) { return baseObject; } } } try { int objectIndex = doc.createXObject(entRefData, context); BaseObject objData = doc.getXObjects(entRefData).get(objectIndex); objData.set("node", nodePrettyId, context); context.getWiki().saveDocument(doc, context); } catch (XWikiException e) { e.printStackTrace(); } return null; } private List<Edge> getEdges(XWikiContext context) { List<Edge> list = new ArrayList<Edge>(); try { for (Object edgeTypeObj : componentManagerProvider.get().getInstanceList(Edge.class)) { Edge edge = (Edge) edgeTypeObj; Edge edgeFromBo = ObjectQuery.getEdge(edge.getPrettyId(), queryManager, context); list.add(edgeFromBo); } } catch (ComponentLookupException e) { e.printStackTrace(); } return list; } private Node getNode(XWikiDocument doc) { for (Node node : getNodes()) { if (node.getDocument().getDocumentReference().getName().equals(doc.getDocumentReference().getName())) { return node; } } return null; } private List<Node> getNodes() { List<Node> list = new ArrayList<Node>(); try { for (Object nodeTypeObj : componentManagerProvider.get().getInstanceList(Node.class)) { Node node = (Node) nodeTypeObj; list.add(node); } } catch (ComponentLookupException e) { e.printStackTrace(); } return list; } private Edge getEdge(String prettyId) { try { for (Object eo : componentManagerProvider.get().getInstanceList(Edge.class)) { Edge edge = (Edge) eo; if (edge.getPrettyId().equals(prettyId)) { return edge; } } } catch (ComponentLookupException e) { e.printStackTrace(); } return null; } private NodeType getNodeType(String prettyId) { try { for (Object nodeTypeObj : componentManagerProvider.get().getInstanceList(NodeType.class)) { NodeType nodeType = (NodeType) nodeTypeObj; if (nodeType.getPrettyId().equals(prettyId)) { return nodeType; } } } catch (ComponentLookupException e) { e.printStackTrace(); } return null; } private EdgeType getEdgeType(String prettyId) { try { for (Object edgeTypeObj : componentManagerProvider.get().getInstanceList(EdgeType.class)) { EdgeType edgeType = (EdgeType) edgeTypeObj; if (edgeType.getPrettyId().equals(prettyId)) { return edgeType; } } } catch (ComponentLookupException e) { e.printStackTrace(); } return null; } }
true
20c9599db08630ce7b4f45aa02bd862d7224960d
Java
aekgmla77/miniproject
/mini_project/src/co/mini_project/project/web/FoodDelete.java
UTF-8
607
2.078125
2
[]
no_license
package co.mini_project.project.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import co.mini_project.project.common.Command; import co.mini_project.project.dao.MenuDao; import co.mini_project.project.vo.MenuVO; public class FoodDelete implements Command { @Override public String execute(HttpServletRequest request, HttpServletResponse response) { // TODO 삭제 MenuDao dao = new MenuDao(); MenuVO vo = new MenuVO(); vo.setmNum(Integer.parseInt(request.getParameter("mNum1"))); int n = dao.delete(vo); return "foodList.do"; } }
true
910597de4993c4bab2ef9a609df85c5c4e2ebfb1
Java
AllanWendy/jenkins
/sdk/src/main/java/com/wecook/sdk/api/model/Session.java
UTF-8
1,614
2.34375
2
[]
no_license
package com.wecook.sdk.api.model; import com.google.gson.annotations.SerializedName; import com.wecook.common.core.internet.ApiModel; import com.wecook.common.utils.JsonUtils; import org.json.JSONException; /** * 会话 * * @author kevin * @version v1.0 * @since 2014-11/18/14 */ public class Session extends ApiModel { @SerializedName("session_id") private String sessionId; @SerializedName("create_uid") private String createUid; @SerializedName("create_time") private String createTime; @SerializedName("update_time") private String updateTime; @Override public void parseJson(String json) throws JSONException { Session session = JsonUtils.getModel(json, Session.class); if (session != null) { sessionId = session.sessionId; createUid = session.createUid; createTime = session.createTime; updateTime = session.updateTime; } } public String getSessionId() { return sessionId; } public void setSessionId(String sessionId) { this.sessionId = sessionId; } public String getCreateUid() { return createUid; } public void setCreateUid(String createUid) { this.createUid = createUid; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getUpdateTime() { return updateTime; } public void setUpdateTime(String updateTime) { this.updateTime = updateTime; } }
true
1cc4bc452161a263422a24eebbee2a008fd332c9
Java
Krzysztof-87/AdvancedJava
/src/Zad7/Circle.java
UTF-8
696
3.28125
3
[]
no_license
package Zad7; /* Klasa Circle powinna implementować interfejs GeometricObject , a ponadto zawierać pole: promień. Metody interfejsu GeometricObject powinny zostać zaimplementowane zgodnie z de nicjami metematycznymi */ public class Circle implements GeometricObject { protected float radius; public Circle(int radius) { this.radius = radius; } @Override public double getPerimeter() { return 2*Math.PI*radius; } @Override public double getArea() { return Math.PI*Math.pow(radius, 2); } @Override public String toString() { return "Circle{" + "radius=" + radius + '}'; } }
true
d966771a6fde22d54163ad8faa95ec7626512d9a
Java
DineshNadar95/Coding-stuff
/Educative/Queues/Queues.java
UTF-8
1,366
3.828125
4
[]
no_license
import java.util.*; class Queues { public static String[] generateBinaryToN(int N){ String[] result = new String[N]; // Write -- Your -- Code Queue<String> q = new LinkedList<>(); q.offer("1"); int indx = result.length; while(indx != 0 && !q.isEmpty()){ String peeked = q.peek(); result[result.length-indx] = peeked; String t1 = peeked + "0"; String t2 = peeked + "1"; q.offer(t1); // add "0" at the end; add to queue q.offer(t2); // add "1" at the end; add to queue q.poll(); // remove from queue indx--; } return result; } public static void reverseK(int K){ Queue<Integer> queue = new LinkedList<>(); Queue<Integer> finalQ = new LinkedList<>(); Stack<Integer> stack = new Stack<>(); queue.offer(10); queue.offer(20); queue.offer(30); queue.offer(40); queue.offer(50); queue.offer(60); queue.offer(70); queue.offer(80); for(int i=0; i<K; i++){ stack.push(queue.poll()); } while(!stack.isEmpty()){ int popped = stack.pop(); finalQ.offer(popped); } while(!queue.isEmpty()){ finalQ.offer(queue.poll()); } while(!finalQ.isEmpty()){ int ele = finalQ.poll(); System.out.print(ele+"\t"); } } public static void main(String[] args) { String[] result = generateBinaryToN(3); for(String res: result){ System.out.println(res); } reverseK(3); } }
true
96dab30a60bcdd4677e9f805b24fdb6e275c4724
Java
ani03sha/Leetcoding
/november-2021-leetcoding-challenge/src/main/java/org/redquark/leetcoding/challenge/Problem27_ProductOfArrayExceptSelf.java
UTF-8
1,495
3.75
4
[ "MIT" ]
permissive
package org.redquark.leetcoding.challenge; /** * @author Anirudh Sharma * <p> * Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the * elements of nums except nums[i]. * <p> * The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. * <p> * You must write an algorithm that runs in O(n) time and without using the division operation. * <p> * Constraints: * <p> * 2 <= nums.length <= 10^5 * -30 <= nums[i] <= 30 * The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. * <p> * Follow up: Can you solve the problem in O(1) extra space complexity? (The output array does not count as * extra space for space complexity analysis.) */ public class Problem27_ProductOfArrayExceptSelf { public int[] productExceptSelf(int[] nums) { // Special case if (nums == null || nums.length == 0) { return new int[]{}; } // Length of the array int n = nums.length; // Array to store the output int[] output = new int[n]; output[0] = 1; // Loop from left to right for (int i = 1; i < n; i++) { output[i] = output[i - 1] * nums[i - 1]; } // Variable to store the product from right to left int product = 1; for (int i = n - 1; i >= 0; i--) { output[i] *= product; product *= nums[i]; } return output; } }
true
a57a18f82705199b2e1d33214b04d3ba5da1f71d
Java
nosmoon/misdevteam
/src/chosun/ciis/hd/lvcmpy/rec/HD_LVCMPY_2801_LCURLISTRecord.java
UHC
2,885
1.828125
2
[]
no_license
/*************************************************************************************************** * ϸ : .java * : ڿ-û * ۼ : 2007-05-22 * ۼ : 뼷 ***************************************************************************************************/ /*************************************************************************************************** * : * : * : * : ***************************************************************************************************/ package chosun.ciis.hd.lvcmpy.rec; import java.sql.*; import chosun.ciis.hd.lvcmpy.dm.*; import chosun.ciis.hd.lvcmpy.ds.*; /** * */ public class HD_LVCMPY_2801_LCURLISTRecord extends java.lang.Object implements java.io.Serializable{ public String dept_nm; public String emp_no; public String flnm; public String dty_nm; public String posi_nm; public String lvcmpy_dt; public String mm_avg_charg_amt; public String cont_svc_yys; public String lvcmpy_amt; public String real_lvcmpy_amt; public String lvcmpy_clsf; public HD_LVCMPY_2801_LCURLISTRecord(){} public void setDept_nm(String dept_nm){ this.dept_nm = dept_nm; } public void setEmp_no(String emp_no){ this.emp_no = emp_no; } public void setFlnm(String flnm){ this.flnm = flnm; } public void setDty_nm(String dty_nm){ this.dty_nm = dty_nm; } public void setPosi_nm(String posi_nm){ this.posi_nm = posi_nm; } public void setLvcmpy_dt(String lvcmpy_dt){ this.lvcmpy_dt = lvcmpy_dt; } public void setMm_avg_charg_amt(String mm_avg_charg_amt){ this.mm_avg_charg_amt = mm_avg_charg_amt; } public void setCont_svc_yys(String cont_svc_yys){ this.cont_svc_yys = cont_svc_yys; } public void setLvcmpy_amt(String lvcmpy_amt){ this.lvcmpy_amt = lvcmpy_amt; } public void setReal_lvcmpy_amt(String real_lvcmpy_amt){ this.real_lvcmpy_amt = real_lvcmpy_amt; } public void setLvcmpy_clsf(String lvcmpy_clsf){ this.lvcmpy_clsf = lvcmpy_clsf; } public String getDept_nm(){ return this.dept_nm; } public String getEmp_no(){ return this.emp_no; } public String getFlnm(){ return this.flnm; } public String getDty_nm(){ return this.dty_nm; } public String getPosi_nm(){ return this.posi_nm; } public String getLvcmpy_dt(){ return this.lvcmpy_dt; } public String getMm_avg_charg_amt(){ return this.mm_avg_charg_amt; } public String getCont_svc_yys(){ return this.cont_svc_yys; } public String getLvcmpy_amt(){ return this.lvcmpy_amt; } public String getReal_lvcmpy_amt(){ return this.real_lvcmpy_amt; } public String getLvcmpy_clsf(){ return this.lvcmpy_clsf; } } /* ۼð : Thu May 21 19:10:31 KST 2009 */
true
2fd1748f157e520cf98daa91ffe8c9c9be5925be
Java
yinfang/XiWeiApp
/common/src/main/java/com/zyf/device/BaseView.java
UTF-8
763
1.945313
2
[]
no_license
package com.zyf.device; import com.zyf.model.Result; /** * 类描述: 描述该类的功能 * 创建人: wzg * 创建时间: 2017/3/9 * 修改时间: 2017/3/9 20:39 * 修改备注: 说明本次修改内容 */ public interface BaseView { void showToast(Result result); void showProgress(); void showProgressNoCancel(); void showProgress(String msg); void dismissProgress(); void onSuccess(Result result); /** * 请求成功 返回错误 * * @param errorCode */ void onCodeError(int errorCode, String message, int action); void showProgressHorizontal(); /** * 请求失败 */ void onError(int action); String getResString(int resId); boolean isLogin(); }
true
65da1c11a03c0bde0094dede3008cd7b3ca204e4
Java
Weijiangtao139300/NewYuNiFangDemo
/app/src/main/java/weijiangtao/bwie/com/newyunifangdemo/activity/Homeactivity.java
UTF-8
5,644
1.921875
2
[]
no_license
package weijiangtao.bwie.com.newyunifangdemo.activity; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import weijiangtao.bwie.com.newyunifangdemo.R; import weijiangtao.bwie.com.newyunifangdemo.fragment.Classifyfragment; import weijiangtao.bwie.com.newyunifangdemo.fragment.Homefragment; import weijiangtao.bwie.com.newyunifangdemo.fragment.Myfragment; import weijiangtao.bwie.com.newyunifangdemo.fragment.Shoppingfragment; /** * Created by asus on 2017/4/11. * <p> * 未江涛 */ public class Homeactivity extends AppCompatActivity implements View.OnClickListener{ int[] image_red = {R.mipmap.bottom_tab_home_selected, R.mipmap.bottom_tab_classify_selected, R.mipmap.bottom_tab_shopping_selected, R.mipmap.bottom_tab_user_selected, }; int[] image_w = {R.mipmap.bottom_tab_home_normal, R.mipmap.bottom_tab_classify_normal, R.mipmap.bottom_tab_shopping_normal, R.mipmap.bottom_tab_user_normal }; private LinearLayout linear_home; private LinearLayout linear_fenlei; private LinearLayout linear_shopping; private LinearLayout linear_my; private TextView textv_home; private TextView textv_home1; private TextView textv_home2; private TextView textv_home3; private ImageView image_home; private ImageView image_home1; private ImageView image_home2; private ImageView image_home3; private List<TextView> list_text; private List<ImageView> list_image; private Homefragment home; private Classifyfragment classif; private Shoppingfragment shop; private Myfragment my; private int num=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_activity); initview(); initdata(0); getSupportFragmentManager().beginTransaction().replace(R.id.fraglayout,home).commit(); } private void initdata(int num) { for (int i = 0; i <list_image.size() ; i++) { if(num==i){ list_image.get(i).setImageResource(image_red[i]); list_text.get(i).setTextColor(Color.RED); }else { list_image.get(i).setImageResource(image_w[i]); list_text.get(i).setTextColor(Color.BLACK); } } } private void initview() { linear_home = (LinearLayout) findViewById(R.id.linear_home); linear_fenlei = (LinearLayout) findViewById(R.id.linear_fenlei); linear_shopping = (LinearLayout) findViewById(R.id.linear_shopping); linear_my = (LinearLayout) findViewById(R.id.linear_my); linear_home.setOnClickListener(this); linear_fenlei.setOnClickListener(this); linear_shopping.setOnClickListener(this); linear_my.setOnClickListener(this); textv_home = (TextView) findViewById(R.id.textv_home); textv_home1 = (TextView) findViewById(R.id.textv_home1); textv_home2 = (TextView) findViewById(R.id.textv_home2); textv_home3 = (TextView) findViewById(R.id.textv_home3); image_home = (ImageView) findViewById(R.id.image_home); image_home1 = (ImageView) findViewById(R.id.image_home1); image_home2 = (ImageView) findViewById(R.id.image_home2); image_home3 = (ImageView) findViewById(R.id.image_home3); list_text = new ArrayList<>(); list_text.add(textv_home); list_text.add(textv_home1); list_text.add(textv_home2); list_text.add(textv_home3); list_image = new ArrayList<>(); list_image.add(image_home); list_image.add(image_home1); list_image.add(image_home2); list_image.add(image_home3); home = new Homefragment(); classif = new Classifyfragment(); shop = new Shoppingfragment(); my = new Myfragment(); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.linear_home: initdata(0); getSupportFragmentManager().beginTransaction().setCustomAnimations(android.R.anim.slide_in_left,android.R.anim.slide_out_right) .replace(R.id.fraglayout,home).commit(); break; case R.id.linear_fenlei: initdata(1); getSupportFragmentManager().beginTransaction().setCustomAnimations(android.R.anim.fade_in,android.R.anim.fade_out) .replace(R.id.fraglayout,classif).commit(); break; case R.id.linear_shopping: initdata(2); getSupportFragmentManager().beginTransaction().setCustomAnimations(android.R.anim.slide_in_left,android.R.anim.slide_out_right) .replace(R.id.fraglayout,shop).commit(); break; case R.id.linear_my: initdata(3); getSupportFragmentManager().beginTransaction().setCustomAnimations(android.R.anim.fade_in,android.R.anim.fade_out) .replace(R.id.fraglayout,my).commit(); break; } } }
true
04a33a20ae242a4f70c1a84c1e8fb47f6e3c47fa
Java
IreneCho424/java2020_2
/javalab4/src/ex1/TwoDShape.java
UHC
306
3.390625
3
[]
no_license
package ex1; //( 1) TwoDShape Ŭ. width height Ÿ showDim() Լ. //1817022 ̸ public class TwoDShape{ public double width; public double height; public void showDim() { System.out.println("Width and height are " + width + " and " + height); } }
true
7c43d529496f4b3cf84b14e9cd01b94a96b6ece7
Java
logicmons/myVhr
/web-vhr/vhr-web/src/main/java/com/ysj/vhr/web/LoginController.java
UTF-8
1,235
2.375
2
[]
no_license
package com.ysj.vhr.web; import com.ysj.vhr.config.VerificationCode; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.awt.image.BufferedImage; import java.io.IOException; @RestController public class LoginController { @GetMapping("login") public ResponseEntity<String> login(){ return ResponseEntity.ok("尚未登录,请登录"); } /** * 验证码 * @param request * @param response * @throws IOException */ @GetMapping("verifyCode") public void verifyCode(HttpServletRequest request, HttpServletResponse response) throws IOException { //获取验证码 VerificationCode code = new VerificationCode(); BufferedImage image = code.getImage(); String text = code.getText(); HttpSession session = request.getSession(); session.setAttribute("verify_code",text); //写出到页面 VerificationCode.output(image,response.getOutputStream()); } }
true
180ed71b49ca5902e5565b5f66249f2e19eb21ab
Java
shnsalal/Spring-Boot-Login-Form-With-JWT
/jwt-project/src/main/java/com/darkroom/main/Service/RoleService.java
UTF-8
146
1.890625
2
[]
no_license
package com.darkroom.main.Service; import com.darkroom.main.model.Role; public interface RoleService { public Role findByRole(String role); }
true
fd8104f0d88e82c0c88871b5efca53393454c061
Java
ruddn777/Chap11
/Chap11/src/SuperTest3/SuperTest3.java
UHC
929
3.21875
3
[]
no_license
package SuperTest3; class SD1{ public int i1; public double d1; public SD1(int i1){ System.out.println("SD1(int i1) "); this.i1=i1*i1; System.out.println(i1+" 2:"+this.i1); } public SD1(double d1){ System.out.println("SD1(double d1) "); this.d1=d1*d1 ; System.out.println(d1+" 2:"+this.d1); } } class Sub1 extends SD1{ public Sub1(int i1){ super(i1); System.out.println("Sub1(int i1) "); this.i1=this.i1*i1; System.out.println(i1+" 3:"+this.i1); } public Sub1(double d1){ super(d1); System.out.println("Sub1(double d1) "); this.d1=this.d1*d1; System.out.println(d1+" 3:"+this.d1); } } public class SuperTest3 { public static void main(String[] args) { // TODO Auto-generated method stub Sub1 sub1=new Sub1(10); Sub1 sub2=new Sub1(10.5); } }
true
857a95d15db0cc38fa2378eede5baa10b02ef443
Java
Banzindun/dota2ai
/Dota2Framework/src/main/java/cz/cuni/mff/kocur/console/CommandResponse.java
UTF-8
2,450
3.65625
4
[]
no_license
package cz.cuni.mff.kocur.console; import cz.cuni.mff.kocur.base.CustomStringBuilder; /** * Class that represents a console command response. The response stores the * status of the command, that was performed as well as it's message. * * @author kocur * */ public class CommandResponse extends CustomStringBuilder { /** * Did the command pass? */ private boolean passed = true; /** * Empty constructor. */ public CommandResponse() { } /** * Constructor, that takes boolean and a string. * @param ok Did the command pass? * @param msg Message to the user. */ public CommandResponse(boolean ok, String msg) { setMsg(msg); setDone(ok); } /** * Sets this response as done with given status. * * @param d * Status of this response (true = passed, false = failed) */ public void setDone(boolean d) { passed = d; } /** * Sets this response as failed. * * @return Returns reference to this. */ public CommandResponse fail() { passed = false; return this; } /** * Sets the message of this response and sets its status as failed. * * @param msg * Message to be stored as a response. * @return Returns reference to this. */ public CommandResponse fail(String msg) { clear(msg); return fail(); } /** * Sets this object to passed. * * @return Returns reference to self. */ public CommandResponse pass() { passed = true; return this; } /** * Sets this command response as passed and appends the given message. * * @param msg * Message that should be stored inside this response. * @return Returns reference to this object. */ public CommandResponse pass(String msg) { clear(msg); return pass(); } /** * * @return Returns true if command that created this response passed. */ public boolean passed() { return passed; } /** * * @return Returns true if command that created this response failed. */ public boolean failed() { return !passed; } /** * Inserts a string to start of the stored String data. * * @param s * String to be inserted to the start. */ public void insertToStart(String s) { builder.insert(0, s); } /** * Set stored message by rewrite what was stored here before. * * @param msg * String to be stored inside this object. */ public void setMsg(String msg) { builder = new StringBuilder(msg); } }
true
c6eadd6781078ae4dd69377a40ab101aeb699613
Java
digidee/powerlift
/Powerlift/src/com/example/powerlift/WorkoutMain.java
UTF-8
1,735
2.015625
2
[]
no_license
package com.example.powerlift; import java.util.List; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.GraphView.GraphViewData; import com.jjoe64.graphview.GraphView.LegendAlign; import com.jjoe64.graphview.GraphViewSeries; import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; import com.jjoe64.graphview.LineGraphView; public class WorkoutMain extends ListFragment { private ExerciseNameDataSource exeds; WorkoutCustomListViewAdapter adapter; List<ExerciseName> values; long wid = 0; Button ba, bb; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.workout_m, container, false); ba = (Button) rootView.findViewById(R.id.li_button_a); bb = (Button) rootView.findViewById(R.id.li_button_b); ba.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setAdapter(1); } }); bb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setAdapter(2); } }); return rootView; } public void setAdapter(long wid) { exeds = new ExerciseNameDataSource(getActivity()); exeds.open(); values = exeds.getAllExerciseNamesWithID(wid); adapter = new WorkoutCustomListViewAdapter(getActivity(), R.layout.list_item, values, wid); setListAdapter(adapter); } }
true
34c9b31597f954dded1f6fea93edae12e7d51b97
Java
achmos/x-debugger
/src/interpreter/bytecode/debuggerByteCodes/HeaderCode.java
UTF-8
551
2.484375
2
[]
no_license
package interpreter.bytecode.debuggerByteCodes; import interpreter.VirtualMachine; import interpreter.bytecode.ByteCode; import interpreter.debugger.DebugVirtualMachine; /** * HeaderCode is an Abstract class that is used to tell the * difference between Header ByteCodes of a Function and * the regular ByteCodes. * @author Ramin */ abstract public class HeaderCode extends ByteCode { @Override public void execute(VirtualMachine VM) { DebugVirtualMachine DVM = (DebugVirtualMachine) VM; DVM.CheckStepBreaks(); } }
true
dcbd4251617b32eb7cda19295ae627004ebd733a
Java
rscerb1/InClassStategy
/src/PaypalStrategy.java
UTF-8
378
2.765625
3
[]
no_license
// Reggie Scerbo, Matt Cole, Delano Powell public class PaypalStrategy implements PaymentStrategy{ private String emailID, password; public PaypalStrategy(String emailID, String password){ this.emailID = emailID; this.password = password; } @Override public void pay(int amount){ System.out.println("Paying " + amount + " with Paypal"); } }
true
9d47202b81595d6d02d413ba4f2722f972d159c8
Java
vtitkova/Dashboard
/dashboard/dashboard-web/src/main/java/com/dmma/dashboard/gwt/admin/client/mvp/tables/broker/brokers/presenter/BrokersPresenterDisplay.java
UTF-8
842
1.929688
2
[]
no_license
package com.dmma.dashboard.gwt.admin.client.mvp.tables.broker.brokers.presenter; import java.util.ArrayList; import com.dmma.dashboard.gwt.core.shared.entities.BrokerDTO; import com.dmma.dashboard.gwt.core.shared.entities.BrokerOfficeDTO; import com.google.gwt.event.dom.client.HasChangeHandlers; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.gwt.user.client.ui.Widget; public interface BrokersPresenterDisplay { public Widget asWidget(); public void setData(ArrayList<BrokerDTO> data); public void setDataRequested(); public HasClickHandlers getAddNewButton(); public void setBrokerOffices(ArrayList<BrokerOfficeDTO> brokerOffices); public HasChangeHandlers getBrokerOfficesLB(); public void setSelectedBrokerOffice(Integer id); public Integer getSelectedBrokerOffice(); }
true
060e613708b863cc88e14d054660f4223c101c3f
Java
VicenteFnowell/sonidosdepeliculas
/app/src/main/java/com/example/sonidosdepeliculas/CSonidos.java
UTF-8
1,037
2.453125
2
[]
no_license
package com.example.sonidosdepeliculas; /** * Created by Vicente FN on 04/03/2018. */ public class CSonidos { String titulo; String duracion; String nombre; String pelicula; public CSonidos(String titulo, String duracion, String nombre,String pelicula) { this.titulo = titulo; this.duracion = duracion; this.nombre = nombre; this.pelicula = pelicula; } public CSonidos() { } public String getTitulo() { return titulo; } public void setTitulo(String titulo) { this.titulo = titulo; } public String getDuracion() { return duracion; } public void setDuracion(String duracion) { this.duracion = duracion; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getPelicula() { return pelicula; } public void setPelicula(String pelicula) { this.pelicula = pelicula; } }
true
81498e2d1d65d6f4fb4d152f8cd56d2189598174
Java
mol-yan/myCode
/redis_study/src/test/java/com/hangyan/redis_study/Mapper/TestCourseMapper.java
UTF-8
992
2.15625
2
[]
no_license
package com.hangyan.redis_study.Mapper; import com.alibaba.fastjson.JSON; import com.hangyan.redis_study.model.Course; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.List; @SpringBootTest @RunWith(SpringRunner.class) public class TestCourseMapper { @Autowired CourseMapper courseMapper; @Test public void testSelect() { Course course=new Course(); List<String> list = new ArrayList<>(); list.add("01"); list.add("02"); list.add("03"); course.setC_ids(list); List<Course> courses =courseMapper.SelectById(course); for (Course c: courses) { System.out.println(JSON.toJSON(c)); } } }
true
971a7858205999b84feec3701a1fd3401bcc3433
Java
DashaMihai/Homework
/Task20_tests/MessageSendGroupTest.java
UTF-8
1,431
2.03125
2
[]
no_license
package test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.AssertJUnit; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import page.LoginPage; import page.MessageSendGroup; public class MessageSendGroupTest { private WebDriver driver; private LoginPage loginPage; private MessageSendGroup messageSendGroup; @BeforeClass public void beforeClass() { String exePath = "D:\\selenium\\chromedriver.exe"; System.setProperty("webdriver.chrome.driver", exePath); driver = new ChromeDriver(); driver.get("http://mail.ru"); loginPage = new LoginPage(driver); messageSendGroup = new MessageSendGroup(driver); } @Test public void sendMessage() { loginPage.enterLoginAndPass("dashamihai", "dasha2912900"); loginPage.clickEnterButton(); messageSendGroup.clickWriteMessage(); AssertJUnit.assertTrue(messageSendGroup.RecipientPresents()); messageSendGroup.enterRecipient("[email protected], [email protected]"); driver.switchTo().frame(driver.findElement(By.xpath(".//tr[@class='mceFirst mceLast']//iframe"))); messageSendGroup.enterTextMessage("text"); driver.switchTo().defaultContent(); messageSendGroup.clickSendMessage(); AssertJUnit.assertTrue(messageSendGroup.sendMessagePresents()); } @AfterClass public void afterClass() { driver.quit(); } }
true
356945b9fdc2094eb6b06f8b0c96d1a57f15a021
Java
ft655508/SilverKing
/src/com/ms/silverking/cloud/dht/daemon/storage/ValidityVerifier.java
UTF-8
971
2.28125
2
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
package com.ms.silverking.cloud.dht.daemon.storage; import java.nio.ByteBuffer; import com.ms.silverking.cloud.dht.ConsistencyProtocol; import com.ms.silverking.cloud.dht.common.MetaDataUtil; import com.ms.silverking.cloud.dht.daemon.storage.protocol.StorageProtocolUtil; /** * Verify storage state. Possibly also verify integrity. * This class is designed to be called out of the critical path in the uncommon * instance where storage state of a previous retrieval was found to be bad. */ class ValidityVerifier { private final ByteBuffer buf; private final ConsistencyProtocol consistencyProtocol; ValidityVerifier(ByteBuffer buf, ConsistencyProtocol consistencyProtocol) { this.buf = buf; this.consistencyProtocol = consistencyProtocol; } boolean isValid(int offset) { return StorageProtocolUtil.storageStateValidForRead(consistencyProtocol, MetaDataUtil.getStorageState(buf, offset)); } }
true
2cf7802149ef6d8f1f6868c19657337f67f99926
Java
spampana/Core-Java
/SCJP/src/com/helpezee/boundedtypeswithgenerics/B.java
UTF-8
155
2.203125
2
[]
no_license
package com.helpezee.boundedtypeswithgenerics; public class B extends A { public void displayClass() { System.out.println("Inside sub class B"); } }
true
5778630fb0721317f8b919e57f512e586bb414f6
Java
chzhcn/biosoftware
/ biosoftware/src/biodraft/PrimerPair.java
UTF-8
2,528
2.734375
3
[]
no_license
package biodraft; import java.sql.*; import java.util.ArrayList; public class PrimerPair { private int forStart; private int forEnd; private int revStart; private int revEnd; private double score; private int groupID; public PrimerPair(int forStart, int forEnd, int revStart, int revEnd, double score, int groupID) { this.forStart = forStart; this.forEnd = forEnd; this.revStart = revStart; this.revEnd = revEnd; this.score = score; this.groupID = groupID; } public int getForEnd() { return forEnd; } public int getForStart() { return forStart; } public int getRevEnd() { return revEnd; } public int getRevStart() { return revStart; } public double getScore() { return score; } /* public int getGroupID() { return groupID; } */ public static ArrayList<PrimerPair> getPrimerPairsByGroupID(int groupID) throws SQLException { String sql = "select * from PrimerPair where groupid = ? order by score Desc"; ArrayList<PrimerPair> primerPairs = new ArrayList<PrimerPair>(); PreparedStatement ps = Main.con.prepareStatement(sql); ps.setInt(1, groupID); ResultSet rs = ps.executeQuery(); while (rs.next()) { primerPairs.add(new PrimerPair(rs.getInt("forstart"), rs.getInt("forend"), rs.getInt("revstart"), rs.getInt("revend"), rs.getDouble("score"), rs.getInt("groupid"))); } rs.close(); ps.close(); return primerPairs; } public static void AddPrimerPair(PrimerPair p) throws SQLException { String sql = "insert into PrimerPair values(?, ?, ?, ?, ?, ?)"; PreparedStatement ps = Main.con.prepareStatement(sql); ps.setInt(1, p.forStart); ps.setInt(2, p.forEnd); ps.setInt(3, p.revStart); ps.setInt(4, p.revEnd); ps.setDouble(5, p.score); ps.setInt(6, p.groupID); ps.executeUpdate(); ps.close(); } public static boolean deletePrimerPairsByGroupID(int id) throws SQLException { boolean flag = false; String sql = "delete from PrimerPair where groupid = ?"; PreparedStatement ps = Main.con.prepareStatement(sql); ps.setInt(1, id); ps.executeUpdate(); flag = true; ps.close(); return flag; } }
true
566d4def792028d7dc0e46cf2e6c382885c89830
Java
lizanle521/springaop
/src/main/java/com/lzl/netty/chapter10fileserver/httpxml/server/HttpXmlServerHandler.java
UTF-8
1,685
2.4375
2
[]
no_license
package com.lzl.netty.chapter10fileserver.httpxml.server; import com.lzl.netty.chapter10fileserver.httpxml.Order; import com.lzl.netty.chapter10fileserver.httpxml.codec.HttpXmlRequest; import com.lzl.netty.chapter10fileserver.httpxml.codec.HttpXmlResponse; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpHeaders; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; /** * @author lizanle * @Date 2019/2/27 14:45 */ public class HttpXmlServerHandler extends SimpleChannelInboundHandler<HttpXmlRequest> { @Override protected void messageReceived(ChannelHandlerContext ctx, HttpXmlRequest xmlRequest) throws Exception { FullHttpRequest request = xmlRequest.getRequest(); Order order = (Order) xmlRequest.getBody(); System.out.println("received order :"+order); doBusiness(order); ChannelFuture future = ctx.writeAndFlush(new HttpXmlResponse(null, order)); if(!HttpHeaders.isKeepAlive(request)){ future.addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { System.out.println("operation complete!"); ctx.close(); } }); } } private void doBusiness(Order order) { System.out.println("do sth. with order:"+order); } }
true
6cdc22881589d7f8dbad3aa74c81acfd2c7f821c
Java
diegomigliavacca/deegree3.3-gpkg
/deegree-services/deegree-services-wps/src/main/java/org/deegree/services/wps/provider/JavaProcessProviderProvider.java
UTF-8
4,231
1.609375
2
[]
no_license
//$HeadURL$ /*---------------------------------------------------------------------------- This file is part of deegree, http://deegree.org/ Copyright (C) 2001-2009 by: - Department of Geography, University of Bonn - and - lat/lon GmbH - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact information: lat/lon GmbH Aennchenstr. 19, 53177 Bonn Germany http://lat-lon.de/ Department of Geography, University of Bonn Prof. Dr. Klaus Greve Postfach 1147, 53001 Bonn Germany http://www.geographie.uni-bonn.de/deegree/ e-mail: [email protected] ----------------------------------------------------------------------------*/ package org.deegree.services.wps.provider; import static org.deegree.commons.xml.jaxb.JAXBUtils.unmarshall; import java.net.URL; import javax.xml.bind.JAXBException; import org.deegree.commons.config.DeegreeWorkspace; import org.deegree.commons.config.ResourceManager; import org.deegree.commons.utils.ProxyUtils; import org.deegree.process.jaxb.java.ProcessDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * {@link ProcessProviderProvider} for the {@link JavaProcessProvider}. * * @author <a href="mailto:[email protected]">Markus Schneider</a> * @author last edited by: $Author$ * * @version $Revision$, $Date$ */ public class JavaProcessProviderProvider implements ProcessProviderProvider { private static final Logger LOG = LoggerFactory.getLogger( JavaProcessProviderProvider.class ); private static final String JAXB_CONFIG_PACKAGE = "org.deegree.process.jaxb.java"; private static final URL JAXB_CONFIG_SCHEMA = JavaProcessProviderProvider.class.getResource( "/META-INF/schemas/processes/java/3.0.0/java.xsd" ); private static final String CONFIG_NS = "http://www.deegree.org/processes/java"; private DeegreeWorkspace workspace; @Override public String getConfigNamespace() { return CONFIG_NS; } @Override public ProcessProvider create( URL configURL ) { ProcessProvider manager = null; LOG.info( "Loading process definition from file '" + configURL + "'." ); // try { ProcessDefinition processDef = (ProcessDefinition) unmarshall( JAXB_CONFIG_PACKAGE, JAXB_CONFIG_SCHEMA, configURL, workspace ); // checkConfigVersion( definitionFile, processDef.getConfigVersion() ); // processDefinitions.add( processDef ); // // String wsdlFile = definitionFile.substring( 0, definitionFile.lastIndexOf( ".xml" ) ) + ".wsdl"; // LOG.debug( "Checking for process WSDL file: '" + wsdlFile + "'" ); // File f = new File( processesDir, wsdlFile ); // if ( f.exists() ) { // CodeType processId = new CodeType( processDef.getIdentifier().getValue(), // processDef.getIdentifier().getCodeSpace() ); // LOG.info( "Found process WSDL file." ); // processIdToWSDL.put( processId, f ); // } manager = new JavaProcessProvider( processDef ); } catch ( JAXBException e ) { e.printStackTrace(); } return manager; } @SuppressWarnings("unchecked") public Class<? extends ResourceManager>[] getDependencies() { return new Class[] { ProxyUtils.class }; } @Override public void init( DeegreeWorkspace workspace ) { this.workspace = workspace; } @Override public URL getConfigSchema() { return JAXB_CONFIG_SCHEMA; } }
true
c983fa77cabdbc53342be44fefa5bec66d4ca167
Java
RitaLanca/spring-course
/src/app/spring_course/model/enums/UnitMeasures.java
UTF-8
118
1.851563
2
[]
no_license
package com.academy.recipes.spring_course.model.enums; public enum UnitMeasures { GR, POUNDS, KILOGRAMS, LITER }
true
f89d64259b79de2f35bd9be6aa0935acc5f107b2
Java
rishikumar-RK/Morse-Code-Translator-App
/app/src/main/java/com/example/rishi/morsecode/MainActivity.java
UTF-8
5,084
2.484375
2
[]
no_license
package com.example.rishi.morsecode; import android.content.ClipData; import android.content.ClipboardManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import java.util.HashMap; public class MainActivity extends AppCompatActivity { TextView input,output; Button encode,decode,clear; ImageButton copy; String copyResult=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); input=(TextView) findViewById(R.id.input); output=(TextView) findViewById(R.id.output); encode=(Button) findViewById(R.id.enc); decode=(Button) findViewById(R.id.dec); clear=(Button) findViewById(R.id.clr); copy=(ImageButton) findViewById(R.id.cpy); final String[] letters={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s", "t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"}; final String[] morse={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--", "-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----", "..---","...--","....-",".....","-....","--...","---..","----."}; final HashMap<String,String> letterToMorse = new HashMap<>(); final HashMap<String,String> morseToLetter = new HashMap<>(); for(int i=0;i<letters.length;i++){ letterToMorse.put(letters[i],morse[i]); morseToLetter.put(morse[i],letters[i]); } encode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String inp=input.getText().toString().toLowerCase(); boolean valid=true; StringBuilder res=new StringBuilder(); String[] words=inp.trim().split(" "); for(String word: words){ if(word.matches("[a-z0-9]+")){ for(int i=0;i<word.length();i++){ res.append(letterToMorse.get(word.substring(i,i+1))); res.append(" "); } res.append(" "); } else{ valid=false; break; } } if(valid){ copyResult=res.toString(); output.setText(copyResult); } else Toast.makeText(MainActivity.this, "Enter valid text", Toast.LENGTH_SHORT).show(); } }); decode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String inp=input.getText().toString(); StringBuilder res=new StringBuilder(); String[] words=inp.trim().split(" "); Boolean valid=true; for(String word: words){ for(String letter: word.split(" ")){ if(!morseToLetter.containsKey(letter)){ valid=false; break; } if(valid) res.append(morseToLetter.get(letter)); else break; } if(valid) res.append(" "); else break; } if(valid){ copyResult=res.toString(); output.setText(copyResult); } else Toast.makeText(MainActivity.this, "Enter valid code", Toast.LENGTH_SHORT).show(); } }); copy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(copyResult.equals("")){ Toast.makeText(MainActivity.this, "No text copied", Toast.LENGTH_SHORT).show(); } else{ ClipboardManager clipboard=(ClipboardManager)getSystemService(CLIPBOARD_SERVICE); ClipData clip=ClipData.newPlainText("text",copyResult); clipboard.setPrimaryClip(clip); Toast.makeText(MainActivity.this, "Text copied", Toast.LENGTH_SHORT).show(); } } }); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { copyResult=""; input.setText(""); output.setText(""); } }); } }
true
bba3a5b6b51ba1de03864d374b48a6fcc0c3ec39
Java
lizhifeng-sky/CreateRecyclerAdapter
/src/CreateJavaUtils.java
UTF-8
3,743
2.703125
3
[]
no_license
import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; /** * Created by Administrator on 2017/4/20 0020. */ public class CreateJavaUtils { public static void createBaseAdapter(String packageName, String path) throws IOException { String filePath = path + "BaseAdapter.java"; File file = new File(filePath); file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String content = String.format(CreateAdapterUtils.BASE_ADAPTER, packageName+".BaseAdapter"); writer.write(content); writer.flush(); writer.close(); } public static void createBaseViewHolder(String packageName, String path) throws IOException { String dir = path + "holder/"; String filePath = dir + "BaseViewHolder.java"; File dirs = new File(dir); File file = new File(filePath); if (!dirs.exists()) { dirs.mkdirs(); } file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String content = String.format(CreateAdapterUtils.BASE_VIEW_HOLDER, packageName+".holder"); writer.write(content); writer.flush(); writer.close(); } public static void createViewHolder(String packageName, String path,String viewHolderName,String typeName,String idName) throws IOException { String dir = path + "holder/"; String filePath = dir + viewHolderName+".java"; File dirs = new File(dir); File file = new File(filePath); if (!dirs.exists()) { dirs.mkdirs(); } file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String content = String.format( CreateAdapterUtils.MODEL_HOLDER, packageName+".holder", viewHolderName, typeName, viewHolderName, idName, typeName); writer.write(content); writer.flush(); writer.close(); } public static void createModelInterface(String packageName, String path) throws IOException { String dir = path + "type/"; String filePath = dir +"TypeInterface.java"; File dirs = new File(dir); File file = new File(filePath); if (!dirs.exists()) { dirs.mkdirs(); } file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String content = String.format( CreateAdapterUtils.LAYOUT_INTERFACE, packageName+".type"); writer.write(content); writer.flush(); writer.close(); } public static void createModel(String packageName, String path,String typeName,String idName) throws IOException { String dir = path + "type/"; String filePath = dir +typeName+"Model.java"; File dirs = new File(dir); File file = new File(filePath); if (!dirs.exists()) { dirs.mkdirs(); } file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file)); String content = String.format(CreateAdapterUtils.MODEL, packageName+".type", typeName, typeName, typeName, typeName, typeName, typeName, typeName, typeName, typeName, typeName, typeName, idName); writer.write(content); writer.flush(); writer.close(); } }
true
377ada14b4cf449fcb886f7568f2cfae63b74035
Java
MarcIotInfra/Dabchat
/Private/Main/src/main/java/com/example/main/webservice/FriendListService.java
UTF-8
680
2.15625
2
[]
no_license
package com.example.main.webservice; import com.example.main.interfaces.IFriendListRepository; import com.example.main.model.User; import java.util.List; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.Query; public interface FriendListService { //TODO: @POST("login/addFriend") Call<String> addFriend(@Body User user, @Query("friendEmail") String mail); @POST("login/getAllFriends") Call<List<User>> getAllFriends(@Body User currentUser); @POST("login/getFriend/{mail}") Call<User> getSpecificFriend(@Path("friendEmail") String mail); }
true
3d779d9a1d2bc55488cea2c0c7e011de5b221600
Java
dscholz-tgm/PasswordManager
/src/pwm/utils/CipherFactory.java
UTF-8
610
2.75
3
[]
no_license
package pwm.utils; import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; /** * Creates the different Cipher to prevent from * catching the exceptions every time * * @author Adrian Bergler * @version 0.1 */ public class CipherFactory { private static final Cipher fallbackCipher = getCipher("AES"); public static Cipher getCipher(String cipherName) { try { return Cipher.getInstance(cipherName); } catch (NoSuchAlgorithmException | NoSuchPaddingException ex) { } return fallbackCipher; } }
true
a115d4430922f6826e45c67d20bf31858d1a9e02
Java
millicAa/LanguageSchoolApp
/projekat/SkolaStranihJezikaZajednicki/src/domen/Kurs.java
UTF-8
4,960
2.46875
2
[]
no_license
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package domen; import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * * @author Milica */ public class Kurs implements Serializable, OpstiDomenskiObjekat{ private int kursID; private String naziv; private Nivo nivo; private double cena; private int brojCasova; private Date datumPocetka; private Date datumZavrsetka; private int maksimalanBrKlijenata; public Kurs() { } public Kurs(int kursID, String naziv, Nivo nivo, double cena, int brojCasova, Date datumPocetka, Date datumZavrsetka, int maksimalanBrKlijenata) { this.kursID = kursID; this.naziv = naziv; this.nivo = nivo; this.cena = cena; this.brojCasova = brojCasova; this.datumPocetka = datumPocetka; this.datumZavrsetka = datumZavrsetka; this.maksimalanBrKlijenata = maksimalanBrKlijenata; } public int getKursID() { return kursID; } public void setKursID(int kursID) { this.kursID = kursID; } public String getNaziv() { return naziv; } public void setNaziv(String naziv) { this.naziv = naziv; } public Nivo getNivo() { return nivo; } public void setNivo(Nivo nivo) { this.nivo = nivo; } public double getCena() { return cena; } public void setCena(double cena) { this.cena = cena; } public int getBrojCasova() { return brojCasova; } public void setBrojCasova(int brojCasova) { this.brojCasova = brojCasova; } public Date getDatumPocetka() { return datumPocetka; } public void setDatumPocetka(Date datumPocetka) { this.datumPocetka = datumPocetka; } public Date getDatumZavrsetka() { return datumZavrsetka; } public void setDatumZavrsetka(Date datumZavrsetka) { this.datumZavrsetka = datumZavrsetka; } public int getMaksimalanBrKlijenata() { return maksimalanBrKlijenata; } public void setMaksimalanBrKlijenata(int maksimalanBrKlijenata) { this.maksimalanBrKlijenata = maksimalanBrKlijenata; } @Override public String vratiNazivTabele() { return " kurs "; } @Override public String vratiNaziveKolona() { return "Naziv, Nivo, Cena, BrojCasova, DatumPocetka, DatumZavrsetka, MaksimalanBrKlijenata"; } @Override public String vratiVrednostiZaUnos() { return "'" + naziv + "','" + nivo + "','" + cena + "','" +brojCasova + "','" + new java.sql.Date(datumPocetka.getTime()) + "','" + new java.sql.Date(datumZavrsetka.getTime()) + "','" + maksimalanBrKlijenata +"'"; } @Override public String vratiVrednostiZaUpdate() { return "Naziv= '"+naziv+"' , Nivo= '"+nivo+"' , Cena= "+cena+" , BrojCasova= "+brojCasova+" , DatumPocetka= '"+new java.sql.Date(datumPocetka.getTime())+"' , DatumZavrsetka= '"+new java.sql.Date(datumZavrsetka.getTime())+"' , MaksimalanBrKlijenata= "+maksimalanBrKlijenata; } @Override public String vratiWhereUslov() { return "KursID="+kursID; } @Override public String vratiKoloneZaSelektovanje() { return "*"; } @Override public String vratiAlijas() { return "ku"; } @Override public String vratiUslovZaJoin() { return ""; } @Override public String vratiWhereUslovSelect() { return ""; } @Override public String vratiGrupisanje() { return ""; } @Override public List<OpstiDomenskiObjekat> ucitajListu(ResultSet rs) throws SQLException { List<OpstiDomenskiObjekat> kursevi= new ArrayList<>(); while(rs.next()) { Nivo n = Nivo.valueOf(rs.getString("Nivo")); kursevi.add(new Kurs(rs.getInt("KursID"), rs.getString("Naziv"), n, rs.getDouble("Cena"), rs.getInt("BrojCasova"), new Date(rs.getDate("DatumPocetka").getTime()), new Date(rs.getDate("DatumZavrsetka").getTime()), rs.getInt("MaksimalanBrKlijenata"))); } return kursevi; } @Override public String vratiMaxPrimarni() { return ""; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Kurs other = (Kurs) obj; if (this.kursID != other.kursID) { return false; } return true; } @Override public String toString() { return naziv+" "+nivo; } }
true
7513ad27a34ccb7e29146a34cead18c03a6fee23
Java
CodingSoldier/java-learn
/文件/thinkinginjavaexamples/annotations/database/Uniqueness.java
UTF-8
237
2.03125
2
[ "Apache-2.0" ]
permissive
//: annotations/database/Uniqueness.java // Sample of nested annotations package com.thinkinginjavaexamples.annotations.database; public @interface Uniqueness { Constraints constraints() default @Constraints(unique=true); } ///:~
true
fcd24750d5bef1b3bec06c0d6b76aca846fd3dec
Java
TehVenomm/sauceCodeProject
/sources/com/google/android/gms/internal/zzcqb.java
UTF-8
7,784
1.71875
2
[]
no_license
package com.google.android.gms.internal; import android.annotation.SuppressLint; import android.content.Context; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.WorkSource; import android.text.TextUtils; import android.util.Log; import com.google.android.gms.common.internal.zzbp; import com.google.android.gms.common.util.zzs; import com.google.android.gms.common.util.zzw; public final class zzcqb { private static boolean DEBUG = false; private static String TAG = "WakeLock"; private static String zzjno = "*gcore*:"; private final Context mContext; private final String zzfxt; private final String zzfxv; private final WakeLock zzjnp; private WorkSource zzjnq; private final int zzjnr; private final String zzjns; private boolean zzjnt; private int zzjnu; private int zzjnv; public zzcqb(Context context, int i, String str) { this(context, 1, str, null, context == null ? null : context.getPackageName()); } @SuppressLint({"UnwrappedWakeLock"}) private zzcqb(Context context, int i, String str, String str2, String str3) { this(context, 1, str, null, str3, null); } @SuppressLint({"UnwrappedWakeLock"}) private zzcqb(Context context, int i, String str, String str2, String str3, String str4) { this.zzjnt = true; zzbp.zzh(str, "Wake lock name can NOT be empty"); this.zzjnr = i; this.zzjns = null; this.zzfxv = null; this.mContext = context.getApplicationContext(); if ("com.google.android.gms".equals(context.getPackageName())) { this.zzfxt = str; } else { String valueOf = String.valueOf(zzjno); String valueOf2 = String.valueOf(str); this.zzfxt = valueOf2.length() != 0 ? valueOf.concat(valueOf2) : new String(valueOf); } this.zzjnp = ((PowerManager) context.getSystemService("power")).newWakeLock(i, str); if (zzw.zzcp(this.mContext)) { if (zzs.zzgl(str3)) { str3 = context.getPackageName(); } this.zzjnq = zzw.zzad(context, str3); WorkSource workSource = this.zzjnq; if (workSource != null && zzw.zzcp(this.mContext)) { if (this.zzjnq != null) { this.zzjnq.add(workSource); } else { this.zzjnq = workSource; } try { this.zzjnp.setWorkSource(this.zzjnq); } catch (IllegalArgumentException e) { Log.wtf(TAG, e.toString()); } } } } private final String zzh(String str, boolean z) { return this.zzjnt ? z ? null : this.zzjns : this.zzjns; } private final boolean zzlb(String str) { if (TextUtils.isEmpty(null)) { return false; } String str2 = this.zzjns; throw new NullPointerException(); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final void acquire(long r13) { /* r12 = this; r10 = 1000; // 0x3e8 float:1.401E-42 double:4.94E-321; r1 = 0; r0 = r12.zzlb(r1); r4 = r12.zzh(r1, r0); monitor-enter(r12); r1 = r12.zzjnu; Catch:{ all -> 0x0061 } if (r1 > 0) goto L_0x0014; L_0x0010: r1 = r12.zzjnv; Catch:{ all -> 0x0061 } if (r1 <= 0) goto L_0x0022; L_0x0014: r1 = r12.zzjnp; Catch:{ all -> 0x0061 } r1 = r1.isHeld(); Catch:{ all -> 0x0061 } if (r1 != 0) goto L_0x0022; L_0x001c: r1 = 0; r12.zzjnu = r1; Catch:{ all -> 0x0061 } r1 = 0; r12.zzjnv = r1; Catch:{ all -> 0x0061 } L_0x0022: r1 = r12.zzjnt; Catch:{ all -> 0x0061 } if (r1 == 0) goto L_0x0030; L_0x0026: r1 = r12.zzjnu; Catch:{ all -> 0x0061 } r2 = r1 + 1; r12.zzjnu = r2; Catch:{ all -> 0x0061 } if (r1 == 0) goto L_0x0038; L_0x002e: if (r0 != 0) goto L_0x0038; L_0x0030: r0 = r12.zzjnt; Catch:{ all -> 0x0061 } if (r0 != 0) goto L_0x005a; L_0x0034: r0 = r12.zzjnv; Catch:{ all -> 0x0061 } if (r0 != 0) goto L_0x005a; L_0x0038: com.google.android.gms.common.stats.zze.zzalb(); Catch:{ all -> 0x0061 } r0 = r12.mContext; Catch:{ all -> 0x0061 } r1 = r12.zzjnp; Catch:{ all -> 0x0061 } r1 = com.google.android.gms.common.stats.zzc.zza(r1, r4); Catch:{ all -> 0x0061 } r2 = 7; r3 = r12.zzfxt; Catch:{ all -> 0x0061 } r5 = 0; r6 = r12.zzjnr; Catch:{ all -> 0x0061 } r7 = r12.zzjnq; Catch:{ all -> 0x0061 } r7 = com.google.android.gms.common.util.zzw.zzb(r7); Catch:{ all -> 0x0061 } r8 = 1000; // 0x3e8 float:1.401E-42 double:4.94E-321; com.google.android.gms.common.stats.zze.zza(r0, r1, r2, r3, r4, r5, r6, r7, r8); Catch:{ all -> 0x0061 } r0 = r12.zzjnv; Catch:{ all -> 0x0061 } r0 = r0 + 1; r12.zzjnv = r0; Catch:{ all -> 0x0061 } L_0x005a: monitor-exit(r12); Catch:{ all -> 0x0061 } r0 = r12.zzjnp; r0.acquire(r10); return; L_0x0061: r0 = move-exception; monitor-exit(r12); Catch:{ all -> 0x0061 } throw r0; */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzcqb.acquire(long):void"); } public final boolean isHeld() { return this.zzjnp.isHeld(); } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ public final void release() { /* r8 = this; r1 = 0; r0 = r8.zzlb(r1); r4 = r8.zzh(r1, r0); monitor-enter(r8); r1 = r8.zzjnt; Catch:{ all -> 0x0049 } if (r1 == 0) goto L_0x0018; L_0x000e: r1 = r8.zzjnu; Catch:{ all -> 0x0049 } r1 = r1 + -1; r8.zzjnu = r1; Catch:{ all -> 0x0049 } if (r1 == 0) goto L_0x0021; L_0x0016: if (r0 != 0) goto L_0x0021; L_0x0018: r0 = r8.zzjnt; Catch:{ all -> 0x0049 } if (r0 != 0) goto L_0x0042; L_0x001c: r0 = r8.zzjnv; Catch:{ all -> 0x0049 } r1 = 1; if (r0 != r1) goto L_0x0042; L_0x0021: com.google.android.gms.common.stats.zze.zzalb(); Catch:{ all -> 0x0049 } r0 = r8.mContext; Catch:{ all -> 0x0049 } r1 = r8.zzjnp; Catch:{ all -> 0x0049 } r1 = com.google.android.gms.common.stats.zzc.zza(r1, r4); Catch:{ all -> 0x0049 } r2 = 8; r3 = r8.zzfxt; Catch:{ all -> 0x0049 } r5 = 0; r6 = r8.zzjnr; Catch:{ all -> 0x0049 } r7 = r8.zzjnq; Catch:{ all -> 0x0049 } r7 = com.google.android.gms.common.util.zzw.zzb(r7); Catch:{ all -> 0x0049 } com.google.android.gms.common.stats.zze.zza(r0, r1, r2, r3, r4, r5, r6, r7); Catch:{ all -> 0x0049 } r0 = r8.zzjnv; Catch:{ all -> 0x0049 } r0 = r0 + -1; r8.zzjnv = r0; Catch:{ all -> 0x0049 } L_0x0042: monitor-exit(r8); Catch:{ all -> 0x0049 } r0 = r8.zzjnp; r0.release(); return; L_0x0049: r0 = move-exception; monitor-exit(r8); Catch:{ all -> 0x0049 } throw r0; */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzcqb.release():void"); } public final void setReferenceCounted(boolean z) { this.zzjnp.setReferenceCounted(false); this.zzjnt = false; } }
true
1465a39946cbe3d3554add1843d6e9dd8cf776ca
Java
foxking0416/SDT
/src/sdt/stepb/stepb_object_array.java
UTF-8
1,801
2.90625
3
[]
no_license
package sdt.stepb; import java.util.LinkedList; import java.util.Hashtable; public class stepb_object_array { protected LinkedList list; protected Hashtable idTable; boolean isRerrangeNeed ; public stepb_object_array() { list = new LinkedList(); idTable = new Hashtable(); isRerrangeNeed = true; } public void add(stepb_object enb) { list.add(enb); } public stepb_object get(int index) { return (stepb_object) list.get(index); } public void RemoveAll() { list.clear(); } public int size() { return list.size(); } public void removeFirst() { list.removeFirst(); } public void removeLast() { list.removeLast(); } public int indexOf(stepb_object enb) { return list.indexOf(enb); } public void remove(int i) { list.remove(i); } public void addArray(stepb_object_array array) { for (int i = 0; i < array.size(); i++) { this.list.add(array.list.get(i)); } } public stepb_object getLast() { return (stepb_object) list.getLast(); } public void rearrangeTable() { if(isRerrangeNeed) { for (int i = 0; i < this.size(); i++) { idTable.put(this.get(i).IDNumber, i); } isRerrangeNeed = false; } } public stepb_object getByID(int IDNumber) { Integer index = (Integer)this.idTable.get(IDNumber); if(index == null) return null; //System.out.println("IDNumber: " + IDNumber + " ---> " + index.intValue()); return (stepb_object) list.get(index.intValue()); } }
true
2eb151e3568b06871db024e5eac6a1f93b55edad
Java
ioulios1/e-student
/Application_Files/DesktopApp/src/DesktopApp/addStudentClient.java
UTF-8
1,955
2.46875
2
[]
no_license
package DesktopApp; import javax.ws.rs.ClientErrorException; import javax.ws.rs.client.Client; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import org.json.*; /** * Η κλάση addStudentClient εκτελεί τις βοηθητικές λειτουργίες για την κλήση * του webService add_student. * @author Ioulios Tsiko: cs131027 * @author Theofilos Axiotis: cs131011 */ public class addStudentClient { private WebTarget webTarget; private Client client; private static final String BASE_URI = "http://localhost:8080/WebServices/webresources"; public addStudentClient() { client = javax.ws.rs.client.ClientBuilder.newClient(); webTarget = client.target(BASE_URI).path("add_student"); } /** * Περνά παραμετρικά τα δεδομένα στο αντιστοιχο webService * @param username : Το όνομα του χρήστη που εκτελεί την προσθήκη * @param arg1 : Τα δεδομένα προς αποθήκευση (στοιχεία φοιτητή) * @param key : Το μοναδικό κλειδί αυθεντικοποίησης που αποδόθηκε κατα το login * @return ένα μήνυμα επιτυχίας ή αποτυχίας της διαδικασίας * @throws ClientErrorException */ public String putUser(String username,String arg1, String key) throws ClientErrorException { WebTarget resource = webTarget; resource = resource.queryParam("usr", username); resource = resource.queryParam("key", key); resource = resource.queryParam("info", arg1); Invocation.Builder build = resource.request(javax.ws.rs.core.MediaType.TEXT_PLAIN); return build.get(String.class); } public void close() { client.close(); } }
true
ebdacbc5adb3619300e0c7c3520abab19f848a50
Java
wangyuchen-1/CompilerFront
/src/com/ctgu/inter/Or.java
WINDOWS-1252
376
2.5625
3
[]
no_license
package com.ctgu.inter; import com.ctgu.lexer.Token; // || ߼ıת jumping public class Or extends Logical{ public Or(Token tok,Expr x1, Expr x2) { super(tok,x1,x2); } public void jumping(int t,int f) { int label = t != 0 ? t : newlabel(); expr1.jumping(label, 0); expr2.jumping(t, f); if(t == 0) { emitlabel(label); } } }
true